diff --git a/404.html b/404.html index 4ea24faedc..bdcd59b841 100644 --- a/404.html +++ b/404.html @@ -9,13 +9,13 @@ - +
Skip to main content

Page Not Found

We could not find what you were looking for 😢

- + diff --git a/assets/js/001c51b5.f7a3d44b.js b/assets/js/001c51b5.2a683f40.js similarity index 71% rename from assets/js/001c51b5.f7a3d44b.js rename to assets/js/001c51b5.2a683f40.js index a04e992bd7..6f56af6f73 100644 --- a/assets/js/001c51b5.f7a3d44b.js +++ b/assets/js/001c51b5.2a683f40.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1951],{30433:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(67294),a=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>m});var n=r(87462),a=r(67294),l=r(34334),o=r(63735),c=r(38224),i=r(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,r=e.block,c=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,r=d.indexOf(t),n=s[r].value;n!==c&&(p(t),i(n))},b=function(e){var t,r=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,a=d.indexOf(e.currentTarget)+1;r=null!=(n=d[a])?n:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;r=null!=(l=d[o])?l:d[d.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},s.map((function(e){var t=e.value,r=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:c===t?0:-1,"aria-selected":c===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",u.tabItem,null==o?void 0:o.className,{"tabs__item--active":c===t})}),null!=r?r:t)})))}function d(e){var t=e.lazy,r=e.children,n=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function p(e){var t=(0,c.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,n.Z)({},e,t)),a.createElement(d,(0,n.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>p});var n=r(67294),a=r(16550),l=r(34423),o=r(20636),c=r(99200);function i(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:i(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,c=(0,a.k6)(),i=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:o});return[(0,l._X)(i),(0,n.useCallback)((function(e){if(i){var t=new URLSearchParams(c.location.search);t.set(i,e),c.replace(Object.assign({},c.location,{search:t.toString()}))}}),[i,c])]}function p(e){var t,r,a,l,o=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=u(e),f=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!s({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),y=f[0],g=f[1],I=d({queryString:p,groupId:m}),w=I[0],v=I[1],h=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),r=(0,c.Nk)(t),a=r[0],l=r[1],[a,(0,n.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=h[0],C=h[1],X=function(){var e=null!=w?w:x;return s({value:e,tabValues:b})?e:null}();return(0,n.useLayoutEffect)((function(){X&&g(X)}),[X]),{selectedValue:y,selectValue:(0,n.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);g(e),v(e),C(e)}),[v,C,b]),tabValues:b}}},88466:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>b,default:()=>h,frontMatter:()=>m,metadata:()=>f,toc:()=>g});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=r(65559),c=r(30433);r(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig"},s={code:"import { PlaywrightCrawler, downloadListOfUrls } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c"};var d,p=["components"],m={id:"crawl-sitemap",title:"Crawl a sitemap"},b=void 0,f={unversionedId:"examples/crawl-sitemap",id:"examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/../docs/examples/crawl_sitemap.mdx",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/next/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_sitemap.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/next/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/next/examples/crawl-some-links"}},y={},g=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),w={toc:g},v="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,p);return(0,l.kt)(v,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(c.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(c.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(c.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=u(r),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return r?n.createElement(b,o(o({ref:t},s),{},{components:r})):n.createElement(b,o({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var u=2;u{r.d(t,{Z:()=>o});var n=r(67294),a=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>m});var n=r(87462),a=r(67294),l=r(34334),o=r(63735),c=r(38224),i=r(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,r=e.block,c=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,r=d.indexOf(t),n=s[r].value;n!==c&&(p(t),i(n))},b=function(e){var t,r=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,a=d.indexOf(e.currentTarget)+1;r=null!=(n=d[a])?n:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;r=null!=(l=d[o])?l:d[d.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},s.map((function(e){var t=e.value,r=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:c===t?0:-1,"aria-selected":c===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",u.tabItem,null==o?void 0:o.className,{"tabs__item--active":c===t})}),null!=r?r:t)})))}function d(e){var t=e.lazy,r=e.children,n=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function p(e){var t=(0,c.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,n.Z)({},e,t)),a.createElement(d,(0,n.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>p});var n=r(67294),a=r(16550),l=r(34423),o=r(20636),c=r(99200);function i(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:i(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,c=(0,a.k6)(),i=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:o});return[(0,l._X)(i),(0,n.useCallback)((function(e){if(i){var t=new URLSearchParams(c.location.search);t.set(i,e),c.replace(Object.assign({},c.location,{search:t.toString()}))}}),[i,c])]}function p(e){var t,r,a,l,o=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=u(e),f=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!s({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),y=f[0],g=f[1],I=d({queryString:p,groupId:m}),w=I[0],v=I[1],h=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),r=(0,c.Nk)(t),a=r[0],l=r[1],[a,(0,n.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=h[0],C=h[1],X=function(){var e=null!=w?w:x;return s({value:e,tabValues:b})?e:null}();return(0,n.useLayoutEffect)((function(){X&&g(X)}),[X]),{selectedValue:y,selectValue:(0,n.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);g(e),v(e),C(e)}),[v,C,b]),tabValues:b}}},88466:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>b,default:()=>h,frontMatter:()=>m,metadata:()=>f,toc:()=>g});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=r(65559),c=r(30433);r(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig"},s={code:"import { PlaywrightCrawler, downloadListOfUrls } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c"};var d,p=["components"],m={id:"crawl-sitemap",title:"Crawl a sitemap"},b=void 0,f={unversionedId:"examples/crawl-sitemap",id:"examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/../docs/examples/crawl_sitemap.mdx",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/next/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_sitemap.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/next/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/next/examples/crawl-some-links"}},y={},g=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),w={toc:g},v="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,p);return(0,l.kt)(v,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(c.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(c.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(c.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=u(r),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return r?n.createElement(b,o(o({ref:t},s),{},{components:r})):n.createElement(b,o({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var u=2;u{r.d(t,{Z:()=>l});var a=r(67294),n=r(88746),o=r(6141),i=r(6832);const l=function(e){var t=e.to,r=e.children,l=(0,o.E)(),s=l.version,c=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(n.default,{to:"/api/"+t},r);var p=s+"/";return"current"===s?p="next/":c&&(p=""),a.createElement(n.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>l,T:()=>i});var a=r(67294),n=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return a.createElement(n.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},l=function(e){var t=e.to,r=e.children;return a.createElement(n.default,{href:o+"/"+t},r)}},79965:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>w,contentTitle:()=>d,default:()=>b,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=r(14563),l=(r(68889),r(26569));const s="import { Actor } from 'apify';\nimport { BasicCrawler } from 'crawlee';\nimport { gotScraping } from 'got-scraping';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\n// Create a BasicCrawler - the simplest crawler that enables\n// users to implement the crawling logic themselves.\nconst crawler = new BasicCrawler({\n // This function will be called for each URL to crawl.\n async requestHandler({ request }) {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils gotScraping\n const { body } = await gotScraping({ url });\n\n // Store the HTML and URL to the default dataset.\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.\nawait crawler.run([\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n]);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n";var c=["components"],p={id:"basic-crawler",title:"Basic crawler"},d=void 0,u={unversionedId:"examples/basic-crawler",id:"version-3.0/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers",source:"@site/versioned_docs/version-3.0/examples/basic_crawler.mdx",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/3.0/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/basic_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"basic-crawler",title:"Basic crawler"},sidebar:"docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/3.0/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/3.0/examples/call-actor"}},w={},m=[],f={toc:m},h="wrapper";function b(e){var t=e.components,r=(0,n.Z)(e,c);return(0,o.kt)(h,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the ",(0,o.kt)(l.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers\nlike ",(0,o.kt)(l.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," or ",(0,o.kt)(l.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping")),"\nnpm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},s))}b.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),c=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},w=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(r),w=n,m=d["".concat(s,".").concat(w)]||d[w]||u[w]||o;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=w;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:n,i[1]=l;for(var c=2;c{r.d(t,{Z:()=>l});var a=r(67294),n=r(88746),o=r(6141),i=r(6832);const l=function(e){var t=e.to,r=e.children,l=(0,o.E)(),s=l.version,c=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(n.default,{to:"/api/"+t},r);var p=s+"/";return"current"===s?p="next/":c&&(p=""),a.createElement(n.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>l,T:()=>i});var a=r(67294),n=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return a.createElement(n.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},l=function(e){var t=e.to,r=e.children;return a.createElement(n.default,{href:o+"/"+t},r)}},79965:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>w,contentTitle:()=>d,default:()=>b,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=r(14563),l=(r(68889),r(26569));const s="import { Actor } from 'apify';\nimport { BasicCrawler } from 'crawlee';\nimport { gotScraping } from 'got-scraping';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\n// Create a BasicCrawler - the simplest crawler that enables\n// users to implement the crawling logic themselves.\nconst crawler = new BasicCrawler({\n // This function will be called for each URL to crawl.\n async requestHandler({ request }) {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils gotScraping\n const { body } = await gotScraping({ url });\n\n // Store the HTML and URL to the default dataset.\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.\nawait crawler.run([\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n]);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n";var c=["components"],p={id:"basic-crawler",title:"Basic crawler"},d=void 0,u={unversionedId:"examples/basic-crawler",id:"version-3.0/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers",source:"@site/versioned_docs/version-3.0/examples/basic_crawler.mdx",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/3.0/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/basic_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"basic-crawler",title:"Basic crawler"},sidebar:"docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/3.0/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/3.0/examples/call-actor"}},w={},m=[],f={toc:m},h="wrapper";function b(e){var t=e.components,r=(0,n.Z)(e,c);return(0,o.kt)(h,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the ",(0,o.kt)(l.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers\nlike ",(0,o.kt)(l.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," or ",(0,o.kt)(l.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping")),"\nnpm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},s))}b.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),c=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},w=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(r),w=n,m=d["".concat(s,".").concat(w)]||d[w]||u[w]||o;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=w;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:n,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),s=(n(67294),n(3905)),o=["components"],i={id:"crawl-sitemap",title:"Crawl a sitemap"},l=void 0,c={unversionedId:"examples/crawl-sitemap",id:"version-2.3/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-2.3/examples/crawl_sitemap.md",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/2.3/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_sitemap.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"version-2.3/docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/2.3/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-some-links"}},p={},u=[],m={toc:u},f="wrapper";function d(e){var t=e.components,n=(0,a.Z)(e,o);return(0,s.kt)(f,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that uses Cheerio\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Puppeteer\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Playwright\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,d=u["".concat(l,".").concat(f)]||u[f]||m[f]||s;return n?r.createElement(d,o(o({ref:t},p),{},{components:n})):r.createElement(d,o({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),s=(n(67294),n(3905)),o=["components"],i={id:"crawl-sitemap",title:"Crawl a sitemap"},l=void 0,c={unversionedId:"examples/crawl-sitemap",id:"version-2.3/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-2.3/examples/crawl_sitemap.md",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/2.3/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_sitemap.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"version-2.3/docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/2.3/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-some-links"}},p={},u=[],m={toc:u},f="wrapper";function d(e){var t=e.components,n=(0,a.Z)(e,o);return(0,s.kt)(f,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that uses Cheerio\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Puppeteer\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Playwright\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,d=u["".concat(l,".").concat(f)]||u[f]||m[f]||s;return n?r.createElement(d,o(o({ref:t},p),{},{components:n})):r.createElement(d,o({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),s=["components"],o={id:"playwright-crawler",title:"Playwright crawler"},l=void 0,c={unversionedId:"examples/playwright-crawler",id:"version-2.3/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/versioned_docs/version-2.3/examples/playwright_crawler.md",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/2.3/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/playwright_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"version-2.3/docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/2.3/examples/map-and-reduce"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/2.3/examples/puppeteer-crawler"}},p={},u=[],h={toc:u},d="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,s);return(0,i.kt)(d,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"This example demonstrates how to use ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"\nin combination with ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," to recursively scrape the\n",(0,i.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,i.kt)("p",null," The crawler starts with a single URL, finds links to next pages,\nenqueues them and continues until no more desired links are available.\nThe results are stored to the default dataset. In local configuration, the results are stored as\nJSON files in ",(0,i.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PlaywrightCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Playwright.\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,f=u["".concat(l,".").concat(d)]||u[d]||h[d]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[u]="string"==typeof e?e:a,s[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),s=["components"],o={id:"playwright-crawler",title:"Playwright crawler"},l=void 0,c={unversionedId:"examples/playwright-crawler",id:"version-2.3/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/versioned_docs/version-2.3/examples/playwright_crawler.md",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/2.3/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/playwright_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"version-2.3/docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/2.3/examples/map-and-reduce"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/2.3/examples/puppeteer-crawler"}},p={},u=[],h={toc:u},d="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,s);return(0,i.kt)(d,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"This example demonstrates how to use ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"\nin combination with ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," to recursively scrape the\n",(0,i.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,i.kt)("p",null," The crawler starts with a single URL, finds links to next pages,\nenqueues them and continues until no more desired links are available.\nThe results are stored to the default dataset. In local configuration, the results are stored as\nJSON files in ",(0,i.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PlaywrightCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Playwright.\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,f=u["".concat(l,".").concat(d)]||u[d]||h[d]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=d;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[u]="string"==typeof e?e:a,s[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-playwright",title:"utils.playwright",id:"playwright"},p=void 0,s={unversionedId:"api/playwright",id:"version-1.3/api/playwright",title:"utils.playwright",description:"A namespace that contains various utilities for Playwright - the headless Chrome Node API.",source:"@site/versioned_docs/version-1.3/api/playwright.md",sourceDirName:"api",slug:"/api/playwright",permalink:"/sdk/js/docs/1.3/api/playwright",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/playwright.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright",title:"utils.playwright",id:"playwright"},sidebar:"version-1.3/docs",previous:{title:"utils.log",permalink:"/sdk/js/docs/1.3/api/log"},next:{title:"utils.puppeteer",permalink:"/sdk/js/docs/1.3/api/puppeteer"}},d={},c=[{value:"playwright.gotoExtended",id:"playwrightgotoextended",level:2}],u={toc:c},g="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(g,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwright"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { playwright } = Apify.utils;\n\n// Navigate to https://www.example.com in Playwright with a POST request\nconst browser = await Apify.launchPlaywright();\nconst page = await browser.newPage();\nawait playwright.gotoExtended(page, {\n url: 'https://example.com,\n method: 'POST',\n});\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"playwrightgotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.gotoExtended")),(0,i.kt)("p",null,"Extended version of Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload.\nURL, method, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Playwright using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=s(r),g=a,m=c["".concat(p,".").concat(g)]||c[g]||u[g]||i;return r?n.createElement(m,o(o({ref:t},d),{},{components:r})):n.createElement(m,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=g;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-playwright",title:"utils.playwright",id:"playwright"},p=void 0,s={unversionedId:"api/playwright",id:"version-1.3/api/playwright",title:"utils.playwright",description:"A namespace that contains various utilities for Playwright - the headless Chrome Node API.",source:"@site/versioned_docs/version-1.3/api/playwright.md",sourceDirName:"api",slug:"/api/playwright",permalink:"/sdk/js/docs/1.3/api/playwright",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/playwright.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright",title:"utils.playwright",id:"playwright"},sidebar:"version-1.3/docs",previous:{title:"utils.log",permalink:"/sdk/js/docs/1.3/api/log"},next:{title:"utils.puppeteer",permalink:"/sdk/js/docs/1.3/api/puppeteer"}},d={},c=[{value:"playwright.gotoExtended",id:"playwrightgotoextended",level:2}],u={toc:c},g="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(g,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwright"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { playwright } = Apify.utils;\n\n// Navigate to https://www.example.com in Playwright with a POST request\nconst browser = await Apify.launchPlaywright();\nconst page = await browser.newPage();\nawait playwright.gotoExtended(page, {\n url: 'https://example.com,\n method: 'POST',\n});\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"playwrightgotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.gotoExtended")),(0,i.kt)("p",null,"Extended version of Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload.\nURL, method, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Playwright using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=s(r),g=a,m=c["".concat(p,".").concat(g)]||c[g]||u[g]||i;return r?n.createElement(m,o(o({ref:t},d),{},{components:r})):n.createElement(m,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=g;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=["components"],i={id:"result-storage",title:"Result Storage"},l=void 0,p={unversionedId:"guides/result-storage",id:"version-2.3/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-2.3/guides/result_storage.md",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/2.3/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/result_storage.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"version-2.3/docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/2.3/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/2.3/guides/environment-variables"}},u={},d=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],c={toc:d},f="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Apify.getInput();\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/screenshots",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify app. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(a),f=n,h=d["".concat(l,".").concat(f)]||d[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},u),{},{components:a})):r.createElement(h,s({ref:t},u))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=["components"],i={id:"result-storage",title:"Result Storage"},l=void 0,p={unversionedId:"guides/result-storage",id:"version-2.3/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-2.3/guides/result_storage.md",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/2.3/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/result_storage.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"version-2.3/docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/2.3/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/2.3/guides/environment-variables"}},u={},d=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],c={toc:d},f="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Apify.getInput();\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/screenshots",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify app. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(a),f=n,h=d["".concat(l,".").concat(f)]||d[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},u),{},{components:a})):r.createElement(h,s({ref:t},u))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>s});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id_old:"version-1.3-adhoc-webhook",title:"AdhocWebhook",id:"adhoc-webhook"},l=void 0,d={unversionedId:"typedefs/adhoc-webhook",id:"version-1.3/typedefs/adhoc-webhook",title:"AdhocWebhook",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/AdhocWebhook.md",sourceDirName:"typedefs",slug:"/typedefs/adhoc-webhook",permalink:"/sdk/js/docs/1.3/typedefs/adhoc-webhook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AdhocWebhook.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-adhoc-webhook",title:"AdhocWebhook",id:"adhoc-webhook"}},c={},s=[{value:"Properties",id:"properties",level:2},{value:"eventTypes",id:"eventtypes",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"idempotencyKey",id:"idempotencykey",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3}],u={toc:s},y="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(y,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"adhocwebhook"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"idempotencykey"},(0,a.kt)("inlineCode",{parentName:"h3"},"idempotencyKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),d=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),s=d(r),y=o,m=s["".concat(l,".").concat(y)]||s[y]||u[y]||a;return r?n.createElement(m,p(p({ref:t},c),{},{components:r})):n.createElement(m,p({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[s]="string"==typeof e?e:o,p[1]=i;for(var d=2;d{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>s});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id_old:"version-1.3-adhoc-webhook",title:"AdhocWebhook",id:"adhoc-webhook"},l=void 0,d={unversionedId:"typedefs/adhoc-webhook",id:"version-1.3/typedefs/adhoc-webhook",title:"AdhocWebhook",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/AdhocWebhook.md",sourceDirName:"typedefs",slug:"/typedefs/adhoc-webhook",permalink:"/sdk/js/docs/1.3/typedefs/adhoc-webhook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AdhocWebhook.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-adhoc-webhook",title:"AdhocWebhook",id:"adhoc-webhook"}},c={},s=[{value:"Properties",id:"properties",level:2},{value:"eventTypes",id:"eventtypes",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"idempotencyKey",id:"idempotencykey",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3}],u={toc:s},y="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(y,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"adhocwebhook"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"idempotencykey"},(0,a.kt)("inlineCode",{parentName:"h3"},"idempotencyKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),d=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),s=d(r),y=o,m=s["".concat(l,".").concat(y)]||s[y]||u[y]||a;return r?n.createElement(m,p(p({ref:t},c),{},{components:r})):n.createElement(m,p({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[s]="string"==typeof e?e:o,p[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),p=["components"],l={id:"puppeteer-launch-context",title:"PuppeteerLaunchContext"},i=void 0,s={unversionedId:"typedefs/puppeteer-launch-context",id:"version-2.3/typedefs/puppeteer-launch-context",title:"PuppeteerLaunchContext",description:"_Deprecated_",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-launch-context",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerLaunchContext.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-launch-context",title:"PuppeteerLaunchContext"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"},next:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"userAgent",id:"useragent",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"launcher",id:"launcher",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"stealth",id:"stealth",level:3},{value:"stealthOptions",id:"stealthoptions",level:3}],d={toc:c},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerlaunchcontext"}),(0,a.kt)("h1",{id:"puppeteerlaunchcontext"},(0,a.kt)("del",{parentName:"h1"},(0,a.kt)("inlineCode",{parentName:"del"},"PuppeteerLaunchContext"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("em",{parentName:"strong"},"Deprecated"))),(0,a.kt)("p",null,"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,a.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Puppeteer options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"launchoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Record")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer.launch")," ",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v13.5.1&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},"options")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useragent"},(0,a.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,a.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Puppeteer will launch full Google Chrome browser available on the machine rather than the bundled Chromium.\nThe path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical Google\nChrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launcher"},(0,a.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("p",null,"Already required module (",(0,a.kt)("inlineCode",{parentName:"p"},"Object"),"). This enables usage of various Puppeteer wrappers such as ",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer-extra"),"."),(0,a.kt)("p",null,"Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides\n",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer")," itself."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useincognitopages"},(0,a.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their\nresources will not be throttled by one another."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stealth"},(0,a.kt)("inlineCode",{parentName:"h3"},"stealth")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stealthoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"stealthOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/stealth-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"StealthOptions"))),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(n),h=o,m=c["".concat(i,".").concat(h)]||c[h]||d[h]||a;return n?r.createElement(m,p(p({ref:t},u),{},{components:n})):r.createElement(m,p({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,p=new Array(a);p[0]=h;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[c]="string"==typeof e?e:o,p[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),p=["components"],l={id:"puppeteer-launch-context",title:"PuppeteerLaunchContext"},i=void 0,s={unversionedId:"typedefs/puppeteer-launch-context",id:"version-2.3/typedefs/puppeteer-launch-context",title:"PuppeteerLaunchContext",description:"_Deprecated_",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-launch-context",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerLaunchContext.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-launch-context",title:"PuppeteerLaunchContext"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"},next:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"userAgent",id:"useragent",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"launcher",id:"launcher",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"stealth",id:"stealth",level:3},{value:"stealthOptions",id:"stealthoptions",level:3}],d={toc:c},h="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,p);return(0,o.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"puppeteerlaunchcontext"}),(0,o.kt)("h1",{id:"puppeteerlaunchcontext"},(0,o.kt)("del",{parentName:"h1"},(0,o.kt)("inlineCode",{parentName:"del"},"PuppeteerLaunchContext"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Deprecated"))),(0,o.kt)("p",null,"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible\n",(0,o.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,o.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Puppeteer options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"launchoptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Record")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer.launch")," ",(0,o.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v13.5.1&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},"options")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyurl"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,o.kt)("p",null,"Example: ",(0,o.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useragent"},(0,o.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,o.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usechrome"},(0,o.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Puppeteer will launch full Google Chrome browser available on the machine rather than the bundled Chromium.\nThe path to Chrome executable is taken from the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical Google\nChrome executable location specific for the operating system. By default, this option is ",(0,o.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"launcher"},(0,o.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"Already required module (",(0,o.kt)("inlineCode",{parentName:"p"},"Object"),"). This enables usage of various Puppeteer wrappers such as ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer-extra"),"."),(0,o.kt)("p",null,"Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides\n",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," itself."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useincognitopages"},(0,o.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their\nresources will not be throttled by one another."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"stealth"},(0,o.kt)("inlineCode",{parentName:"h3"},"stealth")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"stealthoptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"stealthOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/stealth-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"StealthOptions"))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(n),h=a,m=c["".concat(i,".").concat(h)]||c[h]||d[h]||o;return n?r.createElement(m,p(p({ref:t},u),{},{components:n})):r.createElement(m,p({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,p=new Array(o);p[0]=h;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[c]="string"==typeof e?e:a,p[1]=l;for(var s=2;s{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var n=a(87462),l=a(63366),o=(a(67294),a(3905)),r=["components"],i={id_old:"version-1.3-social",title:"utils.social",id:"social"},s=void 0,p={unversionedId:"api/social",id:"version-1.3/api/social",title:"utils.social",description:"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents.",source:"@site/versioned_docs/version-1.3/api/social.md",sourceDirName:"api",slug:"/api/social",permalink:"/sdk/js/docs/1.3/api/social",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/social.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-social",title:"utils.social",id:"social"},sidebar:"version-1.3/docs",previous:{title:"utils.puppeteer",permalink:"/sdk/js/docs/1.3/api/puppeteer"},next:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"}},c={},m=[{value:"social.LINKEDIN_REGEX",id:"sociallinkedin_regex",level:2},{value:"social.LINKEDIN_REGEX_GLOBAL",id:"sociallinkedin_regex_global",level:2},{value:"social.INSTAGRAM_REGEX",id:"socialinstagram_regex",level:2},{value:"social.INSTAGRAM_REGEX_GLOBAL",id:"socialinstagram_regex_global",level:2},{value:"social.TWITTER_REGEX",id:"socialtwitter_regex",level:2},{value:"social.TWITTER_REGEX_GLOBAL",id:"socialtwitter_regex_global",level:2},{value:"social.FACEBOOK_REGEX",id:"socialfacebook_regex",level:2},{value:"social.FACEBOOK_REGEX_GLOBAL",id:"socialfacebook_regex_global",level:2},{value:"social.YOUTUBE_REGEX",id:"socialyoutube_regex",level:2},{value:"social.YOUTUBE_REGEX_GLOBAL",id:"socialyoutube_regex_global",level:2},{value:"social.EMAIL_REGEX",id:"socialemail_regex",level:2},{value:"social.EMAIL_REGEX_GLOBAL",id:"socialemail_regex_global",level:2},{value:"social.emailsFromText(text)",id:"socialemailsfromtexttext",level:2},{value:"social.emailsFromUrls(urls)",id:"socialemailsfromurlsurls",level:2},{value:"social.phonesFromText(text)",id:"socialphonesfromtexttext",level:2},{value:"social.phonesFromUrls(urls)",id:"socialphonesfromurlsurls",level:2},{value:"social.parseHandlesFromHtml(html, [data])",id:"socialparsehandlesfromhtmlhtml-data",level:2}],u={toc:m},d="wrapper";function h(e){var t=e.components,a=(0,l.Z)(e,r);return(0,o.kt)(d,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"social"}),(0,o.kt)("p",null,"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst emails = Apify.utils.social.emailsFromText('alice@example.com bob@example.com');\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex"}),(0,o.kt)("h2",{id:"sociallinkedin_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single LinkedIn profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.LINKEDIN_REGEX.test('https://www.linkedin.com/in/alan-turing')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex_global"}),(0,o.kt)("h2",{id:"sociallinkedin_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple LinkedIn profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.LINKEDIN_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} LinkedIn profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex"}),(0,o.kt)("h2",{id:"socialinstagram_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Instagram profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.INSTAGRAM_REGEX.test('https://www.instagram.com/old_prague')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex_global"}),(0,o.kt)("h2",{id:"socialinstagram_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Instagram profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.INSTAGRAM_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Instagram profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex"}),(0,o.kt)("h2",{id:"socialtwitter_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Twitter profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.TWITTER_REGEX.test('https://www.twitter.com/apify')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex_global"}),(0,o.kt)("h2",{id:"socialtwitter_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Twitter profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.TWITTER_REGEX_STRING);\nif (matches) console.log(`${matches.length} Twitter profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex"}),(0,o.kt)("h2",{id:"socialfacebook_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Facebook profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\nhttps://www.facebook.com/profile.php?id=123456789\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.FACEBOOK_REGEX.test('https://www.facebook.com/apifytech')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex_global"}),(0,o.kt)("h2",{id:"socialfacebook_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Facebook profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.FACEBOOK_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Facebook profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex"}),(0,o.kt)("h2",{id:"socialyoutube_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Youtube video URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex_global"}),(0,o.kt)("h2",{id:"socialyoutube_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Youtube video URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.YOUTUBE_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Youtube videos found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex"}),(0,o.kt)("h2",{id:"socialemail_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single email address. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex_global"}),(0,o.kt)("h2",{id:"socialemail_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple email addresses in a text. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromtext"}),(0,o.kt)("h2",{id:"socialemailsfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromText(text)")),(0,o.kt)("p",null,"The function extracts email addresses from a plain text. Note that the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromurls"}),(0,o.kt)("h2",{id:"socialemailsfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromUrls(urls)")),(0,o.kt)("p",null,"The function extracts email addresses from a list of URLs. Basically it looks for all ",(0,o.kt)("inlineCode",{parentName:"p"},"mailto:")," URLs and returns valid email addresses from them. Note\nthat the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromtext"}),(0,o.kt)("h2",{id:"socialphonesfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromText(text)")),(0,o.kt)("p",null,"The function attempts to extract phone numbers from a text. Please note that the results might not be accurate, since phone numbers appear in a large\nvariety of formats and conventions. If you encounter some problems, please ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"file an issue"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search the phone numbers in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromurls"}),(0,o.kt)("h2",{id:"socialphonesfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromUrls(urls)")),(0,o.kt)("p",null,"Finds phone number links in an array of URLs and extracts the phone numbers from them. Note that the phone number links look like ",(0,o.kt)("inlineCode",{parentName:"p"},"tel://123456789"),",\n",(0,o.kt)("inlineCode",{parentName:"p"},"tel:/123456789")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"tel:123456789"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"parsehandlesfromhtml"}),(0,o.kt)("h2",{id:"socialparsehandlesfromhtmlhtml-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.parseHandlesFromHtml(html, [data])")),(0,o.kt)("p",null,"The function attempts to extract emails, phone numbers and social profile URLs from a HTML document, specifically LinkedIn, Twitter, Instagram and\nFacebook profile URLs. The function removes duplicates from the resulting arrays and sorts the items alphabetically."),(0,o.kt)("p",null,"Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"phones")," field contains phone numbers extracted from the special phone links such as ",(0,o.kt)("inlineCode",{parentName:"p"},"[call us](tel:+1234556789)")," (see\n",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/social#phonesfromurls",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"social.phonesFromUrls()")),") and potentially other sources with high certainty, while ",(0,o.kt)("inlineCode",{parentName:"p"},"phonesUncertain")," contains phone\nnumbers extracted from the plain text, which might be very inaccurate."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('http://www.example.com');\nconst html = await page.content();\n\nconst result = Apify.utils.social.parseHandlesFromHtml(html);\nconsole.log('Social handles:');\nconsole.dir(result);\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - HTML text"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," | ",(0,o.kt)("inlineCode",{parentName:"li"},"null")," ",(0,o.kt)("code",null," = ")," - Optional object which will receive the ",(0,o.kt)("inlineCode",{parentName:"li"},"text")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"$")," properties that contain text content of the\nHTML and ",(0,o.kt)("inlineCode",{parentName:"li"},"cheerio")," object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/social-handles",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SocialHandles"))," - An object with the social handles."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>h});var n=a(67294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=p(a),d=l,h=m["".concat(s,".").concat(d)]||m[d]||u[d]||o;return a?n.createElement(h,r(r({ref:t},c),{},{components:a})):n.createElement(h,r({ref:t},c))}));function h(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=a.length,r=new Array(o);r[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[m]="string"==typeof e?e:l,r[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var n=a(87462),l=a(63366),o=(a(67294),a(3905)),r=["components"],i={id_old:"version-1.3-social",title:"utils.social",id:"social"},s=void 0,p={unversionedId:"api/social",id:"version-1.3/api/social",title:"utils.social",description:"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents.",source:"@site/versioned_docs/version-1.3/api/social.md",sourceDirName:"api",slug:"/api/social",permalink:"/sdk/js/docs/1.3/api/social",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/social.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-social",title:"utils.social",id:"social"},sidebar:"version-1.3/docs",previous:{title:"utils.puppeteer",permalink:"/sdk/js/docs/1.3/api/puppeteer"},next:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"}},c={},m=[{value:"social.LINKEDIN_REGEX",id:"sociallinkedin_regex",level:2},{value:"social.LINKEDIN_REGEX_GLOBAL",id:"sociallinkedin_regex_global",level:2},{value:"social.INSTAGRAM_REGEX",id:"socialinstagram_regex",level:2},{value:"social.INSTAGRAM_REGEX_GLOBAL",id:"socialinstagram_regex_global",level:2},{value:"social.TWITTER_REGEX",id:"socialtwitter_regex",level:2},{value:"social.TWITTER_REGEX_GLOBAL",id:"socialtwitter_regex_global",level:2},{value:"social.FACEBOOK_REGEX",id:"socialfacebook_regex",level:2},{value:"social.FACEBOOK_REGEX_GLOBAL",id:"socialfacebook_regex_global",level:2},{value:"social.YOUTUBE_REGEX",id:"socialyoutube_regex",level:2},{value:"social.YOUTUBE_REGEX_GLOBAL",id:"socialyoutube_regex_global",level:2},{value:"social.EMAIL_REGEX",id:"socialemail_regex",level:2},{value:"social.EMAIL_REGEX_GLOBAL",id:"socialemail_regex_global",level:2},{value:"social.emailsFromText(text)",id:"socialemailsfromtexttext",level:2},{value:"social.emailsFromUrls(urls)",id:"socialemailsfromurlsurls",level:2},{value:"social.phonesFromText(text)",id:"socialphonesfromtexttext",level:2},{value:"social.phonesFromUrls(urls)",id:"socialphonesfromurlsurls",level:2},{value:"social.parseHandlesFromHtml(html, [data])",id:"socialparsehandlesfromhtmlhtml-data",level:2}],u={toc:m},d="wrapper";function h(e){var t=e.components,a=(0,l.Z)(e,r);return(0,o.kt)(d,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"social"}),(0,o.kt)("p",null,"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst emails = Apify.utils.social.emailsFromText('alice@example.com bob@example.com');\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex"}),(0,o.kt)("h2",{id:"sociallinkedin_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single LinkedIn profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.LINKEDIN_REGEX.test('https://www.linkedin.com/in/alan-turing')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex_global"}),(0,o.kt)("h2",{id:"sociallinkedin_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple LinkedIn profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.LINKEDIN_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} LinkedIn profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex"}),(0,o.kt)("h2",{id:"socialinstagram_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Instagram profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.INSTAGRAM_REGEX.test('https://www.instagram.com/old_prague')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex_global"}),(0,o.kt)("h2",{id:"socialinstagram_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Instagram profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.INSTAGRAM_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Instagram profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex"}),(0,o.kt)("h2",{id:"socialtwitter_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Twitter profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.TWITTER_REGEX.test('https://www.twitter.com/apify')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex_global"}),(0,o.kt)("h2",{id:"socialtwitter_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Twitter profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.TWITTER_REGEX_STRING);\nif (matches) console.log(`${matches.length} Twitter profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex"}),(0,o.kt)("h2",{id:"socialfacebook_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Facebook profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\nhttps://www.facebook.com/profile.php?id=123456789\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.FACEBOOK_REGEX.test('https://www.facebook.com/apifytech')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex_global"}),(0,o.kt)("h2",{id:"socialfacebook_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Facebook profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.FACEBOOK_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Facebook profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex"}),(0,o.kt)("h2",{id:"socialyoutube_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Youtube video URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex_global"}),(0,o.kt)("h2",{id:"socialyoutube_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Youtube video URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.YOUTUBE_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Youtube videos found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex"}),(0,o.kt)("h2",{id:"socialemail_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single email address. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex_global"}),(0,o.kt)("h2",{id:"socialemail_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple email addresses in a text. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromtext"}),(0,o.kt)("h2",{id:"socialemailsfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromText(text)")),(0,o.kt)("p",null,"The function extracts email addresses from a plain text. Note that the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromurls"}),(0,o.kt)("h2",{id:"socialemailsfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromUrls(urls)")),(0,o.kt)("p",null,"The function extracts email addresses from a list of URLs. Basically it looks for all ",(0,o.kt)("inlineCode",{parentName:"p"},"mailto:")," URLs and returns valid email addresses from them. Note\nthat the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromtext"}),(0,o.kt)("h2",{id:"socialphonesfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromText(text)")),(0,o.kt)("p",null,"The function attempts to extract phone numbers from a text. Please note that the results might not be accurate, since phone numbers appear in a large\nvariety of formats and conventions. If you encounter some problems, please ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"file an issue"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search the phone numbers in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromurls"}),(0,o.kt)("h2",{id:"socialphonesfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromUrls(urls)")),(0,o.kt)("p",null,"Finds phone number links in an array of URLs and extracts the phone numbers from them. Note that the phone number links look like ",(0,o.kt)("inlineCode",{parentName:"p"},"tel://123456789"),",\n",(0,o.kt)("inlineCode",{parentName:"p"},"tel:/123456789")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"tel:123456789"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"parsehandlesfromhtml"}),(0,o.kt)("h2",{id:"socialparsehandlesfromhtmlhtml-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.parseHandlesFromHtml(html, [data])")),(0,o.kt)("p",null,"The function attempts to extract emails, phone numbers and social profile URLs from a HTML document, specifically LinkedIn, Twitter, Instagram and\nFacebook profile URLs. The function removes duplicates from the resulting arrays and sorts the items alphabetically."),(0,o.kt)("p",null,"Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"phones")," field contains phone numbers extracted from the special phone links such as ",(0,o.kt)("inlineCode",{parentName:"p"},"[call us](tel:+1234556789)")," (see\n",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/social#phonesfromurls",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"social.phonesFromUrls()")),") and potentially other sources with high certainty, while ",(0,o.kt)("inlineCode",{parentName:"p"},"phonesUncertain")," contains phone\nnumbers extracted from the plain text, which might be very inaccurate."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('http://www.example.com');\nconst html = await page.content();\n\nconst result = Apify.utils.social.parseHandlesFromHtml(html);\nconsole.log('Social handles:');\nconsole.dir(result);\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - HTML text"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," | ",(0,o.kt)("inlineCode",{parentName:"li"},"null")," ",(0,o.kt)("code",null," = ")," - Optional object which will receive the ",(0,o.kt)("inlineCode",{parentName:"li"},"text")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"$")," properties that contain text content of the\nHTML and ",(0,o.kt)("inlineCode",{parentName:"li"},"cheerio")," object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/social-handles",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SocialHandles"))," - An object with the social handles."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>h});var n=a(67294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=p(a),d=l,h=m["".concat(s,".").concat(d)]||m[d]||u[d]||o;return a?n.createElement(h,r(r({ref:t},c),{},{components:a})):n.createElement(h,r({ref:t},c))}));function h(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=a.length,r=new Array(o);r[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[m]="string"==typeof e?e:l,r[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-queue-operation-info",title:"QueueOperationInfo",id:"queue-operation-info"},s=void 0,u={unversionedId:"typedefs/queue-operation-info",id:"version-1.3/typedefs/queue-operation-info",title:"QueueOperationInfo",description:"A helper class that is used to report results from various RequestQueue functions as well as",source:"@site/versioned_docs/version-1.3/typedefs/QueueOperationInfo.md",sourceDirName:"typedefs",slug:"/typedefs/queue-operation-info",permalink:"/sdk/js/docs/1.3/typedefs/queue-operation-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/QueueOperationInfo.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-queue-operation-info",title:"QueueOperationInfo",id:"queue-operation-info"},sidebar:"version-1.3/docs",previous:{title:"MemoryInfo",permalink:"/sdk/js/docs/1.3/typedefs/memory-info"},next:{title:"RequestListState",permalink:"/sdk/js/docs/1.3/typedefs/request-list-state"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"wasAlreadyPresent",id:"wasalreadypresent",level:3},{value:"wasAlreadyHandled",id:"wasalreadyhandled",level:3},{value:"requestId",id:"requestid",level:3},{value:"request",id:"request",level:3}],c={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"queueoperationinfo"}),(0,o.kt)("p",null,"A helper class that is used to report results from various ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," functions as well as\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"wasalreadypresent"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyPresent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already present in the queue."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"wasalreadyhandled"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyHandled")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already marked as handled."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestid"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ID of the added request"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object passed to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue")," function."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),u=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||c[f]||o;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-queue-operation-info",title:"QueueOperationInfo",id:"queue-operation-info"},s=void 0,u={unversionedId:"typedefs/queue-operation-info",id:"version-1.3/typedefs/queue-operation-info",title:"QueueOperationInfo",description:"A helper class that is used to report results from various RequestQueue functions as well as",source:"@site/versioned_docs/version-1.3/typedefs/QueueOperationInfo.md",sourceDirName:"typedefs",slug:"/typedefs/queue-operation-info",permalink:"/sdk/js/docs/1.3/typedefs/queue-operation-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/QueueOperationInfo.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-queue-operation-info",title:"QueueOperationInfo",id:"queue-operation-info"},sidebar:"version-1.3/docs",previous:{title:"MemoryInfo",permalink:"/sdk/js/docs/1.3/typedefs/memory-info"},next:{title:"RequestListState",permalink:"/sdk/js/docs/1.3/typedefs/request-list-state"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"wasAlreadyPresent",id:"wasalreadypresent",level:3},{value:"wasAlreadyHandled",id:"wasalreadyhandled",level:3},{value:"requestId",id:"requestid",level:3},{value:"request",id:"request",level:3}],c={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"queueoperationinfo"}),(0,o.kt)("p",null,"A helper class that is used to report results from various ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," functions as well as\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"wasalreadypresent"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyPresent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already present in the queue."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"wasalreadyhandled"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyHandled")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already marked as handled."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestid"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ID of the added request"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object passed to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue")," function."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),u=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||c[f]||o;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"browser-handle-page-function",title:"BrowserHandlePageFunction"},p=void 0,s={unversionedId:"typedefs/browser-handle-page-function",id:"version-2.3/typedefs/browser-handle-page-function",title:"BrowserHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/BrowserHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/browser-handle-page-function",permalink:"/sdk/js/docs/2.3/typedefs/browser-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserHandlePageFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"browser-handle-page-function",title:"BrowserHandlePageFunction"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"browserhandlepagefunction"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"browser-handle-page-function",title:"BrowserHandlePageFunction"},p=void 0,s={unversionedId:"typedefs/browser-handle-page-function",id:"version-2.3/typedefs/browser-handle-page-function",title:"BrowserHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/BrowserHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/browser-handle-page-function",permalink:"/sdk/js/docs/2.3/typedefs/browser-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserHandlePageFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"browser-handle-page-function",title:"BrowserHandlePageFunction"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"browserhandlepagefunction"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s{r.d(n,{Z:()=>s});var o=r(67294),t=r(88746),a=r(6141),i=r(6832);const s=function(e){var n=e.to,r=e.children,s=(0,a.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return o.createElement(t.default,{to:"/api/"+n},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),o.createElement(t.default,{to:"/api/"+c+n},r)}},26569:(e,n,r)=>{r.d(n,{B:()=>s,T:()=>i});var o=r(67294),t=r(88746),a="https://crawlee.dev",i=function(e){var n=e.to,r=e.children,i=e.version;return o.createElement(t.default,{href:a+"/api"+(i?"/"+i:"")+"/"+n},r)},s=function(e){var n=e.to,r=e.children;return o.createElement(t.default,{href:a+"/"+n},r)}},31198:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>y,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>u,toc:()=>f});var o=r(87462),t=r(63366),a=(r(67294),r(3905)),i=r(68889),s=r(26569),p=["components"],l={id:"proxy-management",title:"Proxy Management"},c=void 0,u={unversionedId:"guides/proxy-management",id:"version-3.1/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-3.1/guides/proxy_management.mdx",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/proxy_management.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/guides/session-management"}},y={},f=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],d={toc:f},m="wrapper";function g(e){var n=e.components,r=(0,t.Z)(e,p);return(0,a.kt)(m,(0,o.Z)({},d,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," class. You create an instance using the ",(0,a.kt)(i.Z,{to:"apify/class/Actor#createProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"Actor.createProxyConfiguration()"))," function. See the ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions"))," for all the possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,a.kt)(s.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,"\u200b",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration#newUrl",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyConfiguration.newUrl()"))," allows you to pass a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair, and subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression of a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and ",(0,a.kt)(s.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," class for more information on how keeping a real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas Apify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await SessionPool.open({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst crawler = new PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember. ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyInfo",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}g.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>d});var o=r(67294);function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,o)}return r}function i(e){for(var n=1;n=0||(t[r]=e[r]);return t}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}var p=o.createContext({}),l=function(e){var n=o.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},c=function(e){var n=l(e.components);return o.createElement(p.Provider,{value:n},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var r=e.components,t=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=t,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||a;return r?o.createElement(d,i(i({ref:n},c),{},{components:r})):o.createElement(d,i({ref:n},c))}));function d(e,n){var r=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[u]="string"==typeof e?e:t,i[1]=s;for(var l=2;l{r.d(n,{Z:()=>s});var o=r(67294),t=r(88746),a=r(6141),i=r(6832);const s=function(e){var n=e.to,r=e.children,s=(0,a.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return o.createElement(t.default,{to:"/api/"+n},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),o.createElement(t.default,{to:"/api/"+c+n},r)}},26569:(e,n,r)=>{r.d(n,{B:()=>s,T:()=>i});var o=r(67294),t=r(88746),a="https://crawlee.dev",i=function(e){var n=e.to,r=e.children,i=e.version;return o.createElement(t.default,{href:a+"/api"+(i?"/"+i:"")+"/"+n},r)},s=function(e){var n=e.to,r=e.children;return o.createElement(t.default,{href:a+"/"+n},r)}},31198:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>y,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>u,toc:()=>f});var o=r(87462),t=r(63366),a=(r(67294),r(3905)),i=r(68889),s=r(26569),p=["components"],l={id:"proxy-management",title:"Proxy Management"},c=void 0,u={unversionedId:"guides/proxy-management",id:"version-3.1/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-3.1/guides/proxy_management.mdx",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/proxy_management.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/guides/session-management"}},y={},f=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],d={toc:f},m="wrapper";function g(e){var n=e.components,r=(0,t.Z)(e,p);return(0,a.kt)(m,(0,o.Z)({},d,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," class. You create an instance using the ",(0,a.kt)(i.Z,{to:"apify/class/Actor#createProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"Actor.createProxyConfiguration()"))," function. See the ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions"))," for all the possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,a.kt)(s.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,"\u200b",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration#newUrl",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyConfiguration.newUrl()"))," allows you to pass a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair, and subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression of a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and ",(0,a.kt)(s.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," class for more information on how keeping a real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas Apify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await SessionPool.open({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst crawler = new PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember. ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyInfo",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}g.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>d});var o=r(67294);function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,o)}return r}function i(e){for(var n=1;n=0||(t[r]=e[r]);return t}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}var p=o.createContext({}),l=function(e){var n=o.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},c=function(e){var n=l(e.components);return o.createElement(p.Provider,{value:n},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var r=e.components,t=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=t,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||a;return r?o.createElement(d,i(i({ref:n},c),{},{components:r})):o.createElement(d,i({ref:n},c))}));function d(e,n){var r=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[u]="string"==typeof e?e:t,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],p={id_old:"version-1.3-type-script-actor",title:"TypeScript Actors",id:"type-script-actor"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-1.3/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-1.3/guides/typescript_actor.md",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/1.3/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/typescript_actor.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-type-script-actor",title:"TypeScript Actors",id:"type-script-actor"},sidebar:"version-1.3/docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/1.3/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/1.3/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Apify.getInput()) as any; // getInput returns Promise|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Apify.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],p={id_old:"version-1.3-type-script-actor",title:"TypeScript Actors",id:"type-script-actor"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-1.3/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-1.3/guides/typescript_actor.md",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/1.3/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/typescript_actor.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-type-script-actor",title:"TypeScript Actors",id:"type-script-actor"},sidebar:"version-1.3/docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/1.3/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/1.3/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Apify.getInput()) as any; // getInput returns Promise|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Apify.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),i=["components"],o={id_old:"version-2.3.0-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},s=void 0,p={unversionedId:"api/basic-crawler",id:"version-2.3/api/basic-crawler",title:"BasicCrawler",description:"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of",source:"@site/versioned_docs/version-2.3/api/BasicCrawler.md",sourceDirName:"api",slug:"/api/basic-crawler",permalink:"/sdk/js/docs/2.3/api/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BasicCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},sidebar:"version-2.3/docs",previous:{title:"Configuration",permalink:"/sdk/js/docs/2.3/api/configuration"},next:{title:"CheerioCrawler",permalink:"/sdk/js/docs/2.3/api/cheerio-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new BasicCrawler(options)",id:"new-basiccrawleroptions",level:2},{value:"basicCrawler.optionsShape",id:"basiccrawleroptionsshape",level:2},{value:"basicCrawler.log",id:"basiccrawlerlog",level:2},{value:"basicCrawler.sessionPoolOptions",id:"basiccrawlersessionpooloptions",level:2},{value:"basicCrawler.run()",id:"basiccrawlerrun",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,a=(0,n.Z)(e,i);return(0,l.kt)(m,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"basiccrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of\nURLs enabling recursive crawling of websites."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," is a low-level tool that requires the user to implement the page download and data extraction functionality themselves. If you want a\ncrawler that already facilitates this functionality, please consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," for\neach ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object, which represents a single URL to crawl. The ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects are fed from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," options are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes if there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.BasicCrawler({\n requestList,\n handleRequestFunction: async ({ request }) => {\n // 'request' contains an instance of the Request class\n // Here we simply fetch the HTML of the page and store it to a dataset\n const { body } = await Apify.utils.requestAsBrowser(request);\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to change the concurrency settings on the\nfly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.basiccrawler"}),(0,l.kt)("h2",{id:"new-basiccrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new BasicCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/basic-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"BasicCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"basiccrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"basiccrawlerlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"sessionpooloptions"}),(0,l.kt)("h2",{id:"basiccrawlersessionpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.sessionPoolOptions")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"basiccrawlerrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.run()")),(0,l.kt)("p",null,"Runs the crawler. Returns a promise that gets resolved once all the requests are processed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=n,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||l;return a?r.createElement(k,i(i({ref:t},u),{},{components:a})):r.createElement(k,i({ref:t},u))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:n,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),i=["components"],o={id_old:"version-2.3.0-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},s=void 0,p={unversionedId:"api/basic-crawler",id:"version-2.3/api/basic-crawler",title:"BasicCrawler",description:"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of",source:"@site/versioned_docs/version-2.3/api/BasicCrawler.md",sourceDirName:"api",slug:"/api/basic-crawler",permalink:"/sdk/js/docs/2.3/api/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BasicCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},sidebar:"version-2.3/docs",previous:{title:"Configuration",permalink:"/sdk/js/docs/2.3/api/configuration"},next:{title:"CheerioCrawler",permalink:"/sdk/js/docs/2.3/api/cheerio-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new BasicCrawler(options)",id:"new-basiccrawleroptions",level:2},{value:"basicCrawler.optionsShape",id:"basiccrawleroptionsshape",level:2},{value:"basicCrawler.log",id:"basiccrawlerlog",level:2},{value:"basicCrawler.sessionPoolOptions",id:"basiccrawlersessionpooloptions",level:2},{value:"basicCrawler.run()",id:"basiccrawlerrun",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,a=(0,n.Z)(e,i);return(0,l.kt)(m,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"basiccrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of\nURLs enabling recursive crawling of websites."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," is a low-level tool that requires the user to implement the page download and data extraction functionality themselves. If you want a\ncrawler that already facilitates this functionality, please consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," for\neach ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object, which represents a single URL to crawl. The ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects are fed from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," options are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes if there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.BasicCrawler({\n requestList,\n handleRequestFunction: async ({ request }) => {\n // 'request' contains an instance of the Request class\n // Here we simply fetch the HTML of the page and store it to a dataset\n const { body } = await Apify.utils.requestAsBrowser(request);\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to change the concurrency settings on the\nfly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.basiccrawler"}),(0,l.kt)("h2",{id:"new-basiccrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new BasicCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/basic-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"BasicCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"basiccrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"basiccrawlerlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"sessionpooloptions"}),(0,l.kt)("h2",{id:"basiccrawlersessionpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.sessionPoolOptions")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"basiccrawlerrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.run()")),(0,l.kt)("p",null,"Runs the crawler. Returns a promise that gets resolved once all the requests are processed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=n,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||l;return a?r.createElement(k,i(i({ref:t},u),{},{components:a})):r.createElement(k,i({ref:t},u))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:n,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var n=a(87462),i=a(63366),r=(a(67294),a(3905)),o=["components"],l={id_old:"version-1.3-dataset",title:"Dataset",id:"dataset"},s=void 0,p={unversionedId:"api/dataset",id:"version-1.3/api/dataset",title:"Dataset",description:"The Dataset class represents a store for structured data where each object stored has the same attributes, such as online store products or real",source:"@site/versioned_docs/version-1.3/api/Dataset.md",sourceDirName:"api",slug:"/api/dataset",permalink:"/sdk/js/docs/1.3/api/dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Dataset.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-dataset",title:"Dataset",id:"dataset"},sidebar:"version-1.3/docs",previous:{title:"Statistics",permalink:"/sdk/js/docs/1.3/api/statistics"},next:{title:"KeyValueStore",permalink:"/sdk/js/docs/1.3/api/key-value-store"}},d={},m=[{value:"dataset.pushData(data)",id:"datasetpushdatadata",level:2},{value:"dataset.getData([options])",id:"datasetgetdataoptions",level:2},{value:"dataset.getInfo()",id:"datasetgetinfo",level:2},{value:"dataset.forEach(iteratee, [options], [index])",id:"datasetforeachiteratee-options-index",level:2},{value:"dataset.map(iteratee, [options])",id:"datasetmapiteratee-options",level:2},{value:"dataset.reduce(iteratee, memo, [options])",id:"datasetreduceiteratee-memo-options",level:2},{value:"dataset.drop()",id:"datasetdrop",level:2}],u={toc:m},k="wrapper";function c(e){var t=e.components,a=(0,i.Z)(e,o);return(0,r.kt)(k,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"dataset"}),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," class represents a store for structured data where each object stored has the same attributes, such as online store products or real\nestate offers. You can imagine it as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can\nonly add new records to it but you cannot modify or remove existing records. Typically it is used to store crawling results."),(0,r.kt)("p",null,"Do not instantiate this class directly, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function instead."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," stores its data either on local disk or in the Apify cloud, depending on whether the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment\nvariables are set."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,r.kt)("p",null,"Note that ",(0,r.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID: ",(0,r.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,r.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," not, the data is stored in the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify Dataset")," cloud storage. Note that you can force usage of the cloud storage also by passing the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function, even if the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is set."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"pushdata"}),(0,r.kt)("h2",{id:"datasetpushdatadata"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.pushData(data)")),(0,r.kt)("p",null,"Stores an object or an array of objects to the dataset. The function returns a promise that resolves when the operation finishes. It has no result,\nbut throws on invalid args or other errors."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data is stored!"),(0,r.kt)("p",null,"The size of the data is limited by the receiving API and therefore ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()")," will only allow objects whose JSON representation is smaller than 9MB.\nWhen an array is passed, none of the included objects may be larger than 9MB, but the array itself may be of any size."),(0,r.kt)("p",null,"The function internally chunks the array into separate items and pushes them sequentially. The chunking process is stable (keeps order of data), but\nit does not provide a transaction safety mechanism. Therefore, in the event of an uploading error (after several automatic retries), the function's\nPromise will reject and the dataset will be left in a state where some of the items have already been saved to the dataset while other items from the\nsource array were not. To overcome this limitation, the developer may, for example, read the last item saved in the dataset and re-attempt the save of\nthe data from this item onwards to prevent duplicates."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"data")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - Object or array of objects containing data to be stored in the default dataset. The objects must be\nserializable to JSON and the JSON representation of each object must be smaller than 9MB.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getdata"}),(0,r.kt)("h2",{id:"datasetgetdataoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getData([options])")),(0,r.kt)("p",null,"Returns ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetContent"))," object holding the items in the dataset based on the provided parameters."),(0,r.kt)("p",null,"If you need to get data in an unparsed format, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#newclient",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.newClient()"))," function to get a new ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-client")," instance and\ncall ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-client-js#DatasetClient+downloadItems",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"datasetClient.downloadItems()"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"getData()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[offset]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Number of array elements that should be skipped at the start."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 250000")," - Maximum number of array elements to return."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order. Otherwise they are\nsorted in ascending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - An array of field names that will be included in the result. If omitted, all fields are included in the\nresults."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default,\nthe results are returned as they are."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[clean]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function returns only non-empty items and skips hidden fields (i.e. fields\nstarting with ",(0,r.kt)("inlineCode",{parentName:"li"},"#")," character). Note that the ",(0,r.kt)("inlineCode",{parentName:"li"},"clean")," parameter is a shortcut for ",(0,r.kt)("inlineCode",{parentName:"li"},"skipHidden: true")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"skipEmpty: true")," options."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipHidden]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),' then the function doesn\'t return hidden fields (fields starting with "#"\ncharacter).'),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipEmpty]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function doesn't return empty items. Note that in this case the\nreturned number of items might be lower than limit parameter and pagination must be done using the ",(0,r.kt)("inlineCode",{parentName:"li"},"limit")," value.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getinfo"}),(0,r.kt)("h2",{id:"datasetgetinfo"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getInfo()")),(0,r.kt)("p",null,"Returns an object containing general information about the dataset."),(0,r.kt)("p",null,"The function returns the same object as the Apify API Client's\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/api/apify-client-js/latest#ApifyClient-datasets-getDataset",target:"_blank",rel:"noopener"},"getDataset")," function, which in turn calls the\n",(0,r.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset",target:"_blank",rel:"noopener"},"Get dataset")," API endpoint."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-dataset",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n itemCount: 14,\n cleanItemCount: 10\n}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"foreach"}),(0,r.kt)("h2",{id:"datasetforeachiteratee-options-index"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.forEach(iteratee, [options], [index])")),(0,r.kt)("p",null,"Iterates over dataset items, yielding each in turn to an ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with two arguments:\n",(0,r.kt)("inlineCode",{parentName:"p"},"(item, index)"),"."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forEach")," function throws the error."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset('my-results');\nawait dataset.forEach(async (item, index) => {\n console.log(`Item at ${index}: ${JSON.stringify(item)}`);\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-consumer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetConsumer"))," - A function that is called for every item in the dataset."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"forEach()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - If provided then returned objects will only contain specified keys."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[index]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Specifies the initial index number passed to the ",(0,r.kt)("inlineCode",{parentName:"li"},"iteratee")," function.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"map"}),(0,r.kt)("h2",{id:"datasetmapiteratee-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.map(iteratee, [options])")),(0,r.kt)("p",null,"Produces a new array of values by mapping each value in list through a transformation function ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is called\nwith two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"(element, index)"),"."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-mapper",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetMapper"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"map()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reduce"}),(0,r.kt)("h2",{id:"datasetreduceiteratee-memo-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.reduce(iteratee, memo, [options])")),(0,r.kt)("p",null,"Reduces a list of values down to a single value."),(0,r.kt)("p",null,"Memo is the initial state of the reduction, and each successive step of it should be returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". The ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is passed three\narguments: the ",(0,r.kt)("inlineCode",{parentName:"p"},"memo"),", then the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"index")," of the iteration."),(0,r.kt)("p",null,"If no ",(0,r.kt)("inlineCode",{parentName:"p"},"memo")," is passed to the initial invocation of reduce, the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is not invoked on the first element of the list. The first element is\ninstead passed as the memo in the invocation of the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," on the next element in the list."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-reducer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetReducer"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," - Initial state of the reduction."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"reduce()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"drop"}),(0,r.kt)("h2",{id:"datasetdrop"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.drop()")),(0,r.kt)("p",null,"Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>c});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(a),k=i,c=m["".concat(s,".").concat(k)]||m[k]||u[k]||r;return a?n.createElement(c,o(o({ref:t},d),{},{components:a})):n.createElement(c,o({ref:t},d))}));function c(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,o=new Array(r);o[0]=k;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:i,o[1]=l;for(var p=2;p{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var n=a(87462),i=a(63366),r=(a(67294),a(3905)),o=["components"],l={id_old:"version-1.3-dataset",title:"Dataset",id:"dataset"},s=void 0,p={unversionedId:"api/dataset",id:"version-1.3/api/dataset",title:"Dataset",description:"The Dataset class represents a store for structured data where each object stored has the same attributes, such as online store products or real",source:"@site/versioned_docs/version-1.3/api/Dataset.md",sourceDirName:"api",slug:"/api/dataset",permalink:"/sdk/js/docs/1.3/api/dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Dataset.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-dataset",title:"Dataset",id:"dataset"},sidebar:"version-1.3/docs",previous:{title:"Statistics",permalink:"/sdk/js/docs/1.3/api/statistics"},next:{title:"KeyValueStore",permalink:"/sdk/js/docs/1.3/api/key-value-store"}},d={},m=[{value:"dataset.pushData(data)",id:"datasetpushdatadata",level:2},{value:"dataset.getData([options])",id:"datasetgetdataoptions",level:2},{value:"dataset.getInfo()",id:"datasetgetinfo",level:2},{value:"dataset.forEach(iteratee, [options], [index])",id:"datasetforeachiteratee-options-index",level:2},{value:"dataset.map(iteratee, [options])",id:"datasetmapiteratee-options",level:2},{value:"dataset.reduce(iteratee, memo, [options])",id:"datasetreduceiteratee-memo-options",level:2},{value:"dataset.drop()",id:"datasetdrop",level:2}],u={toc:m},k="wrapper";function c(e){var t=e.components,a=(0,i.Z)(e,o);return(0,r.kt)(k,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"dataset"}),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," class represents a store for structured data where each object stored has the same attributes, such as online store products or real\nestate offers. You can imagine it as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can\nonly add new records to it but you cannot modify or remove existing records. Typically it is used to store crawling results."),(0,r.kt)("p",null,"Do not instantiate this class directly, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function instead."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," stores its data either on local disk or in the Apify cloud, depending on whether the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment\nvariables are set."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,r.kt)("p",null,"Note that ",(0,r.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID: ",(0,r.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,r.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," not, the data is stored in the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify Dataset")," cloud storage. Note that you can force usage of the cloud storage also by passing the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function, even if the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is set."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"pushdata"}),(0,r.kt)("h2",{id:"datasetpushdatadata"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.pushData(data)")),(0,r.kt)("p",null,"Stores an object or an array of objects to the dataset. The function returns a promise that resolves when the operation finishes. It has no result,\nbut throws on invalid args or other errors."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data is stored!"),(0,r.kt)("p",null,"The size of the data is limited by the receiving API and therefore ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()")," will only allow objects whose JSON representation is smaller than 9MB.\nWhen an array is passed, none of the included objects may be larger than 9MB, but the array itself may be of any size."),(0,r.kt)("p",null,"The function internally chunks the array into separate items and pushes them sequentially. The chunking process is stable (keeps order of data), but\nit does not provide a transaction safety mechanism. Therefore, in the event of an uploading error (after several automatic retries), the function's\nPromise will reject and the dataset will be left in a state where some of the items have already been saved to the dataset while other items from the\nsource array were not. To overcome this limitation, the developer may, for example, read the last item saved in the dataset and re-attempt the save of\nthe data from this item onwards to prevent duplicates."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"data")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - Object or array of objects containing data to be stored in the default dataset. The objects must be\nserializable to JSON and the JSON representation of each object must be smaller than 9MB.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getdata"}),(0,r.kt)("h2",{id:"datasetgetdataoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getData([options])")),(0,r.kt)("p",null,"Returns ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetContent"))," object holding the items in the dataset based on the provided parameters."),(0,r.kt)("p",null,"If you need to get data in an unparsed format, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#newclient",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.newClient()"))," function to get a new ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-client")," instance and\ncall ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-client-js#DatasetClient+downloadItems",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"datasetClient.downloadItems()"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"getData()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[offset]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Number of array elements that should be skipped at the start."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 250000")," - Maximum number of array elements to return."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order. Otherwise they are\nsorted in ascending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - An array of field names that will be included in the result. If omitted, all fields are included in the\nresults."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default,\nthe results are returned as they are."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[clean]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function returns only non-empty items and skips hidden fields (i.e. fields\nstarting with ",(0,r.kt)("inlineCode",{parentName:"li"},"#")," character). Note that the ",(0,r.kt)("inlineCode",{parentName:"li"},"clean")," parameter is a shortcut for ",(0,r.kt)("inlineCode",{parentName:"li"},"skipHidden: true")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"skipEmpty: true")," options."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipHidden]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),' then the function doesn\'t return hidden fields (fields starting with "#"\ncharacter).'),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipEmpty]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function doesn't return empty items. Note that in this case the\nreturned number of items might be lower than limit parameter and pagination must be done using the ",(0,r.kt)("inlineCode",{parentName:"li"},"limit")," value.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getinfo"}),(0,r.kt)("h2",{id:"datasetgetinfo"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getInfo()")),(0,r.kt)("p",null,"Returns an object containing general information about the dataset."),(0,r.kt)("p",null,"The function returns the same object as the Apify API Client's\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/api/apify-client-js/latest#ApifyClient-datasets-getDataset",target:"_blank",rel:"noopener"},"getDataset")," function, which in turn calls the\n",(0,r.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset",target:"_blank",rel:"noopener"},"Get dataset")," API endpoint."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-dataset",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n itemCount: 14,\n cleanItemCount: 10\n}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"foreach"}),(0,r.kt)("h2",{id:"datasetforeachiteratee-options-index"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.forEach(iteratee, [options], [index])")),(0,r.kt)("p",null,"Iterates over dataset items, yielding each in turn to an ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with two arguments:\n",(0,r.kt)("inlineCode",{parentName:"p"},"(item, index)"),"."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forEach")," function throws the error."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset('my-results');\nawait dataset.forEach(async (item, index) => {\n console.log(`Item at ${index}: ${JSON.stringify(item)}`);\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-consumer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetConsumer"))," - A function that is called for every item in the dataset."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"forEach()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - If provided then returned objects will only contain specified keys."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[index]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Specifies the initial index number passed to the ",(0,r.kt)("inlineCode",{parentName:"li"},"iteratee")," function.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"map"}),(0,r.kt)("h2",{id:"datasetmapiteratee-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.map(iteratee, [options])")),(0,r.kt)("p",null,"Produces a new array of values by mapping each value in list through a transformation function ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is called\nwith two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"(element, index)"),"."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-mapper",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetMapper"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"map()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reduce"}),(0,r.kt)("h2",{id:"datasetreduceiteratee-memo-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.reduce(iteratee, memo, [options])")),(0,r.kt)("p",null,"Reduces a list of values down to a single value."),(0,r.kt)("p",null,"Memo is the initial state of the reduction, and each successive step of it should be returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". The ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is passed three\narguments: the ",(0,r.kt)("inlineCode",{parentName:"p"},"memo"),", then the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"index")," of the iteration."),(0,r.kt)("p",null,"If no ",(0,r.kt)("inlineCode",{parentName:"p"},"memo")," is passed to the initial invocation of reduce, the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is not invoked on the first element of the list. The first element is\ninstead passed as the memo in the invocation of the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," on the next element in the list."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-reducer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetReducer"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," - Initial state of the reduction."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"reduce()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"drop"}),(0,r.kt)("h2",{id:"datasetdrop"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.drop()")),(0,r.kt)("p",null,"Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise")),(0,r.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>c});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(a),k=i,c=m["".concat(s,".").concat(k)]||m[k]||u[k]||r;return a?n.createElement(c,o(o({ref:t},d),{},{components:a})):n.createElement(c,o({ref:t},d))}));function c(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,o=new Array(r);o[0]=k;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:i,o[1]=l;for(var p=2;p{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>d});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),p=a(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function u(e){var t=e.className,a=e.block,l=e.selectedValue,p=e.selectValue,u=e.tabValues,c=[],f=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==l&&(f(t),p(n))},m=function(e){var t,a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",s.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function f(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",s.tabList)},r.createElement(u,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function d(e){var t=(0,p.Z)();return r.createElement(f,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>f});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function p(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:p(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,a])}function u(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),p=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(p),(0,n.useCallback)((function(e){if(p){var t=new URLSearchParams(l.location.search);t.set(p,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[p,l])]}function f(e){var t,a,r,o,i=e.defaultValue,p=e.queryString,f=void 0!==p&&p,d=e.groupId,m=s(e),y=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!u({value:a,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:m})})),h=y[0],k=y[1],g=c({queryString:f,groupId:d}),v=g[0],b=g[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],A=w[1],C=function(){var e=null!=v?v:N;return u({value:e,tabValues:m})?e:null}();return(0,n.useLayoutEffect)((function(){C&&k(C)}),[C]),{selectedValue:h,selectValue:(0,n.useCallback)((function(e){if(!u({value:e,tabValues:m}))throw new Error("Can't select invalid tab value="+e);k(e),b(e),A(e)}),[b,A,m]),tabValues:m}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),p=l.version,s=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var u=p+"/";return"current"===p?u="next/":s&&(u=""),n.createElement(r.default,{to:"/api/"+u+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},68129:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>k,contentTitle:()=>y,default:()=>w,frontMatter:()=>m,metadata:()=>h,toc:()=>g});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=a(68889),l=a(26569),p=a(65559),s=a(30433),u=a(14563);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.main(async () => {\n const crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n });\n\n // Enqueue the initial request and run the crawler\n await crawler.run(['https://www.iana.org/']);\n});\n",f="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n});\n\n// Enqueue the initial request and run the crawler\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n";var d=["components"],m={id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},y=void 0,h={unversionedId:"guides/apify-platform",id:"guides/apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping",source:"@site/../docs/guides/apify_platform.mdx",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/next/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/apify_platform.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},sidebar:"docs",previous:{title:"Guides",permalink:"/sdk/js/docs/next/guides"},next:{title:"Request Storage",permalink:"/sdk/js/docs/next/guides/request-storage"}},k={},g=[{value:"Logging into Apify platform from Crawlee",id:"logging-into-apify-platform-from-crawlee",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"Log in with Configuration",id:"log-in-with-configuration",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2},{value:"Running an actor locally",id:"running-an-actor-locally",level:2},{value:"Running Crawlee code as an actor",id:"running-crawlee-code-as-an-actor",level:2},{value:"Deploying an actor to Apify platform",id:"deploying-an-actor-to-apify-platform",level:2},{value:"Usage on Apify platform",id:"usage-on-apify-platform",level:2},{value:"Storages",id:"storages",level:2},{value:"Helper functions for default Key-Value Store and Dataset",id:"helper-functions-for-default-key-value-store-and-dataset",level:3},{value:"Using platform storage in a local actor",id:"using-platform-storage-in-a-local-actor",level:3},{value:"Getting public url of an item in the platform storage",id:"getting-public-url-of-an-item-in-the-platform-storage",level:3},{value:"Exporting dataset data",id:"exporting-dataset-data",level:3},{value:"Environment variables",id:"environment-variables",level:2},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_TOKEN and CRAWLEE_STORAGE_DIR",id:"combinations-of-apify_token-and-crawlee_storage_dir",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3},{value:"Proxy management",id:"proxy-management",level:2},{value:"Apify Proxy",id:"apify-proxy",level:3},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:3},{value:"Apify Proxy vs. Own proxies",id:"apify-proxy-vs-own-proxies",level:3}],v={toc:g},b="wrapper";function w(e){var t=e.components,a=(0,r.Z)(e,d);return(0,o.kt)(b,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"./request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"./result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"./proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and it's definitely worth signing up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Crawlee is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"We do not test Crawlee in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-crawlee"},"Logging into Apify platform from Crawlee"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from Crawlee, you must provide\ncredentials - your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\napify login -t YOUR_API_TOKEN\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"Alternatively, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. Actor automatically infers that from your token, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h3",{id:"log-in-with-configuration"},"Log in with Configuration"),(0,o.kt)("p",null,"Another option is to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance and set your api token there."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst sdk = new Actor({ token: 'your_api_token' });\n")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actors",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))),(0,o.kt)("h2",{id:"running-an-actor-locally"},"Running an actor locally"),(0,o.kt)("p",null,"First let's create a boilerplate of the new actor. You could use Apify CLI and just run:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - let\'s pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world")," with a Node.js project files. You can run the actor as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("h2",{id:"running-crawlee-code-as-an-actor"},"Running Crawlee code as an actor"),(0,o.kt)("p",null,"For running Crawlee code as an actor on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform")," you should either:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"use a combination of ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," functions;"),(0,o.kt)("li",{parentName:"ul"},"or wrap it into ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," function.")),(0,o.kt)("admonition",{title:"NOTE",type:"info"},(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Adding ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," to your code are the only two important things needed to run it on Apify platform as an actor. ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," is needed to initialize your actor (e.g. to set the correct storage implementation), while without ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," the process will simply never stop."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," is an alternative to ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," as it calls both behind the scenes."))),(0,o.kt)("p",null,"Let's look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," example from the ",(0,o.kt)(l.B,{to:"docs/quick-start",mdxType:"CrawleeLink"},"Quick Start")," guide:"),(0,o.kt)(p.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"main",label:"Using Actor.main()",default:!0,mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"init_exit",label:"Using Actor.init() and Actor.exit()",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},f))),(0,o.kt)("p",null,"Note that you could also run your actor (that is using Crawlee) locally with Apify CLI. You could start it via the following command in your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify run\n")),(0,o.kt)("h2",{id:"deploying-an-actor-to-apify-platform"},"Deploying an actor to Apify platform"),(0,o.kt)("p",null,"Now (assuming you are already logged in to your Apify account) you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to and built on the Apify platform so that it can be run there. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-apify-platform"},"Usage on Apify platform"),(0,o.kt)("p",null,"You can also develop your actor in an online code editor directly on the platform (you'll need an Apify Account). Let's go to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("em",{parentName:"p"},"Create new")," and then go to the ",(0,o.kt)("em",{parentName:"p"},"Source")," tab and start writing the code or paste one of the examples from the ",(0,o.kt)("a",{parentName:"p",href:"../examples",target:null,rel:null},"Examples")," section."),(0,o.kt)("h2",{id:"storages"},"Storages"),(0,o.kt)("p",null,"There are several things worth mentioning here."),(0,o.kt)("h3",{id:"helper-functions-for-default-key-value-store-and-dataset"},"Helper functions for default Key-Value Store and Dataset"),(0,o.kt)("p",null,"To simplify access to the ",(0,o.kt)("em",{parentName:"p"},"default")," storages, instead of using the helper functions of respective storage classes, you could use:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#setValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.setValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getInput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getInput()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Key-Value Store")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#pushData",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.pushData()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Dataset"))),(0,o.kt)("h3",{id:"using-platform-storage-in-a-local-actor"},"Using platform storage in a local actor"),(0,o.kt)("p",null,"When you plan to use the platform storage while developing and running your actor locally, you should use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openKeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openKeyValueStore()")),", ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openDataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openDataset()"))," and ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openRequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openRequestQueue()"))," to open the respective storage."),(0,o.kt)("p",null,"Using each of these methods allows to pass the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"OpenStorageOptions"))," as a second argument, which has only one optional property: ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions#forceCloud",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"forceCloud")),". If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," - cloud storage will be used instead of the folder on the local disk."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"If you don't plan to force usage of the platform storages when running the actor locally, there is no need to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," class for it. The Crawlee variants ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore.open()")),", ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.open()"))," and ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue.open()"))," will work the same.")),(0,o.kt)("h3",{id:"getting-public-url-of-an-item-in-the-platform-storage"},"Getting public url of an item in the platform storage"),(0,o.kt)("p",null,"If you need to share a link to some file stored in a Key-Value Store on Apify Platform, you can use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore#getPublicUrl",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"getPublicUrl()"))," method. It accepts only one parameter: ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," - the key of the item you want to share."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { KeyValueStore } from 'apify';\n\nconst store = await KeyValueStore.open();\nawait store.setValue('your-file', { foo: 'bar' });\nconst url = store.getPublicUrl('your-file');\n// https://api.apify.com/v2/key-value-stores//records/your-file\n")),(0,o.kt)("h3",{id:"exporting-dataset-data"},"Exporting dataset data"),(0,o.kt)("p",null,"When the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," is stored on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),", you can export its data to the following formats: HTML, JSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This way you can easily share the crawling results."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,o.kt)("p",null,"The following are some additional environment variables specific to Apify platform. More Crawlee specific environment variables could be found in the ",(0,o.kt)(l.B,{to:"docs/guides/configuration#environment-variables",mdxType:"CrawleeLink"},"Environment Variables")," guide."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"It's important to notice that ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_")," environment variables don't need to be replaced with equivalent ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," ones. Likewise, Crawlee understands ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," environment variables after calling ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.init()")," or when using ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.main()"),".")),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Account Settings / Integrations")," page."),(0,o.kt)("h3",{id:"combinations-of-apify_token-and-crawlee_storage_dir"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR")," env variable description could be found in ",(0,o.kt)(l.B,{to:"docs/guides/configuration#crawlee_storage_dir",mdxType:"CrawleeLink"},"Environment Variables")," guide.")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the actor's behavior."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local + platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { Actor } from 'apify';\nimport { Dataset } from 'crawlee';\n\n// or Dataset.open('my-local-data')\nconst localDataset = await Actor.openDataset('my-local-data');\n// but here we need the `Actor` class\nconst remoteDataset = await Actor.openDataset('my-dataset', { forceCloud: true });\n")),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nAssuming Apify Account was already created, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but not access to Apify API, or when you need access to\nproxy from a different account than your token represents."),(0,o.kt)("h2",{id:"proxy-management"},"Proxy management"),(0,o.kt)("p",null,"In addition to your own proxy servers and proxy servers acquired from\nthird-party providers used together with Crawlee, you can also rely on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,o.kt)("h3",{id:"apify-proxy"},"Apify Proxy"),(0,o.kt)("p",null,"If you are already subscribed to Apify Proxy, you can start using them immediately in only a few lines of code (for local usage you first should be ",(0,o.kt)("a",{parentName:"p",href:"#logging-into-apify-platform-from-crawlee",target:null,rel:null},"logged in")," to your Apify account."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Note that unlike using your own proxies in Crawlee, you shouldn't use the constructor to create ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," instance. For using Apify Proxy you should create an instance using the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function instead."),(0,o.kt)("h3",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,o.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can check proxy groups available to you\nin the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,o.kt)("h3",{id:"apify-proxy-vs-own-proxies"},"Apify Proxy vs. Own proxies"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers. However, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Own (third party) proxy."),(0,o.kt)("p",null,"The difference is easy to remember."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"If you're using your own proxies - you should create an instance with the ProxyConfiguration ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration#constructor",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"constructor"))," function based on the provided ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions")),"."),(0,o.kt)("li",{parentName:"ul"},"If you are planning to use Apify Proxy - you should create an instance using the ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function. ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs"))))}w.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(a),d=r,m=c["".concat(p,".").concat(d)]||c[d]||f[d]||o;return a?n.createElement(m,i(i({ref:t},u),{},{components:a})):n.createElement(m,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var s=2;s{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>d});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),p=a(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function u(e){var t=e.className,a=e.block,l=e.selectedValue,p=e.selectValue,u=e.tabValues,c=[],f=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==l&&(f(t),p(n))},m=function(e){var t,a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",s.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function f(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",s.tabList)},r.createElement(u,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function d(e){var t=(0,p.Z)();return r.createElement(f,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>f});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function p(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:p(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,a])}function u(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),p=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(p),(0,n.useCallback)((function(e){if(p){var t=new URLSearchParams(l.location.search);t.set(p,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[p,l])]}function f(e){var t,a,r,o,i=e.defaultValue,p=e.queryString,f=void 0!==p&&p,d=e.groupId,m=s(e),y=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!u({value:a,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:m})})),h=y[0],k=y[1],g=c({queryString:f,groupId:d}),v=g[0],b=g[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],A=w[1],C=function(){var e=null!=v?v:N;return u({value:e,tabValues:m})?e:null}();return(0,n.useLayoutEffect)((function(){C&&k(C)}),[C]),{selectedValue:h,selectValue:(0,n.useCallback)((function(e){if(!u({value:e,tabValues:m}))throw new Error("Can't select invalid tab value="+e);k(e),b(e),A(e)}),[b,A,m]),tabValues:m}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),p=l.version,s=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var u=p+"/";return"current"===p?u="next/":s&&(u=""),n.createElement(r.default,{to:"/api/"+u+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},68129:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>k,contentTitle:()=>y,default:()=>w,frontMatter:()=>m,metadata:()=>h,toc:()=>g});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=a(68889),l=a(26569),p=a(65559),s=a(30433),u=a(14563);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.main(async () => {\n const crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n });\n\n // Enqueue the initial request and run the crawler\n await crawler.run(['https://www.iana.org/']);\n});\n",f="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n});\n\n// Enqueue the initial request and run the crawler\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n";var d=["components"],m={id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},y=void 0,h={unversionedId:"guides/apify-platform",id:"guides/apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping",source:"@site/../docs/guides/apify_platform.mdx",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/next/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/apify_platform.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},sidebar:"docs",previous:{title:"Guides",permalink:"/sdk/js/docs/next/guides"},next:{title:"Request Storage",permalink:"/sdk/js/docs/next/guides/request-storage"}},k={},g=[{value:"Logging into Apify platform from Crawlee",id:"logging-into-apify-platform-from-crawlee",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"Log in with Configuration",id:"log-in-with-configuration",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2},{value:"Running an actor locally",id:"running-an-actor-locally",level:2},{value:"Running Crawlee code as an actor",id:"running-crawlee-code-as-an-actor",level:2},{value:"Deploying an actor to Apify platform",id:"deploying-an-actor-to-apify-platform",level:2},{value:"Usage on Apify platform",id:"usage-on-apify-platform",level:2},{value:"Storages",id:"storages",level:2},{value:"Helper functions for default Key-Value Store and Dataset",id:"helper-functions-for-default-key-value-store-and-dataset",level:3},{value:"Using platform storage in a local actor",id:"using-platform-storage-in-a-local-actor",level:3},{value:"Getting public url of an item in the platform storage",id:"getting-public-url-of-an-item-in-the-platform-storage",level:3},{value:"Exporting dataset data",id:"exporting-dataset-data",level:3},{value:"Environment variables",id:"environment-variables",level:2},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_TOKEN and CRAWLEE_STORAGE_DIR",id:"combinations-of-apify_token-and-crawlee_storage_dir",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3},{value:"Proxy management",id:"proxy-management",level:2},{value:"Apify Proxy",id:"apify-proxy",level:3},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:3},{value:"Apify Proxy vs. Own proxies",id:"apify-proxy-vs-own-proxies",level:3}],v={toc:g},b="wrapper";function w(e){var t=e.components,a=(0,r.Z)(e,d);return(0,o.kt)(b,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"./request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"./result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"./proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and it's definitely worth signing up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Crawlee is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"We do not test Crawlee in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-crawlee"},"Logging into Apify platform from Crawlee"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from Crawlee, you must provide\ncredentials - your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\napify login -t YOUR_API_TOKEN\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"Alternatively, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. Actor automatically infers that from your token, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h3",{id:"log-in-with-configuration"},"Log in with Configuration"),(0,o.kt)("p",null,"Another option is to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance and set your api token there."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst sdk = new Actor({ token: 'your_api_token' });\n")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actors",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))),(0,o.kt)("h2",{id:"running-an-actor-locally"},"Running an actor locally"),(0,o.kt)("p",null,"First let's create a boilerplate of the new actor. You could use Apify CLI and just run:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - let\'s pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world")," with a Node.js project files. You can run the actor as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("h2",{id:"running-crawlee-code-as-an-actor"},"Running Crawlee code as an actor"),(0,o.kt)("p",null,"For running Crawlee code as an actor on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform")," you should either:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"use a combination of ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," functions;"),(0,o.kt)("li",{parentName:"ul"},"or wrap it into ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," function.")),(0,o.kt)("admonition",{title:"NOTE",type:"info"},(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Adding ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," to your code are the only two important things needed to run it on Apify platform as an actor. ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," is needed to initialize your actor (e.g. to set the correct storage implementation), while without ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," the process will simply never stop."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," is an alternative to ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," as it calls both behind the scenes."))),(0,o.kt)("p",null,"Let's look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," example from the ",(0,o.kt)(l.B,{to:"docs/quick-start",mdxType:"CrawleeLink"},"Quick Start")," guide:"),(0,o.kt)(p.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"main",label:"Using Actor.main()",default:!0,mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"init_exit",label:"Using Actor.init() and Actor.exit()",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},f))),(0,o.kt)("p",null,"Note that you could also run your actor (that is using Crawlee) locally with Apify CLI. You could start it via the following command in your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify run\n")),(0,o.kt)("h2",{id:"deploying-an-actor-to-apify-platform"},"Deploying an actor to Apify platform"),(0,o.kt)("p",null,"Now (assuming you are already logged in to your Apify account) you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to and built on the Apify platform so that it can be run there. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-apify-platform"},"Usage on Apify platform"),(0,o.kt)("p",null,"You can also develop your actor in an online code editor directly on the platform (you'll need an Apify Account). Let's go to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("em",{parentName:"p"},"Create new")," and then go to the ",(0,o.kt)("em",{parentName:"p"},"Source")," tab and start writing the code or paste one of the examples from the ",(0,o.kt)("a",{parentName:"p",href:"../examples",target:null,rel:null},"Examples")," section."),(0,o.kt)("h2",{id:"storages"},"Storages"),(0,o.kt)("p",null,"There are several things worth mentioning here."),(0,o.kt)("h3",{id:"helper-functions-for-default-key-value-store-and-dataset"},"Helper functions for default Key-Value Store and Dataset"),(0,o.kt)("p",null,"To simplify access to the ",(0,o.kt)("em",{parentName:"p"},"default")," storages, instead of using the helper functions of respective storage classes, you could use:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#setValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.setValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getInput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getInput()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Key-Value Store")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#pushData",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.pushData()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Dataset"))),(0,o.kt)("h3",{id:"using-platform-storage-in-a-local-actor"},"Using platform storage in a local actor"),(0,o.kt)("p",null,"When you plan to use the platform storage while developing and running your actor locally, you should use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openKeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openKeyValueStore()")),", ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openDataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openDataset()"))," and ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openRequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openRequestQueue()"))," to open the respective storage."),(0,o.kt)("p",null,"Using each of these methods allows to pass the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"OpenStorageOptions"))," as a second argument, which has only one optional property: ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions#forceCloud",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"forceCloud")),". If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," - cloud storage will be used instead of the folder on the local disk."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"If you don't plan to force usage of the platform storages when running the actor locally, there is no need to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," class for it. The Crawlee variants ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore.open()")),", ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.open()"))," and ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue.open()"))," will work the same.")),(0,o.kt)("h3",{id:"getting-public-url-of-an-item-in-the-platform-storage"},"Getting public url of an item in the platform storage"),(0,o.kt)("p",null,"If you need to share a link to some file stored in a Key-Value Store on Apify Platform, you can use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore#getPublicUrl",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"getPublicUrl()"))," method. It accepts only one parameter: ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," - the key of the item you want to share."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { KeyValueStore } from 'apify';\n\nconst store = await KeyValueStore.open();\nawait store.setValue('your-file', { foo: 'bar' });\nconst url = store.getPublicUrl('your-file');\n// https://api.apify.com/v2/key-value-stores//records/your-file\n")),(0,o.kt)("h3",{id:"exporting-dataset-data"},"Exporting dataset data"),(0,o.kt)("p",null,"When the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," is stored on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),", you can export its data to the following formats: HTML, JSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This way you can easily share the crawling results."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,o.kt)("p",null,"The following are some additional environment variables specific to Apify platform. More Crawlee specific environment variables could be found in the ",(0,o.kt)(l.B,{to:"docs/guides/configuration#environment-variables",mdxType:"CrawleeLink"},"Environment Variables")," guide."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"It's important to notice that ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_")," environment variables don't need to be replaced with equivalent ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," ones. Likewise, Crawlee understands ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," environment variables after calling ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.init()")," or when using ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.main()"),".")),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Account Settings / Integrations")," page."),(0,o.kt)("h3",{id:"combinations-of-apify_token-and-crawlee_storage_dir"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR")," env variable description could be found in ",(0,o.kt)(l.B,{to:"docs/guides/configuration#crawlee_storage_dir",mdxType:"CrawleeLink"},"Environment Variables")," guide.")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the actor's behavior."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local + platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { Actor } from 'apify';\nimport { Dataset } from 'crawlee';\n\n// or Dataset.open('my-local-data')\nconst localDataset = await Actor.openDataset('my-local-data');\n// but here we need the `Actor` class\nconst remoteDataset = await Actor.openDataset('my-dataset', { forceCloud: true });\n")),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nAssuming Apify Account was already created, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but not access to Apify API, or when you need access to\nproxy from a different account than your token represents."),(0,o.kt)("h2",{id:"proxy-management"},"Proxy management"),(0,o.kt)("p",null,"In addition to your own proxy servers and proxy servers acquired from\nthird-party providers used together with Crawlee, you can also rely on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,o.kt)("h3",{id:"apify-proxy"},"Apify Proxy"),(0,o.kt)("p",null,"If you are already subscribed to Apify Proxy, you can start using them immediately in only a few lines of code (for local usage you first should be ",(0,o.kt)("a",{parentName:"p",href:"#logging-into-apify-platform-from-crawlee",target:null,rel:null},"logged in")," to your Apify account."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Note that unlike using your own proxies in Crawlee, you shouldn't use the constructor to create ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," instance. For using Apify Proxy you should create an instance using the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function instead."),(0,o.kt)("h3",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,o.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can check proxy groups available to you\nin the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,o.kt)("h3",{id:"apify-proxy-vs-own-proxies"},"Apify Proxy vs. Own proxies"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers. However, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Own (third party) proxy."),(0,o.kt)("p",null,"The difference is easy to remember."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"If you're using your own proxies - you should create an instance with the ProxyConfiguration ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration#constructor",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"constructor"))," function based on the provided ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions")),"."),(0,o.kt)("li",{parentName:"ul"},"If you are planning to use Apify Proxy - you should create an instance using the ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function. ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs"))))}w.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(a),d=r,m=c["".concat(p,".").concat(d)]||c[d]||f[d]||o;return a?n.createElement(m,i(i({ref:t},u),{},{components:a})):n.createElement(m,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",s={unversionedId:"readme/introduction",id:"version-3.1/readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/versioned_docs/version-3.1/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/introduction.md",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},l={},d=[],f={toc:d},u="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(r),u=a,m=d["".concat(c,".").concat(u)]||d[u]||f[u]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",s={unversionedId:"readme/introduction",id:"version-3.1/readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/versioned_docs/version-3.1/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/introduction.md",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},l={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(r),f=a,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>d});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),s=["components"],a={id:"system-info",title:"SystemInfo"},l=void 0,p={unversionedId:"typedefs/system-info",id:"version-2.3/typedefs/system-info",title:"SystemInfo",description:"Represents the current status of the system.",source:"@site/versioned_docs/version-2.3/typedefs/SystemInfo.md",sourceDirName:"typedefs",slug:"/typedefs/system-info",permalink:"/sdk/js/docs/2.3/typedefs/system-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemInfo.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"system-info",title:"SystemInfo"},sidebar:"version-2.3/docs",previous:{title:"SocialHandles",permalink:"/sdk/js/docs/2.3/typedefs/social-handles"},next:{title:"Changelog",permalink:"/sdk/js/docs/2.3/changelog"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"isSystemIdle",id:"issystemidle",level:3},{value:"memInfo",id:"meminfo",level:3},{value:"eventLoopInfo",id:"eventloopinfo",level:3},{value:"cpuInfo",id:"cpuinfo",level:3}],f={toc:d},m="wrapper";function u(e){var t=e.components,n=(0,o.Z)(e,s);return(0,i.kt)(m,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"systeminfo"}),(0,i.kt)("p",null,"Represents the current status of the system."),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"issystemidle"},(0,i.kt)("inlineCode",{parentName:"h3"},"isSystemIdle")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("p",null,"If true, system is being overloaded."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"meminfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"memInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("p",null,"Memory"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"eventloopinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"eventLoopInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"cpuinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"cpuInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null))}u.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,u=d["".concat(l,".").concat(m)]||d[m]||f[m]||i;return n?r.createElement(u,s(s({ref:t},c),{},{components:n})):r.createElement(u,s({ref:t},c))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[d]="string"==typeof e?e:o,s[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>d});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),s=["components"],a={id:"system-info",title:"SystemInfo"},l=void 0,p={unversionedId:"typedefs/system-info",id:"version-2.3/typedefs/system-info",title:"SystemInfo",description:"Represents the current status of the system.",source:"@site/versioned_docs/version-2.3/typedefs/SystemInfo.md",sourceDirName:"typedefs",slug:"/typedefs/system-info",permalink:"/sdk/js/docs/2.3/typedefs/system-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemInfo.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"system-info",title:"SystemInfo"},sidebar:"version-2.3/docs",previous:{title:"SocialHandles",permalink:"/sdk/js/docs/2.3/typedefs/social-handles"},next:{title:"Changelog",permalink:"/sdk/js/docs/2.3/changelog"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"isSystemIdle",id:"issystemidle",level:3},{value:"memInfo",id:"meminfo",level:3},{value:"eventLoopInfo",id:"eventloopinfo",level:3},{value:"cpuInfo",id:"cpuinfo",level:3}],f={toc:d},m="wrapper";function u(e){var t=e.components,n=(0,o.Z)(e,s);return(0,i.kt)(m,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"systeminfo"}),(0,i.kt)("p",null,"Represents the current status of the system."),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"issystemidle"},(0,i.kt)("inlineCode",{parentName:"h3"},"isSystemIdle")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("p",null,"If true, system is being overloaded."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"meminfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"memInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("p",null,"Memory"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"eventloopinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"eventLoopInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"cpuinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"cpuInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null))}u.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,u=d["".concat(l,".").concat(m)]||d[m]||f[m]||i;return n?r.createElement(u,s(s({ref:t},c),{},{components:n})):r.createElement(u,s({ref:t},c))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[d]="string"==typeof e?e:o,s[1]=a;for(var p=2;p{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>c});var r=t(87462),a=t(63366),l=(t(67294),t(3905)),i=["components"],o={id_old:"version-1.3-crawl-all-links",title:"Crawl all links on a website",id:"crawl-all-links"},s=void 0,u={unversionedId:"examples/crawl-all-links",id:"version-1.3/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/versioned_docs/version-1.3/examples/crawl_all_links.md",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/1.3/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_all_links.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawl-all-links",title:"Crawl all links on a website",id:"crawl-all-links"},sidebar:"version-1.3/docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/1.3/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/1.3/examples/crawl-multiple-urls"}},p={},c=[],d={toc:c},f="wrapper";function m(e){var n=e.components,t=(0,a.Z)(e,i);return(0,l.kt)(f,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=u(t),f=a,m=c["".concat(s,".").concat(f)]||c[f]||d[f]||l;return t?r.createElement(m,i(i({ref:n},p),{},{components:t})):r.createElement(m,i({ref:n},p))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=t.length,i=new Array(l);i[0]=f;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[c]="string"==typeof e?e:a,i[1]=o;for(var u=2;u{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>c});var r=t(87462),a=t(63366),l=(t(67294),t(3905)),i=["components"],o={id_old:"version-1.3-crawl-all-links",title:"Crawl all links on a website",id:"crawl-all-links"},s=void 0,u={unversionedId:"examples/crawl-all-links",id:"version-1.3/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/versioned_docs/version-1.3/examples/crawl_all_links.md",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/1.3/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_all_links.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawl-all-links",title:"Crawl all links on a website",id:"crawl-all-links"},sidebar:"version-1.3/docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/1.3/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/1.3/examples/crawl-multiple-urls"}},p={},c=[],d={toc:c},f="wrapper";function m(e){var n=e.components,t=(0,a.Z)(e,i);return(0,l.kt)(f,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=u(t),f=a,m=c["".concat(s,".").concat(f)]||c[f]||d[f]||l;return t?r.createElement(m,i(i({ref:n},p),{},{components:t})):r.createElement(m,i({ref:n},p))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=t.length,i=new Array(l);i[0]=f;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[c]="string"==typeof e?e:a,i[1]=o;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-crawl-single-url",title:"Crawl a single URL",id:"crawl-single-url"},i=void 0,p={unversionedId:"examples/crawl-single-url",id:"version-1.3/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the Apify.utils.requestAsBrowser() function to grab the HTML of a web page.",source:"@site/versioned_docs/version-1.3/examples/crawl_single_url.md",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/1.3/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_single_url.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawl-single-url",title:"Crawl a single URL",id:"crawl-single-url"},sidebar:"version-1.3/docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/1.3/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/1.3/examples/crawl-sitemap"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/utils#utilsrequestasbrowseroptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()"))," function to grab the HTML of a web page."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Get the HTML of a web page\n const { body } = await Apify.utils.requestAsBrowser({ url: 'https://www.example.com' });\n console.log(body);\n});\n")),(0,l.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,l.kt)("a",{parentName:"p",href:"accept-user-input",target:null,rel:null},"Accept User Input")," example."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=a,m=u["".concat(i,".").concat(f)]||u[f]||d[f]||l;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-crawl-single-url",title:"Crawl a single URL",id:"crawl-single-url"},i=void 0,p={unversionedId:"examples/crawl-single-url",id:"version-1.3/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the Apify.utils.requestAsBrowser() function to grab the HTML of a web page.",source:"@site/versioned_docs/version-1.3/examples/crawl_single_url.md",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/1.3/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_single_url.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawl-single-url",title:"Crawl a single URL",id:"crawl-single-url"},sidebar:"version-1.3/docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/1.3/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/1.3/examples/crawl-sitemap"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/utils#utilsrequestasbrowseroptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()"))," function to grab the HTML of a web page."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Get the HTML of a web page\n const { body } = await Apify.utils.requestAsBrowser({ url: 'https://www.example.com' });\n console.log(body);\n});\n")),(0,l.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,l.kt)("a",{parentName:"p",href:"accept-user-input",target:null,rel:null},"Accept User Input")," example."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),f=a,m=u["".concat(i,".").concat(f)]||u[f]||d[f]||l;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.d(t,{Z:()=>o});var r=n(67294),a=n(88746),l=n(6141),c=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var g=i+"/";return"current"===i?g="next/":s&&(g=""),r.createElement(a.default,{to:"/api/"+g+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>c});var r=n(67294),a=n(88746),l="https://crawlee.dev",c=function(e){var t=e.to,n=e.children,c=e.version;return r.createElement(a.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:l+"/"+t},n)}},84770:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>C,frontMatter:()=>g,metadata:()=>I,toc:()=>m});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),c=(n(14563),n(68889),n(26569));const o={code:"import { CheerioCrawler, log, LogLevel } from 'crawlee';\n\n// Crawlers come with various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nlog.setLevel(LogLevel.DEBUG);\n\n// Create an instance of the CheerioCrawler class - a crawler\n// that automatically loads the URLs and parses their HTML using the cheerio library.\nconst crawler = new CheerioCrawler({\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n requestHandlerTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n async requestHandler({ request, $ }) {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the dataset. In local configuration,\n // the data will be stored as JSON files in ./storage/datasets/default\n await Actor.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n log.debug(`Request ${request.url} failed twice.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run();\n\nlog.debug('Crawler finished.');\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s"};var i,s=["components"],g={id:"cheerio-crawler",title:"Cheerio crawler"},d=void 0,I={unversionedId:"examples/cheerio-crawler",id:"examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.",source:"@site/../docs/examples/cheerio_crawler.mdx",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/next/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/cheerio_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/next/examples/call-actor"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/next/examples/crawl-all-links"}},u={},m=[],b=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),p={toc:m},h="wrapper";function C(e){var t=e.components,n=(0,a.Z)(e,s);return(0,l.kt)(h,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title and all ",(0,l.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,l.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}C.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},g=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,g=o(e,["components","mdxType","originalType","parentName"]),d=s(n),u=a,m=d["".concat(i,".").concat(u)]||d[u]||I[u]||l;return n?r.createElement(m,c(c({ref:t},g),{},{components:n})):r.createElement(m,c({ref:t},g))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var s=2;s{n.d(t,{Z:()=>o});var r=n(67294),a=n(88746),l=n(6141),c=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var g=i+"/";return"current"===i?g="next/":s&&(g=""),r.createElement(a.default,{to:"/api/"+g+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>c});var r=n(67294),a=n(88746),l="https://crawlee.dev",c=function(e){var t=e.to,n=e.children,c=e.version;return r.createElement(a.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:l+"/"+t},n)}},84770:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>C,frontMatter:()=>g,metadata:()=>I,toc:()=>m});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),c=(n(14563),n(68889),n(26569));const o={code:"import { CheerioCrawler, log, LogLevel } from 'crawlee';\n\n// Crawlers come with various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nlog.setLevel(LogLevel.DEBUG);\n\n// Create an instance of the CheerioCrawler class - a crawler\n// that automatically loads the URLs and parses their HTML using the cheerio library.\nconst crawler = new CheerioCrawler({\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n requestHandlerTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n async requestHandler({ request, $ }) {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the dataset. In local configuration,\n // the data will be stored as JSON files in ./storage/datasets/default\n await Actor.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n log.debug(`Request ${request.url} failed twice.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run();\n\nlog.debug('Crawler finished.');\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s"};var i,s=["components"],g={id:"cheerio-crawler",title:"Cheerio crawler"},d=void 0,I={unversionedId:"examples/cheerio-crawler",id:"examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.",source:"@site/../docs/examples/cheerio_crawler.mdx",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/next/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/cheerio_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/next/examples/call-actor"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/next/examples/crawl-all-links"}},u={},m=[],b=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),p={toc:m},h="wrapper";function C(e){var t=e.components,n=(0,a.Z)(e,s);return(0,l.kt)(h,(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title and all ",(0,l.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,l.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}C.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},g=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,g=o(e,["components","mdxType","originalType","parentName"]),d=s(n),u=a,m=d["".concat(i,".").concat(u)]||d[u]||I[u]||l;return n?r.createElement(m,c(c({ref:t},g),{},{components:n})):r.createElement(m,c({ref:t},g))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>y,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=["components"],i={id_old:"version-1.3-handle-failed-request-input",title:"HandleFailedRequestInput",id:"handle-failed-request-input"},p=void 0,s={unversionedId:"typedefs/handle-failed-request-input",id:"version-1.3/typedefs/handle-failed-request-input",title:"HandleFailedRequestInput",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/HandleFailedRequestInput.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request-input",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequestInput.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-handle-failed-request-input",title:"HandleFailedRequestInput",id:"handle-failed-request-input"},sidebar:"version-1.3/docs",previous:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request"},next:{title:"HandleRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-request"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"error",id:"error",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:u},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"handlefailedrequestinput"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"error"},(0,o.kt)("inlineCode",{parentName:"h3"},"error")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")),(0,o.kt)("p",null,"The Error thrown by ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original {Request} object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,y=u["".concat(p,".").concat(f)]||u[f]||c[f]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-handle-failed-request-input",title:"HandleFailedRequestInput",id:"handle-failed-request-input"},p=void 0,s={unversionedId:"typedefs/handle-failed-request-input",id:"version-1.3/typedefs/handle-failed-request-input",title:"HandleFailedRequestInput",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/HandleFailedRequestInput.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request-input",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequestInput.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-handle-failed-request-input",title:"HandleFailedRequestInput",id:"handle-failed-request-input"},sidebar:"version-1.3/docs",previous:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request"},next:{title:"HandleRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-request"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"error",id:"error",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:u},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"handlefailedrequestinput"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"error"},(0,o.kt)("inlineCode",{parentName:"h3"},"error")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")),(0,o.kt)("p",null,"The Error thrown by ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original {Request} object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,y=u["".concat(p,".").concat(f)]||u[f]||c[f]||o;return r?n.createElement(y,i(i({ref:t},d),{},{components:r})):n.createElement(y,i({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"dataset-consumer",title:"DatasetConsumer"},p=void 0,l={unversionedId:"typedefs/dataset-consumer",id:"version-2.3/typedefs/dataset-consumer",title:"DatasetConsumer",description:"User-function used in the Dataset.forEach() API.",source:"@site/versioned_docs/version-2.3/typedefs/DatasetConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-consumer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetConsumer.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"dataset-consumer",title:"DatasetConsumer"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"},next:{title:"DatasetMapper",permalink:"/sdk/js/docs/2.3/typedefs/dataset-mapper"}},c={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.forEach()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Current ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=a,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"dataset-consumer",title:"DatasetConsumer"},p=void 0,l={unversionedId:"typedefs/dataset-consumer",id:"version-2.3/typedefs/dataset-consumer",title:"DatasetConsumer",description:"User-function used in the Dataset.forEach() API.",source:"@site/versioned_docs/version-2.3/typedefs/DatasetConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-consumer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetConsumer.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"dataset-consumer",title:"DatasetConsumer"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"},next:{title:"DatasetMapper",permalink:"/sdk/js/docs/2.3/typedefs/dataset-mapper"}},c={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.forEach()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Current ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=a,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,l={unversionedId:"readme/support",id:"version-3.0/readme/support",title:"support",description:"Support",source:"@site/versioned_docs/version-3.0/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/3.0/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/support.md",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,l={unversionedId:"readme/support",id:"version-3.0/readme/support",title:"support",description:"Support",source:"@site/versioned_docs/version-3.0/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/3.0/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/support.md",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id:"apify-env",title:"ApifyEnv"},p=void 0,d={unversionedId:"typedefs/apify-env",id:"version-2.3/typedefs/apify-env",title:"ApifyEnv",description:"Parsed representation of the APIFY_XXX environmental variables. This object is returned by the Apify.getEnv() function.",source:"@site/versioned_docs/version-2.3/typedefs/ApifyEnv.md",sourceDirName:"typedefs",slug:"/typedefs/apify-env",permalink:"/sdk/js/docs/2.3/typedefs/apify-env",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ApifyEnv.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"apify-env",title:"ApifyEnv"},sidebar:"version-2.3/docs",previous:{title:"ApifyCallError",permalink:"/sdk/js/docs/2.3/api/apify-call-error"},next:{title:"DatasetContent",permalink:"/sdk/js/docs/2.3/typedefs/dataset-content"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"actorId",id:"actorid",level:3},{value:"actorRunId",id:"actorrunid",level:3},{value:"actorTaskId",id:"actortaskid",level:3},{value:"userId",id:"userid",level:3},{value:"token",id:"token",level:3},{value:"startedAt",id:"startedat",level:3},{value:"timeoutAt",id:"timeoutat",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"memoryMbytes",id:"memorymbytes",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"apifyenv"}),(0,o.kt)("p",null,"Parsed representation of the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environmental variables. This object is returned by the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getenv",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"actorid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor (APIFY_ACTOR_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"actorrunid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorRunId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor run (APIFY_ACTOR_RUN_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"actortaskid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorTaskId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor task (APIFY_ACTOR_TASK_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userid"},(0,o.kt)("inlineCode",{parentName:"h3"},"userId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"token"},(0,o.kt)("inlineCode",{parentName:"h3"},"token")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"startedat"},(0,o.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Date when the actor was started (APIFY_STARTED_AT)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"timeoutat"},(0,o.kt)("inlineCode",{parentName:"h3"},"timeoutAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Date when the actor will time out (APIFY_TIMEOUT_AT)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,o.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"defaultdatasetid"},(0,o.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"memorymbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"memoryMbytes")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)"),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=d(n),k=a,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||o;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id:"apify-env",title:"ApifyEnv"},p=void 0,d={unversionedId:"typedefs/apify-env",id:"version-2.3/typedefs/apify-env",title:"ApifyEnv",description:"Parsed representation of the APIFY_XXX environmental variables. This object is returned by the Apify.getEnv() function.",source:"@site/versioned_docs/version-2.3/typedefs/ApifyEnv.md",sourceDirName:"typedefs",slug:"/typedefs/apify-env",permalink:"/sdk/js/docs/2.3/typedefs/apify-env",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ApifyEnv.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"apify-env",title:"ApifyEnv"},sidebar:"version-2.3/docs",previous:{title:"ApifyCallError",permalink:"/sdk/js/docs/2.3/api/apify-call-error"},next:{title:"DatasetContent",permalink:"/sdk/js/docs/2.3/typedefs/dataset-content"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"actorId",id:"actorid",level:3},{value:"actorRunId",id:"actorrunid",level:3},{value:"actorTaskId",id:"actortaskid",level:3},{value:"userId",id:"userid",level:3},{value:"token",id:"token",level:3},{value:"startedAt",id:"startedat",level:3},{value:"timeoutAt",id:"timeoutat",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"memoryMbytes",id:"memorymbytes",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"apifyenv"}),(0,o.kt)("p",null,"Parsed representation of the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environmental variables. This object is returned by the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getenv",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"actorid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor (APIFY_ACTOR_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"actorrunid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorRunId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor run (APIFY_ACTOR_RUN_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"actortaskid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorTaskId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor task (APIFY_ACTOR_TASK_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userid"},(0,o.kt)("inlineCode",{parentName:"h3"},"userId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"token"},(0,o.kt)("inlineCode",{parentName:"h3"},"token")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"startedat"},(0,o.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Date when the actor was started (APIFY_STARTED_AT)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"timeoutat"},(0,o.kt)("inlineCode",{parentName:"h3"},"timeoutAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Date when the actor will time out (APIFY_TIMEOUT_AT)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,o.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"defaultdatasetid"},(0,o.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"memorymbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"memoryMbytes")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)"),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=d(n),k=a,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||o;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>g});var r=n(87462),o=n(63366),l=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-logger-options",title:"LoggerOptions",id:"logger-options"},p=void 0,s={unversionedId:"typedefs/logger-options",id:"version-1.3/typedefs/logger-options",title:"LoggerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/LoggerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/logger-options",permalink:"/sdk/js/docs/1.3/typedefs/logger-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LoggerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-logger-options",title:"LoggerOptions",id:"logger-options"},sidebar:"version-1.3/docs",previous:{title:"ProxyInfo",permalink:"/sdk/js/docs/1.3/typedefs/proxy-info"},next:{title:"RequestOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-options"}},d={},g=[{value:"Properties",id:"properties",level:2},{value:"level",id:"level",level:3},{value:"maxDepth",id:"maxdepth",level:3},{value:"maxStringLength",id:"maxstringlength",level:3},{value:"prefix",id:"prefix",level:3},{value:"suffix",id:"suffix",level:3},{value:"logger",id:"logger",level:3},{value:"data",id:"data",level:3}],c={toc:g},u="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,l.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"loggeroptions"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"level"},(0,l.kt)("inlineCode",{parentName:"h3"},"level")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxdepth"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxDepth")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Max depth of data object that will be logged. Anything deeper than the limit will be stripped off."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxstringlength"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxStringLength")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 2000")),(0,l.kt)("p",null,"Max length of the string to be logged. Longer strings will be truncated."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"prefix"},(0,l.kt)("inlineCode",{parentName:"h3"},"prefix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Prefix to be prepended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"suffix"},(0,l.kt)("inlineCode",{parentName:"h3"},"suffix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Suffix that will be appended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"logger"},(0,l.kt)("inlineCode",{parentName:"h3"},"logger")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Logger")),(0,l.kt)("p",null,"Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LoggerJson"),"\nthat formats each log line as a JSON."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"data"},(0,l.kt)("inlineCode",{parentName:"h3"},"data")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Record")),(0,l.kt)("p",null,"Additional data to be added to each log line."),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,p=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),g=s(n),u=o,m=g["".concat(p,".").concat(u)]||g[u]||c[u]||l;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=u;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[g]="string"==typeof e?e:o,i[1]=a;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>g});var r=n(87462),o=n(63366),l=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-logger-options",title:"LoggerOptions",id:"logger-options"},p=void 0,s={unversionedId:"typedefs/logger-options",id:"version-1.3/typedefs/logger-options",title:"LoggerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/LoggerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/logger-options",permalink:"/sdk/js/docs/1.3/typedefs/logger-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LoggerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-logger-options",title:"LoggerOptions",id:"logger-options"},sidebar:"version-1.3/docs",previous:{title:"ProxyInfo",permalink:"/sdk/js/docs/1.3/typedefs/proxy-info"},next:{title:"RequestOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-options"}},d={},g=[{value:"Properties",id:"properties",level:2},{value:"level",id:"level",level:3},{value:"maxDepth",id:"maxdepth",level:3},{value:"maxStringLength",id:"maxstringlength",level:3},{value:"prefix",id:"prefix",level:3},{value:"suffix",id:"suffix",level:3},{value:"logger",id:"logger",level:3},{value:"data",id:"data",level:3}],c={toc:g},u="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,l.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"loggeroptions"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"level"},(0,l.kt)("inlineCode",{parentName:"h3"},"level")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxdepth"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxDepth")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Max depth of data object that will be logged. Anything deeper than the limit will be stripped off."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxstringlength"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxStringLength")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 2000")),(0,l.kt)("p",null,"Max length of the string to be logged. Longer strings will be truncated."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"prefix"},(0,l.kt)("inlineCode",{parentName:"h3"},"prefix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Prefix to be prepended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"suffix"},(0,l.kt)("inlineCode",{parentName:"h3"},"suffix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Suffix that will be appended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"logger"},(0,l.kt)("inlineCode",{parentName:"h3"},"logger")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Logger")),(0,l.kt)("p",null,"Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LoggerJson"),"\nthat formats each log line as a JSON."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"data"},(0,l.kt)("inlineCode",{parentName:"h3"},"data")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Record")),(0,l.kt)("p",null,"Additional data to be added to each log line."),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,p=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),g=s(n),u=o,m=g["".concat(p,".").concat(u)]||g[u]||c[u]||l;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=u;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[g]="string"==typeof e?e:o,i[1]=a;for(var s=2;s{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>d});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],p={id:"upgrading-to-v2",title:"Upgrading to v2"},s=void 0,u={unversionedId:"upgrading/upgrading-to-v2",id:"version-3.1/upgrading/upgrading-to-v2",title:"Upgrading to v2",description:"- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.",source:"@site/versioned_docs/version-3.1/upgrading/upgrading_v2.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v2",permalink:"/sdk/js/docs/upgrading/upgrading-to-v2",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v2.md",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v2",title:"Upgrading to v2"},sidebar:"docs",previous:{title:"Upgrading to v1",permalink:"/sdk/js/docs/upgrading/upgrading-to-v1"},next:{title:"Upgrading to v3",permalink:"/sdk/js/docs/upgrading/upgrading-to-v3"}},l={},d=[],c={toc:d},g="wrapper";function v(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(g,(0,n.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Bump ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," to ",(0,i.kt)("inlineCode",{parentName:"li"},"1.0.0-rc.10")," from ",(0,i.kt)("inlineCode",{parentName:"li"},"rc.3"),". There were breaking changes in ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," between the versions so this bump might be breaking for you as well."),(0,i.kt)("li",{parentName:"ul"},"Remove ",(0,i.kt)("inlineCode",{parentName:"li"},"LiveViewServer")," which was deprecated before release of SDK v1.")))}v.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>v});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},g=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=u(t),g=o,v=d["".concat(s,".").concat(g)]||d[g]||c[g]||i;return t?n.createElement(v,a(a({ref:r},l),{},{components:t})):n.createElement(v,a({ref:r},l))}));function v(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=g;var p={};for(var s in r)hasOwnProperty.call(r,s)&&(p[s]=r[s]);p.originalType=e,p[d]="string"==typeof e?e:o,a[1]=p;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>p,metadata:()=>u,toc:()=>d});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],p={id:"upgrading-to-v2",title:"Upgrading to v2"},s=void 0,u={unversionedId:"upgrading/upgrading-to-v2",id:"version-3.1/upgrading/upgrading-to-v2",title:"Upgrading to v2",description:"- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.",source:"@site/versioned_docs/version-3.1/upgrading/upgrading_v2.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v2",permalink:"/sdk/js/docs/upgrading/upgrading-to-v2",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v2.md",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v2",title:"Upgrading to v2"},sidebar:"docs",previous:{title:"Upgrading to v1",permalink:"/sdk/js/docs/upgrading/upgrading-to-v1"},next:{title:"Upgrading to v3",permalink:"/sdk/js/docs/upgrading/upgrading-to-v3"}},l={},d=[],c={toc:d},g="wrapper";function m(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(g,(0,n.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Bump ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," to ",(0,i.kt)("inlineCode",{parentName:"li"},"1.0.0-rc.10")," from ",(0,i.kt)("inlineCode",{parentName:"li"},"rc.3"),". There were breaking changes in ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," between the versions so this bump might be breaking for you as well."),(0,i.kt)("li",{parentName:"ul"},"Remove ",(0,i.kt)("inlineCode",{parentName:"li"},"LiveViewServer")," which was deprecated before release of SDK v1.")))}m.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},g=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=u(t),g=o,m=d["".concat(s,".").concat(g)]||d[g]||c[g]||i;return t?n.createElement(m,a(a({ref:r},l),{},{components:t})):n.createElement(m,a({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=g;var p={};for(var s in r)hasOwnProperty.call(r,s)&&(p[s]=r[s]);p.originalType=e,p[d]="string"==typeof e?e:o,a[1]=p;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,p={unversionedId:"examples/call-actor",id:"examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/../docs/examples/call_actor.mdx",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/next/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/call_actor.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/next/examples/basic-crawler"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/next/examples/cheerio-crawler"}},s={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(u,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#newClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.newClient()")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Settings - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on Apify Platform, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\nconsole.log('Obtaining own email address...');\nconst apifyClient = Actor.newClient();\nconst { email } = await apifyClient.user().get();\n\n// Load randomword.com and get a random word\nconsole.log('Fetching a random word.');\nconst page = await browser.newPage();\nawait page.goto('https://randomword.com/');\nconst randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n// Send random word to your email. For that, you can use an actor we already\n// have available on the platform under the name: apify/send-mail.\n// The second parameter to the Actor.call() invocation is the actor's\n// desired input. You can find the required input parameters by checking\n// the actor's documentation page: https://apify.com/apify/send-mail\nconsole.log(`Sending email to ${user.email}...`);\nawait Actor.call('apify/send-mail', {\n to: email,\n subject: 'Random Word',\n html: `

Random Word

${randomWord}`,\n});\nconsole.log('Email sent. Good luck!');\n\n// Close Browser\nawait browser.close();\n\nawait Actor.exit();\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),m=p(n),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},s),{},{components:n})):r.createElement(f,l({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,p={unversionedId:"examples/call-actor",id:"examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/../docs/examples/call_actor.mdx",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/next/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/call_actor.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/next/examples/basic-crawler"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/next/examples/cheerio-crawler"}},s={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,l);return(0,o.kt)(u,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#newClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.newClient()")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Settings - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on Apify Platform, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\nconsole.log('Obtaining own email address...');\nconst apifyClient = Actor.newClient();\nconst { email } = await apifyClient.user().get();\n\n// Load randomword.com and get a random word\nconsole.log('Fetching a random word.');\nconst page = await browser.newPage();\nawait page.goto('https://randomword.com/');\nconst randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n// Send random word to your email. For that, you can use an actor we already\n// have available on the platform under the name: apify/send-mail.\n// The second parameter to the Actor.call() invocation is the actor's\n// desired input. You can find the required input parameters by checking\n// the actor's documentation page: https://apify.com/apify/send-mail\nconsole.log(`Sending email to ${user.email}...`);\nawait Actor.call('apify/send-mail', {\n to: email,\n subject: 'Random Word',\n html: `

Random Word

${randomWord}`,\n});\nconsole.log('Email sent. Good luck!');\n\n// Close Browser\nawait browser.close();\n\nawait Actor.exit();\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),p=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?a.createElement(f,l(l({ref:t},s),{},{components:n})):a.createElement(f,l({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:r,l[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=t(87462),a=t(63366),l=(t(67294),t(3905)),o=["components"],i={id_old:"version-1.3-apify-call-error",title:"ApifyCallError",id:"apify-call-error"},p=void 0,s={unversionedId:"api/apify-call-error",id:"version-1.3/api/apify-call-error",title:"ApifyCallError",description:"The class represents exceptions thrown by the Apify.call() function.",source:"@site/versioned_docs/version-1.3/api/ApifyCallError.md",sourceDirName:"api",slug:"/api/apify-call-error",permalink:"/sdk/js/docs/1.3/api/apify-call-error",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ApifyCallError.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-apify-call-error",title:"ApifyCallError",id:"apify-call-error"},sidebar:"version-1.3/docs",previous:{title:"ActorRun",permalink:"/sdk/js/docs/1.3/typedefs/actor-run"},next:{title:"ApifyEnv",permalink:"/sdk/js/docs/1.3/typedefs/apify-env"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"run",id:"run",level:3},{value:"name",id:"name",level:3},{value:"new ApifyCallError(run, [message])",id:"new-apifycallerrorrun-message",level:2}],d={toc:u},f="wrapper";function m(e){var r=e.components,t=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"apifycallerror"}),(0,l.kt)("p",null,"The class represents exceptions thrown by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"message"},(0,l.kt)("inlineCode",{parentName:"h3"},"message")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Error message"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"run"},(0,l.kt)("inlineCode",{parentName:"h3"},"run")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("p",null,"Object representing the failed actor run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"name"},(0,l.kt)("inlineCode",{parentName:"h3"},"name")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Contains ",(0,l.kt)("inlineCode",{parentName:"p"},'"ApifyCallError"')),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.apifycallerror"}),(0,l.kt)("h2",{id:"new-apifycallerrorrun-message"},(0,l.kt)("inlineCode",{parentName:"h2"},"new ApifyCallError(run, [message])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"run")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"The actor invoked by Apify.call() did not succeed",'"'))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(t),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||l;return t?n.createElement(m,o(o({ref:r},c),{},{components:t})):n.createElement(m,o({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=f;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var s=2;s{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=t(87462),a=t(63366),l=(t(67294),t(3905)),o=["components"],i={id_old:"version-1.3-apify-call-error",title:"ApifyCallError",id:"apify-call-error"},p=void 0,s={unversionedId:"api/apify-call-error",id:"version-1.3/api/apify-call-error",title:"ApifyCallError",description:"The class represents exceptions thrown by the Apify.call() function.",source:"@site/versioned_docs/version-1.3/api/ApifyCallError.md",sourceDirName:"api",slug:"/api/apify-call-error",permalink:"/sdk/js/docs/1.3/api/apify-call-error",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ApifyCallError.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-apify-call-error",title:"ApifyCallError",id:"apify-call-error"},sidebar:"version-1.3/docs",previous:{title:"ActorRun",permalink:"/sdk/js/docs/1.3/typedefs/actor-run"},next:{title:"ApifyEnv",permalink:"/sdk/js/docs/1.3/typedefs/apify-env"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"run",id:"run",level:3},{value:"name",id:"name",level:3},{value:"new ApifyCallError(run, [message])",id:"new-apifycallerrorrun-message",level:2}],d={toc:u},f="wrapper";function m(e){var r=e.components,t=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"apifycallerror"}),(0,l.kt)("p",null,"The class represents exceptions thrown by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"message"},(0,l.kt)("inlineCode",{parentName:"h3"},"message")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Error message"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"run"},(0,l.kt)("inlineCode",{parentName:"h3"},"run")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("p",null,"Object representing the failed actor run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"name"},(0,l.kt)("inlineCode",{parentName:"h3"},"name")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Contains ",(0,l.kt)("inlineCode",{parentName:"p"},'"ApifyCallError"')),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.apifycallerror"}),(0,l.kt)("h2",{id:"new-apifycallerrorrun-message"},(0,l.kt)("inlineCode",{parentName:"h2"},"new ApifyCallError(run, [message])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"run")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"The actor invoked by Apify.call() did not succeed",'"'))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(t),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||l;return t?n.createElement(m,o(o({ref:r},c),{},{components:t})):n.createElement(m,o({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=f;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"crawling-context",title:"CrawlingContext"},p=void 0,s={unversionedId:"typedefs/crawling-context",id:"version-2.3/typedefs/crawling-context",title:"CrawlingContext",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/crawling-context",permalink:"/sdk/js/docs/2.3/typedefs/crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CrawlingContext.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawling-context",title:"CrawlingContext"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"response",id:"response",level:3}],u={toc:d},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"crawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"request"},(0,a.kt)("inlineCode",{parentName:"h3"},"request")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"session"},(0,a.kt)("inlineCode",{parentName:"h3"},"session")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyinfo"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"response"},(0,a.kt)("inlineCode",{parentName:"h3"},"response")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"crawling-context",title:"CrawlingContext"},p=void 0,s={unversionedId:"typedefs/crawling-context",id:"version-2.3/typedefs/crawling-context",title:"CrawlingContext",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/crawling-context",permalink:"/sdk/js/docs/2.3/typedefs/crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CrawlingContext.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawling-context",title:"CrawlingContext"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"response",id:"response",level:3}],u={toc:d},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"crawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"request"},(0,a.kt)("inlineCode",{parentName:"h3"},"request")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"session"},(0,a.kt)("inlineCode",{parentName:"h3"},"session")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyinfo"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"response"},(0,a.kt)("inlineCode",{parentName:"h3"},"response")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var n=r(87462),a=r(63366),s=(r(67294),r(3905)),o=["components"],i={id:"request-transform",title:"RequestTransform"},p=void 0,u={unversionedId:"typedefs/request-transform",id:"version-2.3/typedefs/request-transform",title:"RequestTransform",description:"Takes an Apify object and changes it's attributes in a desired way. This user-function is used",source:"@site/versioned_docs/version-2.3/typedefs/RequestTransform.md",sourceDirName:"typedefs",slug:"/typedefs/request-transform",permalink:"/sdk/js/docs/2.3/typedefs/request-transform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestTransform.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-transform",title:"RequestTransform"},sidebar:"version-2.3/docs",previous:{title:"CreateSession",permalink:"/sdk/js/docs/2.3/typedefs/create-session"},next:{title:"ActorRun",permalink:"/sdk/js/docs/2.3/typedefs/actor-run"}},l={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requesttransform"}),(0,s.kt)("p",null,"Takes an Apify {RequestOptions} object and changes it's attributes in a desired way. This user-function is used\n",(0,s.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," to modify requests before enqueuing them."),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"original")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Request options to be modified.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"null")," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"false")," - The modified request options to enqueue."),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),u=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),c=u(r),f=a,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||s;return r?n.createElement(m,o(o({ref:t},l),{},{components:r})):n.createElement(m,o({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"request-transform",title:"RequestTransform"},p=void 0,u={unversionedId:"typedefs/request-transform",id:"version-2.3/typedefs/request-transform",title:"RequestTransform",description:"Takes an Apify object and changes it's attributes in a desired way. This user-function is used",source:"@site/versioned_docs/version-2.3/typedefs/RequestTransform.md",sourceDirName:"typedefs",slug:"/typedefs/request-transform",permalink:"/sdk/js/docs/2.3/typedefs/request-transform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestTransform.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-transform",title:"RequestTransform"},sidebar:"version-2.3/docs",previous:{title:"CreateSession",permalink:"/sdk/js/docs/2.3/typedefs/create-session"},next:{title:"ActorRun",permalink:"/sdk/js/docs/2.3/typedefs/actor-run"}},l={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requesttransform"}),(0,o.kt)("p",null,"Takes an Apify {RequestOptions} object and changes it's attributes in a desired way. This user-function is used\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," to modify requests before enqueuing them."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"original")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Request options to be modified.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},"null")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},"false")," - The modified request options to enqueue."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),u=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),c=u(r),f=a,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||o;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:a,s[1]=i;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},s=void 0,p={unversionedId:"api/cheerio-crawler",id:"version-1.3/api/cheerio-crawler",title:"CheerioCrawler",description:"Provides a framework for the parallel crawling of web pages using plain HTTP requests and cheerio HTML",source:"@site/versioned_docs/version-1.3/api/CheerioCrawler.md",sourceDirName:"api",slug:"/api/cheerio-crawler",permalink:"/sdk/js/docs/1.3/api/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/CheerioCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},sidebar:"version-1.3/docs",previous:{title:"BasicCrawler",permalink:"/sdk/js/docs/1.3/api/basic-crawler"},next:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/1.3/api/playwright-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new CheerioCrawler(options)",id:"new-cheeriocrawleroptions",level:2},{value:"cheerioCrawler.preNavigationHooks",id:"cheeriocrawlerprenavigationhooks",level:2},{value:"cheerioCrawler.postNavigationHooks",id:"cheeriocrawlerpostnavigationhooks",level:2},{value:"cheerioCrawler.defaultRequestAsBrowserOptions",id:"cheeriocrawlerdefaultrequestasbrowseroptions",level:2},{value:"cheerioCrawler.use(extension)",id:"cheeriocrawleruseextension",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("p",null,"Provides a framework for the parallel crawling of web pages using plain HTTP requests and ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," HTML\nparser. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," uses raw HTTP requests to download web pages, it is very fast and efficient on data bandwidth. However, if the target website\nrequires JavaScript to display the content, you might need to use ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," instead, because it loads the pages using full-featured headless Chrome browser."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads each URL using a plain HTTP request, parses the HTML content using ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," and\nthen invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction"))," to extract page\ndata using a ",(0,l.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery"),"-like interface to the parsed HTML DOM."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads the web pages using the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," utility function. As opposed to the\nbrowser based crawlers that are automatically encoding the URLs, the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," function will not\ndo so. We either need to manually encode the URLs via ",(0,l.kt)("inlineCode",{parentName:"p"},"encodeURI()")," function, or set ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding: true")," in the ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which\nwill automatically encode all the URLs before accessing them."),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"We can either use ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding")," or encode manually, but not both - it would result in double encoding and therefore lead to invalid URLs.")),(0,l.kt)("p",null,"We can use the ",(0,l.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," to adjust ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n }\n]\n")),(0,l.kt)("p",null,"By default, ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," only processes web pages with the ",(0,l.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME content types (as reported by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"Content-Type")," HTTP header), and skips pages with other content types. If you want the crawler to process other content types, use the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#additionalmimetypes",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.additionalMimeTypes"))," constructor option. Beware that the parsing\nbehavior differs for HTML, XML, JSON and other types of content. For details, see\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction")),"."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ request, response, body, contentType, $ }) => {\n const data = [];\n\n // Do some data extraction from the page with Cheerio.\n $('.some-collection').each((index, el) => {\n data.push({\n title: $(el)\n .find('.some-title')\n .text(),\n });\n });\n\n // Save the data to dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n data,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("h2",{id:"new-cheeriocrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new CheerioCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/cheerio-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"prenavigationhooks"}),(0,l.kt)("h2",{id:"cheeriocrawlerprenavigationhooks"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.preNavigationHooks")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"postnavigationhooks"}),(0,l.kt)("h2",{id:"cheeriocrawlerpostnavigationhooks"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.postNavigationHooks")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"defaultrequestasbrowseroptions"}),(0,l.kt)("h2",{id:"cheeriocrawlerdefaultrequestasbrowseroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.defaultRequestAsBrowserOptions")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"use"}),(0,l.kt)("h2",{id:"cheeriocrawleruseextension"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.use(extension)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"EXPERIMENTAL")," Function for attaching CrawlerExtensions such as the Unblockers."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"extension")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"CrawlerExtension")," - Crawler extension that overrides the crawler configuration.")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),h=n,m=c["".concat(s,".").concat(h)]||c[h]||d[h]||l;return r?a.createElement(m,o(o({ref:t},u),{},{components:r})):a.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,o=new Array(l);o[0]=h;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},s=void 0,p={unversionedId:"api/cheerio-crawler",id:"version-1.3/api/cheerio-crawler",title:"CheerioCrawler",description:"Provides a framework for the parallel crawling of web pages using plain HTTP requests and cheerio HTML",source:"@site/versioned_docs/version-1.3/api/CheerioCrawler.md",sourceDirName:"api",slug:"/api/cheerio-crawler",permalink:"/sdk/js/docs/1.3/api/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/CheerioCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},sidebar:"version-1.3/docs",previous:{title:"BasicCrawler",permalink:"/sdk/js/docs/1.3/api/basic-crawler"},next:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/1.3/api/playwright-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new CheerioCrawler(options)",id:"new-cheeriocrawleroptions",level:2},{value:"cheerioCrawler.preNavigationHooks",id:"cheeriocrawlerprenavigationhooks",level:2},{value:"cheerioCrawler.postNavigationHooks",id:"cheeriocrawlerpostnavigationhooks",level:2},{value:"cheerioCrawler.defaultRequestAsBrowserOptions",id:"cheeriocrawlerdefaultrequestasbrowseroptions",level:2},{value:"cheerioCrawler.use(extension)",id:"cheeriocrawleruseextension",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("p",null,"Provides a framework for the parallel crawling of web pages using plain HTTP requests and ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," HTML\nparser. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," uses raw HTTP requests to download web pages, it is very fast and efficient on data bandwidth. However, if the target website\nrequires JavaScript to display the content, you might need to use ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," instead, because it loads the pages using full-featured headless Chrome browser."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads each URL using a plain HTTP request, parses the HTML content using ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," and\nthen invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction"))," to extract page\ndata using a ",(0,l.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery"),"-like interface to the parsed HTML DOM."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads the web pages using the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," utility function. As opposed to the\nbrowser based crawlers that are automatically encoding the URLs, the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," function will not\ndo so. We either need to manually encode the URLs via ",(0,l.kt)("inlineCode",{parentName:"p"},"encodeURI()")," function, or set ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding: true")," in the ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which\nwill automatically encode all the URLs before accessing them."),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"We can either use ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding")," or encode manually, but not both - it would result in double encoding and therefore lead to invalid URLs.")),(0,l.kt)("p",null,"We can use the ",(0,l.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," to adjust ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n }\n]\n")),(0,l.kt)("p",null,"By default, ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," only processes web pages with the ",(0,l.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME content types (as reported by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"Content-Type")," HTTP header), and skips pages with other content types. If you want the crawler to process other content types, use the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#additionalmimetypes",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.additionalMimeTypes"))," constructor option. Beware that the parsing\nbehavior differs for HTML, XML, JSON and other types of content. For details, see\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction")),"."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ request, response, body, contentType, $ }) => {\n const data = [];\n\n // Do some data extraction from the page with Cheerio.\n $('.some-collection').each((index, el) => {\n data.push({\n title: $(el)\n .find('.some-title')\n .text(),\n });\n });\n\n // Save the data to dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n data,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("h2",{id:"new-cheeriocrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new CheerioCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/cheerio-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"prenavigationhooks"}),(0,l.kt)("h2",{id:"cheeriocrawlerprenavigationhooks"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.preNavigationHooks")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"postnavigationhooks"}),(0,l.kt)("h2",{id:"cheeriocrawlerpostnavigationhooks"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.postNavigationHooks")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"defaultrequestasbrowseroptions"}),(0,l.kt)("h2",{id:"cheeriocrawlerdefaultrequestasbrowseroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.defaultRequestAsBrowserOptions")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"use"}),(0,l.kt)("h2",{id:"cheeriocrawleruseextension"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.use(extension)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"EXPERIMENTAL")," Function for attaching CrawlerExtensions such as the Unblockers."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"extension")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"CrawlerExtension")," - Crawler extension that overrides the crawler configuration.")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),h=n,m=c["".concat(s,".").concat(h)]||c[h]||d[h]||l;return r?a.createElement(m,o(o({ref:t},u),{},{components:r})):a.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,o=new Array(l);o[0]=h;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var p=2;p{a.d(t,{Z:()=>c});var r=a(67294),n=a(88746),o=a(6141),d=a(6832);const c=function(e){var t=e.to,a=e.children,c=(0,o.E)(),s=c.version,i=c.isLast;if((0,d.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var l=s+"/";return"current"===s?l="next/":i&&(l=""),r.createElement(n.default,{to:"/api/"+l+t},a)}},54553:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>I,frontMatter:()=>l,metadata:()=>u,toc:()=>g});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),d=(a(14563),a(68889));const c={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, body }) {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8"};var s,i=["components"],l={id:"add-data-to-dataset",title:"Add data to dataset"},p=void 0,u={unversionedId:"examples/add-data-to-dataset",id:"version-3.1/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/versioned_docs/version-3.1/examples/add_data_to_dataset.mdx",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/add_data_to_dataset.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/examples/basic-crawler"}},m={},g=[],b=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:g},y="wrapper";function I(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(y,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)(d.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.openDataset()"))),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},c),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/datasets/default/\n")))}I.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>l,kt:()=>g});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function d(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),i=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):d(d({},t),e)),a},l=function(e){var t=i(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),p=i(a),m=n,g=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return a?r.createElement(g,d(d({ref:t},l),{},{components:a})):r.createElement(g,d({ref:t},l))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,d=new Array(o);d[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:n,d[1]=c;for(var i=2;i{a.d(t,{Z:()=>c});var r=a(67294),n=a(88746),o=a(6141),d=a(6832);const c=function(e){var t=e.to,a=e.children,c=(0,o.E)(),s=c.version,i=c.isLast;if((0,d.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var l=s+"/";return"current"===s?l="next/":i&&(l=""),r.createElement(n.default,{to:"/api/"+l+t},a)}},54553:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>I,frontMatter:()=>l,metadata:()=>u,toc:()=>g});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),d=(a(14563),a(68889));const c={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, body }) {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8"};var s,i=["components"],l={id:"add-data-to-dataset",title:"Add data to dataset"},p=void 0,u={unversionedId:"examples/add-data-to-dataset",id:"version-3.1/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/versioned_docs/version-3.1/examples/add_data_to_dataset.mdx",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/add_data_to_dataset.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/examples/basic-crawler"}},m={},g=[],b=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:g},y="wrapper";function I(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(y,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)(d.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.openDataset()"))),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},c),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/datasets/default/\n")))}I.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>l,kt:()=>g});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function d(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),i=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):d(d({},t),e)),a},l=function(e){var t=i(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),p=i(a),m=n,g=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return a?r.createElement(g,d(d({ref:t},l),{},{components:a})):r.createElement(g,d({ref:t},l))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,d=new Array(o);d[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:n,d[1]=c;for(var i=2;i{r.d(t,{Z:()=>c});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const c=function(e){var t=e.to,r=e.children,c=(0,o.E)(),i=c.version,s=c.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=i+"/";return"current"===i?p="next/":s&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},33328:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>y,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905));r(14563),r(68889);const l={code:"import { gotScraping } from 'got-scraping';\n\n// Get the HTML of a web page\nconst { body } = await gotScraping({ url: 'https://www.example.com' });\nconsole.log(body);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE"};var c,i=["components"],s={id:"crawl-single-url",title:"Crawl a single URL"},p=void 0,d={unversionedId:"examples/crawl-single-url",id:"examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the got-scraping npm package",source:"@site/../docs/examples/crawl_single_url.mdx",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/next/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_single_url.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/next/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/next/examples/crawl-sitemap"}},u={},m=[],g=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:m},b="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(b,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping"))," npm package\nto grab the HTML of a web page."),(0,o.kt)(g,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},l),(0,o.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,o.kt)("a",{parentName:"p",href:"./accept-user-input",target:null,rel:null},"Accept User Input")," example."))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,g=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(g,l(l({ref:t},p),{},{components:r})):n.createElement(g,l({ref:t},p))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[d]="string"==typeof e?e:a,l[1]=c;for(var s=2;s{r.d(t,{Z:()=>c});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const c=function(e){var t=e.to,r=e.children,c=(0,o.E)(),i=c.version,s=c.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=i+"/";return"current"===i?p="next/":s&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},33328:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>y,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905));r(14563),r(68889);const l={code:"import { gotScraping } from 'got-scraping';\n\n// Get the HTML of a web page\nconst { body } = await gotScraping({ url: 'https://www.example.com' });\nconsole.log(body);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE"};var c,i=["components"],s={id:"crawl-single-url",title:"Crawl a single URL"},p=void 0,d={unversionedId:"examples/crawl-single-url",id:"examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the got-scraping npm package",source:"@site/../docs/examples/crawl_single_url.mdx",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/next/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_single_url.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/next/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/next/examples/crawl-sitemap"}},u={},m=[],g=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:m},b="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(b,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping"))," npm package\nto grab the HTML of a web page."),(0,o.kt)(g,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},l),(0,o.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,o.kt)("a",{parentName:"p",href:"./accept-user-input",target:null,rel:null},"Accept User Input")," example."))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,g=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(g,l(l({ref:t},p),{},{components:r})):n.createElement(g,l({ref:t},p))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[d]="string"==typeof e?e:a,l[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),l=["components"],i={id_old:"version-1.3-browser-launch-context",title:"BrowserLaunchContext",id:"browser-launch-context"},p=void 0,s={unversionedId:"typedefs/browser-launch-context",id:"version-1.3/typedefs/browser-launch-context",title:"BrowserLaunchContext",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/BrowserLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-launch-context",permalink:"/sdk/js/docs/1.3/typedefs/browser-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserLaunchContext.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-browser-launch-context",title:"BrowserLaunchContext",id:"browser-launch-context"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"launcher",id:"launcher",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,l);return(0,a.kt)(h,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserlaunchcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"launchoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"`Options passed to the browser launcher function. Options are based on underlying library."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launcher"},(0,a.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("p",null,'By default this function uses\nrequire("playwright").chromium',(0,a.kt)("inlineCode",{parentName:"p"},". If you want to use a different browser you can pass it by this property as"),'require("playwright").firefox'),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(r),h=o,m=u["".concat(p,".").concat(h)]||u[h]||d[h]||a;return r?n.createElement(m,l(l({ref:t},c),{},{components:r})):n.createElement(m,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),l=["components"],i={id_old:"version-1.3-browser-launch-context",title:"BrowserLaunchContext",id:"browser-launch-context"},p=void 0,s={unversionedId:"typedefs/browser-launch-context",id:"version-1.3/typedefs/browser-launch-context",title:"BrowserLaunchContext",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/BrowserLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-launch-context",permalink:"/sdk/js/docs/1.3/typedefs/browser-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserLaunchContext.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-browser-launch-context",title:"BrowserLaunchContext",id:"browser-launch-context"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"launcher",id:"launcher",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,l);return(0,a.kt)(h,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserlaunchcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"launchoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"`Options passed to the browser launcher function. Options are based on underlying library."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launcher"},(0,a.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("p",null,'By default this function uses\nrequire("playwright").chromium',(0,a.kt)("inlineCode",{parentName:"p"},". If you want to use a different browser you can pass it by this property as"),'require("playwright").firefox'),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(r),h=o,m=u["".concat(p,".").concat(h)]||u[h]||d[h]||a;return r?n.createElement(m,l(l({ref:t},c),{},{components:r})):n.createElement(m,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-proxy-configuration-options",title:"ProxyConfigurationOptions",id:"proxy-configuration-options"},l=void 0,s={unversionedId:"typedefs/proxy-configuration-options",id:"version-1.3/typedefs/proxy-configuration-options",title:"ProxyConfigurationOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/ProxyConfigurationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-options",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-proxy-configuration-options",title:"ProxyConfigurationOptions",id:"proxy-configuration-options"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"},next:{title:"ProxyInfo",permalink:"/sdk/js/docs/1.3/typedefs/proxy-info"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"password",id:"password",level:3},{value:"groups",id:"groups",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"apifyProxyGroups",id:"apifyproxygroups",level:3},{value:"apifyProxyCountry",id:"apifyproxycountry",level:3},{value:"proxyUrls",id:"proxyurls",level:3},{value:"newUrlFunction",id:"newurlfunction",level:3}],c={toc:d},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyconfigurationoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries. on the Apify cloud, or when using the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxygroups"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyGroups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," option in your crawler code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxycountry"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyCountry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," option in your crawler\ncode."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurls"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrls")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will\ncause an error to be thrown on initialize."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"newurlfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"newUrlFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationFunction"))),(0,a.kt)("p",null,"Custom function that allows you to generate the new proxy URL dynamically. It gets the ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," as a parameter and should always return stringified\nproxy URL. This function is used to generate the URL when ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl"))," or\n",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo"))," is called."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=s(n),y=o,f=d["".concat(l,".").concat(y)]||d[y]||c[y]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-proxy-configuration-options",title:"ProxyConfigurationOptions",id:"proxy-configuration-options"},l=void 0,s={unversionedId:"typedefs/proxy-configuration-options",id:"version-1.3/typedefs/proxy-configuration-options",title:"ProxyConfigurationOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/ProxyConfigurationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-options",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-proxy-configuration-options",title:"ProxyConfigurationOptions",id:"proxy-configuration-options"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"},next:{title:"ProxyInfo",permalink:"/sdk/js/docs/1.3/typedefs/proxy-info"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"password",id:"password",level:3},{value:"groups",id:"groups",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"apifyProxyGroups",id:"apifyproxygroups",level:3},{value:"apifyProxyCountry",id:"apifyproxycountry",level:3},{value:"proxyUrls",id:"proxyurls",level:3},{value:"newUrlFunction",id:"newurlfunction",level:3}],c={toc:d},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyconfigurationoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries. on the Apify cloud, or when using the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxygroups"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyGroups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," option in your crawler code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxycountry"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyCountry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," option in your crawler\ncode."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurls"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrls")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will\ncause an error to be thrown on initialize."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"newurlfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"newUrlFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationFunction"))),(0,a.kt)("p",null,"Custom function that allows you to generate the new proxy URL dynamically. It gets the ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," as a parameter and should always return stringified\nproxy URL. This function is used to generate the URL when ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl"))," or\n",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo"))," is called."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=s(n),y=o,f=d["".concat(l,".").concat(y)]||d[y]||c[y]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=n(87462),a=n(63366),u=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-request-queue",title:"RequestQueue",id:"request-queue"},s=void 0,o={unversionedId:"api/request-queue",id:"version-1.3/api/request-queue",title:"RequestQueue",description:"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links",source:"@site/versioned_docs/version-1.3/api/RequestQueue.md",sourceDirName:"api",slug:"/api/request-queue",permalink:"/sdk/js/docs/1.3/api/request-queue",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestQueue.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-queue",title:"RequestQueue",id:"request-queue"},sidebar:"version-1.3/docs",previous:{title:"RequestList",permalink:"/sdk/js/docs/1.3/api/request-list"},next:{title:"PseudoUrl",permalink:"/sdk/js/docs/1.3/api/pseudo-url"}},p={},d=[{value:"requestQueue.addRequest(requestLike, [options])",id:"requestqueueaddrequestrequestlike-options",level:2},{value:"requestQueue.getRequest(id)",id:"requestqueuegetrequestid",level:2},{value:"requestQueue.fetchNextRequest()",id:"requestqueuefetchnextrequest",level:2},{value:"requestQueue.markRequestHandled(request)",id:"requestqueuemarkrequesthandledrequest",level:2},{value:"requestQueue.reclaimRequest(request, [options])",id:"requestqueuereclaimrequestrequest-options",level:2},{value:"requestQueue.isEmpty()",id:"requestqueueisempty",level:2},{value:"requestQueue.isFinished()",id:"requestqueueisfinished",level:2},{value:"requestQueue.drop()",id:"requestqueuedrop",level:2},{value:"requestQueue.handledCount()",id:"requestqueuehandledcount",level:2},{value:"requestQueue.getInfo()",id:"requestqueuegetinfo",level:2}],m={toc:d},q="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,u.kt)(q,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,u.kt)("a",{name:"requestqueue"}),(0,u.kt)("p",null,"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links\nto other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,u.kt)("p",null,"Each URL is represented using an instance of the ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," class. The queue can only contain unique URLs. More precisely, it can\nonly contain ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," instances with distinct ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can\nalso be overridden. To add a single URL multiple times to the queue, corresponding ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different\n",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties."),(0,u.kt)("p",null,"Do not instantiate this class directly, use the ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function instead."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is used by ",(0,u.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,u.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,u.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and ",(0,u.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl. Unlike\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," supports dynamic adding and removing of requests. On the other hand, the queue is not optimized\nfor operations that add or remove a large number of URLs in a batch."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," stores its data either on local disk or in the Apify Cloud, depending on whether the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN"),"\nenvironment variable is set."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the queue data is stored in that directory in an SQLite database file."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," is not, the data is stored in the\n",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/request-queue",target:"_blank",rel:"noopener"},"Apify Request Queue")," cloud storage. Note that you can force usage of the cloud storage also by passing\nthe ",(0,u.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function, even if the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is\nset."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example usage:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst queue = await Apify.openRequestQueue();\n\n// Open a named request queue\nconst queueWithName = await Apify.openRequestQueue('some-name');\n\n// Enqueue few requests\nawait queue.addRequest({ url: 'http://example.com/aaa' });\nawait queue.addRequest({ url: 'http://example.com/bbb' });\nawait queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });\n")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"addrequest"}),(0,u.kt)("h2",{id:"requestqueueaddrequestrequestlike-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.addRequest(requestLike, [options])")),(0,u.kt)("p",null,"Adds a request to the queue."),(0,u.kt)("p",null,"If a request with the same ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property is already present in the queue, it will not be updated. You can find out whether this happened from\nthe resulting ",(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," object."),(0,u.kt)("p",null,"To add multiple requests to the queue by extracting links from a webpage, see the ",(0,u.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," helper function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"requestLike")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," | ",(0,u.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," object or vanilla\nobject with request data. Note that the function sets the ",(0,u.kt)("inlineCode",{parentName:"li"},"uniqueKey")," and ",(0,u.kt)("inlineCode",{parentName:"li"},"id")," fields to the passed Request."),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"Object"),(0,u.kt)("ul",{parentName:"li"},(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true"),", the request will be added to the foremost position in the queue.")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getrequest"}),(0,u.kt)("h2",{id:"requestqueuegetrequestid"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getRequest(id)")),(0,u.kt)("p",null,"Gets the request from the queue specified by ID."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"id")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"string")," - ID of the request.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if it was not found."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"fetchnextrequest"}),(0,u.kt)("h2",{id:"requestqueuefetchnextrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.fetchNextRequest()")),(0,u.kt)("p",null,"Returns a next request in the queue to be processed, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("p",null,"Once you successfully finish processing of the request, you need to call\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#markrequesthandled",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.markRequestHandled()"))," to mark the request as handled in the queue. If there was some error in\nprocessing the request, call ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#reclaimrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.reclaimRequest()"))," instead, so that the queue will give the request\nto some other consumer in another call to the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,"Note that the ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," return value doesn't mean the queue processing finished, it means there are currently no pending requests. To check whether all\nrequests in queue were finished, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()"))," instead."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"markrequesthandled"}),(0,u.kt)("h2",{id:"requestqueuemarkrequesthandledrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.markRequestHandled(request)")),(0,u.kt)("p",null,"Marks a request that was previously returned by the ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," function as handled\nafter successful processing. Handled requests will never again be returned by the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"reclaimrequest"}),(0,u.kt)("h2",{id:"requestqueuereclaimrequestrequest-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.reclaimRequest(request, [options])")),(0,u.kt)("p",null,"Reclaims a failed request back to the queue, so that it can be returned for processed later again by another call to\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". The request record in the queue is updated using the provided ",(0,u.kt)("inlineCode",{parentName:"p"},"request"),"\nparameter. For example, this lets you store the number of retries or error messages for the request."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"object")," - ",(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true")," then the request it placed to the beginning of the\nqueue, so that it's returned in the next call to ",(0,u.kt)("a",{parentName:"li",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". By default, it's put\nto the end of the queue.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isempty"}),(0,u.kt)("h2",{id:"requestqueueisempty"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isEmpty()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," would return ",(0,u.kt)("inlineCode",{parentName:"p"},"null"),", otherwise it\nresolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that\nthere is no activity in the queue, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()")),"."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isfinished"}),(0,u.kt)("h2",{id:"requestqueueisfinished"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isFinished()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left. Due to the nature of distributed storage used by the queue, the\nfunction might occasionally return a false negative, but it will never return a false positive."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"drop"}),(0,u.kt)("h2",{id:"requestqueuedrop"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.drop()")),(0,u.kt)("p",null,"Removes the queue either from the Apify Cloud storage or from the local database, depending on the mode of operation."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"handledcount"}),(0,u.kt)("h2",{id:"requestqueuehandledcount"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.handledCount()")),(0,u.kt)("p",null,"Returns the number of handled requests."),(0,u.kt)("p",null,"This function is just a convenient shortcut for:"),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"const { handledRequestCount } = await queue.getInfo();\n")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getinfo"}),(0,u.kt)("h2",{id:"requestqueuegetinfo"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getInfo()")),(0,u.kt)("p",null,"Returns an object containing general information about the request queue."),(0,u.kt)("p",null,"The function returns the same object as the Apify API Client's ",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues",target:"_blank",rel:"noopener"},"getQueue"),"\nfunction, which in turn calls the ",(0,u.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue",target:"_blank",rel:"noopener"},"Get request queue")," API endpoint."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-queue",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n totalRequestCount: 25,\n handledRequestCount: 5,\n pendingRequestCount: 20,\n}\n')),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/request-queue-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},q=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,u=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=o(n),q=a,k=d["".concat(s,".").concat(q)]||d[q]||m[q]||u;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var u=n.length,l=new Array(u);l[0]=q;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,l[1]=i;for(var o=2;o{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=n(87462),a=n(63366),u=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-request-queue",title:"RequestQueue",id:"request-queue"},s=void 0,o={unversionedId:"api/request-queue",id:"version-1.3/api/request-queue",title:"RequestQueue",description:"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links",source:"@site/versioned_docs/version-1.3/api/RequestQueue.md",sourceDirName:"api",slug:"/api/request-queue",permalink:"/sdk/js/docs/1.3/api/request-queue",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestQueue.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-queue",title:"RequestQueue",id:"request-queue"},sidebar:"version-1.3/docs",previous:{title:"RequestList",permalink:"/sdk/js/docs/1.3/api/request-list"},next:{title:"PseudoUrl",permalink:"/sdk/js/docs/1.3/api/pseudo-url"}},p={},d=[{value:"requestQueue.addRequest(requestLike, [options])",id:"requestqueueaddrequestrequestlike-options",level:2},{value:"requestQueue.getRequest(id)",id:"requestqueuegetrequestid",level:2},{value:"requestQueue.fetchNextRequest()",id:"requestqueuefetchnextrequest",level:2},{value:"requestQueue.markRequestHandled(request)",id:"requestqueuemarkrequesthandledrequest",level:2},{value:"requestQueue.reclaimRequest(request, [options])",id:"requestqueuereclaimrequestrequest-options",level:2},{value:"requestQueue.isEmpty()",id:"requestqueueisempty",level:2},{value:"requestQueue.isFinished()",id:"requestqueueisfinished",level:2},{value:"requestQueue.drop()",id:"requestqueuedrop",level:2},{value:"requestQueue.handledCount()",id:"requestqueuehandledcount",level:2},{value:"requestQueue.getInfo()",id:"requestqueuegetinfo",level:2}],m={toc:d},q="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,u.kt)(q,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,u.kt)("a",{name:"requestqueue"}),(0,u.kt)("p",null,"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links\nto other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,u.kt)("p",null,"Each URL is represented using an instance of the ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," class. The queue can only contain unique URLs. More precisely, it can\nonly contain ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," instances with distinct ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can\nalso be overridden. To add a single URL multiple times to the queue, corresponding ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different\n",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties."),(0,u.kt)("p",null,"Do not instantiate this class directly, use the ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function instead."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is used by ",(0,u.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,u.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,u.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and ",(0,u.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl. Unlike\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," supports dynamic adding and removing of requests. On the other hand, the queue is not optimized\nfor operations that add or remove a large number of URLs in a batch."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," stores its data either on local disk or in the Apify Cloud, depending on whether the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN"),"\nenvironment variable is set."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the queue data is stored in that directory in an SQLite database file."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," is not, the data is stored in the\n",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/request-queue",target:"_blank",rel:"noopener"},"Apify Request Queue")," cloud storage. Note that you can force usage of the cloud storage also by passing\nthe ",(0,u.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function, even if the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is\nset."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example usage:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst queue = await Apify.openRequestQueue();\n\n// Open a named request queue\nconst queueWithName = await Apify.openRequestQueue('some-name');\n\n// Enqueue few requests\nawait queue.addRequest({ url: 'http://example.com/aaa' });\nawait queue.addRequest({ url: 'http://example.com/bbb' });\nawait queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });\n")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"addrequest"}),(0,u.kt)("h2",{id:"requestqueueaddrequestrequestlike-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.addRequest(requestLike, [options])")),(0,u.kt)("p",null,"Adds a request to the queue."),(0,u.kt)("p",null,"If a request with the same ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property is already present in the queue, it will not be updated. You can find out whether this happened from\nthe resulting ",(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," object."),(0,u.kt)("p",null,"To add multiple requests to the queue by extracting links from a webpage, see the ",(0,u.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," helper function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"requestLike")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," | ",(0,u.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," object or vanilla\nobject with request data. Note that the function sets the ",(0,u.kt)("inlineCode",{parentName:"li"},"uniqueKey")," and ",(0,u.kt)("inlineCode",{parentName:"li"},"id")," fields to the passed Request."),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"Object"),(0,u.kt)("ul",{parentName:"li"},(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true"),", the request will be added to the foremost position in the queue.")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getrequest"}),(0,u.kt)("h2",{id:"requestqueuegetrequestid"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getRequest(id)")),(0,u.kt)("p",null,"Gets the request from the queue specified by ID."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"id")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"string")," - ID of the request.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if it was not found."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"fetchnextrequest"}),(0,u.kt)("h2",{id:"requestqueuefetchnextrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.fetchNextRequest()")),(0,u.kt)("p",null,"Returns a next request in the queue to be processed, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("p",null,"Once you successfully finish processing of the request, you need to call\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#markrequesthandled",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.markRequestHandled()"))," to mark the request as handled in the queue. If there was some error in\nprocessing the request, call ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#reclaimrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.reclaimRequest()"))," instead, so that the queue will give the request\nto some other consumer in another call to the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,"Note that the ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," return value doesn't mean the queue processing finished, it means there are currently no pending requests. To check whether all\nrequests in queue were finished, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()"))," instead."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"markrequesthandled"}),(0,u.kt)("h2",{id:"requestqueuemarkrequesthandledrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.markRequestHandled(request)")),(0,u.kt)("p",null,"Marks a request that was previously returned by the ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," function as handled\nafter successful processing. Handled requests will never again be returned by the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"reclaimrequest"}),(0,u.kt)("h2",{id:"requestqueuereclaimrequestrequest-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.reclaimRequest(request, [options])")),(0,u.kt)("p",null,"Reclaims a failed request back to the queue, so that it can be returned for processed later again by another call to\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". The request record in the queue is updated using the provided ",(0,u.kt)("inlineCode",{parentName:"p"},"request"),"\nparameter. For example, this lets you store the number of retries or error messages for the request."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"object")," - ",(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true")," then the request it placed to the beginning of the\nqueue, so that it's returned in the next call to ",(0,u.kt)("a",{parentName:"li",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". By default, it's put\nto the end of the queue.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isempty"}),(0,u.kt)("h2",{id:"requestqueueisempty"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isEmpty()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," would return ",(0,u.kt)("inlineCode",{parentName:"p"},"null"),", otherwise it\nresolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that\nthere is no activity in the queue, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()")),"."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isfinished"}),(0,u.kt)("h2",{id:"requestqueueisfinished"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isFinished()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left. Due to the nature of distributed storage used by the queue, the\nfunction might occasionally return a false negative, but it will never return a false positive."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"drop"}),(0,u.kt)("h2",{id:"requestqueuedrop"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.drop()")),(0,u.kt)("p",null,"Removes the queue either from the Apify Cloud storage or from the local database, depending on the mode of operation."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"handledcount"}),(0,u.kt)("h2",{id:"requestqueuehandledcount"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.handledCount()")),(0,u.kt)("p",null,"Returns the number of handled requests."),(0,u.kt)("p",null,"This function is just a convenient shortcut for:"),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"const { handledRequestCount } = await queue.getInfo();\n")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getinfo"}),(0,u.kt)("h2",{id:"requestqueuegetinfo"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getInfo()")),(0,u.kt)("p",null,"Returns an object containing general information about the request queue."),(0,u.kt)("p",null,"The function returns the same object as the Apify API Client's ",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues",target:"_blank",rel:"noopener"},"getQueue"),"\nfunction, which in turn calls the ",(0,u.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue",target:"_blank",rel:"noopener"},"Get request queue")," API endpoint."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-queue",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n totalRequestCount: 25,\n handledRequestCount: 5,\n pendingRequestCount: 20,\n}\n')),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/request-queue-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},q=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,u=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=o(n),q=a,k=d["".concat(s,".").concat(q)]||d[q]||m[q]||u;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var u=n.length,l=new Array(u);l[0]=q;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,l[1]=i;for(var o=2;o{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>f,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"request-queue-info",title:"RequestQueueInfo"},u=void 0,d={unversionedId:"typedefs/request-queue-info",id:"version-2.3/typedefs/request-queue-info",title:"RequestQueueInfo",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/RequestQueueInfo.md",sourceDirName:"typedefs",slug:"/typedefs/request-queue-info",permalink:"/sdk/js/docs/2.3/typedefs/request-queue-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestQueueInfo.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-queue-info",title:"RequestQueueInfo"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"name",id:"name",level:3},{value:"userId",id:"userid",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"accessedAt",id:"accessedat",level:3},{value:"totalRequestCount",id:"totalrequestcount",level:3},{value:"handledRequestCount",id:"handledrequestcount",level:3},{value:"pendingRequestCount",id:"pendingrequestcount",level:3}],c={toc:s},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestqueueinfo"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"name"},(0,a.kt)("inlineCode",{parentName:"h3"},"name")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"accessedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"accessedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"totalrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"totalRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handledrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"handledRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"pendingrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"pendingRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),d=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(u.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),s=d(n),m=o,f=s["".concat(u,".").concat(m)]||s[m]||c[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l[s]="string"==typeof e?e:o,i[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>f,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"request-queue-info",title:"RequestQueueInfo"},u=void 0,d={unversionedId:"typedefs/request-queue-info",id:"version-2.3/typedefs/request-queue-info",title:"RequestQueueInfo",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/RequestQueueInfo.md",sourceDirName:"typedefs",slug:"/typedefs/request-queue-info",permalink:"/sdk/js/docs/2.3/typedefs/request-queue-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestQueueInfo.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-queue-info",title:"RequestQueueInfo"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"name",id:"name",level:3},{value:"userId",id:"userid",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"accessedAt",id:"accessedat",level:3},{value:"totalRequestCount",id:"totalrequestcount",level:3},{value:"handledRequestCount",id:"handledrequestcount",level:3},{value:"pendingRequestCount",id:"pendingrequestcount",level:3}],c={toc:s},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestqueueinfo"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"name"},(0,a.kt)("inlineCode",{parentName:"h3"},"name")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"accessedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"accessedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"totalrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"totalRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handledrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"handledRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"pendingrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"pendingRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=r.createContext({}),d=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(u.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),s=d(n),m=o,f=s["".concat(u,".").concat(m)]||s[m]||c[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l[s]="string"==typeof e?e:o,i[1]=l;for(var d=2;d{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",l={unversionedId:"readme/introduction",id:"readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/../docs/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/next/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/introduction.md",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},s={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=l(r),d=a,m=u["".concat(c,".").concat(d)]||u[d]||f[d]||o;return r?n.createElement(m,i(i({ref:t},s),{},{components:r})):n.createElement(m,i({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[u]="string"==typeof e?e:a,i[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",l={unversionedId:"readme/introduction",id:"readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/../docs/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/next/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/introduction.md",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},s={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=l(r),f=a,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,i(i({ref:t},s),{},{components:r})):n.createElement(m,i({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[u]="string"==typeof e?e:a,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),l=["components"],p={id_old:"version-1.3-puppeteer",title:"utils.puppeteer",id:"puppeteer"},o=void 0,s={unversionedId:"api/puppeteer",id:"version-1.3/api/puppeteer",title:"utils.puppeteer",description:"A namespace that contains various utilities for Puppeteer - the headless Chrome Node API.",source:"@site/versioned_docs/version-1.3/api/puppeteer.md",sourceDirName:"api",slug:"/api/puppeteer",permalink:"/sdk/js/docs/1.3/api/puppeteer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/puppeteer.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer",title:"utils.puppeteer",id:"puppeteer"},sidebar:"version-1.3/docs",previous:{title:"utils.playwright",permalink:"/sdk/js/docs/1.3/api/playwright"},next:{title:"utils.social",permalink:"/sdk/js/docs/1.3/api/social"}},u={},d=[{value:"puppeteer.addInterceptRequestHandler",id:"puppeteeraddinterceptrequesthandler",level:2},{value:"puppeteer.removeInterceptRequestHandler",id:"puppeteerremoveinterceptrequesthandler",level:2},{value:"puppeteer.gotoExtended",id:"puppeteergotoextended",level:2},{value:"puppeteer.infiniteScroll",id:"puppeteerinfinitescroll",level:2},{value:"puppeteer.saveSnapshot",id:"puppeteersavesnapshot",level:2},{value:"puppeteer.enqueueLinksByClickingElements(options)",id:"puppeteerenqueuelinksbyclickingelementsoptions",level:2},{value:"puppeteer.injectFile(page, filePath, [options])",id:"puppeteerinjectfilepage-filepath-options",level:2},{value:"puppeteer.injectJQuery(page)",id:"puppeteerinjectjquerypage",level:2},{value:"puppeteer.injectUnderscore(page)",id:"puppeteerinjectunderscorepage",level:2},{value:"puppeteer.blockRequests(page, [options])",id:"puppeteerblockrequestspage-options",level:2},{value:"puppeteer.cacheResponses(page, cache, responseUrlRules)",id:"puppeteercacheresponsespage-cache-responseurlrules",level:2},{value:"puppeteer.compileScript(scriptString, context)",id:"puppeteercompilescriptscriptstring-context",level:2}],c={toc:d},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,i.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"puppeteer"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { puppeteer } = Apify.utils;\n\n// Open https://www.example.com in Puppeteer\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('https://www.example.com');\n\n// Inject jQuery into a page\nawait puppeteer.injectJQuery(page);\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteeraddinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.addInterceptRequestHandler")),(0,i.kt)("p",null,"Adds request interception handler in similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"page.on('request', handler);")," but in addition to that supports multiple parallel handlers."),(0,i.kt)("p",null,"All the handlers are executed sequentially in the order as they were added. Each of the handlers must call one of ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),",\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()"),". In addition to that any of the handlers may modify the request object (method, postData, headers) by\npassing its overrides to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),". If multiple handlers modify same property then the last one wins. Headers are merged separately so you\ncan override only a value of specific header."),(0,i.kt)("p",null,"If one the handlers calls ",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()")," then request is not propagated further to any of the remaining handlers."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Replace images with placeholder.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'image') {\n return request.respond({\n statusCode: 200,\n contentType: 'image/jpeg',\n body: placeholderImageBuffer,\n });\n }\n return request.continue();\n});\n\n// Abort all the scripts.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'script') return request.abort();\n return request.continue();\n});\n\n// Change requests to post.\nawait addInterceptRequestHandler(page, request => {\n return request.continue({\n method: 'POST',\n });\n});\n\nawait page.goto('http://example.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"removeinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteerremoveinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.removeInterceptRequestHandler")),(0,i.kt)("p",null,"Removes request interception handler for given page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"puppeteergotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.gotoExtended")),(0,i.kt)("p",null,"Extended version of Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload. URL,\nmethod, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"infinitescroll"}),(0,i.kt)("h2",{id:"puppeteerinfinitescroll"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.infiniteScroll")),(0,i.kt)("p",null,"Scrolls to the bottom of a page, or until it times out. Loads dynamic content when it hits the bottom of a page, and then continues scrolling."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 0")," - How many seconds to scroll for. If 0, will scroll until bottom of page."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 4")," - How many seconds to wait for no new content to load before exit."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[scrollDownAndUp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If true, it will scroll up a bit after each scroll down. This is required on some\nwebsites for the scroll to work."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[buttonSelector]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Optionally checks and clicks a button if it appears while scrolling. This is required on some websites for\nthe scroll to work.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"savesnapshot"}),(0,i.kt)("h2",{id:"puppeteersavesnapshot"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.saveSnapshot")),(0,i.kt)("p",null,"Saves a full screenshot and HTML of the current page into a Key-Value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[key]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"SNAPSHOT",'"')," - Key under which the screenshot and HTML will be saved. ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg")," will be appended\nfor screenshot and ",(0,i.kt)("inlineCode",{parentName:"li"},".html")," for HTML."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[screenshotQuality]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 50")," - The quality of the image, between 0-100. Higher quality images have bigger size and\nrequire more storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveScreenshot]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full screenshot of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key"),"\nappended by ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveHtml]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full HTML of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key")," appended by\n",(0,i.kt)("inlineCode",{parentName:"li"},".html"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[keyValueStoreName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," ",(0,i.kt)("code",null," = null")," - Name or id of the Key-Value store where snapshot is saved. By default it\nis saved to default Key-Value store.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"enqueuelinksbyclickingelements"}),(0,i.kt)("h2",{id:"puppeteerenqueuelinksbyclickingelementsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.enqueueLinksByClickingElements(options)")),(0,i.kt)("p",null,"The function finds elements matching a specific CSS selector in a Puppeteer page, clicks all those elements using a mouse move and a left mouse button\nclick and intercepts all the navigation requests that are subsequently produced by the page. The intercepted requests, including their methods,\nheaders and payloads are then enqueued to a provided ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". This is useful to crawl JavaScript heavy pages where\nlinks are not available in ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers. If you're looking to find URLs in ",(0,i.kt)("inlineCode",{parentName:"p"},"href"),"\nattributes of the page, see ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,i.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": To be able to do this, this function uses various mutations on the page, such as changing the Z-index of elements being clicked and\ntheir visibility. Therefore, it is recommended to only use this function as the last operation in the page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"USING HEADFUL BROWSER"),": When using a headful browser, this function will only be able to click elements in the focused tab, effectively limiting\nconcurrency to 1. In headless mode, full concurrency can be achieved."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"PERFORMANCE"),": Clicking elements with a mouse and intercepting requests is not a low level operation that takes nanoseconds. It's not very CPU\nintensive, but it takes time. We strongly recommend limiting the scope of the clicking as much as possible by using a specific selector that targets\nonly the elements that you assume or know will produce a navigation. You can certainly click everything by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"*")," selector, but be prepared to\nwait minutes to get results on a large and complex page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.enqueueLinksByClickingElements({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: [\n 'https://www.example.com/handbags/[.*]'\n 'https://www.example.com/purses/[.*]'\n ],\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," parameters are passed via an options object with the following keys:"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"selector")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - A CSS selector matching elements to be clicked on. Unlike in ",(0,i.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),",\nthere is no default value. This is to prevent suboptimal use of this function by using it too broadly."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp|Object)>")," - An array of ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to be\nenqueued, or an array of strings or RegExps or plain Objects from which the ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,i.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,i.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,i.kt)("a",{parentName:"li",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,i.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,i.kt)("p",{parentName:"li"},"For example: by adding ",(0,i.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey: true")," to the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," object, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," will be computed from a combination of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"method"),"\nand ",(0,i.kt)("inlineCode",{parentName:"p"},"payload")," which enables crawling of websites that navigate using form submits (POST requests)."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.useExtendedUniqueKey = true;\n return request;\n };\n}\n")),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 1")," - Clicking in the page triggers various asynchronous operations that lead to new URLs\nbeing shown by the browser. It could be a simple JavaScript redirect or opening of a new tab in the browser. These events often happen only\nsome time after the actual click. Requests typically take milliseconds while new tabs open in hundreds of milliseconds.")),(0,i.kt)("p",{parentName:"li"},"To be able to capture all those events, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," function repeatedly waits for the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitForPageIdleSecs"),". By\nrepeatedly we mean that whenever a relevant event is triggered, the timer is restarted. As long as new events keep coming, the function will not\nreturn, unless the below ",(0,i.kt)("inlineCode",{parentName:"p"},"maxWaitForPageIdleSecs")," timeout is reached."),(0,i.kt)("p",{parentName:"li"},"You may want to reduce this for example when you're sure that your clicks do not open new tabs, or increase when you're not getting all the\nexpected URLs."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxWaitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 5")," - This is the maximum period for which the function will keep tracking events, even\nif more events keep coming. Its purpose is to prevent a deadlock in the page by periodic events, often unrelated to the clicking itself. See\n",(0,i.kt)("inlineCode",{parentName:"li"},"waitForPageIdleSecs")," above for an explanation.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectfile"}),(0,i.kt)("h2",{id:"puppeteerinjectfilepage-filepath-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectFile(page, filePath, [options])")),(0,i.kt)("p",null,"Injects a JavaScript file into a Puppeteer page. Unlike Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"addScriptTag")," function, this function works on pages with arbitrary Cross-Origin\nResource Sharing (CORS) policies."),(0,i.kt)("p",null,"File contents are cached for up to 10 files to limit file system access."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"filePath")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - File path"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[surviveNavigations]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," - Enables the injected script to survive page navigations and reloads without need to be re-injected\nmanually. This does not mean, however, that internal state will be preserved. Just that it will be automatically re-injected on each\nnavigation before any other scripts get the chance to execute.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectjquery"}),(0,i.kt)("h2",{id:"puppeteerinjectjquerypage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectJQuery(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery")," library into a Puppeteer page. jQuery is often useful for various web scraping and crawling tasks. For\nexample, it can help extract text from HTML elements using CSS selectors."),(0,i.kt)("p",null,"Beware that the injected jQuery object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window.$")," variable and thus it might cause conflicts with other libraries included by the\npage that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected jQuery will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectJQuery(page);\nconst title = await page.evaluate(() => {\n return $('head title').text();\n});\n")),(0,i.kt)("p",null,"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"injectJQuery()")," does not affect the Puppeteer's ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-pageselector",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"page.$()"))," function in any\nway."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectunderscore"}),(0,i.kt)("h2",{id:"puppeteerinjectunderscorepage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectUnderscore(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://underscorejs.org/",target:"_blank",rel:"noopener"},"Underscore")," library into a Puppeteer page."),(0,i.kt)("p",null,"Beware that the injected Underscore object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window._")," variable and thus it might cause conflicts with libraries included by the\npage that use the same variable name. This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected Underscore will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectUnderscore(page);\nconst escapedHtml = await page.evaluate(() => {\n return _.escape('

Hello

');\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page",target:"_blank",rel:"noopener"},"Page")," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"blockrequests"}),(0,i.kt)("h2",{id:"puppeteerblockrequestspage-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.blockRequests(page, [options])")),(0,i.kt)("p",null,"Forces the Puppeteer browser tab to block loading URLs that match a provided pattern. This is useful to speed up crawling of websites, since it\nreduces the amount of data that needs to be downloaded from the web, but it may break some websites or unexpectedly prevent loading of resources."),(0,i.kt)("p",null,"By default, the function will block all URLs including the following patterns:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'[".css", ".jpg", ".jpeg", ".png", ".svg", ".gif", ".woff", ".pdf", ".zip"]\n')),(0,i.kt)("p",null,"If you want to extend this list further, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"extraUrlPatterns")," option, which will keep blocking the default patterns, as well as add your custom\nones. If you would like to block only specific patterns, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"urlPatterns")," option, which will override the defaults and block only URLs with your\ncustom patterns."),(0,i.kt)("p",null,"This function does not use Puppeteer's request interception and therefore does not interfere with browser cache. It's also faster than blocking\nrequests using interception, because the blocking happens directly in the browser without the round-trip to Node.js, but it does not provide the extra\nbenefits of request interception."),(0,i.kt)("p",null,"The function will never block main document loads and their respective redirects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\n\n// Block all requests to URLs that include `adsbygoogle.js` and also all defaults.\nawait Apify.utils.puppeteer.blockRequests(page, {\n extraUrlPatterns: ['adsbygoogle.js'],\n});\n\nawait page.goto('https://cnn.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - The patterns of URLs to block from being loaded by the browser. Only ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," can be used as a wildcard. It\nis also automatically added to the beginning and end of the pattern. This limitation is enforced by the DevTools protocol. ",(0,i.kt)("inlineCode",{parentName:"li"},".png")," is the same\nas ",(0,i.kt)("inlineCode",{parentName:"li"},"*.png*"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[extraUrlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - If you just want to append to the default blocked patterns, use this property.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"cacheresponses"}),(0,i.kt)("h2",{id:"puppeteercacheresponsespage-cache-responseurlrules"},(0,i.kt)("del",{parentName:"h2"},(0,i.kt)("inlineCode",{parentName:"del"},"puppeteer.cacheResponses(page, cache, responseUrlRules)"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("em",{parentName:"strong"},"Deprecated"))),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using this function entirely disables browser cache which resolves in sub-optimal performance. Until this\nresolves, we suggest just relying on the in-browser cache unless absolutely necessary."),(0,i.kt)("p",null,"Enables caching of intercepted responses into a provided object. Automatically enables request interception in Puppeteer. ",(0,i.kt)("em",{parentName:"p"},"IMPORTANT"),": Caching\nresponses stores them to memory, so too loose rules could cause memory leaks for longer running crawlers. This issue should be resolved or atleast\nmitigated in future iterations of this feature."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"cache")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Object in which responses are stored"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"responseUrlRules")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp)>")," - List of rules that are used to check if the response should be cached. String rules are\ncompared as page.url().includes(rule) while RegExp rules are evaluated as rule.test(page.url()).")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"compilescript"}),(0,i.kt)("h2",{id:"puppeteercompilescriptscriptstring-context"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.compileScript(scriptString, context)")),(0,i.kt)("p",null,"Compiles a Puppeteer script into an async function that may be executed at any time by providing it with the following object:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n page: Page,\n request: Request,\n}\n")),(0,i.kt)("p",null,"Where ",(0,i.kt)("inlineCode",{parentName:"p"},"page")," is a Puppeteer ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," is a ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,i.kt)("p",null,"The function is compiled by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter as the function's body, so any limitations to function bodies apply. Return value of\nthe compiled function is the return value of the function body = the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter."),(0,i.kt)("p",null,"As a security measure, no globals such as ",(0,i.kt)("inlineCode",{parentName:"p"},"process")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"require")," are accessible from within the function body. Note that the function does not provide\na safe sandbox and even though globals are not easily accessible, malicious code may still execute in the main process via prototype manipulation.\nTherefore you should only use this function to execute sanitized or safe code."),(0,i.kt)("p",null,"Custom context may also be provided using the ",(0,i.kt)("inlineCode",{parentName:"p"},"context")," parameter. To improve security, make sure to only pass the really necessary objects to the\ncontext. Preferably making secured copies beforehand."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"scriptString")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/compiled-script-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptFunction"))),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,k=d["".concat(o,".").concat(m)]||d[m]||c[m]||i;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:r,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),l=["components"],p={id_old:"version-1.3-puppeteer",title:"utils.puppeteer",id:"puppeteer"},o=void 0,s={unversionedId:"api/puppeteer",id:"version-1.3/api/puppeteer",title:"utils.puppeteer",description:"A namespace that contains various utilities for Puppeteer - the headless Chrome Node API.",source:"@site/versioned_docs/version-1.3/api/puppeteer.md",sourceDirName:"api",slug:"/api/puppeteer",permalink:"/sdk/js/docs/1.3/api/puppeteer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/puppeteer.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer",title:"utils.puppeteer",id:"puppeteer"},sidebar:"version-1.3/docs",previous:{title:"utils.playwright",permalink:"/sdk/js/docs/1.3/api/playwright"},next:{title:"utils.social",permalink:"/sdk/js/docs/1.3/api/social"}},u={},d=[{value:"puppeteer.addInterceptRequestHandler",id:"puppeteeraddinterceptrequesthandler",level:2},{value:"puppeteer.removeInterceptRequestHandler",id:"puppeteerremoveinterceptrequesthandler",level:2},{value:"puppeteer.gotoExtended",id:"puppeteergotoextended",level:2},{value:"puppeteer.infiniteScroll",id:"puppeteerinfinitescroll",level:2},{value:"puppeteer.saveSnapshot",id:"puppeteersavesnapshot",level:2},{value:"puppeteer.enqueueLinksByClickingElements(options)",id:"puppeteerenqueuelinksbyclickingelementsoptions",level:2},{value:"puppeteer.injectFile(page, filePath, [options])",id:"puppeteerinjectfilepage-filepath-options",level:2},{value:"puppeteer.injectJQuery(page)",id:"puppeteerinjectjquerypage",level:2},{value:"puppeteer.injectUnderscore(page)",id:"puppeteerinjectunderscorepage",level:2},{value:"puppeteer.blockRequests(page, [options])",id:"puppeteerblockrequestspage-options",level:2},{value:"puppeteer.cacheResponses(page, cache, responseUrlRules)",id:"puppeteercacheresponsespage-cache-responseurlrules",level:2},{value:"puppeteer.compileScript(scriptString, context)",id:"puppeteercompilescriptscriptstring-context",level:2}],c={toc:d},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,i.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"puppeteer"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { puppeteer } = Apify.utils;\n\n// Open https://www.example.com in Puppeteer\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('https://www.example.com');\n\n// Inject jQuery into a page\nawait puppeteer.injectJQuery(page);\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteeraddinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.addInterceptRequestHandler")),(0,i.kt)("p",null,"Adds request interception handler in similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"page.on('request', handler);")," but in addition to that supports multiple parallel handlers."),(0,i.kt)("p",null,"All the handlers are executed sequentially in the order as they were added. Each of the handlers must call one of ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),",\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()"),". In addition to that any of the handlers may modify the request object (method, postData, headers) by\npassing its overrides to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),". If multiple handlers modify same property then the last one wins. Headers are merged separately so you\ncan override only a value of specific header."),(0,i.kt)("p",null,"If one the handlers calls ",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()")," then request is not propagated further to any of the remaining handlers."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Replace images with placeholder.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'image') {\n return request.respond({\n statusCode: 200,\n contentType: 'image/jpeg',\n body: placeholderImageBuffer,\n });\n }\n return request.continue();\n});\n\n// Abort all the scripts.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'script') return request.abort();\n return request.continue();\n});\n\n// Change requests to post.\nawait addInterceptRequestHandler(page, request => {\n return request.continue({\n method: 'POST',\n });\n});\n\nawait page.goto('http://example.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"removeinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteerremoveinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.removeInterceptRequestHandler")),(0,i.kt)("p",null,"Removes request interception handler for given page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"puppeteergotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.gotoExtended")),(0,i.kt)("p",null,"Extended version of Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload. URL,\nmethod, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"infinitescroll"}),(0,i.kt)("h2",{id:"puppeteerinfinitescroll"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.infiniteScroll")),(0,i.kt)("p",null,"Scrolls to the bottom of a page, or until it times out. Loads dynamic content when it hits the bottom of a page, and then continues scrolling."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 0")," - How many seconds to scroll for. If 0, will scroll until bottom of page."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 4")," - How many seconds to wait for no new content to load before exit."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[scrollDownAndUp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If true, it will scroll up a bit after each scroll down. This is required on some\nwebsites for the scroll to work."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[buttonSelector]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Optionally checks and clicks a button if it appears while scrolling. This is required on some websites for\nthe scroll to work.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"savesnapshot"}),(0,i.kt)("h2",{id:"puppeteersavesnapshot"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.saveSnapshot")),(0,i.kt)("p",null,"Saves a full screenshot and HTML of the current page into a Key-Value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[key]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"SNAPSHOT",'"')," - Key under which the screenshot and HTML will be saved. ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg")," will be appended\nfor screenshot and ",(0,i.kt)("inlineCode",{parentName:"li"},".html")," for HTML."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[screenshotQuality]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 50")," - The quality of the image, between 0-100. Higher quality images have bigger size and\nrequire more storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveScreenshot]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full screenshot of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key"),"\nappended by ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveHtml]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full HTML of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key")," appended by\n",(0,i.kt)("inlineCode",{parentName:"li"},".html"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[keyValueStoreName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," ",(0,i.kt)("code",null," = null")," - Name or id of the Key-Value store where snapshot is saved. By default it\nis saved to default Key-Value store.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"enqueuelinksbyclickingelements"}),(0,i.kt)("h2",{id:"puppeteerenqueuelinksbyclickingelementsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.enqueueLinksByClickingElements(options)")),(0,i.kt)("p",null,"The function finds elements matching a specific CSS selector in a Puppeteer page, clicks all those elements using a mouse move and a left mouse button\nclick and intercepts all the navigation requests that are subsequently produced by the page. The intercepted requests, including their methods,\nheaders and payloads are then enqueued to a provided ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". This is useful to crawl JavaScript heavy pages where\nlinks are not available in ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers. If you're looking to find URLs in ",(0,i.kt)("inlineCode",{parentName:"p"},"href"),"\nattributes of the page, see ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,i.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": To be able to do this, this function uses various mutations on the page, such as changing the Z-index of elements being clicked and\ntheir visibility. Therefore, it is recommended to only use this function as the last operation in the page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"USING HEADFUL BROWSER"),": When using a headful browser, this function will only be able to click elements in the focused tab, effectively limiting\nconcurrency to 1. In headless mode, full concurrency can be achieved."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"PERFORMANCE"),": Clicking elements with a mouse and intercepting requests is not a low level operation that takes nanoseconds. It's not very CPU\nintensive, but it takes time. We strongly recommend limiting the scope of the clicking as much as possible by using a specific selector that targets\nonly the elements that you assume or know will produce a navigation. You can certainly click everything by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"*")," selector, but be prepared to\nwait minutes to get results on a large and complex page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.enqueueLinksByClickingElements({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: [\n 'https://www.example.com/handbags/[.*]'\n 'https://www.example.com/purses/[.*]'\n ],\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," parameters are passed via an options object with the following keys:"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"selector")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - A CSS selector matching elements to be clicked on. Unlike in ",(0,i.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),",\nthere is no default value. This is to prevent suboptimal use of this function by using it too broadly."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp|Object)>")," - An array of ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to be\nenqueued, or an array of strings or RegExps or plain Objects from which the ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,i.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,i.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,i.kt)("a",{parentName:"li",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,i.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,i.kt)("p",{parentName:"li"},"For example: by adding ",(0,i.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey: true")," to the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," object, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," will be computed from a combination of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"method"),"\nand ",(0,i.kt)("inlineCode",{parentName:"p"},"payload")," which enables crawling of websites that navigate using form submits (POST requests)."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.useExtendedUniqueKey = true;\n return request;\n };\n}\n")),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 1")," - Clicking in the page triggers various asynchronous operations that lead to new URLs\nbeing shown by the browser. It could be a simple JavaScript redirect or opening of a new tab in the browser. These events often happen only\nsome time after the actual click. Requests typically take milliseconds while new tabs open in hundreds of milliseconds.")),(0,i.kt)("p",{parentName:"li"},"To be able to capture all those events, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," function repeatedly waits for the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitForPageIdleSecs"),". By\nrepeatedly we mean that whenever a relevant event is triggered, the timer is restarted. As long as new events keep coming, the function will not\nreturn, unless the below ",(0,i.kt)("inlineCode",{parentName:"p"},"maxWaitForPageIdleSecs")," timeout is reached."),(0,i.kt)("p",{parentName:"li"},"You may want to reduce this for example when you're sure that your clicks do not open new tabs, or increase when you're not getting all the\nexpected URLs."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxWaitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 5")," - This is the maximum period for which the function will keep tracking events, even\nif more events keep coming. Its purpose is to prevent a deadlock in the page by periodic events, often unrelated to the clicking itself. See\n",(0,i.kt)("inlineCode",{parentName:"li"},"waitForPageIdleSecs")," above for an explanation.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectfile"}),(0,i.kt)("h2",{id:"puppeteerinjectfilepage-filepath-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectFile(page, filePath, [options])")),(0,i.kt)("p",null,"Injects a JavaScript file into a Puppeteer page. Unlike Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"addScriptTag")," function, this function works on pages with arbitrary Cross-Origin\nResource Sharing (CORS) policies."),(0,i.kt)("p",null,"File contents are cached for up to 10 files to limit file system access."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"filePath")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - File path"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[surviveNavigations]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," - Enables the injected script to survive page navigations and reloads without need to be re-injected\nmanually. This does not mean, however, that internal state will be preserved. Just that it will be automatically re-injected on each\nnavigation before any other scripts get the chance to execute.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectjquery"}),(0,i.kt)("h2",{id:"puppeteerinjectjquerypage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectJQuery(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery")," library into a Puppeteer page. jQuery is often useful for various web scraping and crawling tasks. For\nexample, it can help extract text from HTML elements using CSS selectors."),(0,i.kt)("p",null,"Beware that the injected jQuery object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window.$")," variable and thus it might cause conflicts with other libraries included by the\npage that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected jQuery will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectJQuery(page);\nconst title = await page.evaluate(() => {\n return $('head title').text();\n});\n")),(0,i.kt)("p",null,"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"injectJQuery()")," does not affect the Puppeteer's ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-pageselector",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"page.$()"))," function in any\nway."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectunderscore"}),(0,i.kt)("h2",{id:"puppeteerinjectunderscorepage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectUnderscore(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://underscorejs.org/",target:"_blank",rel:"noopener"},"Underscore")," library into a Puppeteer page."),(0,i.kt)("p",null,"Beware that the injected Underscore object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window._")," variable and thus it might cause conflicts with libraries included by the\npage that use the same variable name. This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected Underscore will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectUnderscore(page);\nconst escapedHtml = await page.evaluate(() => {\n return _.escape('

Hello

');\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page",target:"_blank",rel:"noopener"},"Page")," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"blockrequests"}),(0,i.kt)("h2",{id:"puppeteerblockrequestspage-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.blockRequests(page, [options])")),(0,i.kt)("p",null,"Forces the Puppeteer browser tab to block loading URLs that match a provided pattern. This is useful to speed up crawling of websites, since it\nreduces the amount of data that needs to be downloaded from the web, but it may break some websites or unexpectedly prevent loading of resources."),(0,i.kt)("p",null,"By default, the function will block all URLs including the following patterns:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'[".css", ".jpg", ".jpeg", ".png", ".svg", ".gif", ".woff", ".pdf", ".zip"]\n')),(0,i.kt)("p",null,"If you want to extend this list further, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"extraUrlPatterns")," option, which will keep blocking the default patterns, as well as add your custom\nones. If you would like to block only specific patterns, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"urlPatterns")," option, which will override the defaults and block only URLs with your\ncustom patterns."),(0,i.kt)("p",null,"This function does not use Puppeteer's request interception and therefore does not interfere with browser cache. It's also faster than blocking\nrequests using interception, because the blocking happens directly in the browser without the round-trip to Node.js, but it does not provide the extra\nbenefits of request interception."),(0,i.kt)("p",null,"The function will never block main document loads and their respective redirects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\n\n// Block all requests to URLs that include `adsbygoogle.js` and also all defaults.\nawait Apify.utils.puppeteer.blockRequests(page, {\n extraUrlPatterns: ['adsbygoogle.js'],\n});\n\nawait page.goto('https://cnn.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - The patterns of URLs to block from being loaded by the browser. Only ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," can be used as a wildcard. It\nis also automatically added to the beginning and end of the pattern. This limitation is enforced by the DevTools protocol. ",(0,i.kt)("inlineCode",{parentName:"li"},".png")," is the same\nas ",(0,i.kt)("inlineCode",{parentName:"li"},"*.png*"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[extraUrlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - If you just want to append to the default blocked patterns, use this property.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"cacheresponses"}),(0,i.kt)("h2",{id:"puppeteercacheresponsespage-cache-responseurlrules"},(0,i.kt)("del",{parentName:"h2"},(0,i.kt)("inlineCode",{parentName:"del"},"puppeteer.cacheResponses(page, cache, responseUrlRules)"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("em",{parentName:"strong"},"Deprecated"))),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using this function entirely disables browser cache which resolves in sub-optimal performance. Until this\nresolves, we suggest just relying on the in-browser cache unless absolutely necessary."),(0,i.kt)("p",null,"Enables caching of intercepted responses into a provided object. Automatically enables request interception in Puppeteer. ",(0,i.kt)("em",{parentName:"p"},"IMPORTANT"),": Caching\nresponses stores them to memory, so too loose rules could cause memory leaks for longer running crawlers. This issue should be resolved or atleast\nmitigated in future iterations of this feature."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"cache")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Object in which responses are stored"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"responseUrlRules")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp)>")," - List of rules that are used to check if the response should be cached. String rules are\ncompared as page.url().includes(rule) while RegExp rules are evaluated as rule.test(page.url()).")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"compilescript"}),(0,i.kt)("h2",{id:"puppeteercompilescriptscriptstring-context"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.compileScript(scriptString, context)")),(0,i.kt)("p",null,"Compiles a Puppeteer script into an async function that may be executed at any time by providing it with the following object:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n page: Page,\n request: Request,\n}\n")),(0,i.kt)("p",null,"Where ",(0,i.kt)("inlineCode",{parentName:"p"},"page")," is a Puppeteer ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," is a ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,i.kt)("p",null,"The function is compiled by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter as the function's body, so any limitations to function bodies apply. Return value of\nthe compiled function is the return value of the function body = the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter."),(0,i.kt)("p",null,"As a security measure, no globals such as ",(0,i.kt)("inlineCode",{parentName:"p"},"process")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"require")," are accessible from within the function body. Note that the function does not provide\na safe sandbox and even though globals are not easily accessible, malicious code may still execute in the main process via prototype manipulation.\nTherefore you should only use this function to execute sanitized or safe code."),(0,i.kt)("p",null,"Custom context may also be provided using the ",(0,i.kt)("inlineCode",{parentName:"p"},"context")," parameter. To improve security, make sure to only pass the really necessary objects to the\ncontext. Preferably making secured copies beforehand."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"scriptString")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/compiled-script-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptFunction"))),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,k=d["".concat(o,".").concat(m)]||d[m]||c[m]||i;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:r,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),s=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-crawl-sitemap",title:"Crawl a sitemap",id:"crawl-sitemap"},l=void 0,c={unversionedId:"examples/crawl-sitemap",id:"version-1.3/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-1.3/examples/crawl_sitemap.md",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/1.3/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_sitemap.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawl-sitemap",title:"Crawl a sitemap",id:"crawl-sitemap"},sidebar:"version-1.3/docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/1.3/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-some-links"}},p={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,o);return(0,s.kt)(d,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that uses Cheerio\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Puppeteer\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Playwright\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||s;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),s=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-crawl-sitemap",title:"Crawl a sitemap",id:"crawl-sitemap"},l=void 0,c={unversionedId:"examples/crawl-sitemap",id:"version-1.3/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-1.3/examples/crawl_sitemap.md",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/1.3/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_sitemap.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawl-sitemap",title:"Crawl a sitemap",id:"crawl-sitemap"},sidebar:"version-1.3/docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/1.3/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-some-links"}},p={},u=[],m={toc:u},f="wrapper";function d(e){var t=e.components,n=(0,a.Z)(e,o);return(0,s.kt)(f,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that uses Cheerio\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Puppeteer\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList from a sitemap\n const sources = [{ requestsFromUrl: 'https://apify.com/sitemap.xml' }];\n const requestList = await Apify.openRequestList('start-urls', sources);\n\n // Function called for each URL\n const handlePageFunction = async ({ request }) => {\n console.log(request.url);\n };\n\n // Create a crawler that runs Playwright\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n });\n\n // Run the crawler\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,d=u["".concat(l,".").concat(f)]||u[f]||m[f]||s;return n?r.createElement(d,o(o({ref:t},p),{},{components:n})):r.createElement(d,o({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var r=n(87462),o=n(63366),l=(n(67294),n(3905)),a=["components"],i={id:"stealth-options",title:"StealthOptions"},p=void 0,d={unversionedId:"typedefs/stealth-options",id:"version-2.3/typedefs/stealth-options",title:"StealthOptions",description:"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the stealth option",source:"@site/versioned_docs/version-2.3/typedefs/StealthOptions.md",sourceDirName:"typedefs",slug:"/typedefs/stealth-options",permalink:"/sdk/js/docs/2.3/typedefs/stealth-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StealthOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"stealth-options",title:"StealthOptions"},sidebar:"version-2.3/docs",previous:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/2.3/typedefs/snapshotter-options"},next:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/2.3/typedefs/system-status-options"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"addPlugins",id:"addplugins",level:3},{value:"emulateWindowFrame",id:"emulatewindowframe",level:3},{value:"emulateWebGL",id:"emulatewebgl",level:3},{value:"emulateConsoleDebug",id:"emulateconsoledebug",level:3},{value:"addLanguage",id:"addlanguage",level:3},{value:"hideWebDriver",id:"hidewebdriver",level:3},{value:"hackPermissions",id:"hackpermissions",level:3},{value:"mockChrome",id:"mockchrome",level:3},{value:"mockChromeInIframe",id:"mockchromeiniframe",level:3},{value:"mockDeviceMemory",id:"mockdevicememory",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,a);return(0,l.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"stealthoptions"}),(0,l.kt)("p",null,"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the ",(0,l.kt)("inlineCode",{parentName:"p"},"stealth")," option\nis set to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"addplugins"},(0,l.kt)("inlineCode",{parentName:"h3"},"addPlugins")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"If plugins should be added to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewindowframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWindowFrame")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates window Iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewebgl"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWebGL")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates graphic card."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulateconsoledebug"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateConsoleDebug")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates console.debug to return null."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"addlanguage"},(0,l.kt)("inlineCode",{parentName:"h3"},"addLanguage")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds languages to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hidewebdriver"},(0,l.kt)("inlineCode",{parentName:"h3"},"hideWebDriver")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Hides the webdriver by changing the navigator proto."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hackpermissions"},(0,l.kt)("inlineCode",{parentName:"h3"},"hackPermissions")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Fakes interaction with permissions."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchrome"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChrome")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchromeiniframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChromeInIframe")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties inside the every newly created iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockdevicememory"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockDeviceMemory")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Sets device memory to other value than 0."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=o,k=u["".concat(p,".").concat(m)]||u[m]||c[m]||l;return n?r.createElement(k,a(a({ref:t},s),{},{components:n})):r.createElement(k,a({ref:t},s))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,a=new Array(l);a[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var o=n(87462),r=n(63366),l=(n(67294),n(3905)),a=["components"],i={id:"stealth-options",title:"StealthOptions"},p=void 0,d={unversionedId:"typedefs/stealth-options",id:"version-2.3/typedefs/stealth-options",title:"StealthOptions",description:"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the stealth option",source:"@site/versioned_docs/version-2.3/typedefs/StealthOptions.md",sourceDirName:"typedefs",slug:"/typedefs/stealth-options",permalink:"/sdk/js/docs/2.3/typedefs/stealth-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StealthOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"stealth-options",title:"StealthOptions"},sidebar:"version-2.3/docs",previous:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/2.3/typedefs/snapshotter-options"},next:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/2.3/typedefs/system-status-options"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"addPlugins",id:"addplugins",level:3},{value:"emulateWindowFrame",id:"emulatewindowframe",level:3},{value:"emulateWebGL",id:"emulatewebgl",level:3},{value:"emulateConsoleDebug",id:"emulateconsoledebug",level:3},{value:"addLanguage",id:"addlanguage",level:3},{value:"hideWebDriver",id:"hidewebdriver",level:3},{value:"hackPermissions",id:"hackpermissions",level:3},{value:"mockChrome",id:"mockchrome",level:3},{value:"mockChromeInIframe",id:"mockchromeiniframe",level:3},{value:"mockDeviceMemory",id:"mockdevicememory",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,a);return(0,l.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"stealthoptions"}),(0,l.kt)("p",null,"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the ",(0,l.kt)("inlineCode",{parentName:"p"},"stealth")," option\nis set to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"addplugins"},(0,l.kt)("inlineCode",{parentName:"h3"},"addPlugins")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"If plugins should be added to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewindowframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWindowFrame")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates window Iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewebgl"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWebGL")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates graphic card."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulateconsoledebug"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateConsoleDebug")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates console.debug to return null."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"addlanguage"},(0,l.kt)("inlineCode",{parentName:"h3"},"addLanguage")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds languages to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hidewebdriver"},(0,l.kt)("inlineCode",{parentName:"h3"},"hideWebDriver")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Hides the webdriver by changing the navigator proto."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hackpermissions"},(0,l.kt)("inlineCode",{parentName:"h3"},"hackPermissions")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Fakes interaction with permissions."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchrome"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChrome")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchromeiniframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChromeInIframe")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties inside the every newly created iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockdevicememory"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockDeviceMemory")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Sets device memory to other value than 0."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),d=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=d(e.components);return o.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=r,k=u["".concat(p,".").concat(m)]||u[m]||c[m]||l;return n?o.createElement(k,a(a({ref:t},s),{},{components:n})):o.createElement(k,a({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,a=new Array(l);a[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,a[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=n(87462),o=n(63366),r=(n(67294),n(3905)),l=["components"],i={id_old:"version-2.3.0-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},p=void 0,s={unversionedId:"typedefs/playwright-crawler-options",id:"version-2.3/typedefs/playwright-crawler-options",title:"PlaywrightCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/playwright-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},sidebar:"version-2.3/docs",previous:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"},next:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/playwright-launch-context"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"playwrightcrawleroptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"handlepagefunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-handle-page-function",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunction"))),(0,r.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright")," ",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright"),"\n",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-response",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The\nfunction must return a promise, which is then awaited by the crawler."),(0,r.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,r.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,r.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"navigationtimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlefailedrequestfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,r.kt)("p",null,"A function to handle requests that failed more than ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,r.kt)("p",null,"The function receives the following object as an argument:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"prenavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n },\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"postnavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n },\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))),(0,r.kt)("p",null,"The same options as used by ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#launchplaywright",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.launchPlaywright()")),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlepagetimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which the function passed as ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"browserpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persistcookiespersession"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"proxyconfiguration"},(0,r.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,r.kt)("p",null,"If set, ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," will be configured for all connections to use ",(0,r.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs\nprovided and rotated according to the configuration. For more information, see the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestlist"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,r.kt)("p",null,"Static list of URLs to be processed. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestqueue"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,r.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestretries"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 3")),(0,r.kt)("p",null,"Indicates how many times the request is retried if\n",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," fails."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestspercrawl"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaledpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,r.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usesessionpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Playwright crawler will initialize the ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,r.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(n),h=o,k=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=n(87462),o=n(63366),r=(n(67294),n(3905)),l=["components"],i={id_old:"version-2.3.0-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},p=void 0,s={unversionedId:"typedefs/playwright-crawler-options",id:"version-2.3/typedefs/playwright-crawler-options",title:"PlaywrightCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/playwright-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},sidebar:"version-2.3/docs",previous:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"},next:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/playwright-launch-context"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"playwrightcrawleroptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"handlepagefunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-handle-page-function",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunction"))),(0,r.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright")," ",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright"),"\n",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-response",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The\nfunction must return a promise, which is then awaited by the crawler."),(0,r.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,r.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,r.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"navigationtimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlefailedrequestfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,r.kt)("p",null,"A function to handle requests that failed more than ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,r.kt)("p",null,"The function receives the following object as an argument:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"prenavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n },\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"postnavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n },\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))),(0,r.kt)("p",null,"The same options as used by ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#launchplaywright",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.launchPlaywright()")),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlepagetimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which the function passed as ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"browserpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persistcookiespersession"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"proxyconfiguration"},(0,r.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,r.kt)("p",null,"If set, ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," will be configured for all connections to use ",(0,r.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs\nprovided and rotated according to the configuration. For more information, see the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestlist"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,r.kt)("p",null,"Static list of URLs to be processed. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestqueue"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,r.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestretries"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 3")),(0,r.kt)("p",null,"Indicates how many times the request is retried if\n",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," fails."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestspercrawl"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaledpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,r.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usesessionpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Playwright crawler will initialize the ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,r.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(n),h=o,k=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{r.d(t,{Z:()=>s});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const s=function(e){var t=e.to,r=e.children,s=(0,o.E)(),l=s.version,c=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var u=l+"/";return"current"===l?u="next/":c&&(u=""),n.createElement(a.default,{to:"/api/"+u+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>s,T:()=>i});var n=r(67294),a=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return n.createElement(a.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},s=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},53642:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>h,contentTitle:()=>p,default:()=>g,frontMatter:()=>u,metadata:()=>d,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(14563),s=(r(68889),r(26569));const l="import { CheerioCrawler, log, LogLevel } from 'crawlee';\n\n// Crawlers come with various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nlog.setLevel(LogLevel.DEBUG);\n\n// Create an instance of the CheerioCrawler class - a crawler\n// that automatically loads the URLs and parses their HTML using the cheerio library.\nconst crawler = new CheerioCrawler({\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n requestHandlerTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n async requestHandler({ request, $ }) {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the dataset. In local configuration,\n // the data will be stored as JSON files in ./storage/datasets/default\n await Actor.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n log.debug(`Request ${request.url} failed twice.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run();\n\nlog.debug('Crawler finished.');\n";var c=["components"],u={id:"cheerio-crawler",title:"Cheerio crawler"},p=void 0,d={unversionedId:"examples/cheerio-crawler",id:"version-3.0/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.",source:"@site/versioned_docs/version-3.0/examples/cheerio_crawler.mdx",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/3.0/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/cheerio_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/3.0/examples/call-actor"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-all-links"}},h={},m=[],f={toc:m},w="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(w,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title and all ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},l))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=c(r),h=a,m=p["".concat(l,".").concat(h)]||p[h]||d[h]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[p]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{r.d(t,{Z:()=>s});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const s=function(e){var t=e.to,r=e.children,s=(0,o.E)(),l=s.version,c=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=l+"/";return"current"===l?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>s,T:()=>i});var n=r(67294),a=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return n.createElement(a.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},s=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},53642:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>h,contentTitle:()=>u,default:()=>g,frontMatter:()=>p,metadata:()=>d,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(14563),s=(r(68889),r(26569));const l="import { CheerioCrawler, log, LogLevel } from 'crawlee';\n\n// Crawlers come with various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nlog.setLevel(LogLevel.DEBUG);\n\n// Create an instance of the CheerioCrawler class - a crawler\n// that automatically loads the URLs and parses their HTML using the cheerio library.\nconst crawler = new CheerioCrawler({\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n requestHandlerTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n async requestHandler({ request, $ }) {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the dataset. In local configuration,\n // the data will be stored as JSON files in ./storage/datasets/default\n await Actor.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n log.debug(`Request ${request.url} failed twice.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run();\n\nlog.debug('Crawler finished.');\n";var c=["components"],p={id:"cheerio-crawler",title:"Cheerio crawler"},u=void 0,d={unversionedId:"examples/cheerio-crawler",id:"version-3.0/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.",source:"@site/versioned_docs/version-3.0/examples/cheerio_crawler.mdx",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/3.0/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/cheerio_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/3.0/examples/call-actor"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-all-links"}},h={},m=[],f={toc:m},w="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(w,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title and all ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},l))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),h=a,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=t(87462),a=t(63366),l=(t(67294),t(3905)),o=["components"],i={id:"apify-call-error",title:"ApifyCallError"},p=void 0,s={unversionedId:"api/apify-call-error",id:"version-2.3/api/apify-call-error",title:"ApifyCallError",description:"The class represents exceptions thrown by the Apify.call() function.",source:"@site/versioned_docs/version-2.3/api/ApifyCallError.md",sourceDirName:"api",slug:"/api/apify-call-error",permalink:"/sdk/js/docs/2.3/api/apify-call-error",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ApifyCallError.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"apify-call-error",title:"ApifyCallError"},sidebar:"version-2.3/docs",previous:{title:"ActorRun",permalink:"/sdk/js/docs/2.3/typedefs/actor-run"},next:{title:"ApifyEnv",permalink:"/sdk/js/docs/2.3/typedefs/apify-env"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"run",id:"run",level:3},{value:"name",id:"name",level:3},{value:"new ApifyCallError(run, [message])",id:"new-apifycallerrorrun-message",level:2}],d={toc:u},f="wrapper";function m(e){var r=e.components,t=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"apifycallerror"}),(0,l.kt)("p",null,"The class represents exceptions thrown by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"message"},(0,l.kt)("inlineCode",{parentName:"h3"},"message")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Error message"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"run"},(0,l.kt)("inlineCode",{parentName:"h3"},"run")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("p",null,"Object representing the failed actor run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"name"},(0,l.kt)("inlineCode",{parentName:"h3"},"name")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Contains ",(0,l.kt)("inlineCode",{parentName:"p"},'"ApifyCallError"')),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.apifycallerror"}),(0,l.kt)("h2",{id:"new-apifycallerrorrun-message"},(0,l.kt)("inlineCode",{parentName:"h2"},"new ApifyCallError(run, [message])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"run")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"The actor invoked by Apify.call() did not succeed",'"'))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(t),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||l;return t?n.createElement(m,o(o({ref:r},c),{},{components:t})):n.createElement(m,o({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=f;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var s=2;s{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=t(87462),a=t(63366),l=(t(67294),t(3905)),o=["components"],i={id:"apify-call-error",title:"ApifyCallError"},p=void 0,s={unversionedId:"api/apify-call-error",id:"version-2.3/api/apify-call-error",title:"ApifyCallError",description:"The class represents exceptions thrown by the Apify.call() function.",source:"@site/versioned_docs/version-2.3/api/ApifyCallError.md",sourceDirName:"api",slug:"/api/apify-call-error",permalink:"/sdk/js/docs/2.3/api/apify-call-error",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ApifyCallError.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"apify-call-error",title:"ApifyCallError"},sidebar:"version-2.3/docs",previous:{title:"ActorRun",permalink:"/sdk/js/docs/2.3/typedefs/actor-run"},next:{title:"ApifyEnv",permalink:"/sdk/js/docs/2.3/typedefs/apify-env"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"run",id:"run",level:3},{value:"name",id:"name",level:3},{value:"new ApifyCallError(run, [message])",id:"new-apifycallerrorrun-message",level:2}],d={toc:u},f="wrapper";function m(e){var r=e.components,t=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"apifycallerror"}),(0,l.kt)("p",null,"The class represents exceptions thrown by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"message"},(0,l.kt)("inlineCode",{parentName:"h3"},"message")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Error message"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"run"},(0,l.kt)("inlineCode",{parentName:"h3"},"run")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("p",null,"Object representing the failed actor run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"name"},(0,l.kt)("inlineCode",{parentName:"h3"},"name")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Contains ",(0,l.kt)("inlineCode",{parentName:"p"},'"ApifyCallError"')),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.apifycallerror"}),(0,l.kt)("h2",{id:"new-apifycallerrorrun-message"},(0,l.kt)("inlineCode",{parentName:"h2"},"new ApifyCallError(run, [message])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"run")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/actor-run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ActorRun"))),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"The actor invoked by Apify.call() did not succeed",'"'))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>m});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(t),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||l;return t?n.createElement(m,o(o({ref:r},c),{},{components:t})):n.createElement(m,o({ref:r},c))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=f;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>f,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),l=["components"],s={id_old:"version-1.3-crawl-relative-links",title:"Crawl a website with relative links",id:"crawl-relative-links"},o=void 0,u={unversionedId:"examples/crawl-relative-links",id:"version-1.3/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may have trouble following them. This is",source:"@site/versioned_docs/version-1.3/examples/crawl_relative_links.md",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/1.3/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_relative_links.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawl-relative-links",title:"Crawl a website with relative links",id:"crawl-relative-links"},sidebar:"version-1.3/docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/1.3/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/1.3/examples/crawl-single-url"}},c={},p=[],d={toc:p},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,l);return(0,i.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"If a website uses relative links, ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," may have trouble following them. This is\nwhy it is important to set the ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl")," property within ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl, // <-------------- important to set the base url here\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var o=n.createContext({}),u=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(o.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),p=u(r),m=a,f=p["".concat(o,".").concat(m)]||p[m]||d[m]||i;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[p]="string"==typeof e?e:a,l[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>o,metadata:()=>u,toc:()=>p});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),l=["components"],o={id_old:"version-1.3-crawl-relative-links",title:"Crawl a website with relative links",id:"crawl-relative-links"},s=void 0,u={unversionedId:"examples/crawl-relative-links",id:"version-1.3/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may have trouble following them. This is",source:"@site/versioned_docs/version-1.3/examples/crawl_relative_links.md",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/1.3/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_relative_links.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawl-relative-links",title:"Crawl a website with relative links",id:"crawl-relative-links"},sidebar:"version-1.3/docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/1.3/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/1.3/examples/crawl-single-url"}},c={},p=[],d={toc:p},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,l);return(0,i.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"If a website uses relative links, ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," may have trouble following them. This is\nwhy it is important to set the ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl")," property within ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl, // <-------------- important to set the base url here\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),u=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),p=u(r),m=a,f=p["".concat(s,".").concat(m)]||p[m]||d[m]||i;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[p]="string"==typeof e?e:a,l[1]=o;for(var u=2;u{n.d(t,{Z:()=>p});var r=n(67294),a=n(88746),i=n(6141),o=n(6832);const p=function(e){var t=e.to,n=e.children,p=(0,i.E)(),s=p.version,c=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var l=s+"/";return"current"===s?l="next/":c&&(l=""),r.createElement(a.default,{to:"/api/"+l+t},n)}},76404:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=(n(68889),["components"]),p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-3.1/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-3.1/guides/typescript_actor.mdx",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/typescript_actor.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Actor.getInput()) as any; // getInput returns Promise|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Actor.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{n.d(t,{Z:()=>p});var r=n(67294),a=n(88746),i=n(6141),o=n(6832);const p=function(e){var t=e.to,n=e.children,p=(0,i.E)(),s=p.version,c=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var l=s+"/";return"current"===s?l="next/":c&&(l=""),r.createElement(a.default,{to:"/api/"+l+t},n)}},76404:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=(n(68889),["components"]),p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-3.1/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-3.1/guides/typescript_actor.mdx",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/typescript_actor.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Actor.getInput()) as any; // getInput returns Promise|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Actor.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>d,metadata:()=>i,toc:()=>p});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=["components"],d={id:"add-data-to-dataset",title:"Add data to dataset"},l=void 0,i={unversionedId:"examples/add-data-to-dataset",id:"version-2.3/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/versioned_docs/version-2.3/examples/add_data_to_dataset.md",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/2.3/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/add_data_to_dataset.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"version-2.3/docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/2.3/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/2.3/examples/basic-crawler"}},c={},p=[],u={toc:p},m="wrapper";function f(e){var t=e.components,a=(0,n.Z)(e,s);return(0,o.kt)(m,(0,r.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { Actor } = require('apify');\nconst { CheerioCrawler } = require('crawlee');\n\nActor.main(async () => {\n // Function called for each URL\n const requestHandler = async ({ request, body }) => {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n };\n\n const crawler = new CheerioCrawler({\n requestHandler,\n });\n\n // Run the crawler\n await crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n});\n")),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")))}f.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>f});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),i=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=i(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),p=i(a),m=n,f=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return a?r.createElement(f,s(s({ref:t},c),{},{components:a})):r.createElement(f,s({ref:t},c))}));function f(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=m;var d={};for(var l in t)hasOwnProperty.call(t,l)&&(d[l]=t[l]);d.originalType=e,d[p]="string"==typeof e?e:n,s[1]=d;for(var i=2;i{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>d,metadata:()=>i,toc:()=>p});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=["components"],d={id:"add-data-to-dataset",title:"Add data to dataset"},l=void 0,i={unversionedId:"examples/add-data-to-dataset",id:"version-2.3/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/versioned_docs/version-2.3/examples/add_data_to_dataset.md",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/2.3/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/add_data_to_dataset.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"version-2.3/docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/2.3/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/2.3/examples/basic-crawler"}},c={},p=[],u={toc:p},m="wrapper";function f(e){var t=e.components,a=(0,n.Z)(e,s);return(0,o.kt)(m,(0,r.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { Actor } = require('apify');\nconst { CheerioCrawler } = require('crawlee');\n\nActor.main(async () => {\n // Function called for each URL\n const requestHandler = async ({ request, body }) => {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n };\n\n const crawler = new CheerioCrawler({\n requestHandler,\n });\n\n // Run the crawler\n await crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n});\n")),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")))}f.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>f});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),i=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=i(e.components);return r.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),p=i(a),m=n,f=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return a?r.createElement(f,s(s({ref:t},c),{},{components:a})):r.createElement(f,s({ref:t},c))}));function f(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=m;var d={};for(var l in t)hasOwnProperty.call(t,l)&&(d[l]=t[l]);d.originalType=e,d[p]="string"==typeof e?e:n,s[1]=d;for(var i=2;i{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-goto-function",title:"GotoFunction",id:"goto-function"},c=void 0,p={unversionedId:"typedefs/goto-function",id:"version-1.3/typedefs/goto-function",title:"GotoFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/GotoFunction.md",sourceDirName:"typedefs",slug:"/typedefs/goto-function",permalink:"/sdk/js/docs/1.3/typedefs/goto-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/GotoFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-goto-function",title:"GotoFunction",id:"goto-function"}},s={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"gotofunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,m=u["".concat(c,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-goto-function",title:"GotoFunction",id:"goto-function"},c=void 0,p={unversionedId:"typedefs/goto-function",id:"version-1.3/typedefs/goto-function",title:"GotoFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/GotoFunction.md",sourceDirName:"typedefs",slug:"/typedefs/goto-function",permalink:"/sdk/js/docs/1.3/typedefs/goto-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/GotoFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-goto-function",title:"GotoFunction",id:"goto-function"}},s={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"gotofunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,m=u["".concat(c,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>c,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=t(87462),o=t(63366),a=(t(67294),t(3905)),i=["components"],l={id:"browser-crawling-context",title:"BrowserCrawlingContext"},c=void 0,s={unversionedId:"typedefs/browser-crawling-context",id:"version-2.3/typedefs/browser-crawling-context",title:"BrowserCrawlingContext",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/BrowserCrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-crawling-context",permalink:"/sdk/js/docs/2.3/typedefs/browser-crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserCrawlingContext.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"browser-crawling-context",title:"BrowserCrawlingContext"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"browserController",id:"browsercontroller",level:3}],u={toc:d},f="wrapper";function y(e){var r=e.components,t=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browsercrawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"browsercontroller"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserController")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserController")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>y});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),s=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=s(e.components);return n.createElement(c.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(t),f=o,y=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(y,i(i({ref:r},p),{},{components:t})):n.createElement(y,i({ref:r},p))}));function y(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=f;var l={};for(var c in r)hasOwnProperty.call(r,c)&&(l[c]=r[c]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>c,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=t(87462),o=t(63366),a=(t(67294),t(3905)),i=["components"],l={id:"browser-crawling-context",title:"BrowserCrawlingContext"},c=void 0,s={unversionedId:"typedefs/browser-crawling-context",id:"version-2.3/typedefs/browser-crawling-context",title:"BrowserCrawlingContext",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/BrowserCrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-crawling-context",permalink:"/sdk/js/docs/2.3/typedefs/browser-crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserCrawlingContext.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"browser-crawling-context",title:"BrowserCrawlingContext"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"browserController",id:"browsercontroller",level:3}],u={toc:d},f="wrapper";function y(e){var r=e.components,t=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browsercrawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"browsercontroller"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserController")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserController")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>y});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),s=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=s(e.components);return n.createElement(c.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(t),f=o,y=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(y,i(i({ref:r},p),{},{components:t})):n.createElement(y,i({ref:r},p))}));function y(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=f;var l={};for(var c in r)hasOwnProperty.call(r,c)&&(l[c]=r[c]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"crawl-some-links",title:"Crawl some links on a website"},l=void 0,p={unversionedId:"examples/crawl-some-links",id:"version-2.3/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property",source:"@site/versioned_docs/version-2.3/examples/crawl_some_links.md",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/2.3/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_some_links.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"version-2.3/docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/2.3/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/2.3/examples/forms"}},u={},c=[],m={toc:c},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," example uses the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/pseudo-url",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"pseudoUrls"))," property\nin the ",(0,o.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method to only add links to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestList")," queue if\nthey match the specified regular expression."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/store' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add some links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),d=a,f=c["".concat(l,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(f,s(s({ref:t},u),{},{components:r})):n.createElement(f,s({ref:t},u))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:a,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"crawl-some-links",title:"Crawl some links on a website"},l=void 0,p={unversionedId:"examples/crawl-some-links",id:"version-2.3/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property",source:"@site/versioned_docs/version-2.3/examples/crawl_some_links.md",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/2.3/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_some_links.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"version-2.3/docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/2.3/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/2.3/examples/forms"}},u={},c=[],m={toc:c},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," example uses the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/pseudo-url",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"pseudoUrls"))," property\nin the ",(0,o.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method to only add links to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestList")," queue if\nthey match the specified regular expression."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/store' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add some links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),d=a,f=c["".concat(l,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(f,s(s({ref:t},u),{},{components:r})):n.createElement(f,s({ref:t},u))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:a,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-dataset-consumer",title:"DatasetConsumer",id:"dataset-consumer"},p=void 0,l={unversionedId:"typedefs/dataset-consumer",id:"version-1.3/typedefs/dataset-consumer",title:"DatasetConsumer",description:"User-function used in the Dataset.forEach() API.",source:"@site/versioned_docs/version-1.3/typedefs/DatasetConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-consumer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetConsumer.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-dataset-consumer",title:"DatasetConsumer",id:"dataset-consumer"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"},next:{title:"DatasetMapper",permalink:"/sdk/js/docs/1.3/typedefs/dataset-mapper"}},c={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.forEach()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Current ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=a,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-dataset-consumer",title:"DatasetConsumer",id:"dataset-consumer"},p=void 0,l={unversionedId:"typedefs/dataset-consumer",id:"version-1.3/typedefs/dataset-consumer",title:"DatasetConsumer",description:"User-function used in the Dataset.forEach() API.",source:"@site/versioned_docs/version-1.3/typedefs/DatasetConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-consumer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetConsumer.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-dataset-consumer",title:"DatasetConsumer",id:"dataset-consumer"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"},next:{title:"DatasetMapper",permalink:"/sdk/js/docs/1.3/typedefs/dataset-mapper"}},c={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.forEach()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Current ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=a,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-sitemap",title:"Puppeteer sitemap",id:"puppeteer-sitemap"},s=void 0,l={unversionedId:"examples/puppeteer-sitemap",id:"version-1.3/examples/puppeteer-sitemap",title:"Puppeteer sitemap",description:"This example demonstrates how to use PuppeteerCrawler to crawl a list of web pages specified in a sitemap. The",source:"@site/versioned_docs/version-1.3/examples/puppeteer_sitemap.md",sourceDirName:"examples",slug:"/examples/puppeteer-sitemap",permalink:"/sdk/js/docs/1.3/examples/puppeteer-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_sitemap.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-sitemap",title:"Puppeteer sitemap",id:"puppeteer-sitemap"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/1.3/examples/puppeteer-with-proxy"}},c={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to use ",(0,p.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to crawl a list of web pages specified in a sitemap. The\ncrawler extracts the page title and URL from each page and stores them as a record in the default dataset. In local configuration, the results are\nstored as JSON files in ",(0,p.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)")," base image on the ",(0,p.kt)("strong",{parentName:"p"},"Source")," tab\nwhen configuring the actor.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = new Apify.RequestList({\n sources: [{ requestsFromUrl: 'https://apify.com/sitemaps.xml' }],\n });\n await requestList.initialize();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n maxRequestsPerCrawl: 10,\n handlePageFunction: async ({ page, request }) => {\n console.log(`Processing ${request.url}...`);\n await Apify.pushData({\n url: request.url,\n title: await page.title(),\n html: await page.content(),\n });\n },\n });\n\n await crawler.run();\n console.log('Done.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),d=a,f=u["".concat(s,".").concat(d)]||u[d]||m[d]||p;return r?n.createElement(f,o(o({ref:t},c),{},{components:r})):n.createElement(f,o({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-sitemap",title:"Puppeteer sitemap",id:"puppeteer-sitemap"},s=void 0,l={unversionedId:"examples/puppeteer-sitemap",id:"version-1.3/examples/puppeteer-sitemap",title:"Puppeteer sitemap",description:"This example demonstrates how to use PuppeteerCrawler to crawl a list of web pages specified in a sitemap. The",source:"@site/versioned_docs/version-1.3/examples/puppeteer_sitemap.md",sourceDirName:"examples",slug:"/examples/puppeteer-sitemap",permalink:"/sdk/js/docs/1.3/examples/puppeteer-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_sitemap.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-sitemap",title:"Puppeteer sitemap",id:"puppeteer-sitemap"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/1.3/examples/puppeteer-with-proxy"}},c={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to use ",(0,p.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to crawl a list of web pages specified in a sitemap. The\ncrawler extracts the page title and URL from each page and stores them as a record in the default dataset. In local configuration, the results are\nstored as JSON files in ",(0,p.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)")," base image on the ",(0,p.kt)("strong",{parentName:"p"},"Source")," tab\nwhen configuring the actor.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = new Apify.RequestList({\n sources: [{ requestsFromUrl: 'https://apify.com/sitemaps.xml' }],\n });\n await requestList.initialize();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n maxRequestsPerCrawl: 10,\n handlePageFunction: async ({ page, request }) => {\n console.log(`Processing ${request.url}...`);\n await Apify.pushData({\n url: request.url,\n title: await page.title(),\n html: await page.content(),\n });\n },\n });\n\n await crawler.run();\n console.log('Done.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),d=a,f=u["".concat(s,".").concat(d)]||u[d]||m[d]||p;return r?n.createElement(f,o(o({ref:t},c),{},{components:r})):n.createElement(f,o({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id_old:"version-1.3-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"},l=void 0,s={unversionedId:"typedefs/puppeteer-hook",id:"version-1.3/typedefs/puppeteer-hook",title:"PuppeteerHook",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHook.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-hook",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHook.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerhook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(r),f=o,m=c["".concat(l,".").concat(f)]||c[f]||d[f]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:o,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id_old:"version-1.3-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"},l=void 0,s={unversionedId:"typedefs/puppeteer-hook",id:"version-1.3/typedefs/puppeteer-hook",title:"PuppeteerHook",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHook.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-hook",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHook.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerhook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(r),f=o,m=c["".concat(l,".").concat(f)]||c[f]||d[f]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:o,p[1]=i;for(var s=2;s{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var n=t(87462),a=t(63366),p=(t(67294),t(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",id:"puppeteer-recursive-crawl"},l=void 0,u={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-1.3/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/versioned_docs/version-1.3/examples/puppeteer_recursive_crawl.md",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_recursive_crawl.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",id:"puppeteer-recursive-crawl"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/1.3/examples/puppeteer-crawler"},next:{title:"Puppeteer sitemap",permalink:"/sdk/js/docs/1.3/examples/puppeteer-sitemap"}},s={},c=[],f={toc:c},m="wrapper";function d(e){var r=e.components,t=(0,a.Z)(e,o);return(0,p.kt)(m,(0,n.Z)({},f,t,{components:r,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,p.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n });\n\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>d});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},s=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=a,d=c["".concat(l,".").concat(m)]||c[m]||f[m]||p;return t?n.createElement(d,o(o({ref:r},s),{},{components:t})):n.createElement(d,o({ref:r},s))}));function d(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var p=t.length,o=new Array(p);o[0]=m;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var n=t(87462),a=t(63366),p=(t(67294),t(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",id:"puppeteer-recursive-crawl"},l=void 0,u={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-1.3/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/versioned_docs/version-1.3/examples/puppeteer_recursive_crawl.md",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_recursive_crawl.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",id:"puppeteer-recursive-crawl"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/1.3/examples/puppeteer-crawler"},next:{title:"Puppeteer sitemap",permalink:"/sdk/js/docs/1.3/examples/puppeteer-sitemap"}},s={},c=[],f={toc:c},m="wrapper";function d(e){var r=e.components,t=(0,a.Z)(e,o);return(0,p.kt)(m,(0,n.Z)({},f,t,{components:r,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,p.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n });\n\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>d});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},s=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),c=u(t),m=a,d=c["".concat(l,".").concat(m)]||c[m]||f[m]||p;return t?n.createElement(d,o(o({ref:r},s),{},{components:t})):n.createElement(d,o({ref:r},s))}));function d(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var p=t.length,o=new Array(p);o[0]=m;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{n.d(t,{Z:()=>l});var r=n(67294),a=n(34334);const c={tabItem:"tabItem_Ymn6"};function l(e){var t=e.children,n=e.hidden,l=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(c.tabItem,l),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),c=n(34334),l=n(63735),o=n(38224),u=n(5730);const i={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,p=[],d=(0,l.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=p.indexOf(t),r=s[n].value;r!==o&&(d(t),u(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=p.indexOf(e.currentTarget)+1;n=null!=(r=p[a])?r:p[0];break;case"ArrowLeft":var c,l=p.indexOf(e.currentTarget)-1;n=null!=(c=p[l])?c:p[p.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,c.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,l=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return p.push(e)},onKeyDown:b,onClick:m},l,{className:(0,c.Z)("tabs__item",i.tabItem,null==l?void 0:l.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function p(e){var t=e.lazy,n=e.children,r=e.selectedValue,c=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var l=c.find((function(e){return e.props.value===r}));return l?(0,a.cloneElement)(l,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},c.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function d(e){var t=(0,o.Y)(e);return a.createElement("div",{className:(0,c.Z)("tabs-container",i.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(p,(0,r.Z)({},e,t)))}function m(e){var t=(0,u.Z)();return a.createElement(d,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>d});var r=n(67294),a=n(16550),c=n(34423),l=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function i(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,l.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,n=void 0!==t&&t,l=e.groupId,o=(0,a.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:l});return[(0,c._X)(u),(0,r.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function d(e){var t,n,a,c,l=e.defaultValue,u=e.queryString,d=void 0!==u&&u,m=e.groupId,b=i(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:l,tabValues:b})})),h=g[0],y=g[1],I=p({queryString:d,groupId:m}),w=I[0],v=I[1],f=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,o.Nk)(t),a=n[0],c=n[1],[a,(0,r.useCallback)((function(e){t&&c.set(e)}),[t,c])]),X=f[0],G=f[1],C=function(){var e=null!=w?w:X;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){C&&y(C)}),[C]),{selectedValue:h,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),v(e),G(e)}),[v,G,b]),tabValues:b}}},60416:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>y,contentTitle:()=>g,default:()=>X,frontMatter:()=>b,metadata:()=>h,toc:()=>I});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=n(65559),o=n(30433);n(14563);const u={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nconst screenshot = await page.screenshot();\n\n// Save the screenshot to the default key-value store\nawait Actor.setValue('my-key', screenshot, { contentType: 'image/png' });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCB1cmwgPSAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nO1xcbi8vIFN0YXJ0IGEgYnJvd3NlclxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBPcGVuIG5ldyB0YWIgaW4gdGhlIGJyb3dzZXJcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuXFxuLy8gTmF2aWdhdGUgdG8gdGhlIFVSTFxcbmF3YWl0IHBhZ2UuZ290byh1cmwpO1xcblxcbi8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG5jb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuXFxuLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgnbXkta2V5Jywgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuXFxuLy8gQ2xvc2UgUHVwcGV0ZWVyXFxuYXdhaXQgYnJvd3Nlci5jbG9zZSgpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.xy-Qn13nROyNEPEB6pUG8xQ1VfIjq56rsat4wKqhq9o"},i={code:"import { Actor } from 'apify';\nimport { launchPuppeteer, utils } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nawait utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciwgdXRpbHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgdXJsID0gJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vJztcXG4vLyBTdGFydCBhIGJyb3dzZXJcXG5jb25zdCBicm93c2VyID0gYXdhaXQgbGF1bmNoUHVwcGV0ZWVyKCk7XFxuXFxuLy8gT3BlbiBuZXcgdGFiIGluIHRoZSBicm93c2VyXFxuY29uc3QgcGFnZSA9IGF3YWl0IGJyb3dzZXIubmV3UGFnZSgpO1xcblxcbi8vIE5hdmlnYXRlIHRvIHRoZSBVUkxcXG5hd2FpdCBwYWdlLmdvdG8odXJsKTtcXG5cXG4vLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90XFxuYXdhaXQgdXRpbHMucHVwcGV0ZWVyLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleTogJ215LWtleScsIHNhdmVIdG1sOiBmYWxzZSB9KTtcXG5cXG4vLyBDbG9zZSBQdXBwZXRlZXJcXG5hd2FpdCBicm93c2VyLmNsb3NlKCk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.QSyAaQjtq2wJi2-pHooiFMBrLOELGoFYIBj8kQcDYtA"},s={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Actor.setValue(key, screenshot, { contentType: 'image/png' });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgUHVwcGV0ZWVyQ3Jhd2xlclxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUHVwcGV0ZWVyQ3Jhd2xlcih7XFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICAvLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90IHdpdGggUHVwcGV0ZWVyXFxuICAgICAgICBjb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuICAgICAgICAvLyBDb252ZXJ0IHRoZSBVUkwgaW50byBhIHZhbGlkIGtleVxcbiAgICAgICAgY29uc3Qga2V5ID0gcmVxdWVzdC51cmwucmVwbGFjZSgvWzovXS9nLCAnXycpO1xcbiAgICAgICAgLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG4gICAgICAgIGF3YWl0IEFjdG9yLnNldFZhbHVlKGtleSwgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyB9LFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.V_BcbfCWH__rcmGznaMSLm6R1wTtqF583QKH4Z3n5Uc"},p={code:"import { PuppeteerCrawler, puppeteerUtils } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await puppeteerUtils.saveSnapshot(page, { key, saveHtml: false });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIHB1cHBldGVlclV0aWxzIH0gZnJvbSAnY3Jhd2xlZSc7XFxuaW1wb3J0IHsgQWN0b3IgfSBmcm9tICdhcGlmeSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIFB1cHBldGVlckNyYXdsZXJcXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgLy8gQ29udmVydCB0aGUgVVJMIGludG8gYSB2YWxpZCBrZXlcXG4gICAgICAgIGNvbnN0IGtleSA9IHJlcXVlc3QudXJsLnJlcGxhY2UoL1s6L10vZywgJ18nKTtcXG4gICAgICAgIC8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG4gICAgICAgIGF3YWl0IHB1cHBldGVlclV0aWxzLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleSwgc2F2ZUh0bWw6IGZhbHNlIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.2SyyQ1VmxXhmOlrpTJRLqsinn3178wgSbrygIl4JJdg"};var d,m=["components"],b={id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},g=void 0,h={unversionedId:"examples/capture-screenshot",id:"version-3.1/examples/capture-screenshot",title:"Capture a screenshot using Puppeteer",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-3.1/examples/puppeteer_capture_screenshot.mdx",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_capture_screenshot.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},sidebar:"docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/examples/playwright-crawler"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/examples/puppeteer-crawler"}},y={},I=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),v={toc:I},f="wrapper";function X(e){var t=e.components,n=(0,a.Z)(e,m);return(0,c.kt)(f,(0,r.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)("p",null,"This example captures a screenshot of a web page using ",(0,c.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,c.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))),(0,c.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))),(0,c.kt)("p",null,"In both examples using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,c.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}X.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=i(n),m=a,b=p["".concat(u,".").concat(m)]||p[m]||d[m]||c;return n?r.createElement(b,l(l({ref:t},s),{},{components:n})):r.createElement(b,l({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=m;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[p]="string"==typeof e?e:a,l[1]=o;for(var i=2;i{n.d(t,{Z:()=>l});var r=n(67294),a=n(34334);const c={tabItem:"tabItem_Ymn6"};function l(e){var t=e.children,n=e.hidden,l=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(c.tabItem,l),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),c=n(34334),l=n(63735),o=n(38224),u=n(5730);const i={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,p=[],d=(0,l.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=p.indexOf(t),r=s[n].value;r!==o&&(d(t),u(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=p.indexOf(e.currentTarget)+1;n=null!=(r=p[a])?r:p[0];break;case"ArrowLeft":var c,l=p.indexOf(e.currentTarget)-1;n=null!=(c=p[l])?c:p[p.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,c.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,l=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return p.push(e)},onKeyDown:b,onClick:m},l,{className:(0,c.Z)("tabs__item",i.tabItem,null==l?void 0:l.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function p(e){var t=e.lazy,n=e.children,r=e.selectedValue,c=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var l=c.find((function(e){return e.props.value===r}));return l?(0,a.cloneElement)(l,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},c.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function d(e){var t=(0,o.Y)(e);return a.createElement("div",{className:(0,c.Z)("tabs-container",i.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(p,(0,r.Z)({},e,t)))}function m(e){var t=(0,u.Z)();return a.createElement(d,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>d});var r=n(67294),a=n(16550),c=n(34423),l=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function i(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,l.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,n=void 0!==t&&t,l=e.groupId,o=(0,a.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:l});return[(0,c._X)(u),(0,r.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function d(e){var t,n,a,c,l=e.defaultValue,u=e.queryString,d=void 0!==u&&u,m=e.groupId,b=i(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:l,tabValues:b})})),h=g[0],y=g[1],I=p({queryString:d,groupId:m}),w=I[0],v=I[1],f=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,o.Nk)(t),a=n[0],c=n[1],[a,(0,r.useCallback)((function(e){t&&c.set(e)}),[t,c])]),X=f[0],G=f[1],C=function(){var e=null!=w?w:X;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){C&&y(C)}),[C]),{selectedValue:h,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),v(e),G(e)}),[v,G,b]),tabValues:b}}},60416:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>y,contentTitle:()=>g,default:()=>X,frontMatter:()=>b,metadata:()=>h,toc:()=>I});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=n(65559),o=n(30433);n(14563);const u={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nconst screenshot = await page.screenshot();\n\n// Save the screenshot to the default key-value store\nawait Actor.setValue('my-key', screenshot, { contentType: 'image/png' });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCB1cmwgPSAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nO1xcbi8vIFN0YXJ0IGEgYnJvd3NlclxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBPcGVuIG5ldyB0YWIgaW4gdGhlIGJyb3dzZXJcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuXFxuLy8gTmF2aWdhdGUgdG8gdGhlIFVSTFxcbmF3YWl0IHBhZ2UuZ290byh1cmwpO1xcblxcbi8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG5jb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuXFxuLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgnbXkta2V5Jywgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuXFxuLy8gQ2xvc2UgUHVwcGV0ZWVyXFxuYXdhaXQgYnJvd3Nlci5jbG9zZSgpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.xy-Qn13nROyNEPEB6pUG8xQ1VfIjq56rsat4wKqhq9o"},i={code:"import { Actor } from 'apify';\nimport { launchPuppeteer, utils } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nawait utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciwgdXRpbHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgdXJsID0gJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vJztcXG4vLyBTdGFydCBhIGJyb3dzZXJcXG5jb25zdCBicm93c2VyID0gYXdhaXQgbGF1bmNoUHVwcGV0ZWVyKCk7XFxuXFxuLy8gT3BlbiBuZXcgdGFiIGluIHRoZSBicm93c2VyXFxuY29uc3QgcGFnZSA9IGF3YWl0IGJyb3dzZXIubmV3UGFnZSgpO1xcblxcbi8vIE5hdmlnYXRlIHRvIHRoZSBVUkxcXG5hd2FpdCBwYWdlLmdvdG8odXJsKTtcXG5cXG4vLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90XFxuYXdhaXQgdXRpbHMucHVwcGV0ZWVyLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleTogJ215LWtleScsIHNhdmVIdG1sOiBmYWxzZSB9KTtcXG5cXG4vLyBDbG9zZSBQdXBwZXRlZXJcXG5hd2FpdCBicm93c2VyLmNsb3NlKCk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.QSyAaQjtq2wJi2-pHooiFMBrLOELGoFYIBj8kQcDYtA"},s={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Actor.setValue(key, screenshot, { contentType: 'image/png' });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgUHVwcGV0ZWVyQ3Jhd2xlclxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUHVwcGV0ZWVyQ3Jhd2xlcih7XFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICAvLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90IHdpdGggUHVwcGV0ZWVyXFxuICAgICAgICBjb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuICAgICAgICAvLyBDb252ZXJ0IHRoZSBVUkwgaW50byBhIHZhbGlkIGtleVxcbiAgICAgICAgY29uc3Qga2V5ID0gcmVxdWVzdC51cmwucmVwbGFjZSgvWzovXS9nLCAnXycpO1xcbiAgICAgICAgLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG4gICAgICAgIGF3YWl0IEFjdG9yLnNldFZhbHVlKGtleSwgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyB9LFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.V_BcbfCWH__rcmGznaMSLm6R1wTtqF583QKH4Z3n5Uc"},p={code:"import { PuppeteerCrawler, puppeteerUtils } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await puppeteerUtils.saveSnapshot(page, { key, saveHtml: false });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIHB1cHBldGVlclV0aWxzIH0gZnJvbSAnY3Jhd2xlZSc7XFxuaW1wb3J0IHsgQWN0b3IgfSBmcm9tICdhcGlmeSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIFB1cHBldGVlckNyYXdsZXJcXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgLy8gQ29udmVydCB0aGUgVVJMIGludG8gYSB2YWxpZCBrZXlcXG4gICAgICAgIGNvbnN0IGtleSA9IHJlcXVlc3QudXJsLnJlcGxhY2UoL1s6L10vZywgJ18nKTtcXG4gICAgICAgIC8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG4gICAgICAgIGF3YWl0IHB1cHBldGVlclV0aWxzLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleSwgc2F2ZUh0bWw6IGZhbHNlIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.2SyyQ1VmxXhmOlrpTJRLqsinn3178wgSbrygIl4JJdg"};var d,m=["components"],b={id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},g=void 0,h={unversionedId:"examples/capture-screenshot",id:"version-3.1/examples/capture-screenshot",title:"Capture a screenshot using Puppeteer",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-3.1/examples/puppeteer_capture_screenshot.mdx",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_capture_screenshot.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},sidebar:"docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/examples/playwright-crawler"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/examples/puppeteer-crawler"}},y={},I=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),v={toc:I},f="wrapper";function X(e){var t=e.components,n=(0,a.Z)(e,m);return(0,c.kt)(f,(0,r.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)("p",null,"This example captures a screenshot of a web page using ",(0,c.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,c.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))),(0,c.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))),(0,c.kt)("p",null,"In both examples using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,c.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}X.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=i(n),m=a,b=p["".concat(u,".").concat(m)]||p[m]||d[m]||c;return n?r.createElement(b,l(l({ref:t},s),{},{components:n})):r.createElement(b,l({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=m;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[p]="string"==typeof e?e:a,l[1]=o;for(var i=2;i{r.d(t,{Z:()=>l});var n=r(67294),a=r(34334);const o={tabItem:"tabItem_Ymn6"};function l(e){var t=e.children,r=e.hidden,l=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(o.tabItem,l),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>d});var n=r(87462),a=r(67294),o=r(34334),l=r(63735),u=r(38224),s=r(5730);const i={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,r=e.block,u=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],m=(0,l.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,r=c.indexOf(t),n=p[r].value;n!==u&&(m(t),s(n))},f=function(e){var t,r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,a=c.indexOf(e.currentTarget)+1;r=null!=(n=c[a])?n:c[0];break;case"ArrowLeft":var o,l=c.indexOf(e.currentTarget)-1;r=null!=(o=c[l])?o:c[c.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":r},t)},p.map((function(e){var t=e.value,r=e.label,l=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:u===t?0:-1,"aria-selected":u===t,key:t,ref:function(e){return c.push(e)},onKeyDown:f,onClick:d},l,{className:(0,o.Z)("tabs__item",i.tabItem,null==l?void 0:l.className,{"tabs__item--active":u===t})}),null!=r?r:t)})))}function c(e){var t=e.lazy,r=e.children,n=e.selectedValue,o=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var l=o.find((function(e){return e.props.value===n}));return l?(0,a.cloneElement)(l,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function m(e){var t=(0,u.Y)(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",i.tabList)},a.createElement(p,(0,n.Z)({},e,t)),a.createElement(c,(0,n.Z)({},e,t)))}function d(e){var t=(0,s.Z)();return a.createElement(m,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>m});var n=r(67294),a=r(16550),o=r(34423),l=r(20636),u=r(99200);function s(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function i(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(r);return function(e){var t=(0,l.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,r=void 0!==t&&t,l=e.groupId,u=(0,a.k6)(),s=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:l});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(u.location.search);t.set(s,e),u.replace(Object.assign({},u.location,{search:t.toString()}))}}),[s,u])]}function m(e){var t,r,a,o,l=e.defaultValue,s=e.queryString,m=void 0!==s&&s,d=e.groupId,f=i(e),h=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!p({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:l,tabValues:f})})),w=h[0],v=h[1],b=c({queryString:m,groupId:d}),g=b[0],y=b[1],k=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),r=(0,u.Nk)(t),a=r[0],o=r[1],[a,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),x=k[0],C=k[1],T=function(){var e=null!=g?g:x;return p({value:e,tabValues:f})?e:null}();return(0,n.useLayoutEffect)((function(){T&&v(T)}),[T]),{selectedValue:w,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);v(e),y(e),C(e)}),[y,C,f]),tabValues:f}}},56665:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>v,contentTitle:()=>h,default:()=>k,frontMatter:()=>f,metadata:()=>w,toc:()=>b});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=r(65559),u=r(30433),s=r(14563);const i="import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nconst screenshot = await page.screenshot();\n\n// Save the screenshot to the default key-value store\nawait Actor.setValue('my-key', screenshot, { contentType: 'image/png' });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { launchPuppeteer, utils } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nawait utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",c="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Actor.setValue(key, screenshot, { contentType: 'image/png' });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",m="import { PuppeteerCrawler, puppeteerUtils } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await puppeteerUtils.saveSnapshot(page, { key, saveHtml: false });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n";var d=["components"],f={id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},h=void 0,w={unversionedId:"examples/capture-screenshot",id:"version-3.0/examples/capture-screenshot",title:"Capture a screenshot using Puppeteer",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-3.0/examples/puppeteer_capture_screenshot.mdx",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/3.0/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_capture_screenshot.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},sidebar:"docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/3.0/examples/playwright-crawler"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/3.0/examples/puppeteer-crawler"}},v={},b=[],g={toc:b},y="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,d);return(0,o.kt)(y,(0,n.Z)({},g,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("p",null,"This example captures a screenshot of a web page using ",(0,o.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,o.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,o.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,o.kt)(u.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},i)),(0,o.kt)(u.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},p))),(0,o.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,o.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,o.kt)(u.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,o.kt)(u.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},m))),(0,o.kt)("p",null,"In both examples using ",(0,o.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),i=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=i(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),c=i(r),d=a,f=c["".concat(s,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var u={};for(var s in t)hasOwnProperty.call(t,s)&&(u[s]=t[s]);u.originalType=e,u[c]="string"==typeof e?e:a,l[1]=u;for(var i=2;i{r.d(t,{Z:()=>l});var n=r(67294),a=r(34334);const o={tabItem:"tabItem_Ymn6"};function l(e){var t=e.children,r=e.hidden,l=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(o.tabItem,l),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>d});var n=r(87462),a=r(67294),o=r(34334),l=r(63735),u=r(38224),s=r(5730);const i={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,r=e.block,u=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],m=(0,l.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,r=c.indexOf(t),n=p[r].value;n!==u&&(m(t),s(n))},f=function(e){var t,r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,a=c.indexOf(e.currentTarget)+1;r=null!=(n=c[a])?n:c[0];break;case"ArrowLeft":var o,l=c.indexOf(e.currentTarget)-1;r=null!=(o=c[l])?o:c[c.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":r},t)},p.map((function(e){var t=e.value,r=e.label,l=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:u===t?0:-1,"aria-selected":u===t,key:t,ref:function(e){return c.push(e)},onKeyDown:f,onClick:d},l,{className:(0,o.Z)("tabs__item",i.tabItem,null==l?void 0:l.className,{"tabs__item--active":u===t})}),null!=r?r:t)})))}function c(e){var t=e.lazy,r=e.children,n=e.selectedValue,o=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var l=o.find((function(e){return e.props.value===n}));return l?(0,a.cloneElement)(l,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function m(e){var t=(0,u.Y)(e);return a.createElement("div",{className:(0,o.Z)("tabs-container",i.tabList)},a.createElement(p,(0,n.Z)({},e,t)),a.createElement(c,(0,n.Z)({},e,t)))}function d(e){var t=(0,s.Z)();return a.createElement(m,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>m});var n=r(67294),a=r(16550),o=r(34423),l=r(20636),u=r(99200);function s(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function i(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(r);return function(e){var t=(0,l.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,r=void 0!==t&&t,l=e.groupId,u=(0,a.k6)(),s=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:l});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(u.location.search);t.set(s,e),u.replace(Object.assign({},u.location,{search:t.toString()}))}}),[s,u])]}function m(e){var t,r,a,o,l=e.defaultValue,s=e.queryString,m=void 0!==s&&s,d=e.groupId,f=i(e),h=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!p({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:l,tabValues:f})})),w=h[0],v=h[1],b=c({queryString:m,groupId:d}),g=b[0],y=b[1],k=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),r=(0,u.Nk)(t),a=r[0],o=r[1],[a,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),x=k[0],C=k[1],T=function(){var e=null!=g?g:x;return p({value:e,tabValues:f})?e:null}();return(0,n.useLayoutEffect)((function(){T&&v(T)}),[T]),{selectedValue:w,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);v(e),y(e),C(e)}),[y,C,f]),tabValues:f}}},56665:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>v,contentTitle:()=>h,default:()=>k,frontMatter:()=>f,metadata:()=>w,toc:()=>b});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=r(65559),u=r(30433),s=r(14563);const i="import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nconst screenshot = await page.screenshot();\n\n// Save the screenshot to the default key-value store\nawait Actor.setValue('my-key', screenshot, { contentType: 'image/png' });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { launchPuppeteer, utils } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nawait utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",c="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Actor.setValue(key, screenshot, { contentType: 'image/png' });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",m="import { PuppeteerCrawler, puppeteerUtils } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await puppeteerUtils.saveSnapshot(page, { key, saveHtml: false });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n";var d=["components"],f={id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},h=void 0,w={unversionedId:"examples/capture-screenshot",id:"version-3.0/examples/capture-screenshot",title:"Capture a screenshot using Puppeteer",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-3.0/examples/puppeteer_capture_screenshot.mdx",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/3.0/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_capture_screenshot.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},sidebar:"docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/3.0/examples/playwright-crawler"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/3.0/examples/puppeteer-crawler"}},v={},b=[],g={toc:b},y="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,d);return(0,o.kt)(y,(0,n.Z)({},g,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("p",null,"This example captures a screenshot of a web page using ",(0,o.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,o.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,o.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,o.kt)(u.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},i)),(0,o.kt)(u.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},p))),(0,o.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,o.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,o.kt)(u.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,o.kt)(u.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,o.kt)("p",null,"Using ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},m))),(0,o.kt)("p",null,"In both examples using ",(0,o.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),i=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=i(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),c=i(r),d=a,f=c["".concat(s,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var u={};for(var s in t)hasOwnProperty.call(t,s)&&(u[s]=t[s]);u.originalType=e,u[c]="string"==typeof e?e:a,l[1]=u;for(var i=2;i{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>s});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],p={id_old:"version-1.3-playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",id:"playwright-handle-page-function-param"},l=void 0,c={unversionedId:"typedefs/playwright-handle-page-function-param",id:"version-1.3/typedefs/playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function-param",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunctionParam.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",id:"playwright-handle-page-function-param"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"},next:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:s},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrighthandlepagefunctionparam"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"page"},(0,i.kt)("inlineCode",{parentName:"h3"},"page")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Page")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"crawler"},(0,i.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),s=c(r),f=a,y=s["".concat(l,".").concat(f)]||s[f]||u[f]||i;return r?n.createElement(y,o(o({ref:t},d),{},{components:r})):n.createElement(y,o({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[s]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>s});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],p={id_old:"version-1.3-playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",id:"playwright-handle-page-function-param"},l=void 0,c={unversionedId:"typedefs/playwright-handle-page-function-param",id:"version-1.3/typedefs/playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function-param",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunctionParam.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",id:"playwright-handle-page-function-param"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"},next:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:s},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrighthandlepagefunctionparam"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"page"},(0,i.kt)("inlineCode",{parentName:"h3"},"page")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Page")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"crawler"},(0,i.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),s=c(r),f=a,y=s["".concat(l,".").concat(f)]||s[f]||u[f]||i;return r?n.createElement(y,o(o({ref:t},d),{},{components:r})):n.createElement(y,o({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[s]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>p,toc:()=>m});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=["components"],o={id_old:"version-2.3.0-utils",title:"utils",id:"utils"},s=void 0,p={unversionedId:"api/utils",id:"version-2.3/api/utils",title:"utils",description:"A namespace that contains various utilities.",source:"@site/versioned_docs/version-2.3/api/utils.md",sourceDirName:"api",slug:"/api/utils",permalink:"/sdk/js/docs/2.3/api/utils",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/utils.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-utils",title:"utils",id:"utils"},sidebar:"version-2.3/docs",previous:{title:"PseudoUrl",permalink:"/sdk/js/docs/2.3/api/pseudo-url"},next:{title:"utils.log",permalink:"/sdk/js/docs/2.3/api/log"}},u={},m=[{value:"utils.URL_NO_COMMAS_REGEX",id:"utilsurl_no_commas_regex",level:2},{value:"utils.URL_WITH_COMMAS_REGEX",id:"utilsurl_with_commas_regex",level:2},{value:"utils.enqueueLinks(options)",id:"utilsenqueuelinksoptions",level:2},{value:"utils.requestAsBrowser(options)",id:"utilsrequestasbrowseroptions",level:2},{value:"utils.isDocker(forceReset)",id:"utilsisdockerforcereset",level:2},{value:"utils.sleep(millis)",id:"utilssleepmillis",level:2},{value:"utils.downloadListOfUrls(options)",id:"utilsdownloadlistofurlsoptions",level:2},{value:"utils.extractUrls(options)",id:"utilsextracturlsoptions",level:2},{value:"utils.htmlToText(html)",id:"utilshtmltotexthtml",level:2},{value:"utils.purgeLocalStorage([folder])",id:"utilspurgelocalstoragefolder",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,i);return(0,l.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"utils"}),(0,l.kt)("p",null,"A namespace that contains various utilities."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"url_no_commas_regex"}),(0,l.kt)("h2",{id:"utilsurl_no_commas_regex"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.URL_NO_COMMAS_REGEX")),(0,l.kt)("p",null,"Default regular expression to match URLs in a string that may be plain text, JSON, CSV or other. It supports common URL characters and does not\nsupport URLs containing commas or spaces. The URLs also may contain Unicode letters (not symbols)."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"url_with_commas_regex"}),(0,l.kt)("h2",{id:"utilsurl_with_commas_regex"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.URL_WITH_COMMAS_REGEX")),(0,l.kt)("p",null,"Regular expression that, in addition to the default regular expression ",(0,l.kt)("inlineCode",{parentName:"p"},"URL_NO_COMMAS_REGEX"),", supports matching commas in URL path and query. Note,\nhowever, that this may prevent parsing URLs from comma delimited lists, or the URLs may become malformed."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"enqueuelinks"}),(0,l.kt)("h2",{id:"utilsenqueuelinksoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.enqueueLinks(options)")),(0,l.kt)("p",null,"The function finds elements matching a specific CSS selector (HTML anchor (",(0,l.kt)("inlineCode",{parentName:"p"},""),") by default) either in a Puppeteer page, or in a Cheerio object\n(parsed HTML), and enqueues the URLs in their ",(0,l.kt)("inlineCode",{parentName:"p"},"href")," attributes to the provided ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". If you're looking to find URLs\nin JavaScript heavy pages where links are not available in ",(0,l.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers see\n",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer#enqueuelinksbyclickingelements",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"puppeteer.enqueueLinksByClickingElements()")),"."),(0,l.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,l.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: ['https://www.example.com/handbags/[.*]', 'https://www.example.com/purses/[.*]'],\n});\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameters are passed via an options object with the following keys:"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[page]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"PuppeteerPage")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"PlaywrightPage")," - Puppeteer ",(0,l.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"Page"))," object. Either\n",(0,l.kt)("inlineCode",{parentName:"li"},"page")," or ",(0,l.kt)("inlineCode",{parentName:"li"},"$")," option must be provided."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Number")," - Limit the count of actually enqueued URLs to this number. Useful for testing across the entire crawling scope."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[$]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioAPI")," - ",(0,l.kt)("a",{parentName:"li",href:"https://github.com/cheeriojs/cheerio",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"Cheerio"))," function with loaded HTML. Either ",(0,l.kt)("inlineCode",{parentName:"li"},"page")," or ",(0,l.kt)("inlineCode",{parentName:"li"},"$")," option must be\nprovided."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,l.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[selector]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"'","a","'",'"')," - A CSS selector matching links to be enqueued."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[baseUrl]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - A base URL that will be used to resolve relative URLs when using Cheerio. Ignored when using Puppeteer, since the\nrelative URL resolution is done inside the browser automatically."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Array")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"Array.<string>")," - An array of ",(0,l.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to\nbe enqueued, or an array of strings or RegExps or plain Objects from which the ",(0,l.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,l.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,l.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,l.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,l.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,l.kt)("p",{parentName:"li"},"If ",(0,l.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,l.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,l.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,l.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,l.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,l.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,l.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,l.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,l.kt)("p",{parentName:"li"},"For example: by adding ",(0,l.kt)("inlineCode",{parentName:"p"},"keepUrlFragment: true")," to the ",(0,l.kt)("inlineCode",{parentName:"p"},"request")," object, URL fragments will not be removed when ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed."),(0,l.kt)("p",{parentName:"li"},(0,l.kt)("strong",{parentName:"p"},"Example:")),(0,l.kt)("pre",{parentName:"li"},(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.keepUrlFragment = true;\n return request;\n };\n}\n")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"requestasbrowser"}),(0,l.kt)("h2",{id:"utilsrequestasbrowseroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.requestAsBrowser(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"IMPORTANT:")," This function uses an insecure version of HTTP parser by default and also ignores SSL/TLS errors. This is very useful in scraping,\nbecause it allows bypassing certain anti-scraping walls, but it also exposes some vulnerability. For other than scraping scenarios, please set\n",(0,l.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser: false")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"ignoreSslErrors: false"),"."),(0,l.kt)("p",null,"Sends a HTTP request that looks like a request sent by a web browser, fully emulating browser's HTTP headers. It uses HTTP2 by default for Node 12+."),(0,l.kt)("p",null,"This function is useful for web scraping of websites that send the full HTML in the first response. Thanks to this function, the target web server has\nno simple way to find out the request hasn't been sent by a human's web browser. Using a headless browser for such requests is an order of magnitude\nmore resource-intensive than this function."),(0,l.kt)("p",null,"The function emulates the Chrome and Firefox web browsers. If you want more control over the browsers and their versions, use the\n",(0,l.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," property. You can find more info in the readme of the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"header-generator")),"\nlibrary."),(0,l.kt)("p",null,"Internally, the function uses the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"got-scraping"))," library to perform the request. All ",(0,l.kt)("inlineCode",{parentName:"p"},"options")," not recognized\nby this function are passed to it so see it for more details."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nconst { utils: { requestAsBrowser } } = Apify;\n\n...\n\nconst response = await requestAsBrowser({ url: 'https://www.example.com/' });\n\nconst html = response.body;\nconst status = response.statusCode;\nconst contentType = response.headers['content-type'];\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-as-browser-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestAsBrowserOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"requestAsBrowser")," configuration options.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../typedefs/request-as-browser-result",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Promise"))," - The result can be various objects, but it will always be like a\n",(0,l.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"Node.js HTTP response stream")," with a 'body' property for the parsed response body,\nunless the 'stream' option is used."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"isdocker"}),(0,l.kt)("h2",{id:"utilsisdockerforcereset"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.isDocker(forceReset)")),(0,l.kt)("p",null,"Returns a ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to true if the code is running in a Docker container."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"forceReset")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"sleep"}),(0,l.kt)("h2",{id:"utilssleepmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.sleep(millis)")),(0,l.kt)("p",null,"Returns a ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves after a specific period of time. This is useful to implement waiting in your code, e.g. to prevent overloading of\ntarget website or to avoid bot detection."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"millis")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number")," - Period of time to sleep, in milliseconds. If not a positive number, the returned promise resolves immediately.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"downloadlistofurls"}),(0,l.kt)("h2",{id:"utilsdownloadlistofurlsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.downloadListOfUrls(options)")),(0,l.kt)("p",null,"Returns a promise that resolves to an array of urls parsed from the resource available at the provided url. Optionally, custom regular expression and\nencoding may be provided."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - URL to the file"),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[encoding]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"'","utf8","'",'"')," - The encoding of the file."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,l.kt)("code",null," = URL_NO_COMMAS_REGEX")," - Custom regular expression to identify the URLs in the file to extract. The\nregular expression should be case-insensitive and have global flag set (i.e. ",(0,l.kt)("inlineCode",{parentName:"li"},"/something/gi"),").")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"extracturls"}),(0,l.kt)("h2",{id:"utilsextracturlsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.extractUrls(options)")),(0,l.kt)("p",null,"Collects all URLs in an arbitrary string to an array, optionally using a custom regular expression."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"string")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,l.kt)("code",null," = Apify.utils.URL_NO_COMMAS_REGEX"))))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"htmltotext"}),(0,l.kt)("h2",{id:"utilshtmltotexthtml"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.htmlToText(html)")),(0,l.kt)("p",null,"The function converts a HTML document to a plain text."),(0,l.kt)("p",null,"The plain text generated by the function is similar to a text captured by pressing Ctrl+A and Ctrl+C on a page when loaded in a web browser. The\nfunction doesn't aspire to preserve the formatting or to be perfectly correct with respect to HTML specifications. However, it attempts to generate\nnewlines and whitespaces in and around HTML elements to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g.\nphone numbers)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const text = htmlToText('Some text');\nconsole.log(text);\n")),(0,l.kt)("p",null,"Note that the function uses ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," to parse the HTML. Optionally, to avoid duplicate parsing of HTML and\nthus improve performance, you can pass an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed with the\n",(0,l.kt)("inlineCode",{parentName:"p"},"decodeEntities")," option set to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),". For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerio = require('cheerio');\nconst html = 'Some text';\nconst text = htmlToText(cheerio.load(html, { decodeEntities: true }));\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioAPI")," - HTML text or parsed HTML represented using a ",(0,l.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," function.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"string")," - Plain text"),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"purgelocalstorage"}),(0,l.kt)("h2",{id:"utilspurgelocalstoragefolder"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.purgeLocalStorage([folder])")),(0,l.kt)("p",null,"Cleans up the local storage folder created when testing locally. This is useful in the event you are debugging your code locally."),(0,l.kt)("p",null,"Be careful as this will remove the folder you provide and everything in it!"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[folder]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - The folder to clean up")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(n),k=r,c=m["".concat(s,".").concat(k)]||m[k]||d[k]||l;return n?a.createElement(c,i(i({ref:t},u),{},{components:n})):a.createElement(c,i({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=k;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[m]="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>p,toc:()=>m});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=["components"],o={id_old:"version-2.3.0-utils",title:"utils",id:"utils"},s=void 0,p={unversionedId:"api/utils",id:"version-2.3/api/utils",title:"utils",description:"A namespace that contains various utilities.",source:"@site/versioned_docs/version-2.3/api/utils.md",sourceDirName:"api",slug:"/api/utils",permalink:"/sdk/js/docs/2.3/api/utils",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/utils.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-utils",title:"utils",id:"utils"},sidebar:"version-2.3/docs",previous:{title:"PseudoUrl",permalink:"/sdk/js/docs/2.3/api/pseudo-url"},next:{title:"utils.log",permalink:"/sdk/js/docs/2.3/api/log"}},u={},m=[{value:"utils.URL_NO_COMMAS_REGEX",id:"utilsurl_no_commas_regex",level:2},{value:"utils.URL_WITH_COMMAS_REGEX",id:"utilsurl_with_commas_regex",level:2},{value:"utils.enqueueLinks(options)",id:"utilsenqueuelinksoptions",level:2},{value:"utils.requestAsBrowser(options)",id:"utilsrequestasbrowseroptions",level:2},{value:"utils.isDocker(forceReset)",id:"utilsisdockerforcereset",level:2},{value:"utils.sleep(millis)",id:"utilssleepmillis",level:2},{value:"utils.downloadListOfUrls(options)",id:"utilsdownloadlistofurlsoptions",level:2},{value:"utils.extractUrls(options)",id:"utilsextracturlsoptions",level:2},{value:"utils.htmlToText(html)",id:"utilshtmltotexthtml",level:2},{value:"utils.purgeLocalStorage([folder])",id:"utilspurgelocalstoragefolder",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,i);return(0,l.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"utils"}),(0,l.kt)("p",null,"A namespace that contains various utilities."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"url_no_commas_regex"}),(0,l.kt)("h2",{id:"utilsurl_no_commas_regex"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.URL_NO_COMMAS_REGEX")),(0,l.kt)("p",null,"Default regular expression to match URLs in a string that may be plain text, JSON, CSV or other. It supports common URL characters and does not\nsupport URLs containing commas or spaces. The URLs also may contain Unicode letters (not symbols)."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"url_with_commas_regex"}),(0,l.kt)("h2",{id:"utilsurl_with_commas_regex"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.URL_WITH_COMMAS_REGEX")),(0,l.kt)("p",null,"Regular expression that, in addition to the default regular expression ",(0,l.kt)("inlineCode",{parentName:"p"},"URL_NO_COMMAS_REGEX"),", supports matching commas in URL path and query. Note,\nhowever, that this may prevent parsing URLs from comma delimited lists, or the URLs may become malformed."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"enqueuelinks"}),(0,l.kt)("h2",{id:"utilsenqueuelinksoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.enqueueLinks(options)")),(0,l.kt)("p",null,"The function finds elements matching a specific CSS selector (HTML anchor (",(0,l.kt)("inlineCode",{parentName:"p"},""),") by default) either in a Puppeteer page, or in a Cheerio object\n(parsed HTML), and enqueues the URLs in their ",(0,l.kt)("inlineCode",{parentName:"p"},"href")," attributes to the provided ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". If you're looking to find URLs\nin JavaScript heavy pages where links are not available in ",(0,l.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers see\n",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer#enqueuelinksbyclickingelements",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"puppeteer.enqueueLinksByClickingElements()")),"."),(0,l.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,l.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: ['https://www.example.com/handbags/[.*]', 'https://www.example.com/purses/[.*]'],\n});\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("p",{parentName:"li"},(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameters are passed via an options object with the following keys:"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[page]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"PuppeteerPage")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"PlaywrightPage")," - Puppeteer ",(0,l.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"Page"))," object. Either\n",(0,l.kt)("inlineCode",{parentName:"li"},"page")," or ",(0,l.kt)("inlineCode",{parentName:"li"},"$")," option must be provided."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Number")," - Limit the count of actually enqueued URLs to this number. Useful for testing across the entire crawling scope."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[$]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioAPI")," - ",(0,l.kt)("a",{parentName:"li",href:"https://github.com/cheeriojs/cheerio",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"Cheerio"))," function with loaded HTML. Either ",(0,l.kt)("inlineCode",{parentName:"li"},"page")," or ",(0,l.kt)("inlineCode",{parentName:"li"},"$")," option must be\nprovided."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,l.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[selector]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"'","a","'",'"')," - A CSS selector matching links to be enqueued."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[baseUrl]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - A base URL that will be used to resolve relative URLs when using Cheerio. Ignored when using Puppeteer, since the\nrelative URL resolution is done inside the browser automatically."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Array")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"Array.<string>")," - An array of ",(0,l.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to\nbe enqueued, or an array of strings or RegExps or plain Objects from which the ",(0,l.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,l.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,l.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,l.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,l.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,l.kt)("p",{parentName:"li"},"If ",(0,l.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,l.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,l.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,l.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,l.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,l.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,l.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,l.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,l.kt)("p",{parentName:"li"},"For example: by adding ",(0,l.kt)("inlineCode",{parentName:"p"},"keepUrlFragment: true")," to the ",(0,l.kt)("inlineCode",{parentName:"p"},"request")," object, URL fragments will not be removed when ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed."),(0,l.kt)("p",{parentName:"li"},(0,l.kt)("strong",{parentName:"p"},"Example:")),(0,l.kt)("pre",{parentName:"li"},(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.keepUrlFragment = true;\n return request;\n };\n}\n")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"requestasbrowser"}),(0,l.kt)("h2",{id:"utilsrequestasbrowseroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.requestAsBrowser(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"IMPORTANT:")," This function uses an insecure version of HTTP parser by default and also ignores SSL/TLS errors. This is very useful in scraping,\nbecause it allows bypassing certain anti-scraping walls, but it also exposes some vulnerability. For other than scraping scenarios, please set\n",(0,l.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser: false")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"ignoreSslErrors: false"),"."),(0,l.kt)("p",null,"Sends a HTTP request that looks like a request sent by a web browser, fully emulating browser's HTTP headers. It uses HTTP2 by default for Node 12+."),(0,l.kt)("p",null,"This function is useful for web scraping of websites that send the full HTML in the first response. Thanks to this function, the target web server has\nno simple way to find out the request hasn't been sent by a human's web browser. Using a headless browser for such requests is an order of magnitude\nmore resource-intensive than this function."),(0,l.kt)("p",null,"The function emulates the Chrome and Firefox web browsers. If you want more control over the browsers and their versions, use the\n",(0,l.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," property. You can find more info in the readme of the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"header-generator")),"\nlibrary."),(0,l.kt)("p",null,"Internally, the function uses the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"got-scraping"))," library to perform the request. All ",(0,l.kt)("inlineCode",{parentName:"p"},"options")," not recognized\nby this function are passed to it so see it for more details."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nconst { utils: { requestAsBrowser } } = Apify;\n\n...\n\nconst response = await requestAsBrowser({ url: 'https://www.example.com/' });\n\nconst html = response.body;\nconst status = response.statusCode;\nconst contentType = response.headers['content-type'];\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-as-browser-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestAsBrowserOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"requestAsBrowser")," configuration options.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../typedefs/request-as-browser-result",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Promise"))," - The result can be various objects, but it will always be like a\n",(0,l.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"Node.js HTTP response stream")," with a 'body' property for the parsed response body,\nunless the 'stream' option is used."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"isdocker"}),(0,l.kt)("h2",{id:"utilsisdockerforcereset"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.isDocker(forceReset)")),(0,l.kt)("p",null,"Returns a ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to true if the code is running in a Docker container."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"forceReset")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"sleep"}),(0,l.kt)("h2",{id:"utilssleepmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.sleep(millis)")),(0,l.kt)("p",null,"Returns a ",(0,l.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves after a specific period of time. This is useful to implement waiting in your code, e.g. to prevent overloading of\ntarget website or to avoid bot detection."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"millis")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number")," - Period of time to sleep, in milliseconds. If not a positive number, the returned promise resolves immediately.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"downloadlistofurls"}),(0,l.kt)("h2",{id:"utilsdownloadlistofurlsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.downloadListOfUrls(options)")),(0,l.kt)("p",null,"Returns a promise that resolves to an array of urls parsed from the resource available at the provided url. Optionally, custom regular expression and\nencoding may be provided."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - URL to the file"),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[encoding]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," ",(0,l.kt)("code",null," = ",'"',"'","utf8","'",'"')," - The encoding of the file."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,l.kt)("code",null," = URL_NO_COMMAS_REGEX")," - Custom regular expression to identify the URLs in the file to extract. The\nregular expression should be case-insensitive and have global flag set (i.e. ",(0,l.kt)("inlineCode",{parentName:"li"},"/something/gi"),").")))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"extracturls"}),(0,l.kt)("h2",{id:"utilsextracturlsoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.extractUrls(options)")),(0,l.kt)("p",null,"Collects all URLs in an arbitrary string to an array, optionally using a custom regular expression."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"string")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,l.kt)("code",null," = Apify.utils.URL_NO_COMMAS_REGEX"))))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"htmltotext"}),(0,l.kt)("h2",{id:"utilshtmltotexthtml"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.htmlToText(html)")),(0,l.kt)("p",null,"The function converts a HTML document to a plain text."),(0,l.kt)("p",null,"The plain text generated by the function is similar to a text captured by pressing Ctrl+A and Ctrl+C on a page when loaded in a web browser. The\nfunction doesn't aspire to preserve the formatting or to be perfectly correct with respect to HTML specifications. However, it attempts to generate\nnewlines and whitespaces in and around HTML elements to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g.\nphone numbers)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const text = htmlToText('Some text');\nconsole.log(text);\n")),(0,l.kt)("p",null,"Note that the function uses ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," to parse the HTML. Optionally, to avoid duplicate parsing of HTML and\nthus improve performance, you can pass an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed with the\n",(0,l.kt)("inlineCode",{parentName:"p"},"decodeEntities")," option set to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),". For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerio = require('cheerio');\nconst html = 'Some text';\nconst text = htmlToText(cheerio.load(html, { decodeEntities: true }));\n")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioAPI")," - HTML text or parsed HTML represented using a ",(0,l.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," function.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"string")," - Plain text"),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"purgelocalstorage"}),(0,l.kt)("h2",{id:"utilspurgelocalstoragefolder"},(0,l.kt)("inlineCode",{parentName:"h2"},"utils.purgeLocalStorage([folder])")),(0,l.kt)("p",null,"Cleans up the local storage folder created when testing locally. This is useful in the event you are debugging your code locally."),(0,l.kt)("p",null,"Be careful as this will remove the folder you provide and everything in it!"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[folder]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - The folder to clean up")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(n),k=r,c=m["".concat(s,".").concat(k)]||m[k]||d[k]||l;return n?a.createElement(c,i(i({ref:t},u),{},{components:n})):a.createElement(c,i({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=k;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[m]="string"==typeof e?e:r,i[1]=o;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id_old:"version-1.3-accept-user-input",title:"Accept user input",id:"accept-user-input"},s=void 0,c={unversionedId:"examples/accept-user-input",id:"version-1.3/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-1.3/examples/accept_user_input.md",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/1.3/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/accept_user_input.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-accept-user-input",title:"Accept user input",id:"accept-user-input"},sidebar:"version-1.3/docs",previous:{title:"Examples",permalink:"/sdk/js/docs/1.3/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/1.3/examples/add-data-to-dataset"}},l={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const input = await Apify.getInput();\n console.log(input);\n});\n")),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,p(p({ref:t},l),{},{components:r})):n.createElement(m,p({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id_old:"version-1.3-accept-user-input",title:"Accept user input",id:"accept-user-input"},s=void 0,c={unversionedId:"examples/accept-user-input",id:"version-1.3/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-1.3/examples/accept_user_input.md",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/1.3/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/accept_user_input.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-accept-user-input",title:"Accept user input",id:"accept-user-input"},sidebar:"version-1.3/docs",previous:{title:"Examples",permalink:"/sdk/js/docs/1.3/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/1.3/examples/add-data-to-dataset"}},l={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const input = await Apify.getInput();\n console.log(input);\n});\n")),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,p(p({ref:t},l),{},{components:r})):n.createElement(m,p({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var s=a(87462),i=a(63366),r=(a(67294),a(3905)),n=["components"],l={id:"statistics",title:"Statistics"},o=void 0,c={unversionedId:"api/statistics",id:"version-2.3/api/statistics",title:"Statistics",description:"The statistics class provides an interface to collecting and logging run statistics for requests.",source:"@site/versioned_docs/version-2.3/api/Statistics.md",sourceDirName:"api",slug:"/api/statistics",permalink:"/sdk/js/docs/2.3/api/statistics",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Statistics.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"statistics",title:"Statistics"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/2.3/api/puppeteer-crawler"},next:{title:"Dataset",permalink:"/sdk/js/docs/2.3/api/dataset"}},p={},u=[{value:"Properties",id:"properties",level:2},{value:"state",id:"state",level:3},{value:"id",id:"id",level:3},{value:"requestRetryHistogram",id:"requestretryhistogram",level:3},{value:"statistics.reset()",id:"statisticsreset",level:2},{value:"statistics.calculate()",id:"statisticscalculate",level:2},{value:"statistics.startCapturing()",id:"statisticsstartcapturing",level:2},{value:"statistics.stopCapturing()",id:"statisticsstopcapturing",level:2},{value:"statistics.persistState()",id:"statisticspersiststate",level:2},{value:"statistics.toJSON()",id:"statisticstojson",level:2}],d={toc:u},k="wrapper";function m(t){var e=t.components,a=(0,i.Z)(t,n);return(0,r.kt)(k,(0,s.Z)({},d,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"statistics"}),(0,r.kt)("p",null,"The statistics class provides an interface to collecting and logging run statistics for requests."),(0,r.kt)("p",null,"All statistic information is saved on key value store under the key SDK",(0,r.kt)("em",{parentName:"p"},"CRAWLER_STATISTICS"),"*",", persists between migrations and abort/resurrect"),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"state"},(0,r.kt)("inlineCode",{parentName:"h3"},"state")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("p",null,"Current statistic state used for doing calculations on ",(0,r.kt)("a",{parentName:"p",href:"../api/statistics#calculate",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Statistics.calculate()"))," calls"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"id"},(0,r.kt)("inlineCode",{parentName:"h3"},"id")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Statistic instance id"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestretryhistogram"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Array")),(0,r.kt)("p",null,"Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reset"}),(0,r.kt)("h2",{id:"statisticsreset"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.reset()")),(0,r.kt)("p",null,"Set the current statistic instance to pristine values"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"calculate"}),(0,r.kt)("h2",{id:"statisticscalculate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.calculate()")),(0,r.kt)("p",null,"Calculate the current statistics"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"startcapturing"}),(0,r.kt)("h2",{id:"statisticsstartcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.startCapturing()")),(0,r.kt)("p",null,"Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"stopcapturing"}),(0,r.kt)("h2",{id:"statisticsstopcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.stopCapturing()")),(0,r.kt)("p",null,"Stops logging and remove event listeners, then persist"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"persiststate"}),(0,r.kt)("h2",{id:"statisticspersiststate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.persistState()")),(0,r.kt)("p",null,"Persist internal state to the key value store"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"tojson"}),(0,r.kt)("h2",{id:"statisticstojson"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.toJSON()")),(0,r.kt)("p",null,"Make this class serializable when called with ",(0,r.kt)("inlineCode",{parentName:"p"},"JSON.stringify(statsInstance)")," directly or through ",(0,r.kt)("inlineCode",{parentName:"p"},"keyValueStore.setValue('KEY', statsInstance)")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-persisted-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticPersistedState"))," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("hr",null))}m.isMDXComponent=!0},3905:(t,e,a)=>{a.d(e,{Zo:()=>p,kt:()=>m});var s=a(67294);function i(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function r(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,s)}return a}function n(t){for(var e=1;e=0||(i[a]=t[a]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(i[a]=t[a])}return i}var o=s.createContext({}),c=function(t){var e=s.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):n(n({},e),t)),a},p=function(t){var e=c(t.components);return s.createElement(o.Provider,{value:e},t.children)},u="mdxType",d={inlineCode:"code",wrapper:function(t){var e=t.children;return s.createElement(s.Fragment,{},e)}},k=s.forwardRef((function(t,e){var a=t.components,i=t.mdxType,r=t.originalType,o=t.parentName,p=l(t,["components","mdxType","originalType","parentName"]),u=c(a),k=i,m=u["".concat(o,".").concat(k)]||u[k]||d[k]||r;return a?s.createElement(m,n(n({ref:e},p),{},{components:a})):s.createElement(m,n({ref:e},p))}));function m(t,e){var a=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=a.length,n=new Array(r);n[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[u]="string"==typeof t?t:i,n[1]=l;for(var c=2;c{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var s=a(87462),i=a(63366),r=(a(67294),a(3905)),n=["components"],l={id:"statistics",title:"Statistics"},o=void 0,c={unversionedId:"api/statistics",id:"version-2.3/api/statistics",title:"Statistics",description:"The statistics class provides an interface to collecting and logging run statistics for requests.",source:"@site/versioned_docs/version-2.3/api/Statistics.md",sourceDirName:"api",slug:"/api/statistics",permalink:"/sdk/js/docs/2.3/api/statistics",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Statistics.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"statistics",title:"Statistics"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/2.3/api/puppeteer-crawler"},next:{title:"Dataset",permalink:"/sdk/js/docs/2.3/api/dataset"}},p={},u=[{value:"Properties",id:"properties",level:2},{value:"state",id:"state",level:3},{value:"id",id:"id",level:3},{value:"requestRetryHistogram",id:"requestretryhistogram",level:3},{value:"statistics.reset()",id:"statisticsreset",level:2},{value:"statistics.calculate()",id:"statisticscalculate",level:2},{value:"statistics.startCapturing()",id:"statisticsstartcapturing",level:2},{value:"statistics.stopCapturing()",id:"statisticsstopcapturing",level:2},{value:"statistics.persistState()",id:"statisticspersiststate",level:2},{value:"statistics.toJSON()",id:"statisticstojson",level:2}],d={toc:u},k="wrapper";function m(t){var e=t.components,a=(0,i.Z)(t,n);return(0,r.kt)(k,(0,s.Z)({},d,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"statistics"}),(0,r.kt)("p",null,"The statistics class provides an interface to collecting and logging run statistics for requests."),(0,r.kt)("p",null,"All statistic information is saved on key value store under the key SDK",(0,r.kt)("em",{parentName:"p"},"CRAWLER_STATISTICS"),"*",", persists between migrations and abort/resurrect"),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"state"},(0,r.kt)("inlineCode",{parentName:"h3"},"state")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("p",null,"Current statistic state used for doing calculations on ",(0,r.kt)("a",{parentName:"p",href:"../api/statistics#calculate",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Statistics.calculate()"))," calls"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"id"},(0,r.kt)("inlineCode",{parentName:"h3"},"id")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Statistic instance id"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestretryhistogram"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Array")),(0,r.kt)("p",null,"Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reset"}),(0,r.kt)("h2",{id:"statisticsreset"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.reset()")),(0,r.kt)("p",null,"Set the current statistic instance to pristine values"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"calculate"}),(0,r.kt)("h2",{id:"statisticscalculate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.calculate()")),(0,r.kt)("p",null,"Calculate the current statistics"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"startcapturing"}),(0,r.kt)("h2",{id:"statisticsstartcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.startCapturing()")),(0,r.kt)("p",null,"Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"stopcapturing"}),(0,r.kt)("h2",{id:"statisticsstopcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.stopCapturing()")),(0,r.kt)("p",null,"Stops logging and remove event listeners, then persist"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"persiststate"}),(0,r.kt)("h2",{id:"statisticspersiststate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.persistState()")),(0,r.kt)("p",null,"Persist internal state to the key value store"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"tojson"}),(0,r.kt)("h2",{id:"statisticstojson"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.toJSON()")),(0,r.kt)("p",null,"Make this class serializable when called with ",(0,r.kt)("inlineCode",{parentName:"p"},"JSON.stringify(statsInstance)")," directly or through ",(0,r.kt)("inlineCode",{parentName:"p"},"keyValueStore.setValue('KEY', statsInstance)")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-persisted-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticPersistedState"))," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("hr",null))}m.isMDXComponent=!0},3905:(t,e,a)=>{a.d(e,{Zo:()=>p,kt:()=>m});var s=a(67294);function i(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function r(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,s)}return a}function n(t){for(var e=1;e=0||(i[a]=t[a]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(i[a]=t[a])}return i}var o=s.createContext({}),c=function(t){var e=s.useContext(o),a=e;return t&&(a="function"==typeof t?t(e):n(n({},e),t)),a},p=function(t){var e=c(t.components);return s.createElement(o.Provider,{value:e},t.children)},u="mdxType",d={inlineCode:"code",wrapper:function(t){var e=t.children;return s.createElement(s.Fragment,{},e)}},k=s.forwardRef((function(t,e){var a=t.components,i=t.mdxType,r=t.originalType,o=t.parentName,p=l(t,["components","mdxType","originalType","parentName"]),u=c(a),k=i,m=u["".concat(o,".").concat(k)]||u[k]||d[k]||r;return a?s.createElement(m,n(n({ref:e},p),{},{components:a})):s.createElement(m,n({ref:e},p))}));function m(t,e){var a=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=a.length,n=new Array(r);n[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[u]="string"==typeof t?t:i,n[1]=l;for(var c=2;c{n.d(t,{Z:()=>l});var a=n(67294),i=n(88746),r=n(6141),o=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(i.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(i.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>l,T:()=>o});var a=n(67294),i=n(88746),r="https://crawlee.dev",o=function(e){var t=e.to,n=e.children,o=e.version;return a.createElement(i.default,{href:r+"/api"+(o?"/"+o:"")+"/"+t},n)},l=function(e){var t=e.to,n=e.children;return a.createElement(i.default,{href:r+"/"+t},n)}},76006:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=(n(68889),n(26569)),l=["components"],s={id:"upgrading-to-v3",title:"Upgrading to v3"},p=void 0,d={unversionedId:"upgrading/upgrading-to-v3",id:"version-3.0/upgrading/upgrading-to-v3",title:"Upgrading to v3",description:"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.",source:"@site/versioned_docs/version-3.0/upgrading/upgrading_v3.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v3",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v3",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v3.md",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v3",title:"Upgrading to v3"},sidebar:"docs",previous:{title:"Upgrading to v2",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v2"},next:{title:"Changelog",permalink:"/sdk/js/docs/3.0/changelog"}},u={},m=[{value:"Crawlee monorepo",id:"crawlee-monorepo",level:2},{value:"Installing Crawlee",id:"installing-crawlee",level:3},{value:"Full TypeScript support",id:"full-typescript-support",level:2},{value:"Docker build",id:"docker-build",level:3},{value:"Browser fingerprints",id:"browser-fingerprints",level:2},{value:"Session cookie method renames",id:"session-cookie-method-renames",level:2},{value:"Memory storage",id:"memory-storage",level:2},{value:"Purging of the default storage",id:"purging-of-the-default-storage",level:2},{value:"Renamed crawler options and interfaces",id:"renamed-crawler-options-and-interfaces",level:2},{value:"Context aware helpers",id:"context-aware-helpers",level:2},{value:"Enqueuing links",id:"enqueuing-links",level:3},{value:"Implicit RequestQueue instance",id:"implicit-requestqueue-instance",level:2},{value:"crawler.addRequests()",id:"crawleraddrequests",level:2},{value:"Less verbose error logging",id:"less-verbose-error-logging",level:2},{value:"Request.label shortcut",id:"requestlabel-shortcut",level:2},{value:"Removal of requestAsBrowser",id:"removal-of-requestasbrowser",level:2},{value:"How to use sendRequest()?",id:"how-to-use-sendrequest",level:3},{value:"Removed options",id:"removed-options",level:3},{value:"Renamed options",id:"renamed-options",level:3},{value:"payload",id:"payload",level:4},{value:"ignoreSslErrors",id:"ignoresslerrors",level:4},{value:"header-generator options",id:"header-generator-options",level:4},{value:"timeoutSecs",id:"timeoutsecs",level:4},{value:"throwOnHttpErrors",id:"throwonhttperrors",level:4},{value:"decodeBody",id:"decodebody",level:4},{value:"abortFunction",id:"abortfunction",level:4},{value:"Removal of browser pool plugin mixing",id:"removal-of-browser-pool-plugin-mixing",level:2},{value:"Handling requests outside of browser",id:"handling-requests-outside-of-browser",level:2},{value:"Logging",id:"logging",level:2},{value:"Auto-saved crawler state",id:"auto-saved-crawler-state",level:2},{value:"Apify SDK",id:"apify-sdk",level:2},{value:"Events",id:"events",level:3},{value:"Smaller/internal breaking changes",id:"smallerinternal-breaking-changes",level:2}],c={toc:m},k="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(k,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3."),(0,r.kt)("admonition",{title:"Crawlee vs Apify SDK v2",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Up until version 3 of ",(0,r.kt)("inlineCode",{parentName:"p"},"apify"),", the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/crawlee",target:"_blank",rel:"noopener"},"Crawlee"),", the new web-scraping library, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package on NPM"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/apify-sdk-js",target:"_blank",rel:"noopener"},"Apify SDK"),", helpers for the Apify platform, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"apify"))," package on NPM"))),(0,r.kt)("h2",{id:"crawlee-monorepo"},"Crawlee monorepo"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package consists of several smaller packages, released separately under ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee")," namespace:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/core"),": the base for all the crawler implementations, also contains things like ",(0,r.kt)("inlineCode",{parentName:"li"},"Request"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestQueue"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestList")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Dataset")," classes"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/basic"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BasicCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/http"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"HttpCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"DOMCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BrowserCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/memory-storage"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"@apify/storage-local")," alternative"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser-pool"),": previously ",(0,r.kt)("inlineCode",{parentName:"li"},"browser-pool")," package"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/utils"),": utility methods"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/types"),": holds TS interfaces mainly about the ",(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient"))),(0,r.kt)("h3",{id:"installing-crawlee"},"Installing Crawlee"),(0,r.kt)("p",null,"Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright")," if you plan on using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," - it already contains everything from the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/browser")," package, which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/basic"),", which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/core"),"."),(0,r.kt)("p",null,"If we don't care much about additional code being pulled in, we can just use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package, which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee\n")),(0,r.kt)("p",null,"Or if all we need is cheerio support, we can install only ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/cheerio"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @crawlee/cheerio\n")),(0,r.kt)("p",null,"When using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer"),", we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee playwright\n# or npm install @crawlee/playwright playwright\n")),(0,r.kt)("p",null,"Alternatively we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sometimes you might want to use some utility methods from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/utils"),", so you might want to install that as well. This package contains some utilities that were previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils"),". Browser related utilities can be also found in the crawler packages (e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright"),").")),(0,r.kt)("h2",{id:"full-typescript-support"},"Full TypeScript support"),(0,r.kt)("p",null,"Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," package. Don't forget to set the ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"target")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"ES2022")," or above to be able to use top level await."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," config has ",(0,r.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#noImplicitAny",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"noImplicitAny"))," enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="tsconfig.json"',title:'"tsconfig.json"'},'{\n "extends": "@apify/tsconfig",\n "compilerOptions": {\n "module": "ES2022",\n "target": "ES2022",\n "outDir": "dist",\n "lib": ["DOM"]\n },\n "include": [\n "./src/**/*"\n ]\n}\n')),(0,r.kt)("h3",{id:"docker-build"},"Docker build"),(0,r.kt)("p",null,"For ",(0,r.kt)("inlineCode",{parentName:"p"},"Dockerfile")," we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-dockerfile",metastring:'title="Dockerfile"',title:'"Dockerfile"'},'# using multistage build, as we need dev deps to build the TS source code\nFROM apify/actor-node:16 AS builder\n\n# copy all files, install all dependencies (including dev deps) and build the project\nCOPY . ./\nRUN npm install --include=dev \\\n && npm run build\n\n# create final image\nFROM apify/actor-node:16\n# copy only necessary files\nCOPY --from=builder /usr/src/app/package*.json ./\nCOPY --from=builder /usr/src/app/README.md ./\nCOPY --from=builder /usr/src/app/dist ./dist\nCOPY --from=builder /usr/src/app/apify.json ./apify.json\nCOPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json\n\n# install only prod deps\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --only=prod --no-optional --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# run compiled code\nCMD npm run start:prod\n')),(0,r.kt)("h2",{id:"browser-fingerprints"},"Browser fingerprints"),(0,r.kt)("p",null,"Previously we had a magical ",(0,r.kt)("inlineCode",{parentName:"p"},"stealth")," option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints."),(0,r.kt)("p",null,"In case we don't want to have dynamic fingerprints, we can disable this behaviour via ",(0,r.kt)("inlineCode",{parentName:"p"},"useFingerprints")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: false,\n },\n});\n")),(0,r.kt)("h2",{id:"session-cookie-method-renames"},"Session cookie method renames"),(0,r.kt)("p",null,"Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getPuppeteerCookies()")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setPuppeteerCookies()"),". Since this method could be used for any of our crawlers, not just ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),", the methods have been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getCookies()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setCookies()")," respectively. Otherwise, their usage is exactly the same!"),(0,r.kt)("h2",{id:"memory-storage"},"Memory storage"),(0,r.kt)("p",null,"When we store some data or intermediate state (like the one ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," holds), we now use ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/memory-storage")," by default. It is an alternative to the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", that stores the state inside memory (as opposed to SQLite database used by ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),"). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the ",(0,r.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file)."),(0,r.kt)("p",null,"When we want to run the crawler on Apify platform, we need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main"),", which will automatically switch the storage client to ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when on the Apify platform."),(0,r.kt)("p",null,"We can still use the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", to do it, first install it pass it to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," options:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local")," v2.1.0+ is required for Crawlee")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\nimport { ApifyStorageLocal } from '@apify/storage-local';\n\nconst storage = new ApifyStorageLocal(/* options like `enableWalMode` belong here */);\nawait Actor.init({ storage });\n")),(0,r.kt)("h2",{id:"purging-of-the-default-storage"},"Purging of the default storage"),(0,r.kt)("p",null,"Previously the state was preserved between local runs, and we had to use ",(0,r.kt)("inlineCode",{parentName:"p"},"--purge")," argument of the ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-cli"),". With Crawlee, this is now the default behaviour, we purge the storage automatically on ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init/main")," call. We can opt out of it via ",(0,r.kt)("inlineCode",{parentName:"p"},"purge: false")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," options."),(0,r.kt)("h2",{id:"renamed-crawler-options-and-interfaces"},"Renamed crawler options and interfaces"),(0,r.kt)("p",null,"Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"requestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"navigationTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleFailedRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"failedRequestHandler"))),(0,r.kt)("p",null,"We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CheerioHandlePageInputs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawlingContext"))),(0,r.kt)("h2",{id:"context-aware-helpers"},"Context aware helpers"),(0,r.kt)("p",null,"Some utilities previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils")," namespace are now moved to the crawling context and are ",(0,r.kt)("em",{parentName:"p"},"context aware"),". This means they have some parameters automatically filled in from the context, like the current ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," instance or current ",(0,r.kt)("inlineCode",{parentName:"p"},"Page")," object, or the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," bound to the crawler."),(0,r.kt)("h3",{id:"enqueuing-links"},"Enqueuing links"),(0,r.kt)("p",null,"One common helper that received more attention is the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks"),". As mentioned above, it is context aware - we no longer need pass in the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," arguments (or the cheerio handle ",(0,r.kt)("inlineCode",{parentName:"p"},"$"),"). In addition to that, it now offers 3 enqueuing strategies:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.All")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'all'"),"): Matches any URLs found"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameHostname")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-hostname'"),") Matches any URLs that have the same subdomain as the base URL (default)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameDomain")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-domain'"),") Matches any URLs that have the same domain name. For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://wow.an.example.com")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com")," will both be matched for a base url of ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com"),".")),(0,r.kt)("p",null,"This means we can even call ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain."),(0,r.kt)("p",null,"Moreover, we can specify patterns the URL should match via globs:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n async requestHandler({ enqueueLinks }) {\n await enqueueLinks({\n globs: ['https://crawlee.dev/*/*'],\n // we can also use `regexps` and `pseudoUrls` keys here\n });\n },\n});\n")),(0,r.kt)("h2",{id:"implicit-requestqueue-instance"},"Implicit ",(0,r.kt)("inlineCode",{parentName:"h2"},"RequestQueue")," instance"),(0,r.kt)("p",null,"All crawlers now have the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance automatically available via ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance manually, and we can just use ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.addRequests()")," method described underneath."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can still create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," explicitly, the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method will respect that and return the instance provided via crawler options.")),(0,r.kt)("h2",{id:"crawleraddrequests"},(0,r.kt)("inlineCode",{parentName:"h2"},"crawler.addRequests()")),(0,r.kt)("p",null,"We can now add multiple requests in batches. The newly added ",(0,r.kt)("inlineCode",{parentName:"p"},"addRequests")," method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// will resolve right after the initial batch of 1000 requests is added\nconst result = await crawler.addRequests([/* many requests, can be even millions */]);\n\n// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise\nawait result.waitForAllRequestsToBeAdded;\n")),(0,r.kt)("h2",{id:"less-verbose-error-logging"},"Less verbose error logging"),(0,r.kt)("p",null,"Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"CRAWLEE_VERBOSE_LOG")," env var."),(0,r.kt)("h2",{id:"requestlabel-shortcut"},(0,r.kt)("inlineCode",{parentName:"h2"},"Request.label")," shortcut"),(0,r.kt)("p",null,"Labeling requests used to work via the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData")," object. With Crawlee, we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.label")," shortcut. It is implemented as a ",(0,r.kt)("inlineCode",{parentName:"p"},"get/set")," pair, using the value from ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData"),". The support for this shortcut is also added to the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," options interface."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"async requestHandler({ request, enqueueLinks }) {\n if (request.label !== 'DETAIL') {\n await enqueueLinks({\n globs: ['...'],\n label: 'DETAIL',\n });\n }\n}\n")),(0,r.kt)("h2",{id:"removal-of-requestasbrowser"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h2"},"requestAsBrowser")),(0,r.kt)("p",null,"In v1 we replaced the underlying implementation of ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," to be just a proxy over calling ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," - our custom extension to ",(0,r.kt)("inlineCode",{parentName:"p"},"got")," that tries to mimic the real browsers as much as possible. With v3, we are removing the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser"),", encouraging the use of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," directly."),(0,r.kt)("p",null,"For easier migration, we also added ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()")," helper that allows processing the context bound ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," object through ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping")),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new BasicCrawler({\n async requestHandler({ sendRequest, log }) {\n // we can use the options parameter to override gotScraping options\n const res = await sendRequest({ responseType: 'json' });\n log.info('received body', res.body);\n },\n});\n")),(0,r.kt)("h3",{id:"how-to-use-sendrequest"},"How to use ",(0,r.kt)("inlineCode",{parentName:"h3"},"sendRequest()"),"?"),(0,r.kt)("p",null,"See ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/guides/got-scraping",target:"_blank",rel:"noopener"},"the Got Scraping guide"),"."),(0,r.kt)("h3",{id:"removed-options"},"Removed options"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option has been removed. It's permanently set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," in order to better mimic browsers' behavior."),(0,r.kt)("p",null,"Got Scraping automatically performs protocol negotiation, hence we removed the ",(0,r.kt)("inlineCode",{parentName:"p"},"useHttp2")," option. It's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!"),(0,r.kt)("h3",{id:"renamed-options"},"Renamed options"),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," approach, some of the options were named differently. Here's a list of renamed options:"),(0,r.kt)("h4",{id:"payload"},(0,r.kt)("inlineCode",{parentName:"h4"},"payload")),(0,r.kt)("p",null,"This options represents the body to send. It could be a ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"Buffer"),". However, there is no ",(0,r.kt)("inlineCode",{parentName:"p"},"payload")," option anymore. You need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"body")," instead. Or, if you wish to send JSON, ",(0,r.kt)("inlineCode",{parentName:"p"},"json"),". Here's an example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, payload: 'Hello, world!' });\nawait Apify.utils.requestAsBrowser({ \u2026, payload: Buffer.from('c0ffe', 'hex') });\nawait Apify.utils.requestAsBrowser({ \u2026, json: { hello: 'world' } });\n\n// After:\nawait gotScraping({ \u2026, body: 'Hello, world!' });\nawait gotScraping({ \u2026, body: Buffer.from('c0ffe', 'hex') });\nawait gotScraping({ \u2026, json: { hello: 'world' } });\n")),(0,r.kt)("h4",{id:"ignoresslerrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"ignoreSslErrors")),(0,r.kt)("p",null,"It has been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"https.rejectUnauthorized"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," for convenience. However, if you want to make sure the connection is secure, you can do the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, ignoreSslErrors: false });\n\n// After:\nawait gotScraping({ \u2026, https: { rejectUnauthorized: true } });\n")),(0,r.kt)("p",null,"Please note: the meanings are opposite! So we needed to invert the values as well."),(0,r.kt)("h4",{id:"header-generator-options"},(0,r.kt)("inlineCode",{parentName:"h4"},"header-generator")," options"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"useMobileVersion"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"languageCode")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"countryCode")," no longer exist. Instead, you need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," directly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n useMobileVersion: true,\n languageCode: 'en',\n countryCode: 'US',\n});\n\n// After:\nawait gotScraping({\n \u2026,\n headerGeneratorOptions: {\n devices: ['mobile'], // or ['desktop']\n locales: ['en-US'],\n },\n});\n")),(0,r.kt)("h4",{id:"timeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h4"},"timeoutSecs")),(0,r.kt)("p",null,"In order to set a timeout, use ",(0,r.kt)("inlineCode",{parentName:"p"},"timeout.request")," (which is ",(0,r.kt)("strong",{parentName:"p"},"milliseconds")," now)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n timeoutSecs: 30,\n});\n\n// After:\nawait gotScraping({\n \u2026,\n timeout: {\n request: 30 * 1000,\n },\n});\n")),(0,r.kt)("h4",{id:"throwonhttperrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"throwOnHttpErrors")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"throwOnHttpErrors")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"throwHttpErrors"),". This options throws on unsuccessful HTTP status codes, for example ",(0,r.kt)("inlineCode",{parentName:"p"},"404"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h4",{id:"decodebody"},(0,r.kt)("inlineCode",{parentName:"h4"},"decodeBody")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"decodeBody")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"decompress"),". This options decompresses the body. Defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - please do not change this or websites will break (unless you know what you're doing!)."),(0,r.kt)("h4",{id:"abortfunction"},(0,r.kt)("inlineCode",{parentName:"h4"},"abortFunction")),(0,r.kt)("p",null,"This function used to make the promise throw on specific responses, if it returned ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". However, it wasn't that useful."),(0,r.kt)("p",null,"You probably want to cancel the request instead, which you can do in the following way:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const promise = gotScraping(\u2026);\n\npromise.on('request', request => {\n // Please note this is not a Got Request instance, but a ClientRequest one.\n // https://nodejs.org/api/http.html#class-httpclientrequest\n\n if (request.protocol !== 'https:') {\n // Unsecure request, abort.\n promise.cancel();\n\n // If you set `isStream` to `true`, please use `stream.destroy()` instead.\n }\n});\n\nconst response = await promise;\n")),(0,r.kt)("h2",{id:"removal-of-browser-pool-plugin-mixing"},"Removal of browser pool plugin mixing"),(0,r.kt)("p",null,"Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type)."),(0,r.kt)("admonition",{title:"Confused?",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!")),(0,r.kt)("h2",{id:"handling-requests-outside-of-browser"},"Handling requests outside of browser"),(0,r.kt)("p",null,"One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.skipNavigation")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()"),"."),(0,r.kt)("p",null,"Take a look at how to achieve this by checking out the ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/examples/skip-navigation",target:"_blank",rel:"noopener"},"Skipping navigation for certain requests")," example!"),(0,r.kt)("h2",{id:"logging"},"Logging"),(0,r.kt)("p",null,"Crawlee exports the default ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance directly as a named export. We also have a scoped ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ log, request }) {\n log.info(`Opened ${request.loadedUrl}`);\n },\n});\n")),(0,r.kt)("h2",{id:"auto-saved-crawler-state"},"Auto-saved crawler state"),(0,r.kt)("p",null,"Every crawler instance now has ",(0,r.kt)("inlineCode",{parentName:"p"},"useState()")," method that will return a state object we can use. It will be automatically saved when ",(0,r.kt)("inlineCode",{parentName:"p"},"persistState")," event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ crawler }) {\n const state = await crawler.useState({ foo: [] as number[] });\n // just change the value, no need to care about saving it\n state.foo.push(123);\n },\n});\n")),(0,r.kt)("h2",{id:"apify-sdk"},"Apify SDK"),(0,r.kt)("p",null,"The Apify platform helpers can be now found in the Apify SDK (",(0,r.kt)("inlineCode",{parentName:"p"},"apify")," NPM package). It exports the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor")," class that offers following static helpers:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient")," shortcuts: ",(0,r.kt)("inlineCode",{parentName:"li"},"addWebhook()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"call()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"callTask()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"metamorph()")),(0,r.kt)("li",{parentName:"ul"},"helpers for running on Apify platform: ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"exit()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"fail()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"main()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"isAtHome()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"createProxyConfiguration()")),(0,r.kt)("li",{parentName:"ul"},"storage support: ",(0,r.kt)("inlineCode",{parentName:"li"},"getInput()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"getValue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openDataset()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openKeyValueStore()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openRequestQueue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"pushData()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"setValue()")),(0,r.kt)("li",{parentName:"ul"},"events support: ",(0,r.kt)("inlineCode",{parentName:"li"},"on()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"off()")),(0,r.kt)("li",{parentName:"ul"},"other utilities: ",(0,r.kt)("inlineCode",{parentName:"li"},"getEnv()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"newClient()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"reboot()"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," is now just a syntax sugar around calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," at the beginning and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.init();\n// your code\nawait Actor.exit('Crawling finished!');\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.main(async () => {\n // your code\n}, { statusMessage: 'Crawling finished!' });\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," will conditionally set the storage implementation of Crawlee to the ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," will handle the tear down and calls ",(0,r.kt)("inlineCode",{parentName:"p"},"process.exit()")," to ensure our process won't hang indefinitely for some reason."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"Apify SDK (v2) exports ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.events"),", which is an ",(0,r.kt)("inlineCode",{parentName:"p"},"EventEmitter")," instance. With Crawlee, the events are managed by ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," class instead. We can either access it via ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.eventManager")," getter, or use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.on")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.off")," shortcuts instead."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-diff"},"-Apify.events.on(...);\n+Actor.on(...);\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can also get the ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," instance via ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration.getEventManager()"),".")),(0,r.kt)("p",null,"In addition to the existing events, we now have an ",(0,r.kt)("inlineCode",{parentName:"p"},"exit")," event fired when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," (which is called at the end of ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main()"),"). This event allows you to gracefully shut down any resources when ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit")," is called."),(0,r.kt)("h2",{id:"smallerinternal-breaking-changes"},"Smaller/internal breaking changes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.call()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.actor(actorId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.callTask()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.metamorph()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).metamorph(input, options)"),", while also taking the ACTOR_RUN_ID inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.waitForRunToFinish()")," has been removed, use ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.waitForFinish()")," instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Actor.main/init")," purges the storage by default"),(0,r.kt)("li",{parentName:"ul"},"remove ",(0,r.kt)("inlineCode",{parentName:"li"},"purgeLocalStorage")," helper, move purging to the storage class directly",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient")," interface now has optional ",(0,r.kt)("inlineCode",{parentName:"li"},"purge")," method"),(0,r.kt)("li",{parentName:"ul"},"purging happens automatically via ",(0,r.kt)("inlineCode",{parentName:"li"},"Actor.init()")," (you can opt out via ",(0,r.kt)("inlineCode",{parentName:"li"},"purge: false")," in the options of ",(0,r.kt)("inlineCode",{parentName:"li"},"init/main")," methods)"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"QueueOperationInfo.request")," is no longer available"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.handledAt")," is now string date in ISO format"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.inProgress")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Request.reclaimed")," are now ",(0,r.kt)("inlineCode",{parentName:"li"},"Set"),"s instead of POJOs"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"injectUnderscore")," from puppeteer utils has been removed"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"APIFY_MEMORY_MBYTES")," is no longer taken into account, use ",(0,r.kt)("inlineCode",{parentName:"li"},"CRAWLEE_AVAILABLE_MEMORY_RATIO")," instead"),(0,r.kt)("li",{parentName:"ul"},"some ",(0,r.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," options are no longer available:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"cpuSnapshotIntervalSecs")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"memorySnapshotIntervalSecs")," has been replaced with top level ",(0,r.kt)("inlineCode",{parentName:"li"},"systemInfoIntervalMillis")," configuration"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"maxUsedCpuRatio")," has been moved to the top level configuration"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ProxyConfiguration.newUrlFunction")," can be async. ",(0,r.kt)("inlineCode",{parentName:"li"},".newUrl()")," and ",(0,r.kt)("inlineCode",{parentName:"li"},".newProxyInfo()")," now return promises."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"prepareRequestFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"postResponseFunction")," options are removed, use navigation hooks instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"gotoFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"gotoTimeoutSecs")," are removed"),(0,r.kt)("li",{parentName:"ul"},"removed compatibility fix for old/broken request queues with null ",(0,r.kt)("inlineCode",{parentName:"li"},"Request")," props"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintsOptions")," renamed to ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," (",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprints")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprint"),")."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," now accept ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintCacheSize")," (instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintPerProxyCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintPerProxyCacheSize"),", which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=i,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p{n.d(t,{Z:()=>l});var a=n(67294),i=n(88746),r=n(6141),o=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(i.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(i.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>l,T:()=>o});var a=n(67294),i=n(88746),r="https://crawlee.dev",o=function(e){var t=e.to,n=e.children,o=e.version;return a.createElement(i.default,{href:r+"/api"+(o?"/"+o:"")+"/"+t},n)},l=function(e){var t=e.to,n=e.children;return a.createElement(i.default,{href:r+"/"+t},n)}},76006:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=(n(68889),n(26569)),l=["components"],s={id:"upgrading-to-v3",title:"Upgrading to v3"},p=void 0,d={unversionedId:"upgrading/upgrading-to-v3",id:"version-3.0/upgrading/upgrading-to-v3",title:"Upgrading to v3",description:"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.",source:"@site/versioned_docs/version-3.0/upgrading/upgrading_v3.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v3",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v3",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v3.md",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v3",title:"Upgrading to v3"},sidebar:"docs",previous:{title:"Upgrading to v2",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v2"},next:{title:"Changelog",permalink:"/sdk/js/docs/3.0/changelog"}},u={},m=[{value:"Crawlee monorepo",id:"crawlee-monorepo",level:2},{value:"Installing Crawlee",id:"installing-crawlee",level:3},{value:"Full TypeScript support",id:"full-typescript-support",level:2},{value:"Docker build",id:"docker-build",level:3},{value:"Browser fingerprints",id:"browser-fingerprints",level:2},{value:"Session cookie method renames",id:"session-cookie-method-renames",level:2},{value:"Memory storage",id:"memory-storage",level:2},{value:"Purging of the default storage",id:"purging-of-the-default-storage",level:2},{value:"Renamed crawler options and interfaces",id:"renamed-crawler-options-and-interfaces",level:2},{value:"Context aware helpers",id:"context-aware-helpers",level:2},{value:"Enqueuing links",id:"enqueuing-links",level:3},{value:"Implicit RequestQueue instance",id:"implicit-requestqueue-instance",level:2},{value:"crawler.addRequests()",id:"crawleraddrequests",level:2},{value:"Less verbose error logging",id:"less-verbose-error-logging",level:2},{value:"Request.label shortcut",id:"requestlabel-shortcut",level:2},{value:"Removal of requestAsBrowser",id:"removal-of-requestasbrowser",level:2},{value:"How to use sendRequest()?",id:"how-to-use-sendrequest",level:3},{value:"Removed options",id:"removed-options",level:3},{value:"Renamed options",id:"renamed-options",level:3},{value:"payload",id:"payload",level:4},{value:"ignoreSslErrors",id:"ignoresslerrors",level:4},{value:"header-generator options",id:"header-generator-options",level:4},{value:"timeoutSecs",id:"timeoutsecs",level:4},{value:"throwOnHttpErrors",id:"throwonhttperrors",level:4},{value:"decodeBody",id:"decodebody",level:4},{value:"abortFunction",id:"abortfunction",level:4},{value:"Removal of browser pool plugin mixing",id:"removal-of-browser-pool-plugin-mixing",level:2},{value:"Handling requests outside of browser",id:"handling-requests-outside-of-browser",level:2},{value:"Logging",id:"logging",level:2},{value:"Auto-saved crawler state",id:"auto-saved-crawler-state",level:2},{value:"Apify SDK",id:"apify-sdk",level:2},{value:"Events",id:"events",level:3},{value:"Smaller/internal breaking changes",id:"smallerinternal-breaking-changes",level:2}],c={toc:m},k="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(k,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3."),(0,r.kt)("admonition",{title:"Crawlee vs Apify SDK v2",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Up until version 3 of ",(0,r.kt)("inlineCode",{parentName:"p"},"apify"),", the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/crawlee",target:"_blank",rel:"noopener"},"Crawlee"),", the new web-scraping library, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package on NPM"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/apify-sdk-js",target:"_blank",rel:"noopener"},"Apify SDK"),", helpers for the Apify platform, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"apify"))," package on NPM"))),(0,r.kt)("h2",{id:"crawlee-monorepo"},"Crawlee monorepo"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package consists of several smaller packages, released separately under ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee")," namespace:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/core"),": the base for all the crawler implementations, also contains things like ",(0,r.kt)("inlineCode",{parentName:"li"},"Request"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestQueue"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestList")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Dataset")," classes"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/basic"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BasicCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/http"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"HttpCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"DOMCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BrowserCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/memory-storage"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"@apify/storage-local")," alternative"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser-pool"),": previously ",(0,r.kt)("inlineCode",{parentName:"li"},"browser-pool")," package"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/utils"),": utility methods"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/types"),": holds TS interfaces mainly about the ",(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient"))),(0,r.kt)("h3",{id:"installing-crawlee"},"Installing Crawlee"),(0,r.kt)("p",null,"Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright")," if you plan on using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," - it already contains everything from the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/browser")," package, which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/basic"),", which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/core"),"."),(0,r.kt)("p",null,"If we don't care much about additional code being pulled in, we can just use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package, which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee\n")),(0,r.kt)("p",null,"Or if all we need is cheerio support, we can install only ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/cheerio"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @crawlee/cheerio\n")),(0,r.kt)("p",null,"When using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer"),", we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee playwright\n# or npm install @crawlee/playwright playwright\n")),(0,r.kt)("p",null,"Alternatively we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sometimes you might want to use some utility methods from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/utils"),", so you might want to install that as well. This package contains some utilities that were previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils"),". Browser related utilities can be also found in the crawler packages (e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright"),").")),(0,r.kt)("h2",{id:"full-typescript-support"},"Full TypeScript support"),(0,r.kt)("p",null,"Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," package. Don't forget to set the ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"target")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"ES2022")," or above to be able to use top level await."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," config has ",(0,r.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#noImplicitAny",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"noImplicitAny"))," enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="tsconfig.json"',title:'"tsconfig.json"'},'{\n "extends": "@apify/tsconfig",\n "compilerOptions": {\n "module": "ES2022",\n "target": "ES2022",\n "outDir": "dist",\n "lib": ["DOM"]\n },\n "include": [\n "./src/**/*"\n ]\n}\n')),(0,r.kt)("h3",{id:"docker-build"},"Docker build"),(0,r.kt)("p",null,"For ",(0,r.kt)("inlineCode",{parentName:"p"},"Dockerfile")," we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-dockerfile",metastring:'title="Dockerfile"',title:'"Dockerfile"'},'# using multistage build, as we need dev deps to build the TS source code\nFROM apify/actor-node:16 AS builder\n\n# copy all files, install all dependencies (including dev deps) and build the project\nCOPY . ./\nRUN npm install --include=dev \\\n && npm run build\n\n# create final image\nFROM apify/actor-node:16\n# copy only necessary files\nCOPY --from=builder /usr/src/app/package*.json ./\nCOPY --from=builder /usr/src/app/README.md ./\nCOPY --from=builder /usr/src/app/dist ./dist\nCOPY --from=builder /usr/src/app/apify.json ./apify.json\nCOPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json\n\n# install only prod deps\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --only=prod --no-optional --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# run compiled code\nCMD npm run start:prod\n')),(0,r.kt)("h2",{id:"browser-fingerprints"},"Browser fingerprints"),(0,r.kt)("p",null,"Previously we had a magical ",(0,r.kt)("inlineCode",{parentName:"p"},"stealth")," option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints."),(0,r.kt)("p",null,"In case we don't want to have dynamic fingerprints, we can disable this behaviour via ",(0,r.kt)("inlineCode",{parentName:"p"},"useFingerprints")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: false,\n },\n});\n")),(0,r.kt)("h2",{id:"session-cookie-method-renames"},"Session cookie method renames"),(0,r.kt)("p",null,"Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getPuppeteerCookies()")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setPuppeteerCookies()"),". Since this method could be used for any of our crawlers, not just ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),", the methods have been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getCookies()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setCookies()")," respectively. Otherwise, their usage is exactly the same!"),(0,r.kt)("h2",{id:"memory-storage"},"Memory storage"),(0,r.kt)("p",null,"When we store some data or intermediate state (like the one ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," holds), we now use ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/memory-storage")," by default. It is an alternative to the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", that stores the state inside memory (as opposed to SQLite database used by ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),"). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the ",(0,r.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file)."),(0,r.kt)("p",null,"When we want to run the crawler on Apify platform, we need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main"),", which will automatically switch the storage client to ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when on the Apify platform."),(0,r.kt)("p",null,"We can still use the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", to do it, first install it pass it to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," options:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local")," v2.1.0+ is required for Crawlee")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\nimport { ApifyStorageLocal } from '@apify/storage-local';\n\nconst storage = new ApifyStorageLocal(/* options like `enableWalMode` belong here */);\nawait Actor.init({ storage });\n")),(0,r.kt)("h2",{id:"purging-of-the-default-storage"},"Purging of the default storage"),(0,r.kt)("p",null,"Previously the state was preserved between local runs, and we had to use ",(0,r.kt)("inlineCode",{parentName:"p"},"--purge")," argument of the ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-cli"),". With Crawlee, this is now the default behaviour, we purge the storage automatically on ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init/main")," call. We can opt out of it via ",(0,r.kt)("inlineCode",{parentName:"p"},"purge: false")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," options."),(0,r.kt)("h2",{id:"renamed-crawler-options-and-interfaces"},"Renamed crawler options and interfaces"),(0,r.kt)("p",null,"Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"requestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"navigationTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleFailedRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"failedRequestHandler"))),(0,r.kt)("p",null,"We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CheerioHandlePageInputs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawlingContext"))),(0,r.kt)("h2",{id:"context-aware-helpers"},"Context aware helpers"),(0,r.kt)("p",null,"Some utilities previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils")," namespace are now moved to the crawling context and are ",(0,r.kt)("em",{parentName:"p"},"context aware"),". This means they have some parameters automatically filled in from the context, like the current ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," instance or current ",(0,r.kt)("inlineCode",{parentName:"p"},"Page")," object, or the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," bound to the crawler."),(0,r.kt)("h3",{id:"enqueuing-links"},"Enqueuing links"),(0,r.kt)("p",null,"One common helper that received more attention is the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks"),". As mentioned above, it is context aware - we no longer need pass in the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," arguments (or the cheerio handle ",(0,r.kt)("inlineCode",{parentName:"p"},"$"),"). In addition to that, it now offers 3 enqueuing strategies:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.All")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'all'"),"): Matches any URLs found"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameHostname")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-hostname'"),") Matches any URLs that have the same subdomain as the base URL (default)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameDomain")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-domain'"),") Matches any URLs that have the same domain name. For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://wow.an.example.com")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com")," will both be matched for a base url of ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com"),".")),(0,r.kt)("p",null,"This means we can even call ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain."),(0,r.kt)("p",null,"Moreover, we can specify patterns the URL should match via globs:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n async requestHandler({ enqueueLinks }) {\n await enqueueLinks({\n globs: ['https://crawlee.dev/*/*'],\n // we can also use `regexps` and `pseudoUrls` keys here\n });\n },\n});\n")),(0,r.kt)("h2",{id:"implicit-requestqueue-instance"},"Implicit ",(0,r.kt)("inlineCode",{parentName:"h2"},"RequestQueue")," instance"),(0,r.kt)("p",null,"All crawlers now have the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance automatically available via ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance manually, and we can just use ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.addRequests()")," method described underneath."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can still create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," explicitly, the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method will respect that and return the instance provided via crawler options.")),(0,r.kt)("h2",{id:"crawleraddrequests"},(0,r.kt)("inlineCode",{parentName:"h2"},"crawler.addRequests()")),(0,r.kt)("p",null,"We can now add multiple requests in batches. The newly added ",(0,r.kt)("inlineCode",{parentName:"p"},"addRequests")," method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// will resolve right after the initial batch of 1000 requests is added\nconst result = await crawler.addRequests([/* many requests, can be even millions */]);\n\n// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise\nawait result.waitForAllRequestsToBeAdded;\n")),(0,r.kt)("h2",{id:"less-verbose-error-logging"},"Less verbose error logging"),(0,r.kt)("p",null,"Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"CRAWLEE_VERBOSE_LOG")," env var."),(0,r.kt)("h2",{id:"requestlabel-shortcut"},(0,r.kt)("inlineCode",{parentName:"h2"},"Request.label")," shortcut"),(0,r.kt)("p",null,"Labeling requests used to work via the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData")," object. With Crawlee, we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.label")," shortcut. It is implemented as a ",(0,r.kt)("inlineCode",{parentName:"p"},"get/set")," pair, using the value from ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData"),". The support for this shortcut is also added to the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," options interface."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"async requestHandler({ request, enqueueLinks }) {\n if (request.label !== 'DETAIL') {\n await enqueueLinks({\n globs: ['...'],\n label: 'DETAIL',\n });\n }\n}\n")),(0,r.kt)("h2",{id:"removal-of-requestasbrowser"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h2"},"requestAsBrowser")),(0,r.kt)("p",null,"In v1 we replaced the underlying implementation of ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," to be just a proxy over calling ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," - our custom extension to ",(0,r.kt)("inlineCode",{parentName:"p"},"got")," that tries to mimic the real browsers as much as possible. With v3, we are removing the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser"),", encouraging the use of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," directly."),(0,r.kt)("p",null,"For easier migration, we also added ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()")," helper that allows processing the context bound ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," object through ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping")),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new BasicCrawler({\n async requestHandler({ sendRequest, log }) {\n // we can use the options parameter to override gotScraping options\n const res = await sendRequest({ responseType: 'json' });\n log.info('received body', res.body);\n },\n});\n")),(0,r.kt)("h3",{id:"how-to-use-sendrequest"},"How to use ",(0,r.kt)("inlineCode",{parentName:"h3"},"sendRequest()"),"?"),(0,r.kt)("p",null,"See ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/guides/got-scraping",target:"_blank",rel:"noopener"},"the Got Scraping guide"),"."),(0,r.kt)("h3",{id:"removed-options"},"Removed options"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option has been removed. It's permanently set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," in order to better mimic browsers' behavior."),(0,r.kt)("p",null,"Got Scraping automatically performs protocol negotiation, hence we removed the ",(0,r.kt)("inlineCode",{parentName:"p"},"useHttp2")," option. It's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!"),(0,r.kt)("h3",{id:"renamed-options"},"Renamed options"),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," approach, some of the options were named differently. Here's a list of renamed options:"),(0,r.kt)("h4",{id:"payload"},(0,r.kt)("inlineCode",{parentName:"h4"},"payload")),(0,r.kt)("p",null,"This options represents the body to send. It could be a ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"Buffer"),". However, there is no ",(0,r.kt)("inlineCode",{parentName:"p"},"payload")," option anymore. You need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"body")," instead. Or, if you wish to send JSON, ",(0,r.kt)("inlineCode",{parentName:"p"},"json"),". Here's an example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, payload: 'Hello, world!' });\nawait Apify.utils.requestAsBrowser({ \u2026, payload: Buffer.from('c0ffe', 'hex') });\nawait Apify.utils.requestAsBrowser({ \u2026, json: { hello: 'world' } });\n\n// After:\nawait gotScraping({ \u2026, body: 'Hello, world!' });\nawait gotScraping({ \u2026, body: Buffer.from('c0ffe', 'hex') });\nawait gotScraping({ \u2026, json: { hello: 'world' } });\n")),(0,r.kt)("h4",{id:"ignoresslerrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"ignoreSslErrors")),(0,r.kt)("p",null,"It has been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"https.rejectUnauthorized"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," for convenience. However, if you want to make sure the connection is secure, you can do the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, ignoreSslErrors: false });\n\n// After:\nawait gotScraping({ \u2026, https: { rejectUnauthorized: true } });\n")),(0,r.kt)("p",null,"Please note: the meanings are opposite! So we needed to invert the values as well."),(0,r.kt)("h4",{id:"header-generator-options"},(0,r.kt)("inlineCode",{parentName:"h4"},"header-generator")," options"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"useMobileVersion"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"languageCode")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"countryCode")," no longer exist. Instead, you need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," directly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n useMobileVersion: true,\n languageCode: 'en',\n countryCode: 'US',\n});\n\n// After:\nawait gotScraping({\n \u2026,\n headerGeneratorOptions: {\n devices: ['mobile'], // or ['desktop']\n locales: ['en-US'],\n },\n});\n")),(0,r.kt)("h4",{id:"timeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h4"},"timeoutSecs")),(0,r.kt)("p",null,"In order to set a timeout, use ",(0,r.kt)("inlineCode",{parentName:"p"},"timeout.request")," (which is ",(0,r.kt)("strong",{parentName:"p"},"milliseconds")," now)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n timeoutSecs: 30,\n});\n\n// After:\nawait gotScraping({\n \u2026,\n timeout: {\n request: 30 * 1000,\n },\n});\n")),(0,r.kt)("h4",{id:"throwonhttperrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"throwOnHttpErrors")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"throwOnHttpErrors")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"throwHttpErrors"),". This options throws on unsuccessful HTTP status codes, for example ",(0,r.kt)("inlineCode",{parentName:"p"},"404"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h4",{id:"decodebody"},(0,r.kt)("inlineCode",{parentName:"h4"},"decodeBody")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"decodeBody")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"decompress"),". This options decompresses the body. Defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - please do not change this or websites will break (unless you know what you're doing!)."),(0,r.kt)("h4",{id:"abortfunction"},(0,r.kt)("inlineCode",{parentName:"h4"},"abortFunction")),(0,r.kt)("p",null,"This function used to make the promise throw on specific responses, if it returned ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". However, it wasn't that useful."),(0,r.kt)("p",null,"You probably want to cancel the request instead, which you can do in the following way:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const promise = gotScraping(\u2026);\n\npromise.on('request', request => {\n // Please note this is not a Got Request instance, but a ClientRequest one.\n // https://nodejs.org/api/http.html#class-httpclientrequest\n\n if (request.protocol !== 'https:') {\n // Unsecure request, abort.\n promise.cancel();\n\n // If you set `isStream` to `true`, please use `stream.destroy()` instead.\n }\n});\n\nconst response = await promise;\n")),(0,r.kt)("h2",{id:"removal-of-browser-pool-plugin-mixing"},"Removal of browser pool plugin mixing"),(0,r.kt)("p",null,"Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type)."),(0,r.kt)("admonition",{title:"Confused?",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!")),(0,r.kt)("h2",{id:"handling-requests-outside-of-browser"},"Handling requests outside of browser"),(0,r.kt)("p",null,"One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.skipNavigation")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()"),"."),(0,r.kt)("p",null,"Take a look at how to achieve this by checking out the ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/examples/skip-navigation",target:"_blank",rel:"noopener"},"Skipping navigation for certain requests")," example!"),(0,r.kt)("h2",{id:"logging"},"Logging"),(0,r.kt)("p",null,"Crawlee exports the default ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance directly as a named export. We also have a scoped ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ log, request }) {\n log.info(`Opened ${request.loadedUrl}`);\n },\n});\n")),(0,r.kt)("h2",{id:"auto-saved-crawler-state"},"Auto-saved crawler state"),(0,r.kt)("p",null,"Every crawler instance now has ",(0,r.kt)("inlineCode",{parentName:"p"},"useState()")," method that will return a state object we can use. It will be automatically saved when ",(0,r.kt)("inlineCode",{parentName:"p"},"persistState")," event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ crawler }) {\n const state = await crawler.useState({ foo: [] as number[] });\n // just change the value, no need to care about saving it\n state.foo.push(123);\n },\n});\n")),(0,r.kt)("h2",{id:"apify-sdk"},"Apify SDK"),(0,r.kt)("p",null,"The Apify platform helpers can be now found in the Apify SDK (",(0,r.kt)("inlineCode",{parentName:"p"},"apify")," NPM package). It exports the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor")," class that offers following static helpers:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient")," shortcuts: ",(0,r.kt)("inlineCode",{parentName:"li"},"addWebhook()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"call()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"callTask()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"metamorph()")),(0,r.kt)("li",{parentName:"ul"},"helpers for running on Apify platform: ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"exit()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"fail()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"main()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"isAtHome()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"createProxyConfiguration()")),(0,r.kt)("li",{parentName:"ul"},"storage support: ",(0,r.kt)("inlineCode",{parentName:"li"},"getInput()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"getValue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openDataset()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openKeyValueStore()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openRequestQueue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"pushData()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"setValue()")),(0,r.kt)("li",{parentName:"ul"},"events support: ",(0,r.kt)("inlineCode",{parentName:"li"},"on()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"off()")),(0,r.kt)("li",{parentName:"ul"},"other utilities: ",(0,r.kt)("inlineCode",{parentName:"li"},"getEnv()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"newClient()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"reboot()"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," is now just a syntax sugar around calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," at the beginning and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.init();\n// your code\nawait Actor.exit('Crawling finished!');\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.main(async () => {\n // your code\n}, { statusMessage: 'Crawling finished!' });\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," will conditionally set the storage implementation of Crawlee to the ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," will handle the tear down and calls ",(0,r.kt)("inlineCode",{parentName:"p"},"process.exit()")," to ensure our process won't hang indefinitely for some reason."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"Apify SDK (v2) exports ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.events"),", which is an ",(0,r.kt)("inlineCode",{parentName:"p"},"EventEmitter")," instance. With Crawlee, the events are managed by ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," class instead. We can either access it via ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.eventManager")," getter, or use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.on")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.off")," shortcuts instead."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-diff"},"-Apify.events.on(...);\n+Actor.on(...);\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can also get the ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," instance via ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration.getEventManager()"),".")),(0,r.kt)("p",null,"In addition to the existing events, we now have an ",(0,r.kt)("inlineCode",{parentName:"p"},"exit")," event fired when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," (which is called at the end of ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main()"),"). This event allows you to gracefully shut down any resources when ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit")," is called."),(0,r.kt)("h2",{id:"smallerinternal-breaking-changes"},"Smaller/internal breaking changes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.call()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.actor(actorId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.callTask()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.metamorph()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).metamorph(input, options)"),", while also taking the ACTOR_RUN_ID inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.waitForRunToFinish()")," has been removed, use ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.waitForFinish()")," instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Actor.main/init")," purges the storage by default"),(0,r.kt)("li",{parentName:"ul"},"remove ",(0,r.kt)("inlineCode",{parentName:"li"},"purgeLocalStorage")," helper, move purging to the storage class directly",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient")," interface now has optional ",(0,r.kt)("inlineCode",{parentName:"li"},"purge")," method"),(0,r.kt)("li",{parentName:"ul"},"purging happens automatically via ",(0,r.kt)("inlineCode",{parentName:"li"},"Actor.init()")," (you can opt out via ",(0,r.kt)("inlineCode",{parentName:"li"},"purge: false")," in the options of ",(0,r.kt)("inlineCode",{parentName:"li"},"init/main")," methods)"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"QueueOperationInfo.request")," is no longer available"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.handledAt")," is now string date in ISO format"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.inProgress")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Request.reclaimed")," are now ",(0,r.kt)("inlineCode",{parentName:"li"},"Set"),"s instead of POJOs"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"injectUnderscore")," from puppeteer utils has been removed"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"APIFY_MEMORY_MBYTES")," is no longer taken into account, use ",(0,r.kt)("inlineCode",{parentName:"li"},"CRAWLEE_AVAILABLE_MEMORY_RATIO")," instead"),(0,r.kt)("li",{parentName:"ul"},"some ",(0,r.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," options are no longer available:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"cpuSnapshotIntervalSecs")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"memorySnapshotIntervalSecs")," has been replaced with top level ",(0,r.kt)("inlineCode",{parentName:"li"},"systemInfoIntervalMillis")," configuration"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"maxUsedCpuRatio")," has been moved to the top level configuration"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ProxyConfiguration.newUrlFunction")," can be async. ",(0,r.kt)("inlineCode",{parentName:"li"},".newUrl()")," and ",(0,r.kt)("inlineCode",{parentName:"li"},".newProxyInfo()")," now return promises."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"prepareRequestFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"postResponseFunction")," options are removed, use navigation hooks instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"gotoFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"gotoTimeoutSecs")," are removed"),(0,r.kt)("li",{parentName:"ul"},"removed compatibility fix for old/broken request queues with null ",(0,r.kt)("inlineCode",{parentName:"li"},"Request")," props"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintsOptions")," renamed to ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," (",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprints")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprint"),")."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," now accept ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintCacheSize")," (instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintPerProxyCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintPerProxyCacheSize"),", which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=i,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>y,frontMatter:()=>u,metadata:()=>a,toc:()=>l});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),i=["components"],u={id:"request-list-sources-function",title:"RequestListSourcesFunction"},c=void 0,a={unversionedId:"typedefs/request-list-sources-function",id:"version-2.3/typedefs/request-list-sources-function",title:"RequestListSourcesFunction",description:"Returns:",source:"@site/versioned_docs/version-2.3/typedefs/RequestListSourcesFunction.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-sources-function",permalink:"/sdk/js/docs/2.3/typedefs/request-list-sources-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListSourcesFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-list-sources-function",title:"RequestListSourcesFunction"}},p={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,s.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requestlistsourcesfunction"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Promise>"))),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),a=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=a(e.components);return n.createElement(c.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=a(r),d=o,y=l["".concat(c,".").concat(d)]||l[d]||f[d]||s;return r?n.createElement(y,i(i({ref:t},p),{},{components:r})):n.createElement(y,i({ref:t},p))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,i=new Array(s);i[0]=d;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u[l]="string"==typeof e?e:o,i[1]=u;for(var a=2;a{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>y,frontMatter:()=>u,metadata:()=>a,toc:()=>l});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),i=["components"],u={id:"request-list-sources-function",title:"RequestListSourcesFunction"},c=void 0,a={unversionedId:"typedefs/request-list-sources-function",id:"version-2.3/typedefs/request-list-sources-function",title:"RequestListSourcesFunction",description:"Returns:",source:"@site/versioned_docs/version-2.3/typedefs/RequestListSourcesFunction.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-sources-function",permalink:"/sdk/js/docs/2.3/typedefs/request-list-sources-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListSourcesFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-list-sources-function",title:"RequestListSourcesFunction"}},p={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,s.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requestlistsourcesfunction"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Promise>"))),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),a=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=a(e.components);return n.createElement(c.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=a(r),d=o,y=l["".concat(c,".").concat(d)]||l[d]||f[d]||s;return r?n.createElement(y,i(i({ref:t},p),{},{components:r})):n.createElement(y,i({ref:t},p))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,i=new Array(s);i[0]=d;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u[l]="string"==typeof e?e:o,i[1]=u;for(var a=2;a{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),s=["components"],l={id:"request-list",title:"RequestList"},u=void 0,o={unversionedId:"api/request-list",id:"version-2.3/api/request-list",title:"RequestList",description:"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. RequestList is used",source:"@site/versioned_docs/version-2.3/api/RequestList.md",sourceDirName:"api",slug:"/api/request-list",permalink:"/sdk/js/docs/2.3/api/request-list",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestList.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-list",title:"RequestList"},sidebar:"version-2.3/docs",previous:{title:"Request",permalink:"/sdk/js/docs/2.3/api/request"},next:{title:"RequestQueue",permalink:"/sdk/js/docs/2.3/api/request-queue"}},p={},d=[{value:"new RequestList(options)",id:"new-requestlistoptions",level:2},{value:"requestList.requests",id:"requestlistrequests",level:2},{value:"requestList.initialize()",id:"requestlistinitialize",level:2},{value:"requestList.persistState()",id:"requestlistpersiststate",level:2},{value:"requestList.getState()",id:"requestlistgetstate",level:2},{value:"requestList.isEmpty()",id:"requestlistisempty",level:2},{value:"requestList.isFinished()",id:"requestlistisfinished",level:2},{value:"requestList.fetchNextRequest()",id:"requestlistfetchnextrequest",level:2},{value:"requestList.markRequestHandled(request)",id:"requestlistmarkrequesthandledrequest",level:2},{value:"requestList.reclaimRequest(request)",id:"requestlistreclaimrequestrequest",level:2},{value:"requestList.length()",id:"requestlistlength",level:2},{value:"requestList.handledCount()",id:"requestlisthandledcount",level:2}],m={toc:d},c="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(c,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlist"}),(0,i.kt)("p",null,"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is used\nby ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl."),(0,i.kt)("p",null,"Each URL is represented using an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class. The list can only contain unique URLs. More precisely, it can only\ncontain ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances with distinct ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can also be overridden. To\nadd a single URL to the list multiple times, corresponding ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. You\ncan use the ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," option to do this for you when initializing the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," from sources."),(0,i.kt)("p",null,"Once you create an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", you need to call the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," function before the\ninstance can be used. After that, no more URLs can be added to the list. Unlike ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is static but it\ncan contain even millions of URLs."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," can be used together with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," by the same crawler. In such cases, each request from ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is enqueued\ninto ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," first and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list\nfirst and then possibly from the queue). In practical terms, such a combination can be useful when there is a large number of initial URLs, but more\nURLs would be added dynamically by the crawler.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," has an internal state where it stores information about which requests were already handled, which are in progress and which were\nreclaimed. The state may be automatically persisted to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," by setting the ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," option\nso that if the Node.js process is restarted, the crawling can continue where it left off. The automated persisting is launched upon receiving the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event that is periodically emitted by ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events")),"."),(0,i.kt)("p",null,"The internal state is closely tied to the provided sources (URLs). If the sources change on actor restart, the state will become corrupted and\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will raise an exception. This typically happens when the sources is a list of URLs downloaded from the web. In such case, use the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," option in conjunction with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey"),", to make the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," store the initial sources to the default key-value store\nand load them after restart, which will prevent any issues that a live list of URLs might cause."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Basic usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use a helper function to simplify request list initialization.\n// State and sources are automatically persisted. This is a preferred usage.\nconst requestList = await Apify.openRequestList('my-request-list', [\n 'http://www.example.com/page-1',\n { url: 'http://www.example.com/page-2', method: 'POST', userData: { foo: 'bar' } },\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n]);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use the constructor to get more control over the initialization.\nconst requestList = new Apify.RequestList({\n sources: [\n // Separate requests\n { url: 'http://www.example.com/page-1', method: 'GET', headers: { ... } },\n { url: 'http://www.example.com/page-2', userData: { foo: 'bar' }},\n\n // Bulk load of URLs from file `http://www.example.com/my-url-list.txt`\n // Note that all URLs must start with http:// or https://\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n ],\n\n // Persist the state to avoid re-crawling which can lead to data duplications.\n // Keep in mind that the sources have to be immutable or this will throw an error.\n persistStateKey: 'my-state',\n});\n\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"exports.requestlist"}),(0,i.kt)("h2",{id:"new-requestlistoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"new RequestList(options)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," configuration options")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"requests"}),(0,i.kt)("h2",{id:"requestlistrequests"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.requests")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"requestlistinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.initialize()")),(0,i.kt)("p",null,"Loads all remote sources of URLs and potentially starts periodic state persistence. This function must be called before you can start using the\ninstance in a meaningful way."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"requestlistpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals, but calling this method manually is useful in cases where you want to have the most current state available after you pause or stop\nfetching its requests. For example after you pause or abort a crawl. Or just before a server migration."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"requestlistgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isempty"}),(0,i.kt)("h2",{id:"requestlistisempty"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isEmpty()")),(0,i.kt)("p",null,"Resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#fetchnextrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.fetchNextRequest()"))," function would return ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),",\notherwise it resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the list is empty, there might be some pending requests currently being processed."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isfinished"}),(0,i.kt)("h2",{id:"requestlistisfinished"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isFinished()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"fetchnextrequest"}),(0,i.kt)("h2",{id:"requestlistfetchnextrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.fetchNextRequest()")),(0,i.kt)("p",null,"Gets the next ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," to process. First, the function gets a request previously reclaimed using the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#reclaimrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.reclaimRequest()"))," function, if there is any. Otherwise it gets the next request from sources."),(0,i.kt)("p",null,"The function's ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if there are no more requests to process."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"markrequesthandled"}),(0,i.kt)("h2",{id:"requestlistmarkrequesthandledrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.markRequestHandled(request)")),(0,i.kt)("p",null,"Marks request as handled after successful processing."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"reclaimrequest"}),(0,i.kt)("h2",{id:"requestlistreclaimrequestrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.reclaimRequest(request)")),(0,i.kt)("p",null,"Reclaims request to the list if its processing failed. The request will become available in the next ",(0,i.kt)("inlineCode",{parentName:"p"},"this.fetchNextRequest()"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"length"}),(0,i.kt)("h2",{id:"requestlistlength"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.length()")),(0,i.kt)("p",null,"Returns the total number of unique requests present in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"handledcount"}),(0,i.kt)("h2",{id:"requestlisthandledcount"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.handledCount()")),(0,i.kt)("p",null,"Returns number of handled requests."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),o=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=o(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=o(n),c=r,h=d["".concat(u,".").concat(c)]||d[c]||m[c]||i;return n?a.createElement(h,s(s({ref:t},p),{},{components:n})):a.createElement(h,s({ref:t},p))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,s=new Array(i);s[0]=c;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l[d]="string"==typeof e?e:r,s[1]=l;for(var o=2;o{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>h,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),s=["components"],l={id:"request-list",title:"RequestList"},o=void 0,u={unversionedId:"api/request-list",id:"version-2.3/api/request-list",title:"RequestList",description:"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. RequestList is used",source:"@site/versioned_docs/version-2.3/api/RequestList.md",sourceDirName:"api",slug:"/api/request-list",permalink:"/sdk/js/docs/2.3/api/request-list",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestList.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-list",title:"RequestList"},sidebar:"version-2.3/docs",previous:{title:"Request",permalink:"/sdk/js/docs/2.3/api/request"},next:{title:"RequestQueue",permalink:"/sdk/js/docs/2.3/api/request-queue"}},p={},d=[{value:"new RequestList(options)",id:"new-requestlistoptions",level:2},{value:"requestList.requests",id:"requestlistrequests",level:2},{value:"requestList.initialize()",id:"requestlistinitialize",level:2},{value:"requestList.persistState()",id:"requestlistpersiststate",level:2},{value:"requestList.getState()",id:"requestlistgetstate",level:2},{value:"requestList.isEmpty()",id:"requestlistisempty",level:2},{value:"requestList.isFinished()",id:"requestlistisfinished",level:2},{value:"requestList.fetchNextRequest()",id:"requestlistfetchnextrequest",level:2},{value:"requestList.markRequestHandled(request)",id:"requestlistmarkrequesthandledrequest",level:2},{value:"requestList.reclaimRequest(request)",id:"requestlistreclaimrequestrequest",level:2},{value:"requestList.length()",id:"requestlistlength",level:2},{value:"requestList.handledCount()",id:"requestlisthandledcount",level:2}],m={toc:d},c="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(c,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlist"}),(0,i.kt)("p",null,"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is used\nby ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl."),(0,i.kt)("p",null,"Each URL is represented using an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class. The list can only contain unique URLs. More precisely, it can only\ncontain ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances with distinct ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can also be overridden. To\nadd a single URL to the list multiple times, corresponding ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. You\ncan use the ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," option to do this for you when initializing the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," from sources."),(0,i.kt)("p",null,"Once you create an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", you need to call the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," function before the\ninstance can be used. After that, no more URLs can be added to the list. Unlike ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is static but it\ncan contain even millions of URLs."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," can be used together with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," by the same crawler. In such cases, each request from ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is enqueued\ninto ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," first and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list\nfirst and then possibly from the queue). In practical terms, such a combination can be useful when there is a large number of initial URLs, but more\nURLs would be added dynamically by the crawler.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," has an internal state where it stores information about which requests were already handled, which are in progress and which were\nreclaimed. The state may be automatically persisted to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," by setting the ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," option\nso that if the Node.js process is restarted, the crawling can continue where it left off. The automated persisting is launched upon receiving the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event that is periodically emitted by ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events")),"."),(0,i.kt)("p",null,"The internal state is closely tied to the provided sources (URLs). If the sources change on actor restart, the state will become corrupted and\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will raise an exception. This typically happens when the sources is a list of URLs downloaded from the web. In such case, use the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," option in conjunction with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey"),", to make the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," store the initial sources to the default key-value store\nand load them after restart, which will prevent any issues that a live list of URLs might cause."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Basic usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use a helper function to simplify request list initialization.\n// State and sources are automatically persisted. This is a preferred usage.\nconst requestList = await Apify.openRequestList('my-request-list', [\n 'http://www.example.com/page-1',\n { url: 'http://www.example.com/page-2', method: 'POST', userData: { foo: 'bar' } },\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n]);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use the constructor to get more control over the initialization.\nconst requestList = new Apify.RequestList({\n sources: [\n // Separate requests\n { url: 'http://www.example.com/page-1', method: 'GET', headers: { ... } },\n { url: 'http://www.example.com/page-2', userData: { foo: 'bar' }},\n\n // Bulk load of URLs from file `http://www.example.com/my-url-list.txt`\n // Note that all URLs must start with http:// or https://\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n ],\n\n // Persist the state to avoid re-crawling which can lead to data duplications.\n // Keep in mind that the sources have to be immutable or this will throw an error.\n persistStateKey: 'my-state',\n});\n\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"exports.requestlist"}),(0,i.kt)("h2",{id:"new-requestlistoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"new RequestList(options)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," configuration options")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"requests"}),(0,i.kt)("h2",{id:"requestlistrequests"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.requests")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"requestlistinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.initialize()")),(0,i.kt)("p",null,"Loads all remote sources of URLs and potentially starts periodic state persistence. This function must be called before you can start using the\ninstance in a meaningful way."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"requestlistpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals, but calling this method manually is useful in cases where you want to have the most current state available after you pause or stop\nfetching its requests. For example after you pause or abort a crawl. Or just before a server migration."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"requestlistgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isempty"}),(0,i.kt)("h2",{id:"requestlistisempty"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isEmpty()")),(0,i.kt)("p",null,"Resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#fetchnextrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.fetchNextRequest()"))," function would return ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),",\notherwise it resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the list is empty, there might be some pending requests currently being processed."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isfinished"}),(0,i.kt)("h2",{id:"requestlistisfinished"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isFinished()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"fetchnextrequest"}),(0,i.kt)("h2",{id:"requestlistfetchnextrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.fetchNextRequest()")),(0,i.kt)("p",null,"Gets the next ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," to process. First, the function gets a request previously reclaimed using the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#reclaimrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.reclaimRequest()"))," function, if there is any. Otherwise it gets the next request from sources."),(0,i.kt)("p",null,"The function's ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if there are no more requests to process."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"markrequesthandled"}),(0,i.kt)("h2",{id:"requestlistmarkrequesthandledrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.markRequestHandled(request)")),(0,i.kt)("p",null,"Marks request as handled after successful processing."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"reclaimrequest"}),(0,i.kt)("h2",{id:"requestlistreclaimrequestrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.reclaimRequest(request)")),(0,i.kt)("p",null,"Reclaims request to the list if its processing failed. The request will become available in the next ",(0,i.kt)("inlineCode",{parentName:"p"},"this.fetchNextRequest()"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"length"}),(0,i.kt)("h2",{id:"requestlistlength"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.length()")),(0,i.kt)("p",null,"Returns the total number of unique requests present in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"handledcount"}),(0,i.kt)("h2",{id:"requestlisthandledcount"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.handledCount()")),(0,i.kt)("p",null,"Returns number of handled requests."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),u=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),c=r,h=d["".concat(o,".").concat(c)]||d[c]||m[c]||i;return n?a.createElement(h,s(s({ref:t},p),{},{components:n})):a.createElement(h,s({ref:t},p))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,s=new Array(i);s[0]=c;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[d]="string"==typeof e?e:r,s[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>d,toc:()=>c});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],p={id:"direct-navigation-options",title:"DirectNavigationOptions"},l=void 0,d={unversionedId:"typedefs/direct-navigation-options",id:"version-2.3/typedefs/direct-navigation-options",title:"DirectNavigationOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/DirectNavigationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/direct-navigation-options",permalink:"/sdk/js/docs/2.3/typedefs/direct-navigation-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DirectNavigationOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"direct-navigation-options",title:"DirectNavigationOptions"}},s={},c=[{value:"Properties",id:"properties",level:2},{value:"timeout",id:"timeout",level:3},{value:"waitUntil",id:"waituntil",level:3},{value:"referer",id:"referer",level:3}],u={toc:c},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"directnavigationoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=d(n),m=o,f=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},s),{},{components:n})):r.createElement(f,a({ref:t},s))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[c]="string"==typeof e?e:o,a[1]=p;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>d,toc:()=>c});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],p={id:"direct-navigation-options",title:"DirectNavigationOptions"},l=void 0,d={unversionedId:"typedefs/direct-navigation-options",id:"version-2.3/typedefs/direct-navigation-options",title:"DirectNavigationOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/DirectNavigationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/direct-navigation-options",permalink:"/sdk/js/docs/2.3/typedefs/direct-navigation-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DirectNavigationOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"direct-navigation-options",title:"DirectNavigationOptions"}},s={},c=[{value:"Properties",id:"properties",level:2},{value:"timeout",id:"timeout",level:3},{value:"waitUntil",id:"waituntil",level:3},{value:"referer",id:"referer",level:3}],u={toc:c},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"directnavigationoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=d(n),m=o,f=c["".concat(l,".").concat(m)]||c[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},s),{},{components:n})):r.createElement(f,a({ref:t},s))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[c]="string"==typeof e?e:o,a[1]=p;for(var d=2;d{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-environment-variables",title:"Environment Variables",id:"environment-variables"},s=void 0,p={unversionedId:"guides/environment-variables",id:"version-1.3/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-1.3/guides/environment_variables.md",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/1.3/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/environment_variables.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-environment-variables",title:"Environment Variables",id:"environment-variables"},sidebar:"version-1.3/docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/1.3/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/1.3/guides/proxy-management"}},d={},u=[{value:"Important env vars:",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars:",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],m={toc:u},c="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)(c,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,o.kt)("h2",{id:"important-env-vars"},"Important env vars:"),(0,o.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,o.kt)("h3",{id:"apify_local_storage_dir"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("p",null,"Defines the path to a local directory where ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),",\n",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset")),", and ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," store their data.\nTypically it is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". If omitted, you should define the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variable instead."),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,o.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Apify.openDataset('my-local-data');\nconst remoteDataset = await Apify.openDataset('my-remote-data', { forceCloud: true });\n")),(0,o.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars:"),(0,o.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,o.kt)("h3",{id:"apify_headless"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,o.kt)("p",null,"If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,o.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," function. But having this setting\nin an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging,\nand only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers\nare launched in headful mode, i.e. with windows."),(0,o.kt)("h3",{id:"apify_log_level"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,o.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,o.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.log")),"\nnamespace for logging utilities."),(0,o.kt)("h3",{id:"apify_memory_mbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,o.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i. e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify app. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=r,f=u["".concat(s,".").concat(c)]||u[c]||m[c]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:r,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-environment-variables",title:"Environment Variables",id:"environment-variables"},s=void 0,p={unversionedId:"guides/environment-variables",id:"version-1.3/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-1.3/guides/environment_variables.md",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/1.3/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/environment_variables.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-environment-variables",title:"Environment Variables",id:"environment-variables"},sidebar:"version-1.3/docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/1.3/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/1.3/guides/proxy-management"}},d={},u=[{value:"Important env vars:",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars:",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],m={toc:u},c="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)(c,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,o.kt)("h2",{id:"important-env-vars"},"Important env vars:"),(0,o.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,o.kt)("h3",{id:"apify_local_storage_dir"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("p",null,"Defines the path to a local directory where ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),",\n",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset")),", and ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," store their data.\nTypically it is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". If omitted, you should define the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variable instead."),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,o.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Apify.openDataset('my-local-data');\nconst remoteDataset = await Apify.openDataset('my-remote-data', { forceCloud: true });\n")),(0,o.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars:"),(0,o.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,o.kt)("h3",{id:"apify_headless"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,o.kt)("p",null,"If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,o.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," function. But having this setting\nin an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging,\nand only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers\nare launched in headful mode, i.e. with windows."),(0,o.kt)("h3",{id:"apify_log_level"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,o.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,o.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.log")),"\nnamespace for logging utilities."),(0,o.kt)("h3",{id:"apify_memory_mbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,o.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i. e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify app. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=r,f=u["".concat(s,".").concat(c)]||u[c]||m[c]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:r,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),i=["components"],o={id_old:"version-1.3-request",title:"Request",id:"request"},s=void 0,p={unversionedId:"api/request",id:"version-1.3/api/request",title:"Request",description:"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The Request object also stores information",source:"@site/versioned_docs/version-1.3/api/Request.md",sourceDirName:"api",slug:"/api/request",permalink:"/sdk/js/docs/1.3/api/request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Request.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request",title:"Request",id:"request"},sidebar:"version-1.3/docs",previous:{title:"SystemStatus",permalink:"/sdk/js/docs/1.3/api/system-status"},next:{title:"RequestList",permalink:"/sdk/js/docs/1.3/api/request-list"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"url",id:"url",level:3},{value:"loadedUrl",id:"loadedurl",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"noRetry",id:"noretry",level:3},{value:"retryCount",id:"retrycount",level:3},{value:"errorMessages",id:"errormessages",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"handledAt",id:"handledat",level:3},{value:"new Request(options)",id:"new-requestoptions",level:2},{value:"request.headers",id:"requestheaders",level:2},{value:"request.userData",id:"requestuserdata",level:2},{value:"request.pushErrorMessage(errorOrMessage, [options])",id:"requestpusherrormessageerrorormessage-options",level:2}],m={toc:d},c="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,i);return(0,l.kt)(c,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"request"}),(0,l.kt)("p",null,"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," object also stores information\nabout errors that occurred during processing of the request."),(0,l.kt)("p",null,"Each ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," instance has the ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property, which can be either specified manually in the constructor or generated automatically from the\nURL. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same web resource. This behavior applies to all Apify SDK classes, such\nas ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"Example use:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = new Apify.Request({\n url: 'http://www.example.com',\n headers: { Accept: 'application/json' },\n});\n\n...\n\nrequest.userData.foo = 'bar';\nrequest.pushErrorMessage(new Error('Request failed!'));\n\n...\n\nconst foo = request.userData.foo;\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Request ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"url"},(0,l.kt)("inlineCode",{parentName:"h3"},"url")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL of the web page to crawl."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"loadedurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"loadedUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"An actually loaded URL after redirects, if present. HTTP redirects are guaranteed to be included."),(0,l.kt)("p",null,"When using ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),", meta tag and JavaScript redirects may,\nor may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but\ndelayed redirects will not."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"uniquekey"},(0,l.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"method"},(0,l.kt)("inlineCode",{parentName:"h3"},"method")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"HTTP method, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"GET")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"POST"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"payload"},(0,l.kt)("inlineCode",{parentName:"h3"},"payload")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,l.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"noretry"},(0,l.kt)("inlineCode",{parentName:"h3"},"noRetry")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," value indicates that the request will not be automatically retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"retrycount"},(0,l.kt)("inlineCode",{parentName:"h3"},"retryCount")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Indicates the number of times the crawling of the request has been retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"errormessages"},(0,l.kt)("inlineCode",{parentName:"h3"},"errorMessages")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Array")),(0,l.kt)("p",null,"An array of error messages from request processing."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"headers"},(0,l.kt)("inlineCode",{parentName:"h3"},"headers")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Object with HTTP headers. Key is header name, value is the value."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"userdata"},(0,l.kt)("inlineCode",{parentName:"h3"},"userData")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Custom user data assigned to the request."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"handledat"},(0,l.kt)("inlineCode",{parentName:"h3"},"handledAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Indicates the time when the request has been processed. Is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if the request has not been crawled yet."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"request"}),(0,l.kt)("h2",{id:"new-requestoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Request(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,l.kt)("inlineCode",{parentName:"li"},"Request")," parameters including the URL, HTTP method and headers, and others.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"headers"}),(0,l.kt)("h2",{id:"requestheaders"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.headers")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"userdata"}),(0,l.kt)("h2",{id:"requestuserdata"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.userData")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pusherrormessage"}),(0,l.kt)("h2",{id:"requestpusherrormessageerrorormessage-options"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.pushErrorMessage(errorOrMessage, [options])")),(0,l.kt)("p",null,"Stores information about an error that occurred during processing of this request."),(0,l.kt)("p",null,"You should always use Error instances when throwing errors in JavaScript."),(0,l.kt)("p",null,"Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs\na type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any\ndebugging rather difficult."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"errorOrMessage")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Error")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - Error object or error message to be stored in the request."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[omitStack]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,l.kt)("code",null," = false")," - Only push the error message without stack trace when true.")))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(r),c=a,k=d["".concat(s,".").concat(c)]||d[c]||m[c]||l;return r?n.createElement(k,i(i({ref:t},u),{},{components:r})):n.createElement(k,i({ref:t},u))}));function k(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=c;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[d]="string"==typeof e?e:a,i[1]=o;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-request",title:"Request",id:"request"},s=void 0,p={unversionedId:"api/request",id:"version-1.3/api/request",title:"Request",description:"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The Request object also stores information",source:"@site/versioned_docs/version-1.3/api/Request.md",sourceDirName:"api",slug:"/api/request",permalink:"/sdk/js/docs/1.3/api/request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Request.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request",title:"Request",id:"request"},sidebar:"version-1.3/docs",previous:{title:"SystemStatus",permalink:"/sdk/js/docs/1.3/api/system-status"},next:{title:"RequestList",permalink:"/sdk/js/docs/1.3/api/request-list"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"url",id:"url",level:3},{value:"loadedUrl",id:"loadedurl",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"noRetry",id:"noretry",level:3},{value:"retryCount",id:"retrycount",level:3},{value:"errorMessages",id:"errormessages",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"handledAt",id:"handledat",level:3},{value:"new Request(options)",id:"new-requestoptions",level:2},{value:"request.headers",id:"requestheaders",level:2},{value:"request.userData",id:"requestuserdata",level:2},{value:"request.pushErrorMessage(errorOrMessage, [options])",id:"requestpusherrormessageerrorormessage-options",level:2}],m={toc:d},c="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(c,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"request"}),(0,l.kt)("p",null,"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," object also stores information\nabout errors that occurred during processing of the request."),(0,l.kt)("p",null,"Each ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," instance has the ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property, which can be either specified manually in the constructor or generated automatically from the\nURL. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same web resource. This behavior applies to all Apify SDK classes, such\nas ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"Example use:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = new Apify.Request({\n url: 'http://www.example.com',\n headers: { Accept: 'application/json' },\n});\n\n...\n\nrequest.userData.foo = 'bar';\nrequest.pushErrorMessage(new Error('Request failed!'));\n\n...\n\nconst foo = request.userData.foo;\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Request ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"url"},(0,l.kt)("inlineCode",{parentName:"h3"},"url")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL of the web page to crawl."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"loadedurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"loadedUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"An actually loaded URL after redirects, if present. HTTP redirects are guaranteed to be included."),(0,l.kt)("p",null,"When using ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),", meta tag and JavaScript redirects may,\nor may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but\ndelayed redirects will not."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"uniquekey"},(0,l.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"method"},(0,l.kt)("inlineCode",{parentName:"h3"},"method")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"HTTP method, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"GET")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"POST"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"payload"},(0,l.kt)("inlineCode",{parentName:"h3"},"payload")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,l.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"noretry"},(0,l.kt)("inlineCode",{parentName:"h3"},"noRetry")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," value indicates that the request will not be automatically retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"retrycount"},(0,l.kt)("inlineCode",{parentName:"h3"},"retryCount")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Indicates the number of times the crawling of the request has been retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"errormessages"},(0,l.kt)("inlineCode",{parentName:"h3"},"errorMessages")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Array")),(0,l.kt)("p",null,"An array of error messages from request processing."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"headers"},(0,l.kt)("inlineCode",{parentName:"h3"},"headers")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Object with HTTP headers. Key is header name, value is the value."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"userdata"},(0,l.kt)("inlineCode",{parentName:"h3"},"userData")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Custom user data assigned to the request."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"handledat"},(0,l.kt)("inlineCode",{parentName:"h3"},"handledAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Indicates the time when the request has been processed. Is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if the request has not been crawled yet."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"request"}),(0,l.kt)("h2",{id:"new-requestoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Request(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,l.kt)("inlineCode",{parentName:"li"},"Request")," parameters including the URL, HTTP method and headers, and others.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"headers"}),(0,l.kt)("h2",{id:"requestheaders"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.headers")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"userdata"}),(0,l.kt)("h2",{id:"requestuserdata"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.userData")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pusherrormessage"}),(0,l.kt)("h2",{id:"requestpusherrormessageerrorormessage-options"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.pushErrorMessage(errorOrMessage, [options])")),(0,l.kt)("p",null,"Stores information about an error that occurred during processing of this request."),(0,l.kt)("p",null,"You should always use Error instances when throwing errors in JavaScript."),(0,l.kt)("p",null,"Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs\na type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any\ndebugging rather difficult."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"errorOrMessage")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Error")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - Error object or error message to be stored in the request."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[omitStack]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,l.kt)("code",null," = false")," - Only push the error message without stack trace when true.")))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(r),c=a,k=d["".concat(s,".").concat(c)]||d[c]||m[c]||l;return r?n.createElement(k,o(o({ref:t},u),{},{components:r})):n.createElement(k,o({ref:t},u))}));function k(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=c;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var p=2;p{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),s=i.version,c=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var d=s+"/";return"current"===s?d="next/":c&&(d=""),n.createElement(a.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>l});var n=r(67294),a=r(88746),o="https://crawlee.dev",l=function(e){var t=e.to,r=e.children,l=e.version;return n.createElement(a.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},93195:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>p,default:()=>g,frontMatter:()=>u,metadata:()=>m,toc:()=>b});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=(r(14563),r(68889)),i=r(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a CheerioCrawler\nconst crawler = new CheerioCrawler({\n // Limits the crawler to only 10 requests (do not use if you want to crawl all links)\n maxRequestsPerCrawl: 10,\n // Function called for each URL\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add some links from page to the crawler's RequestQueue\n await enqueueLinks({\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n },\n});\n\n// Define the starting URL and run the crawler\nawait crawler.run(['https://apify.com/store']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko"};var c,d=["components"],u={id:"crawl-some-links",title:"Crawl some links on a website"},p=void 0,m={unversionedId:"examples/crawl-some-links",id:"examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.",source:"@site/../docs/examples/crawl_some_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/next/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_some_links.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/next/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/next/examples/forms"}},y={},b=[],f=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),C={toc:b},h="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,d);return(0,o.kt)(h,(0,n.Z)({},C,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," example uses the ",(0,o.kt)(i.T,{to:"core/class/PseudoUrl",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"pseudoUrls"))," property in the ",(0,o.kt)(i.T,{to:"cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"))," method to only add links to the ",(0,o.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," queue if they match the specified regular expression."),(0,o.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,y=u["".concat(s,".").concat(m)]||u[m]||p[m]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),s=i.version,c=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var d=s+"/";return"current"===s?d="next/":c&&(d=""),n.createElement(a.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>l});var n=r(67294),a=r(88746),o="https://crawlee.dev",l=function(e){var t=e.to,r=e.children,l=e.version;return n.createElement(a.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},93195:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>u,default:()=>g,frontMatter:()=>p,metadata:()=>m,toc:()=>b});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=(r(14563),r(68889)),i=r(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a CheerioCrawler\nconst crawler = new CheerioCrawler({\n // Limits the crawler to only 10 requests (do not use if you want to crawl all links)\n maxRequestsPerCrawl: 10,\n // Function called for each URL\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add some links from page to the crawler's RequestQueue\n await enqueueLinks({\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n },\n});\n\n// Define the starting URL and run the crawler\nawait crawler.run(['https://apify.com/store']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko"};var c,d=["components"],p={id:"crawl-some-links",title:"Crawl some links on a website"},u=void 0,m={unversionedId:"examples/crawl-some-links",id:"examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.",source:"@site/../docs/examples/crawl_some_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/next/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_some_links.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/next/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/next/examples/forms"}},y={},b=[],f=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),C={toc:b},h="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,d);return(0,o.kt)(h,(0,n.Z)({},C,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," example uses the ",(0,o.kt)(i.T,{to:"core/class/PseudoUrl",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"pseudoUrls"))," property in the ",(0,o.kt)(i.T,{to:"cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"))," method to only add links to the ",(0,o.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," queue if they match the specified regular expression."),(0,o.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(r),m=a,y=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:a,l[1]=i;for(var c=2;c{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>c,default:()=>w,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=t(87462),o=t(63366),a=(t(67294),t(3905)),i=["components"],l={id_old:"version-1.3-browser-crawling-context",title:"BrowserCrawlingContext",id:"browser-crawling-context"},c=void 0,s={unversionedId:"typedefs/browser-crawling-context",id:"version-1.3/typedefs/browser-crawling-context",title:"BrowserCrawlingContext",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/BrowserCrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-crawling-context",permalink:"/sdk/js/docs/1.3/typedefs/browser-crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserCrawlingContext.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-browser-crawling-context",title:"BrowserCrawlingContext",id:"browser-crawling-context"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"browserController",id:"browsercontroller",level:3}],u={toc:d},f="wrapper";function w(e){var r=e.components,t=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browsercrawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"browsercontroller"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserController")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserController")),(0,a.kt)("hr",null))}w.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>w});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),s=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=s(e.components);return n.createElement(c.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(t),f=o,w=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(w,i(i({ref:r},p),{},{components:t})):n.createElement(w,i({ref:r},p))}));function w(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=f;var l={};for(var c in r)hasOwnProperty.call(r,c)&&(l[c]=r[c]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{t.r(r),t.d(r,{assets:()=>p,contentTitle:()=>c,default:()=>w,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=t(87462),o=t(63366),a=(t(67294),t(3905)),i=["components"],l={id_old:"version-1.3-browser-crawling-context",title:"BrowserCrawlingContext",id:"browser-crawling-context"},c=void 0,s={unversionedId:"typedefs/browser-crawling-context",id:"version-1.3/typedefs/browser-crawling-context",title:"BrowserCrawlingContext",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/BrowserCrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-crawling-context",permalink:"/sdk/js/docs/1.3/typedefs/browser-crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserCrawlingContext.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-browser-crawling-context",title:"BrowserCrawlingContext",id:"browser-crawling-context"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"browserController",id:"browsercontroller",level:3}],u={toc:d},f="wrapper";function w(e){var r=e.components,t=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browsercrawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"browsercontroller"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserController")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserController")),(0,a.kt)("hr",null))}w.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>w});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),s=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},p=function(e){var r=s(e.components);return n.createElement(c.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(t),f=o,w=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(w,i(i({ref:r},p),{},{components:t})):n.createElement(w,i({ref:r},p))}));function w(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=f;var l={};for(var c in r)hasOwnProperty.call(r,c)&&(l[c]=r[c]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],s={id_old:"version-1.3-proxy-configuration",title:"ProxyConfiguration",id:"proxy-configuration"},p=void 0,l={unversionedId:"api/proxy-configuration",id:"version-1.3/api/proxy-configuration",title:"ProxyConfiguration",description:"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based",source:"@site/versioned_docs/version-1.3/api/ProxyConfiguration.md",sourceDirName:"api",slug:"/api/proxy-configuration",permalink:"/sdk/js/docs/1.3/api/proxy-configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ProxyConfiguration.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-proxy-configuration",title:"ProxyConfiguration",id:"proxy-configuration"},sidebar:"version-1.3/docs",previous:{title:"SessionPool",permalink:"/sdk/js/docs/1.3/api/session-pool"},next:{title:"Snapshotter",permalink:"/sdk/js/docs/1.3/api/snapshotter"}},u={},d=[{value:"proxyConfiguration.initialize()",id:"proxyconfigurationinitialize",level:2},{value:"proxyConfiguration.newProxyInfo([sessionId])",id:"proxyconfigurationnewproxyinfosessionid",level:2},{value:"proxyConfiguration.newUrl([sessionId])",id:"proxyconfigurationnewurlsessionid",level:2}],c={toc:d},y="wrapper";function f(e){var n=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(y,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfiguration"}),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections. You can get information about the currently used proxy by inspecting the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," property in your\ncrawler's page function. There, you can inspect the proxy's URL and other attributes."),(0,i.kt)("p",null,"The proxy servers are managed by ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". To be able to use Apify Proxy, you need an Apify account and access to\nthe selected proxies. If you provide no configuration option, the proxies will be managed automatically using a smart algorithm."),(0,i.kt)("p",null,"If you want to use your own proxies, use the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," option. Your\nlist of proxy URLs will be rotated by the configuration if this option is provided."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"proxyconfigurationinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.initialize()")),(0,i.kt)("p",null,"Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups if Apify Proxy configuration is used. Also checks\nif country has access to Apify Proxy groups if the country code is provided."),(0,i.kt)("p",null,"You should use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration"))," function to create a pre-initialized ",(0,i.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"),"\ninstance instead of calling this manually."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newproxyinfo"}),(0,i.kt)("h2",{id:"proxyconfigurationnewproxyinfosessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newProxyInfo([sessionId])")),(0,i.kt)("p",null,"This function creates a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," info object. It is used by CheerioCrawler and PuppeteerCrawler to generate proxy\nURLs and also to allow the user to inspect the currently used proxy via the handlePageFunction parameter: proxyInfo. Use it if you want to work with a\nrich representation of a proxy URL. If you need the URL string only, use ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string. Property sessionId of ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," is always returned as a type\nstring.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," - represents information about used proxy and its configuration."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newurl"}),(0,i.kt)("h2",{id:"proxyconfigurationnewurlsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newUrl([sessionId])")),(0,i.kt)("p",null,"Returns a new proxy URL based on provided configuration options and the ",(0,i.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")," - A string with a proxy URL, including authentication credentials and port number. For example,\n",(0,i.kt)("inlineCode",{parentName:"p"},"http://bob:password123@proxy.example.com:8000")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},y=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(t),y=o,f=d["".concat(p,".").concat(y)]||d[y]||c[y]||i;return t?r.createElement(f,a(a({ref:n},u),{},{components:t})):r.createElement(f,a({ref:n},u))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],s={id_old:"version-1.3-proxy-configuration",title:"ProxyConfiguration",id:"proxy-configuration"},p=void 0,l={unversionedId:"api/proxy-configuration",id:"version-1.3/api/proxy-configuration",title:"ProxyConfiguration",description:"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based",source:"@site/versioned_docs/version-1.3/api/ProxyConfiguration.md",sourceDirName:"api",slug:"/api/proxy-configuration",permalink:"/sdk/js/docs/1.3/api/proxy-configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ProxyConfiguration.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-proxy-configuration",title:"ProxyConfiguration",id:"proxy-configuration"},sidebar:"version-1.3/docs",previous:{title:"SessionPool",permalink:"/sdk/js/docs/1.3/api/session-pool"},next:{title:"Snapshotter",permalink:"/sdk/js/docs/1.3/api/snapshotter"}},u={},d=[{value:"proxyConfiguration.initialize()",id:"proxyconfigurationinitialize",level:2},{value:"proxyConfiguration.newProxyInfo([sessionId])",id:"proxyconfigurationnewproxyinfosessionid",level:2},{value:"proxyConfiguration.newUrl([sessionId])",id:"proxyconfigurationnewurlsessionid",level:2}],c={toc:d},y="wrapper";function f(e){var n=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(y,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfiguration"}),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections. You can get information about the currently used proxy by inspecting the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," property in your\ncrawler's page function. There, you can inspect the proxy's URL and other attributes."),(0,i.kt)("p",null,"The proxy servers are managed by ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". To be able to use Apify Proxy, you need an Apify account and access to\nthe selected proxies. If you provide no configuration option, the proxies will be managed automatically using a smart algorithm."),(0,i.kt)("p",null,"If you want to use your own proxies, use the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," option. Your\nlist of proxy URLs will be rotated by the configuration if this option is provided."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"proxyconfigurationinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.initialize()")),(0,i.kt)("p",null,"Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups if Apify Proxy configuration is used. Also checks\nif country has access to Apify Proxy groups if the country code is provided."),(0,i.kt)("p",null,"You should use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration"))," function to create a pre-initialized ",(0,i.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"),"\ninstance instead of calling this manually."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newproxyinfo"}),(0,i.kt)("h2",{id:"proxyconfigurationnewproxyinfosessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newProxyInfo([sessionId])")),(0,i.kt)("p",null,"This function creates a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," info object. It is used by CheerioCrawler and PuppeteerCrawler to generate proxy\nURLs and also to allow the user to inspect the currently used proxy via the handlePageFunction parameter: proxyInfo. Use it if you want to work with a\nrich representation of a proxy URL. If you need the URL string only, use ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string. Property sessionId of ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," is always returned as a type\nstring.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," - represents information about used proxy and its configuration."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newurl"}),(0,i.kt)("h2",{id:"proxyconfigurationnewurlsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newUrl([sessionId])")),(0,i.kt)("p",null,"Returns a new proxy URL based on provided configuration options and the ",(0,i.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")," - A string with a proxy URL, including authentication credentials and port number. For example,\n",(0,i.kt)("inlineCode",{parentName:"p"},"http://bob:password123@proxy.example.com:8000")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},y=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(t),y=o,f=d["".concat(p,".").concat(y)]||d[y]||c[y]||i;return t?r.createElement(f,a(a({ref:n},u),{},{components:t})):r.createElement(f,a({ref:n},u))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>m,frontMatter:()=>u,metadata:()=>c,toc:()=>s});var r=n(87462),o=n(63366),p=(n(67294),n(3905)),a=["components"],u={id_old:"version-1.3-launch-puppeteer-function",title:"LaunchPuppeteerFunction",id:"launch-puppeteer-function"},i=void 0,c={unversionedId:"typedefs/launch-puppeteer-function",id:"version-1.3/typedefs/launch-puppeteer-function",title:"LaunchPuppeteerFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/LaunchPuppeteerFunction.md",sourceDirName:"typedefs",slug:"/typedefs/launch-puppeteer-function",permalink:"/sdk/js/docs/1.3/typedefs/launch-puppeteer-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-launch-puppeteer-function",title:"LaunchPuppeteerFunction",id:"launch-puppeteer-function"}},l={},s=[],f={toc:s},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,p.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"launchpuppeteerfunction"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/launch-puppeteer-options",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerOptions")))),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),c=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(i.Provider,{value:t},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,p=e.originalType,i=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),s=c(n),d=o,m=s["".concat(i,".").concat(d)]||s[d]||f[d]||p;return n?r.createElement(m,a(a({ref:t},l),{},{components:n})):r.createElement(m,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=n.length,a=new Array(p);a[0]=d;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[s]="string"==typeof e?e:o,a[1]=u;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>m,frontMatter:()=>u,metadata:()=>c,toc:()=>s});var r=n(87462),o=n(63366),p=(n(67294),n(3905)),a=["components"],u={id_old:"version-1.3-launch-puppeteer-function",title:"LaunchPuppeteerFunction",id:"launch-puppeteer-function"},i=void 0,c={unversionedId:"typedefs/launch-puppeteer-function",id:"version-1.3/typedefs/launch-puppeteer-function",title:"LaunchPuppeteerFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/LaunchPuppeteerFunction.md",sourceDirName:"typedefs",slug:"/typedefs/launch-puppeteer-function",permalink:"/sdk/js/docs/1.3/typedefs/launch-puppeteer-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-launch-puppeteer-function",title:"LaunchPuppeteerFunction",id:"launch-puppeteer-function"}},l={},s=[],f={toc:s},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,p.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"launchpuppeteerfunction"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/launch-puppeteer-options",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerOptions")))),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),c=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(i.Provider,{value:t},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,p=e.originalType,i=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),s=c(n),d=o,m=s["".concat(i,".").concat(d)]||s[d]||f[d]||p;return n?r.createElement(m,a(a({ref:t},l),{},{components:n})):r.createElement(m,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=n.length,a=new Array(p);a[0]=d;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[s]="string"==typeof e?e:o,a[1]=u;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],p={id_old:"version-2.3.0-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},i=void 0,s={unversionedId:"typedefs/cheerio-handle-page-inputs",id:"version-2.3/typedefs/cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CheerioHandlePageInputs.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page-inputs",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePageInputs.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},sidebar:"version-2.3/docs",previous:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page"},next:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"$",id:"",level:3},{value:"body",id:"body",level:3},{value:"json",id:"json",level:3},{value:"request",id:"request",level:3},{value:"contentType",id:"contenttype",level:3},{value:"response",id:"response",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(h,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepageinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:""},(0,o.kt)("inlineCode",{parentName:"h3"},"$")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"CheerioAPI")),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://cheerio.js.org/",target:"_blank",rel:"noopener"},"Cheerio")," object with parsed HTML."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"body"},(0,o.kt)("inlineCode",{parentName:"h3"},"body")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"The request body of the web page."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"json"},(0,o.kt)("inlineCode",{parentName:"h3"},"json")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"The parsed object from JSON string if the response contains the content type application/json."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"contenttype"},(0,o.kt)("inlineCode",{parentName:"h3"},"contentType")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Parsed ",(0,o.kt)("inlineCode",{parentName:"p"},"Content-Type header: { type, encoding }"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"response"},(0,o.kt)("inlineCode",{parentName:"h3"},"response")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"IncomingMessage")),(0,o.kt)("p",null,"An instance of Node's ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"http.IncomingMessage")," object,"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,o.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"crawler"},(0,o.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=s(n),h=a,k=c["".concat(i,".").concat(h)]||c[h]||u[h]||o;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=h;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[c]="string"==typeof e?e:a,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],p={id_old:"version-2.3.0-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},i=void 0,s={unversionedId:"typedefs/cheerio-handle-page-inputs",id:"version-2.3/typedefs/cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CheerioHandlePageInputs.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page-inputs",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePageInputs.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},sidebar:"version-2.3/docs",previous:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page"},next:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"$",id:"",level:3},{value:"body",id:"body",level:3},{value:"json",id:"json",level:3},{value:"request",id:"request",level:3},{value:"contentType",id:"contenttype",level:3},{value:"response",id:"response",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(h,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepageinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:""},(0,o.kt)("inlineCode",{parentName:"h3"},"$")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"CheerioAPI")),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://cheerio.js.org/",target:"_blank",rel:"noopener"},"Cheerio")," object with parsed HTML."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"body"},(0,o.kt)("inlineCode",{parentName:"h3"},"body")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"The request body of the web page."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"json"},(0,o.kt)("inlineCode",{parentName:"h3"},"json")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"The parsed object from JSON string if the response contains the content type application/json."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"contenttype"},(0,o.kt)("inlineCode",{parentName:"h3"},"contentType")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Parsed ",(0,o.kt)("inlineCode",{parentName:"p"},"Content-Type header: { type, encoding }"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"response"},(0,o.kt)("inlineCode",{parentName:"h3"},"response")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"IncomingMessage")),(0,o.kt)("p",null,"An instance of Node's ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"http.IncomingMessage")," object,"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,o.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"crawler"},(0,o.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=s(n),h=a,k=c["".concat(i,".").concat(h)]||c[h]||u[h]||o;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=h;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[c]="string"==typeof e?e:a,l[1]=p;for(var s=2;s{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>h,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),i=["components"],l={id_old:"version-1.3-docker-images",title:"Running in Docker",id:"docker-images"},s=void 0,p={unversionedId:"guides/docker-images",id:"version-1.3/guides/docker-images",title:"Running in Docker",description:"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the Apify Platform.",source:"@site/versioned_docs/version-1.3/guides/docker_images.md",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/1.3/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/docker_images.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-docker-images",title:"Running in Docker",id:"docker-images"},sidebar:"version-1.3/docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/1.3/guides/type-script-actor"},next:{title:"Migration to version 1",permalink:"/sdk/js/docs/1.3/guides/migration-to-v1"}},d={},u=[{value:"Overview",id:"overview",level:2},{value:"Example Dockerfile",id:"example-dockerfile",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"actor-node",id:"actor-node",level:2},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:2},{value:"actor-node-playwright",id:"actor-node-playwright",level:2},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:2},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:2},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:2}],c={toc:u},m="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(m,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/guides/apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit your needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use our images, you need a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/guides/getting-started#creating-a-new-project",target:null,rel:null},"Apify CLI")," which automatically copies the correct Dockerfile into your project folder."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},'# First, specify the base Docker image. You can read more about\n# the available images at https://sdk.apify.com/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\n# The 16 represents the version of Node.js you want to use.\nFROM apify/actor-node:16\n\n# Second, copy just package.json and package-lock.json since it should be\n# the only file that affects "npm install" in the next step, to speed up the build\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY ../../version-1.2.0/guides ./\n\n# Optionally, specify how to launch the source code of your actor.\n# By default, Apify\'s base Docker images define the CMD instruction\n# that runs the Node.js source code using the command specified\n# in the "scripts.start" section of the package.json file.\n# In short, the instruction looks something like this:\n#\n# CMD npm start\n')),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in your production Dockerfiles. It will ensure that a future update of Node.js will not break your automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js versions 14, 15 and 16 are supported. To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 14\nFROM apify/actor-node:14\n# Use Node.js 16\nFROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-8.0.0")," comes with Node.js 16 and Puppeteer v8.0.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chrome we pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.10.0")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.10.0."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Always")," use Node.js version tag."),(0,o.kt)("li",{parentName:"ul"},"For ",(0,o.kt)("strong",{parentName:"li"},"added security"),", use the automation library version tag."),(0,o.kt)("li",{parentName:"ul"},"Use asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," as the automation library version in your ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not reinstalled on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "apify": "^1.2.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"Be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"Use only what you need, and you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore\nbest used with ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"\nand other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h2",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with\n",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox,\nWebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose,\nbut in most cases, we suggest using the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),",\nbut ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")),"\nenvironment variable to block installation of more browsers into your images (to keep them small).\nIf you want more browsers, either choose the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image\nor override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(a),m=n,h=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return a?r.createElement(h,i(i({ref:t},d),{},{components:a})):r.createElement(h,i({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>h,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),i=["components"],l={id_old:"version-1.3-docker-images",title:"Running in Docker",id:"docker-images"},s=void 0,p={unversionedId:"guides/docker-images",id:"version-1.3/guides/docker-images",title:"Running in Docker",description:"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the Apify Platform.",source:"@site/versioned_docs/version-1.3/guides/docker_images.md",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/1.3/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/docker_images.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-docker-images",title:"Running in Docker",id:"docker-images"},sidebar:"version-1.3/docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/1.3/guides/type-script-actor"},next:{title:"Migration to version 1",permalink:"/sdk/js/docs/1.3/guides/migration-to-v1"}},d={},u=[{value:"Overview",id:"overview",level:2},{value:"Example Dockerfile",id:"example-dockerfile",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"actor-node",id:"actor-node",level:2},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:2},{value:"actor-node-playwright",id:"actor-node-playwright",level:2},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:2},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:2},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:2}],c={toc:u},m="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(m,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/guides/apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit your needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use our images, you need a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/guides/getting-started#creating-a-new-project",target:null,rel:null},"Apify CLI")," which automatically copies the correct Dockerfile into your project folder."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},'# First, specify the base Docker image. You can read more about\n# the available images at https://sdk.apify.com/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\n# The 16 represents the version of Node.js you want to use.\nFROM apify/actor-node:16\n\n# Second, copy just package.json and package-lock.json since it should be\n# the only file that affects "npm install" in the next step, to speed up the build\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY ../../version-1.2.0/guides ./\n\n# Optionally, specify how to launch the source code of your actor.\n# By default, Apify\'s base Docker images define the CMD instruction\n# that runs the Node.js source code using the command specified\n# in the "scripts.start" section of the package.json file.\n# In short, the instruction looks something like this:\n#\n# CMD npm start\n')),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in your production Dockerfiles. It will ensure that a future update of Node.js will not break your automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js versions 14, 15 and 16 are supported. To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 14\nFROM apify/actor-node:14\n# Use Node.js 16\nFROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-8.0.0")," comes with Node.js 16 and Puppeteer v8.0.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chrome we pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.10.0")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.10.0."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Always")," use Node.js version tag."),(0,o.kt)("li",{parentName:"ul"},"For ",(0,o.kt)("strong",{parentName:"li"},"added security"),", use the automation library version tag."),(0,o.kt)("li",{parentName:"ul"},"Use asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," as the automation library version in your ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not reinstalled on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "apify": "^1.2.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"Be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"Use only what you need, and you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore\nbest used with ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"\nand other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h2",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with\n",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox,\nWebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose,\nbut in most cases, we suggest using the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),",\nbut ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")),"\nenvironment variable to block installation of more browsers into your images (to keep them small).\nIf you want more browsers, either choose the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image\nor override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(a),m=n,h=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return a?r.createElement(h,i(i({ref:t},d),{},{components:a})):r.createElement(h,i({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var s=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],r={id_old:"version-1.3-session",title:"Session",id:"session"},l=void 0,p={unversionedId:"api/session",id:"version-1.3/api/session",title:"Session",description:"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as",source:"@site/versioned_docs/version-1.3/api/Session.md",sourceDirName:"api",slug:"/api/session",permalink:"/sdk/js/docs/1.3/api/session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Session.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-session",title:"Session",id:"session"},sidebar:"version-1.3/docs",previous:{title:"AutoscaledPool",permalink:"/sdk/js/docs/1.3/api/autoscaled-pool"},next:{title:"SessionPool",permalink:"/sdk/js/docs/1.3/api/session-pool"}},u={},d=[{value:"new Session(options)",id:"new-sessionoptions",level:2},{value:"session.userData",id:"sessionuserdata",level:2},{value:"session.isBlocked()",id:"sessionisblocked",level:2},{value:"session.isExpired()",id:"sessionisexpired",level:2},{value:"session.isMaxUsageCountReached()",id:"sessionismaxusagecountreached",level:2},{value:"session.isUsable()",id:"sessionisusable",level:2},{value:"session.markGood()",id:"sessionmarkgood",level:2},{value:"session.getState()",id:"sessiongetstate",level:2},{value:"session.retire()",id:"sessionretire",level:2},{value:"session.markBad()",id:"sessionmarkbad",level:2},{value:"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])",id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes",level:2},{value:"session.setCookiesFromResponse(response)",id:"sessionsetcookiesfromresponseresponse",level:2},{value:"session.setPuppeteerCookies(cookies, url)",id:"sessionsetpuppeteercookiescookies-url",level:2},{value:"session.getPuppeteerCookies(url)",id:"sessiongetpuppeteercookiesurl",level:2},{value:"session.getCookieString(url)",id:"sessiongetcookiestringurl",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(c,(0,s.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"session"}),(0,a.kt)("p",null,"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as\na specific user, with its own cookies, IP (via proxy) and potentially a unique browser fingerprint. Session internal state can be enriched with custom\nuser data for example some authorization tokens and specific headers in general."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"exports.session"}),(0,a.kt)("h2",{id:"new-sessionoptions"},(0,a.kt)("inlineCode",{parentName:"h2"},"new Session(options)")),(0,a.kt)("p",null,"Session configuration."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionOptions")))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"userdata"}),(0,a.kt)("h2",{id:"sessionuserdata"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.userData")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isblocked"}),(0,a.kt)("h2",{id:"sessionisblocked"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isBlocked()")),(0,a.kt)("p",null,"indicates whether the session is blocked. Session is blocked once it reaches the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxErrorScore"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isexpired"}),(0,a.kt)("h2",{id:"sessionisexpired"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isExpired()")),(0,a.kt)("p",null,"Indicates whether the session is expired. Session expiration is determined by the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxAgeSecs"),". Once the session is older than\n",(0,a.kt)("inlineCode",{parentName:"p"},"createdAt + maxAgeSecs")," the session is considered expired."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"ismaxusagecountreached"}),(0,a.kt)("h2",{id:"sessionismaxusagecountreached"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isMaxUsageCountReached()")),(0,a.kt)("p",null,"Indicates whether the session is used maximum number of times. Session maximum usage count can be changed by ",(0,a.kt)("inlineCode",{parentName:"p"},"maxUsageCount")," parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isusable"}),(0,a.kt)("h2",{id:"sessionisusable"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isUsable()")),(0,a.kt)("p",null,"Indicates whether the session can be used for next requests. Session is usable when it is not expired, not blocked and the maximum usage count has not\nbe reached."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markgood"}),(0,a.kt)("h2",{id:"sessionmarkgood"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markGood()")),(0,a.kt)("p",null,"This method should be called after a successful session usage. It increases ",(0,a.kt)("inlineCode",{parentName:"p"},"usageCount")," and potentially lowers the ",(0,a.kt)("inlineCode",{parentName:"p"},"errorScore")," by the\n",(0,a.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement"),"."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getstate"}),(0,a.kt)("h2",{id:"sessiongetstate"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getState()")),(0,a.kt)("p",null,"Gets session state for persistence in KeyValueStore."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-state",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionState"))," - represents session internal state."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retire"}),(0,a.kt)("h2",{id:"sessionretire"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retire()")),(0,a.kt)("p",null,"Marks session as blocked and emits event on the ",(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool")," This method should be used if the session usage was unsuccessful and you are sure that\nit is because of the session configuration and not any external matters. For example when server returns 403 status code. If the session does not work\ndue to some external factors as server error such as 5XX you probably want to use ",(0,a.kt)("inlineCode",{parentName:"p"},"markBad")," method."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markbad"}),(0,a.kt)("h2",{id:"sessionmarkbad"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markBad()")),(0,a.kt)("p",null,"Increases usage and error count. Should be used when the session has been used unsuccessfully. For example because of timeouts."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retireonblockedstatuscodes"}),(0,a.kt)("h2",{id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])")),(0,a.kt)("p",null,"With certain status codes: ",(0,a.kt)("inlineCode",{parentName:"p"},"401"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"403")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"429")," we can be certain that the target website is blocking us. This function helps to do this conveniently\nby retiring the session when such code is received. Optionally the default status codes can be extended in the second parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"statusCode")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"number")," - HTTP status code"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"[blockedStatusCodes]")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Array")," - Custom HTTP status codes that means blocking on particular website.")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," - whether the session was retired."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setcookiesfromresponse"}),(0,a.kt)("h2",{id:"sessionsetcookiesfromresponseresponse"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setCookiesFromResponse(response)")),(0,a.kt)("p",null,"Saves cookies from an HTTP response to be used with the session. It expects an object with a ",(0,a.kt)("inlineCode",{parentName:"p"},"headers")," property that's either an ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")," (typical\nNode.js responses) or a ",(0,a.kt)("inlineCode",{parentName:"p"},"Function")," (Puppeteer Response)."),(0,a.kt)("p",null,"It then parses and saves the cookies from the ",(0,a.kt)("inlineCode",{parentName:"p"},"set-cookie")," header, if available."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"PuppeteerResponse")," | ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setpuppeteercookies"}),(0,a.kt)("h2",{id:"sessionsetpuppeteercookiescookies-url"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setPuppeteerCookies(cookies, url)")),(0,a.kt)("p",null,"Saves an array with cookie objects to be used with the session. The objects should be in the format that\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-pagecookiesurls",target:"_blank",rel:"noopener"},"Puppeteer uses"),", but you can also use this function to set cookies\nmanually:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"[\n { name: 'cookie1', value: 'my-cookie' },\n { name: 'cookie2', value: 'your-cookie' }\n]\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"cookies")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Array")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getpuppeteercookies"}),(0,a.kt)("h2",{id:"sessiongetpuppeteercookiesurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getPuppeteerCookies(url)")),(0,a.kt)("p",null,"Returns cookies in a format compatible with puppeteer and ready to be used with ",(0,a.kt)("inlineCode",{parentName:"p"},"page.setCookie"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string")," - website url. Only cookies stored for this url will be returned")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getcookiestring"}),(0,a.kt)("h2",{id:"sessiongetcookiestringurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getCookieString(url)")),(0,a.kt)("p",null,"Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"string")," - represents ",(0,a.kt)("inlineCode",{parentName:"p"},"Cookie")," header."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var s=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},c=s.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),d=p(n),c=o,m=d["".concat(l,".").concat(c)]||d[c]||k[c]||a;return n?s.createElement(m,i(i({ref:t},u),{},{components:n})):s.createElement(m,i({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=c;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r[d]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var s=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],r={id_old:"version-1.3-session",title:"Session",id:"session"},l=void 0,p={unversionedId:"api/session",id:"version-1.3/api/session",title:"Session",description:"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as",source:"@site/versioned_docs/version-1.3/api/Session.md",sourceDirName:"api",slug:"/api/session",permalink:"/sdk/js/docs/1.3/api/session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Session.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-session",title:"Session",id:"session"},sidebar:"version-1.3/docs",previous:{title:"AutoscaledPool",permalink:"/sdk/js/docs/1.3/api/autoscaled-pool"},next:{title:"SessionPool",permalink:"/sdk/js/docs/1.3/api/session-pool"}},u={},d=[{value:"new Session(options)",id:"new-sessionoptions",level:2},{value:"session.userData",id:"sessionuserdata",level:2},{value:"session.isBlocked()",id:"sessionisblocked",level:2},{value:"session.isExpired()",id:"sessionisexpired",level:2},{value:"session.isMaxUsageCountReached()",id:"sessionismaxusagecountreached",level:2},{value:"session.isUsable()",id:"sessionisusable",level:2},{value:"session.markGood()",id:"sessionmarkgood",level:2},{value:"session.getState()",id:"sessiongetstate",level:2},{value:"session.retire()",id:"sessionretire",level:2},{value:"session.markBad()",id:"sessionmarkbad",level:2},{value:"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])",id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes",level:2},{value:"session.setCookiesFromResponse(response)",id:"sessionsetcookiesfromresponseresponse",level:2},{value:"session.setPuppeteerCookies(cookies, url)",id:"sessionsetpuppeteercookiescookies-url",level:2},{value:"session.getPuppeteerCookies(url)",id:"sessiongetpuppeteercookiesurl",level:2},{value:"session.getCookieString(url)",id:"sessiongetcookiestringurl",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(c,(0,s.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"session"}),(0,a.kt)("p",null,"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as\na specific user, with its own cookies, IP (via proxy) and potentially a unique browser fingerprint. Session internal state can be enriched with custom\nuser data for example some authorization tokens and specific headers in general."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"exports.session"}),(0,a.kt)("h2",{id:"new-sessionoptions"},(0,a.kt)("inlineCode",{parentName:"h2"},"new Session(options)")),(0,a.kt)("p",null,"Session configuration."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionOptions")))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"userdata"}),(0,a.kt)("h2",{id:"sessionuserdata"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.userData")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isblocked"}),(0,a.kt)("h2",{id:"sessionisblocked"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isBlocked()")),(0,a.kt)("p",null,"indicates whether the session is blocked. Session is blocked once it reaches the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxErrorScore"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isexpired"}),(0,a.kt)("h2",{id:"sessionisexpired"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isExpired()")),(0,a.kt)("p",null,"Indicates whether the session is expired. Session expiration is determined by the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxAgeSecs"),". Once the session is older than\n",(0,a.kt)("inlineCode",{parentName:"p"},"createdAt + maxAgeSecs")," the session is considered expired."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"ismaxusagecountreached"}),(0,a.kt)("h2",{id:"sessionismaxusagecountreached"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isMaxUsageCountReached()")),(0,a.kt)("p",null,"Indicates whether the session is used maximum number of times. Session maximum usage count can be changed by ",(0,a.kt)("inlineCode",{parentName:"p"},"maxUsageCount")," parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isusable"}),(0,a.kt)("h2",{id:"sessionisusable"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isUsable()")),(0,a.kt)("p",null,"Indicates whether the session can be used for next requests. Session is usable when it is not expired, not blocked and the maximum usage count has not\nbe reached."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markgood"}),(0,a.kt)("h2",{id:"sessionmarkgood"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markGood()")),(0,a.kt)("p",null,"This method should be called after a successful session usage. It increases ",(0,a.kt)("inlineCode",{parentName:"p"},"usageCount")," and potentially lowers the ",(0,a.kt)("inlineCode",{parentName:"p"},"errorScore")," by the\n",(0,a.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement"),"."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getstate"}),(0,a.kt)("h2",{id:"sessiongetstate"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getState()")),(0,a.kt)("p",null,"Gets session state for persistence in KeyValueStore."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-state",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionState"))," - represents session internal state."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retire"}),(0,a.kt)("h2",{id:"sessionretire"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retire()")),(0,a.kt)("p",null,"Marks session as blocked and emits event on the ",(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool")," This method should be used if the session usage was unsuccessful and you are sure that\nit is because of the session configuration and not any external matters. For example when server returns 403 status code. If the session does not work\ndue to some external factors as server error such as 5XX you probably want to use ",(0,a.kt)("inlineCode",{parentName:"p"},"markBad")," method."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markbad"}),(0,a.kt)("h2",{id:"sessionmarkbad"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markBad()")),(0,a.kt)("p",null,"Increases usage and error count. Should be used when the session has been used unsuccessfully. For example because of timeouts."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retireonblockedstatuscodes"}),(0,a.kt)("h2",{id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])")),(0,a.kt)("p",null,"With certain status codes: ",(0,a.kt)("inlineCode",{parentName:"p"},"401"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"403")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"429")," we can be certain that the target website is blocking us. This function helps to do this conveniently\nby retiring the session when such code is received. Optionally the default status codes can be extended in the second parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"statusCode")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"number")," - HTTP status code"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"[blockedStatusCodes]")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Array")," - Custom HTTP status codes that means blocking on particular website.")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," - whether the session was retired."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setcookiesfromresponse"}),(0,a.kt)("h2",{id:"sessionsetcookiesfromresponseresponse"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setCookiesFromResponse(response)")),(0,a.kt)("p",null,"Saves cookies from an HTTP response to be used with the session. It expects an object with a ",(0,a.kt)("inlineCode",{parentName:"p"},"headers")," property that's either an ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")," (typical\nNode.js responses) or a ",(0,a.kt)("inlineCode",{parentName:"p"},"Function")," (Puppeteer Response)."),(0,a.kt)("p",null,"It then parses and saves the cookies from the ",(0,a.kt)("inlineCode",{parentName:"p"},"set-cookie")," header, if available."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"PuppeteerResponse")," | ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setpuppeteercookies"}),(0,a.kt)("h2",{id:"sessionsetpuppeteercookiescookies-url"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setPuppeteerCookies(cookies, url)")),(0,a.kt)("p",null,"Saves an array with cookie objects to be used with the session. The objects should be in the format that\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-pagecookiesurls",target:"_blank",rel:"noopener"},"Puppeteer uses"),", but you can also use this function to set cookies\nmanually:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"[\n { name: 'cookie1', value: 'my-cookie' },\n { name: 'cookie2', value: 'your-cookie' }\n]\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"cookies")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Array")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getpuppeteercookies"}),(0,a.kt)("h2",{id:"sessiongetpuppeteercookiesurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getPuppeteerCookies(url)")),(0,a.kt)("p",null,"Returns cookies in a format compatible with puppeteer and ready to be used with ",(0,a.kt)("inlineCode",{parentName:"p"},"page.setCookie"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string")," - website url. Only cookies stored for this url will be returned")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getcookiestring"}),(0,a.kt)("h2",{id:"sessiongetcookiestringurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getCookieString(url)")),(0,a.kt)("p",null,"Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"string")," - represents ",(0,a.kt)("inlineCode",{parentName:"p"},"Cookie")," header."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var s=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},c=s.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),d=p(n),c=o,m=d["".concat(l,".").concat(c)]||d[c]||k[c]||a;return n?s.createElement(m,i(i({ref:t},u),{},{components:n})):s.createElement(m,i({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=c;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r[d]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-playwright-hook",title:"PlaywrightHook",id:"playwright-hook"},p=void 0,s={unversionedId:"typedefs/playwright-hook",id:"version-1.3/typedefs/playwright-hook",title:"PlaywrightHook",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightHook.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-hook",permalink:"/sdk/js/docs/1.3/typedefs/playwright-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHook.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-hook",title:"PlaywrightHook",id:"playwright-hook"}},c={},d=[],u={toc:d},y="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(y,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"playwrighthook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/playwright-goto-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PlaywrightGotoOptions")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),y=o,f=d["".concat(p,".").concat(y)]||d[y]||u[y]||a;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=y;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-playwright-hook",title:"PlaywrightHook",id:"playwright-hook"},p=void 0,s={unversionedId:"typedefs/playwright-hook",id:"version-1.3/typedefs/playwright-hook",title:"PlaywrightHook",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightHook.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-hook",permalink:"/sdk/js/docs/1.3/typedefs/playwright-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHook.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-hook",title:"PlaywrightHook",id:"playwright-hook"}},c={},d=[],u={toc:d},y="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(y,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"playwrighthook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/playwright-goto-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PlaywrightGotoOptions")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),y=o,f=d["".concat(p,".").concat(y)]||d[y]||u[y]||a;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=y;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>y,frontMatter:()=>s,metadata:()=>u,toc:()=>l});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),c=["components"],s={id_old:"version-1.3-user-func",title:"UserFunc",id:"user-func"},i=void 0,u={unversionedId:"typedefs/user-func",id:"version-1.3/typedefs/user-func",title:"UserFunc",description:"Returns:",source:"@site/versioned_docs/version-1.3/typedefs/UserFunc.md",sourceDirName:"typedefs",slug:"/typedefs/user-func",permalink:"/sdk/js/docs/1.3/typedefs/user-func",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/UserFunc.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-user-func",title:"UserFunc",id:"user-func"}},p={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,c);return(0,a.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"userfunc"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),l=u(r),d=o,y=l["".concat(i,".").concat(d)]||l[d]||f[d]||a;return r?n.createElement(y,c(c({ref:t},p),{},{components:r})):n.createElement(y,c({ref:t},p))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[l]="string"==typeof e?e:o,c[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>y,frontMatter:()=>s,metadata:()=>u,toc:()=>l});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),c=["components"],s={id:"user-func",title:"UserFunc"},i=void 0,u={unversionedId:"typedefs/user-func",id:"version-2.3/typedefs/user-func",title:"UserFunc",description:"Returns:",source:"@site/versioned_docs/version-2.3/typedefs/UserFunc.md",sourceDirName:"typedefs",slug:"/typedefs/user-func",permalink:"/sdk/js/docs/2.3/typedefs/user-func",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/UserFunc.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"user-func",title:"UserFunc"}},p={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,c);return(0,a.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"userfunc"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),l=u(r),d=o,y=l["".concat(i,".").concat(d)]||l[d]||f[d]||a;return r?n.createElement(y,c(c({ref:t},p),{},{components:r})):n.createElement(y,c({ref:t},p))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[l]="string"==typeof e?e:o,c[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>l});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],c={id_old:"version-1.3-user-func",title:"UserFunc",id:"user-func"},i=void 0,u={unversionedId:"typedefs/user-func",id:"version-1.3/typedefs/user-func",title:"UserFunc",description:"Returns:",source:"@site/versioned_docs/version-1.3/typedefs/UserFunc.md",sourceDirName:"typedefs",slug:"/typedefs/user-func",permalink:"/sdk/js/docs/1.3/typedefs/user-func",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/UserFunc.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-user-func",title:"UserFunc",id:"user-func"}},p={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"userfunc"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),l=u(r),d=o,y=l["".concat(i,".").concat(d)]||l[d]||f[d]||a;return r?n.createElement(y,s(s({ref:t},p),{},{components:r})):n.createElement(y,s({ref:t},p))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[l]="string"==typeof e?e:o,s[1]=c;for(var u=2;u{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),r=n(63366),a=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},p=void 0,s={unversionedId:"typedefs/puppeteer-crawler-options",id:"version-1.3/typedefs/puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/playwright-launch-context"},next:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,a.kt)(h,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteercrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerHandlePage"))),(0,a.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,a.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer")," ",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,a.kt)("inlineCode",{parentName:"p"},"browserPool")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer"),"\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by\n",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The function must return a promise, which is then awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"navigationtimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,"Where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchcontext"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))),(0,a.kt)("p",null,"Options used by ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," to start new Puppeteer instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"browserpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided and\nrotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n const { page } = crawlingContext;\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n }\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n };\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by the crawler and cannot be overridden. However, you can provide a custom implementation of\n",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Puppeteer crawler will initialize the ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"The configuration options for ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),s=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},h=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(n),h=r,k=c["".concat(p,".").concat(h)]||c[h]||d[h]||a;return n?o.createElement(k,l(l({ref:t},u),{},{components:n})):o.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),r=n(63366),a=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},p=void 0,s={unversionedId:"typedefs/puppeteer-crawler-options",id:"version-1.3/typedefs/puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/playwright-launch-context"},next:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,a.kt)(h,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteercrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerHandlePage"))),(0,a.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,a.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer")," ",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,a.kt)("inlineCode",{parentName:"p"},"browserPool")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer"),"\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by\n",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The function must return a promise, which is then awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"navigationtimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,"Where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchcontext"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))),(0,a.kt)("p",null,"Options used by ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," to start new Puppeteer instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"browserpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided and\nrotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n const { page } = crawlingContext;\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n }\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n };\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by the crawler and cannot be overridden. However, you can provide a custom implementation of\n",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Puppeteer crawler will initialize the ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"The configuration options for ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),s=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},h=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(n),h=r,k=c["".concat(p,".").concat(h)]||c[h]||d[h]||a;return n?o.createElement(k,l(l({ref:t},u),{},{components:n})):o.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"goto-function",title:"GotoFunction"},p=void 0,c={unversionedId:"typedefs/goto-function",id:"version-2.3/typedefs/goto-function",title:"GotoFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/GotoFunction.md",sourceDirName:"typedefs",slug:"/typedefs/goto-function",permalink:"/sdk/js/docs/2.3/typedefs/goto-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/GotoFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"goto-function",title:"GotoFunction"}},s={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"gotofunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),d=o,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"goto-function",title:"GotoFunction"},p=void 0,c={unversionedId:"typedefs/goto-function",id:"version-2.3/typedefs/goto-function",title:"GotoFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/GotoFunction.md",sourceDirName:"typedefs",slug:"/typedefs/goto-function",permalink:"/sdk/js/docs/2.3/typedefs/goto-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/GotoFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"goto-function",title:"GotoFunction"}},s={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"gotofunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),d=o,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var c=2;c{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"upgrading-to-v1",title:"Upgrading to v1"},p=void 0,s={unversionedId:"upgrading/upgrading-to-v1",id:"version-3.0/upgrading/upgrading-to-v1",title:"Upgrading to v1",description:"Summary",source:"@site/versioned_docs/version-3.0/upgrading/upgrading_v1.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v1",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v1.md",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v1",title:"Upgrading to v1"},sidebar:"docs",previous:{title:"Upgrading",permalink:"/sdk/js/docs/3.0/upgrading"},next:{title:"Upgrading to v2",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v2"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"Map of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"autoscaledPool was moved under crawlingContext.crawler",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of PuppeteerPool with BrowserPool",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running BrowserPool",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of BrowserController",id:"introduction-of-browsercontroller",level:3},{value:"BrowserPool methods vs PuppeteerPool",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated PuppeteerCrawlerOptions",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of gotoFunction",id:"removal-of-gotofunction",level:3},{value:"launchPuppeteerOptions => launchContext",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of launchPuppeteerFunction",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},h="wrapper";function m(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),h=o,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return t?a.createElement(m,l(l({ref:n},u),{},{components:t})):a.createElement(m,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=h;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"upgrading-to-v1",title:"Upgrading to v1"},p=void 0,s={unversionedId:"upgrading/upgrading-to-v1",id:"version-3.0/upgrading/upgrading-to-v1",title:"Upgrading to v1",description:"Summary",source:"@site/versioned_docs/version-3.0/upgrading/upgrading_v1.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v1",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v1.md",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v1",title:"Upgrading to v1"},sidebar:"docs",previous:{title:"Upgrading",permalink:"/sdk/js/docs/3.0/upgrading"},next:{title:"Upgrading to v2",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v2"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"Map of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"autoscaledPool was moved under crawlingContext.crawler",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of PuppeteerPool with BrowserPool",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running BrowserPool",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of BrowserController",id:"introduction-of-browsercontroller",level:3},{value:"BrowserPool methods vs PuppeteerPool",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated PuppeteerCrawlerOptions",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of gotoFunction",id:"removal-of-gotofunction",level:3},{value:"launchPuppeteerOptions => launchContext",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of launchPuppeteerFunction",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},h="wrapper";function m(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),h=o,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return t?a.createElement(m,l(l({ref:n},u),{},{components:t})):a.createElement(m,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=h;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>y,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],p={id_old:"version-1.3-playwright-launch-context",title:"PlaywrightLaunchContext",id:"playwright-launch-context"},i=void 0,s={unversionedId:"typedefs/playwright-launch-context",id:"version-1.3/typedefs/playwright-launch-context",title:"PlaywrightLaunchContext",description:"Apify extends the launch options of Playwright. You can use any of the Playwright compatible",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-launch-context",permalink:"/sdk/js/docs/1.3/typedefs/playwright-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightLaunchContext.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-launch-context",title:"PlaywrightLaunchContext",id:"playwright-launch-context"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/playwright-crawler-options"},next:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"launcher",id:"launcher",level:3}],h={toc:u},d="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(d,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrightlaunchcontext"}),(0,o.kt)("p",null,"Apify extends the launch options of Playwright. You can use any of the Playwright compatible\n",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype#browsertypelaunchoptions",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,o.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Playwright options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"launchoptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"LaunchOptions")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"browserType.launch")," ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions",target:"_blank",rel:"noopener"},"options")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyurl"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,o.kt)("p",null,"Example: ",(0,o.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usechrome"},(0,o.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system. By default, this option is ",(0,o.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"launcher"},(0,o.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"By default this function uses ",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").chromium'),". If you want to use a different browser you can pass it by this property as e.g.\n",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").firefox')),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(n),d=a,y=u["".concat(i,".").concat(d)]||u[d]||h[d]||o;return n?r.createElement(y,l(l({ref:t},c),{},{components:n})):r.createElement(y,l({ref:t},c))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[u]="string"==typeof e?e:a,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>y,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],p={id_old:"version-1.3-playwright-launch-context",title:"PlaywrightLaunchContext",id:"playwright-launch-context"},i=void 0,s={unversionedId:"typedefs/playwright-launch-context",id:"version-1.3/typedefs/playwright-launch-context",title:"PlaywrightLaunchContext",description:"Apify extends the launch options of Playwright. You can use any of the Playwright compatible",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-launch-context",permalink:"/sdk/js/docs/1.3/typedefs/playwright-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightLaunchContext.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-launch-context",title:"PlaywrightLaunchContext",id:"playwright-launch-context"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/playwright-crawler-options"},next:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"launcher",id:"launcher",level:3}],h={toc:u},d="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(d,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrightlaunchcontext"}),(0,o.kt)("p",null,"Apify extends the launch options of Playwright. You can use any of the Playwright compatible\n",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype#browsertypelaunchoptions",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,o.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Playwright options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"launchoptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"LaunchOptions")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"browserType.launch")," ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions",target:"_blank",rel:"noopener"},"options")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyurl"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,o.kt)("p",null,"Example: ",(0,o.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usechrome"},(0,o.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system. By default, this option is ",(0,o.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"launcher"},(0,o.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"By default this function uses ",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").chromium'),". If you want to use a different browser you can pass it by this property as e.g.\n",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").firefox')),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(n),d=a,y=u["".concat(i,".").concat(d)]||u[d]||h[d]||o;return n?r.createElement(y,l(l({ref:t},c),{},{components:n})):r.createElement(y,l({ref:t},c))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[u]="string"==typeof e?e:a,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-social-handles",title:"SocialHandles",id:"social-handles"},s=void 0,p={unversionedId:"typedefs/social-handles",id:"version-1.3/typedefs/social-handles",title:"SocialHandles",description:"Representation of social handles parsed from a HTML page.",source:"@site/versioned_docs/version-1.3/typedefs/SocialHandles.md",sourceDirName:"typedefs",slug:"/typedefs/social-handles",permalink:"/sdk/js/docs/1.3/typedefs/social-handles",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SocialHandles.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-social-handles",title:"SocialHandles",id:"social-handles"},sidebar:"version-1.3/docs",previous:{title:"SessionState",permalink:"/sdk/js/docs/1.3/typedefs/session-state"},next:{title:"SystemInfo",permalink:"/sdk/js/docs/1.3/typedefs/system-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"emails",id:"emails",level:3},{value:"phones",id:"phones",level:3},{value:"phonesUncertain",id:"phonesuncertain",level:3},{value:"linkedIns",id:"linkedins",level:3},{value:"twitters",id:"twitters",level:3},{value:"instagrams",id:"instagrams",level:3},{value:"facebooks",id:"facebooks",level:3},{value:"youtubes",id:"youtubes",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"socialhandles"}),(0,o.kt)("p",null,"Representation of social handles parsed from a HTML page."),(0,o.kt)("p",null,"The object has the following structure:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n emails: String[],\n phones: String[],\n phonesUncertain: String[],\n linkedIns: String[],\n twitters: String[],\n instagrams: String[],\n facebooks: String[],\n youtubes: String[],\n}\n")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"emails"},(0,o.kt)("inlineCode",{parentName:"h3"},"emails")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"phones"},(0,o.kt)("inlineCode",{parentName:"h3"},"phones")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"phonesuncertain"},(0,o.kt)("inlineCode",{parentName:"h3"},"phonesUncertain")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"linkedins"},(0,o.kt)("inlineCode",{parentName:"h3"},"linkedIns")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"twitters"},(0,o.kt)("inlineCode",{parentName:"h3"},"twitters")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"instagrams"},(0,o.kt)("inlineCode",{parentName:"h3"},"instagrams")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"facebooks"},(0,o.kt)("inlineCode",{parentName:"h3"},"facebooks")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"youtubes"},(0,o.kt)("inlineCode",{parentName:"h3"},"youtubes")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Array")),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return n?r.createElement(k,i(i({ref:t},d),{},{components:n})):r.createElement(k,i({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-social-handles",title:"SocialHandles",id:"social-handles"},s=void 0,p={unversionedId:"typedefs/social-handles",id:"version-1.3/typedefs/social-handles",title:"SocialHandles",description:"Representation of social handles parsed from a HTML page.",source:"@site/versioned_docs/version-1.3/typedefs/SocialHandles.md",sourceDirName:"typedefs",slug:"/typedefs/social-handles",permalink:"/sdk/js/docs/1.3/typedefs/social-handles",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SocialHandles.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-social-handles",title:"SocialHandles",id:"social-handles"},sidebar:"version-1.3/docs",previous:{title:"SessionState",permalink:"/sdk/js/docs/1.3/typedefs/session-state"},next:{title:"SystemInfo",permalink:"/sdk/js/docs/1.3/typedefs/system-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"emails",id:"emails",level:3},{value:"phones",id:"phones",level:3},{value:"phonesUncertain",id:"phonesuncertain",level:3},{value:"linkedIns",id:"linkedins",level:3},{value:"twitters",id:"twitters",level:3},{value:"instagrams",id:"instagrams",level:3},{value:"facebooks",id:"facebooks",level:3},{value:"youtubes",id:"youtubes",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"socialhandles"}),(0,i.kt)("p",null,"Representation of social handles parsed from a HTML page."),(0,i.kt)("p",null,"The object has the following structure:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n emails: String[],\n phones: String[],\n phonesUncertain: String[],\n linkedIns: String[],\n twitters: String[],\n instagrams: String[],\n facebooks: String[],\n youtubes: String[],\n}\n")),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"emails"},(0,i.kt)("inlineCode",{parentName:"h3"},"emails")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"phones"},(0,i.kt)("inlineCode",{parentName:"h3"},"phones")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"phonesuncertain"},(0,i.kt)("inlineCode",{parentName:"h3"},"phonesUncertain")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"linkedins"},(0,i.kt)("inlineCode",{parentName:"h3"},"linkedIns")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"twitters"},(0,i.kt)("inlineCode",{parentName:"h3"},"twitters")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"instagrams"},(0,i.kt)("inlineCode",{parentName:"h3"},"instagrams")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"facebooks"},(0,i.kt)("inlineCode",{parentName:"h3"},"facebooks")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"youtubes"},(0,i.kt)("inlineCode",{parentName:"h3"},"youtubes")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||u[m]||i;return n?r.createElement(k,o(o({ref:t},d),{},{components:n})):r.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,o[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",id:"puppeteer-handle-page-function-param"},l=void 0,c={unversionedId:"typedefs/puppeteer-handle-page-function-param",id:"version-1.3/typedefs/puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page-function-param",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageFunctionParam.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",id:"puppeteer-handle-page-function-param"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],s={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepagefunctionparam"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"page"},(0,p.kt)("inlineCode",{parentName:"h3"},"page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||s[f]||p;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",id:"puppeteer-handle-page-function-param"},l=void 0,c={unversionedId:"typedefs/puppeteer-handle-page-function-param",id:"version-1.3/typedefs/puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page-function-param",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageFunctionParam.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",id:"puppeteer-handle-page-function-param"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],s={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepagefunctionparam"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"page"},(0,p.kt)("inlineCode",{parentName:"h3"},"page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||s[f]||p;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>p,toc:()=>d});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],s={id_old:"version-2.3.0-avoid-blocking",title:"Avoid getting blocked",id:"avoid-blocking"},l=void 0,p={unversionedId:"guides/avoid-blocking",id:"version-2.3/guides/avoid-blocking",title:"Avoid getting blocked",description:"A Scraper might get blocked for numerous reasons. Let's narrow it down to two main reasons. The first one is a bad or blocked IP address. This topic is covered in the proxy management guide. The second reason we will explore more is browser fingerprints or signatures.",source:"@site/versioned_docs/version-2.3/guides/avoid_blocking.md",sourceDirName:"guides",slug:"/guides/avoid-blocking",permalink:"/sdk/js/docs/2.3/guides/avoid-blocking",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/avoid_blocking.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-avoid-blocking",title:"Avoid getting blocked",id:"avoid-blocking"},sidebar:"version-2.3/docs",previous:{title:"Migration to version 1",permalink:"/sdk/js/docs/2.3/guides/migration-to-v1"},next:{title:"Examples",permalink:"/sdk/js/docs/2.3/examples"}},c={},d=[],u={toc:d},g="wrapper";function f(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(g,(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"A Scraper might get blocked for numerous reasons. Let's narrow it down to two main reasons. The first one is a bad or blocked IP address. This topic is covered in the ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/2.3/guides/proxy-management",target:null,rel:null},"proxy management guide"),". The second reason we will explore more is ",(0,i.kt)("a",{parentName:"p",href:"https://pixelprivacy.com/resources/browser-fingerprinting/",target:"_blank",rel:"noopener"},"browser fingerprints")," or signatures.\nBrowser fingerprint is a collection of browser attributes and significant features that can show if your browser is a bot or a real user. Moreover, even most browsers have these unique features that allow the website to track the browser even within different IP addresses. This is the main reason why scrapers should change browser fingerprints while doing browser-based scraping. In addition, it should reduce blocking significantly."),(0,i.kt)("p",null,"Changing browser fingerprints can be a tedious job. Luckily, Apify SDK provides this feature out of the box with zero configuration necessary. Let's take a look at how it is done."),(0,i.kt)("p",null," Changing browser fingerprints is available in ",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". You have to pass the ",(0,i.kt)("inlineCode",{parentName:"p"},"useFingerprints")," option to the ",(0,i.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: true,\n },\n})\n\n")),(0,i.kt)("p",null,"Now, it is all set. The fingerprints are going to be generated for the default browser and the operating system. The Crawler can have the generation alghoritm customized to reflect particular browser version and many more. Let's take a look at the example bellow:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: true,\n fingerprintOptions: {\n fingerprintGeneratorOptions: {\n browsers: [\n { name: 'firefox', minVersion: 80 },\n { name: 'chrome', minVersion: 87 },\n 'safari',\n ],\n devices: [\n 'desktop',\n ],\n operatingSystems: [\n 'windows',\n ],\n },\n },\n },\n})\n\n")),(0,i.kt)("p",null," Fingerprint generator has more options available check out the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/fingerprint-generator#HeaderGeneratorOptions",target:"_blank",rel:"noopener"},"Fingerprint generator docs"),"."))}f.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),p=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},c=function(e){var r=p(e.components);return n.createElement(l.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},g=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(t),g=o,f=d["".concat(l,".").concat(g)]||d[g]||u[g]||i;return t?n.createElement(f,a(a({ref:r},c),{},{components:t})):n.createElement(f,a({ref:r},c))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=g;var s={};for(var l in r)hasOwnProperty.call(r,l)&&(s[l]=r[l]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>p,toc:()=>d});var t=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],s={id_old:"version-2.3.0-avoid-blocking",title:"Avoid getting blocked",id:"avoid-blocking"},l=void 0,p={unversionedId:"guides/avoid-blocking",id:"version-2.3/guides/avoid-blocking",title:"Avoid getting blocked",description:"A Scraper might get blocked for numerous reasons. Let's narrow it down to two main reasons. The first one is a bad or blocked IP address. This topic is covered in the proxy management guide. The second reason we will explore more is browser fingerprints or signatures.",source:"@site/versioned_docs/version-2.3/guides/avoid_blocking.md",sourceDirName:"guides",slug:"/guides/avoid-blocking",permalink:"/sdk/js/docs/2.3/guides/avoid-blocking",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/avoid_blocking.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-avoid-blocking",title:"Avoid getting blocked",id:"avoid-blocking"},sidebar:"version-2.3/docs",previous:{title:"Migration to version 1",permalink:"/sdk/js/docs/2.3/guides/migration-to-v1"},next:{title:"Examples",permalink:"/sdk/js/docs/2.3/examples"}},c={},d=[],u={toc:d},g="wrapper";function f(e){var r=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(g,(0,t.Z)({},u,n,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"A Scraper might get blocked for numerous reasons. Let's narrow it down to two main reasons. The first one is a bad or blocked IP address. This topic is covered in the ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/2.3/guides/proxy-management",target:null,rel:null},"proxy management guide"),". The second reason we will explore more is ",(0,i.kt)("a",{parentName:"p",href:"https://pixelprivacy.com/resources/browser-fingerprinting/",target:"_blank",rel:"noopener"},"browser fingerprints")," or signatures.\nBrowser fingerprint is a collection of browser attributes and significant features that can show if your browser is a bot or a real user. Moreover, even most browsers have these unique features that allow the website to track the browser even within different IP addresses. This is the main reason why scrapers should change browser fingerprints while doing browser-based scraping. In addition, it should reduce blocking significantly."),(0,i.kt)("p",null,"Changing browser fingerprints can be a tedious job. Luckily, Apify SDK provides this feature out of the box with zero configuration necessary. Let's take a look at how it is done."),(0,i.kt)("p",null," Changing browser fingerprints is available in ",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". You have to pass the ",(0,i.kt)("inlineCode",{parentName:"p"},"useFingerprints")," option to the ",(0,i.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: true,\n },\n})\n\n")),(0,i.kt)("p",null,"Now, it is all set. The fingerprints are going to be generated for the default browser and the operating system. The Crawler can have the generation alghoritm customized to reflect particular browser version and many more. Let's take a look at the example bellow:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: true,\n fingerprintOptions: {\n fingerprintGeneratorOptions: {\n browsers: [\n { name: 'firefox', minVersion: 80 },\n { name: 'chrome', minVersion: 87 },\n 'safari',\n ],\n devices: [\n 'desktop',\n ],\n operatingSystems: [\n 'windows',\n ],\n },\n },\n },\n})\n\n")),(0,i.kt)("p",null," Fingerprint generator has more options available check out the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/fingerprint-generator#HeaderGeneratorOptions",target:"_blank",rel:"noopener"},"Fingerprint generator docs"),"."))}f.isMDXComponent=!0},3905:(e,r,n)=>{n.d(r,{Zo:()=>c,kt:()=>f});var t=n(67294);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function i(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function a(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),p=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):a(a({},r),e)),n},c=function(e){var r=p(e.components);return t.createElement(l.Provider,{value:r},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},g=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),g=o,f=d["".concat(l,".").concat(g)]||d[g]||u[g]||i;return n?t.createElement(f,a(a({ref:r},c),{},{components:n})):t.createElement(f,a({ref:r},c))}));function f(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=g;var s={};for(var l in r)hasOwnProperty.call(r,l)&&(s[l]=r[l]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var p=2;p{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var t=o(87462),s=o(63366),r=(o(67294),o(3905)),a=["components"],i={id:"session-management",title:"Session Management"},l=void 0,u={unversionedId:"guides/session-management",id:"version-2.3/guides/session-management",title:"Session Management",description:"SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-2.3/guides/session_management.md",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/2.3/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/session_management.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"version-2.3/docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/2.3/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/2.3/guides/type-script-actor"}},p={},c=[],d={toc:c},m="wrapper";function y(e){var n=e.components,o=(0,s.Z)(e,a);return(0,r.kt)(m,(0,t.Z)({},d,o,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,r.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,r.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/puppeteer-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Apify.createProxyConfiguration();\n\nconst crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/cheerio-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/basic-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BasicCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await Apify.utils.requestAsBrowser(requestOptions);\n } catch (e) {\n if (e === "SomeNetworkError") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example solo usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(async () => {\n\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await Apify.openSessionPool(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,r.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}y.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>p,kt:()=>y});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),u=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},p=function(e){var n=u(e.components);return t.createElement(l.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=u(o),m=s,y=c["".concat(l,".").concat(m)]||c[m]||d[m]||r;return o?t.createElement(y,a(a({ref:n},p),{},{components:o})):t.createElement(y,a({ref:n},p))}));function y(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[c]="string"==typeof e?e:s,a[1]=i;for(var u=2;u{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var t=o(87462),s=o(63366),r=(o(67294),o(3905)),a=["components"],i={id:"session-management",title:"Session Management"},l=void 0,u={unversionedId:"guides/session-management",id:"version-2.3/guides/session-management",title:"Session Management",description:"SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-2.3/guides/session_management.md",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/2.3/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/session_management.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"version-2.3/docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/2.3/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/2.3/guides/type-script-actor"}},p={},c=[],d={toc:c},m="wrapper";function y(e){var n=e.components,o=(0,s.Z)(e,a);return(0,r.kt)(m,(0,t.Z)({},d,o,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,r.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,r.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/puppeteer-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Apify.createProxyConfiguration();\n\nconst crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/cheerio-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/basic-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BasicCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await Apify.utils.requestAsBrowser(requestOptions);\n } catch (e) {\n if (e === "SomeNetworkError") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example solo usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(async () => {\n\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await Apify.openSessionPool(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,r.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}y.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>p,kt:()=>y});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),u=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},p=function(e){var n=u(e.components);return t.createElement(l.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=u(o),m=s,y=c["".concat(l,".").concat(m)]||c[m]||d[m]||r;return o?t.createElement(y,a(a({ref:n},p),{},{components:o})):t.createElement(y,a({ref:n},p))}));function y(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[c]="string"==typeof e?e:s,a[1]=i;for(var u=2;u{a.d(t,{Z:()=>c});var n=a(67294),r=a(88746),o=a(6141),d=a(6832);const c=function(e){var t=e.to,a=e.children,c=(0,o.E)(),l=c.version,s=c.isLast;if((0,d.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var i=l+"/";return"current"===l?i="next/":s&&(i=""),n.createElement(r.default,{to:"/api/"+i+t},a)}},35637:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>I,frontMatter:()=>i,metadata:()=>u,toc:()=>g});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),d=(a(14563),a(68889));const c={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, body }) {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8"};var l,s=["components"],i={id:"add-data-to-dataset",title:"Add data to dataset"},p=void 0,u={unversionedId:"examples/add-data-to-dataset",id:"examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/../docs/examples/add_data_to_dataset.mdx",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/next/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/add_data_to_dataset.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/next/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/next/examples/basic-crawler"}},m={},g=[],b=(l="RunnableCodeBlock",function(e){return console.warn("Component "+l+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:g},y="wrapper";function I(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(y,(0,n.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)(d.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.openDataset()"))),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},c),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/datasets/default/\n")))}I.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>i,kt:()=>g});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function d(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),s=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):d(d({},t),e)),a},i=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,i=c(e,["components","mdxType","originalType","parentName"]),p=s(a),m=r,g=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return a?n.createElement(g,d(d({ref:t},i),{},{components:a})):n.createElement(g,d({ref:t},i))}));function g(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,d=new Array(o);d[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[p]="string"==typeof e?e:r,d[1]=c;for(var s=2;s{a.d(t,{Z:()=>c});var n=a(67294),r=a(88746),d=a(6141),o=a(6832);const c=function(e){var t=e.to,a=e.children,c=(0,d.E)(),l=c.version,s=c.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var i=l+"/";return"current"===l?i="next/":s&&(i=""),n.createElement(r.default,{to:"/api/"+i+t},a)}},35637:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>I,frontMatter:()=>i,metadata:()=>u,toc:()=>g});var n=a(87462),r=a(63366),d=(a(67294),a(3905)),o=(a(14563),a(68889));const c={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, body }) {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8"};var l,s=["components"],i={id:"add-data-to-dataset",title:"Add data to dataset"},p=void 0,u={unversionedId:"examples/add-data-to-dataset",id:"examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/../docs/examples/add_data_to_dataset.mdx",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/next/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/add_data_to_dataset.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/next/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/next/examples/basic-crawler"}},m={},g=[],b=(l="RunnableCodeBlock",function(e){return console.warn("Component "+l+" was not imported, exported, or provided by MDXProvider as global scope"),(0,d.kt)("div",e)}),f={toc:g},y="wrapper";function I(e){var t=e.components,a=(0,r.Z)(e,s);return(0,d.kt)(y,(0,n.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,d.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,d.kt)(o.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,d.kt)("inlineCode",{parentName:"p"},"Actor.openDataset()"))),(0,d.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},c),(0,d.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,d.kt)("pre",null,(0,d.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/datasets/default/\n")))}I.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>i,kt:()=>g});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function d(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),s=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},i=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,d=e.originalType,l=e.parentName,i=c(e,["components","mdxType","originalType","parentName"]),p=s(a),m=r,g=p["".concat(l,".").concat(m)]||p[m]||u[m]||d;return a?n.createElement(g,o(o({ref:t},i),{},{components:a})):n.createElement(g,o({ref:t},i))}));function g(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var d=a.length,o=new Array(d);o[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c[p]="string"==typeof e?e:r,o[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var a=n(87462),s=n(63366),r=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-system-status",title:"SystemStatus",id:"system-status"},i=void 0,p={unversionedId:"api/system-status",id:"version-1.3/api/system-status",title:"SystemStatus",description:"Provides a simple interface to reading system status from a Snapshotter instance. It only exposes two functions",source:"@site/versioned_docs/version-1.3/api/SystemStatus.md",sourceDirName:"api",slug:"/api/system-status",permalink:"/sdk/js/docs/1.3/api/system-status",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SystemStatus.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-system-status",title:"SystemStatus",id:"system-status"},sidebar:"version-1.3/docs",previous:{title:"Snapshotter",permalink:"/sdk/js/docs/1.3/api/snapshotter"},next:{title:"Request",permalink:"/sdk/js/docs/1.3/api/request"}},u={},m=[{value:"new SystemStatus([options])",id:"new-systemstatusoptions",level:2},{value:"systemStatus.getCurrentStatus()",id:"systemstatusgetcurrentstatus",level:2},{value:"systemStatus.getHistoricalStatus()",id:"systemstatusgethistoricalstatus",level:2}],c={toc:m},d="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,o);return(0,r.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("p",null,"Provides a simple interface to reading system status from a ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance. It only exposes two functions\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," and\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()")),". The system status is calculated using a weighted average of\noverloaded messages in the snapshots, with the weights being the time intervals between the snapshots. Each resource is calculated separately and the\nsystem is overloaded whenever at least one resource is overloaded. The class is used by the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," returns a boolean that represents the current status of the system. The\nlength of the current timeframe in seconds is configurable by the ",(0,r.kt)("inlineCode",{parentName:"p"},"currentHistorySecs")," option and represents the max age of snapshots to be considered\nfor the calculation."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()"))," returns a boolean that represents the long-term status of the system.\nIt considers the full snapshot history available in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance."),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("h2",{id:"new-systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new SystemStatus([options])")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"SystemStatus")," configuration options.")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getcurrentstatus"}),(0,r.kt)("h2",{id:"systemstatusgetcurrentstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getCurrentStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the last ",(0,r.kt)("inlineCode",{parentName:"p"},"options.currentHistorySecs")," seconds, and ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),"\notherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"gethistoricalstatus"}),(0,r.kt)("h2",{id:"systemstatusgethistoricalstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getHistoricalStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the full history of the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),"\n(which is configurable in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),") and ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," otherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var a=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=p(n),d=s,y=m["".concat(i,".").concat(d)]||m[d]||c[d]||r;return n?a.createElement(y,o(o({ref:t},u),{},{components:n})):a.createElement(y,o({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[m]="string"==typeof e?e:s,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var a=n(87462),s=n(63366),r=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-system-status",title:"SystemStatus",id:"system-status"},i=void 0,p={unversionedId:"api/system-status",id:"version-1.3/api/system-status",title:"SystemStatus",description:"Provides a simple interface to reading system status from a Snapshotter instance. It only exposes two functions",source:"@site/versioned_docs/version-1.3/api/SystemStatus.md",sourceDirName:"api",slug:"/api/system-status",permalink:"/sdk/js/docs/1.3/api/system-status",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SystemStatus.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-system-status",title:"SystemStatus",id:"system-status"},sidebar:"version-1.3/docs",previous:{title:"Snapshotter",permalink:"/sdk/js/docs/1.3/api/snapshotter"},next:{title:"Request",permalink:"/sdk/js/docs/1.3/api/request"}},u={},m=[{value:"new SystemStatus([options])",id:"new-systemstatusoptions",level:2},{value:"systemStatus.getCurrentStatus()",id:"systemstatusgetcurrentstatus",level:2},{value:"systemStatus.getHistoricalStatus()",id:"systemstatusgethistoricalstatus",level:2}],c={toc:m},d="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,o);return(0,r.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("p",null,"Provides a simple interface to reading system status from a ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance. It only exposes two functions\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," and\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()")),". The system status is calculated using a weighted average of\noverloaded messages in the snapshots, with the weights being the time intervals between the snapshots. Each resource is calculated separately and the\nsystem is overloaded whenever at least one resource is overloaded. The class is used by the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," returns a boolean that represents the current status of the system. The\nlength of the current timeframe in seconds is configurable by the ",(0,r.kt)("inlineCode",{parentName:"p"},"currentHistorySecs")," option and represents the max age of snapshots to be considered\nfor the calculation."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()"))," returns a boolean that represents the long-term status of the system.\nIt considers the full snapshot history available in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance."),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("h2",{id:"new-systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new SystemStatus([options])")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"SystemStatus")," configuration options.")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getcurrentstatus"}),(0,r.kt)("h2",{id:"systemstatusgetcurrentstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getCurrentStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the last ",(0,r.kt)("inlineCode",{parentName:"p"},"options.currentHistorySecs")," seconds, and ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),"\notherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"gethistoricalstatus"}),(0,r.kt)("h2",{id:"systemstatusgethistoricalstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getHistoricalStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the full history of the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),"\n(which is configurable in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),") and ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," otherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var a=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=p(n),d=s,y=m["".concat(i,".").concat(d)]||m[d]||c[d]||r;return n?a.createElement(y,o(o({ref:t},u),{},{components:n})):a.createElement(y,o({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[m]="string"==typeof e?e:s,o[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-motivation",title:"Motivation",id:"motivation"},p=void 0,l={unversionedId:"guides/motivation",id:"version-1.3/guides/motivation",title:"Motivation",description:"Thanks to tools like Playwright, Puppeteer or",source:"@site/versioned_docs/version-1.3/guides/motivation.md",sourceDirName:"guides",slug:"/guides/motivation",permalink:"/sdk/js/docs/1.3/guides/motivation",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/motivation.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-motivation",title:"Motivation",id:"motivation"},sidebar:"version-1.3/docs",next:{title:"Quick Start",permalink:"/sdk/js/docs/1.3/guides/quick-start"}},c={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Thanks to tools like ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),", ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," or\n",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio"),", it is easy to write Node.js code to extract data from web pages. But\neventually things will get complicated. For example, when you try to:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Perform a deep crawl of an entire website using a persistent queue of URLs."),(0,a.kt)("li",{parentName:"ul"},"Run your scraping code on a list of 100k URLs in a CSV file, without losing any data when your code crashes."),(0,a.kt)("li",{parentName:"ul"},"Rotate proxies to hide your browser origin and keep user-like sessions."),(0,a.kt)("li",{parentName:"ul"},"Disable browser fingerprinting protections used by websites.")),(0,a.kt)("p",null,"Python has ",(0,a.kt)("a",{parentName:"p",href:"https://scrapy.org/",target:"_blank",rel:"noopener"},"Scrapy")," for these tasks, but there was no such library for ",(0,a.kt)("strong",{parentName:"p"},"JavaScript, the language of\nthe web"),". The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a\nbrowser."),(0,a.kt)("p",null,"The goal of the Apify SDK is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't\nreinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing\ncommonalities."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-motivation",title:"Motivation",id:"motivation"},p=void 0,l={unversionedId:"guides/motivation",id:"version-1.3/guides/motivation",title:"Motivation",description:"Thanks to tools like Playwright, Puppeteer or",source:"@site/versioned_docs/version-1.3/guides/motivation.md",sourceDirName:"guides",slug:"/guides/motivation",permalink:"/sdk/js/docs/1.3/guides/motivation",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/motivation.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-motivation",title:"Motivation",id:"motivation"},sidebar:"version-1.3/docs",next:{title:"Quick Start",permalink:"/sdk/js/docs/1.3/guides/quick-start"}},c={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Thanks to tools like ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),", ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," or\n",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio"),", it is easy to write Node.js code to extract data from web pages. But\neventually things will get complicated. For example, when you try to:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Perform a deep crawl of an entire website using a persistent queue of URLs."),(0,a.kt)("li",{parentName:"ul"},"Run your scraping code on a list of 100k URLs in a CSV file, without losing any data when your code crashes."),(0,a.kt)("li",{parentName:"ul"},"Rotate proxies to hide your browser origin and keep user-like sessions."),(0,a.kt)("li",{parentName:"ul"},"Disable browser fingerprinting protections used by websites.")),(0,a.kt)("p",null,"Python has ",(0,a.kt)("a",{parentName:"p",href:"https://scrapy.org/",target:"_blank",rel:"noopener"},"Scrapy")," for these tasks, but there was no such library for ",(0,a.kt)("strong",{parentName:"p"},"JavaScript, the language of\nthe web"),". The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a\nbrowser."),(0,a.kt)("p",null,"The goal of the Apify SDK is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't\nreinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing\ncommonalities."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id:"quick-start",title:"Quick Start"},p=void 0,s={unversionedId:"guides/quick-start",id:"version-2.3/guides/quick-start",title:"Quick Start",description:"This short tutorial will set you up to start using Apify SDK in a minute or two.",source:"@site/versioned_docs/version-2.3/guides/quick_start.md",sourceDirName:"guides",slug:"/guides/quick-start",permalink:"/sdk/js/docs/2.3/guides/quick-start",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/quick_start.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"quick-start",title:"Quick Start"},sidebar:"version-2.3/docs",previous:{title:"Motivation",permalink:"/sdk/js/docs/2.3/guides/motivation"},next:{title:"Apify Platform",permalink:"/sdk/js/docs/2.3/guides/apify-platform"}},u={},c=[{value:"Local stand-alone usage",id:"local-stand-alone-usage",level:2},{value:"Local usage with Apify command-line interface (CLI)",id:"local-usage-with-apify-command-line-interface-cli",level:2},{value:"Usage on the Apify platform",id:"usage-on-the-apify-platform",level:2}],d={toc:c},f="wrapper";function m(e){var t=e.components,i=(0,r.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This short tutorial will set you up to start using Apify SDK in a minute or two.\nIf you want to learn more, proceed to the ",(0,o.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started"),"\ntutorial that will take you step by step through creating your first scraper."),(0,o.kt)("h2",{id:"local-stand-alone-usage"},"Local stand-alone usage"),(0,o.kt)("p",null,"Apify SDK requires ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/en/",target:"_blank",rel:"noopener"},"Node.js")," 15.10 or later.\nAdd Apify SDK to any Node.js project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Neither ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," nor ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," are bundled with the SDK to reduce install size and allow greater\nflexibility. That's why we install it with NPM. You can choose one, both, or neither.")),(0,o.kt)("p",null,"Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of the Apify SDK,\n",(0,o.kt)("a",{parentName:"p",href:"../examples/crawl-multiple-urls",target:null,rel:null},"see the Examples section of the documentation"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main is a helper function, you don't need to use it.\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n // Choose the first URL to open.\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n // Extract HTML title of the page.\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To read more about what pseudo-URL is, check the ",(0,o.kt)("a",{parentName:"p",href:"getting-started#introduction-to-pseudo-urls",target:null,rel:null},"getting-started"),".")),(0,o.kt)("p",null,"When you run the example, you should see Apify SDK automating a Chrome browser."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Chrome Scrape",src:a(91966).Z,width:"705",height:"529"})),(0,o.kt)("p",null,"By default, Apify SDK stores data to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory. You can override this behavior by setting either the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. For details, see ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables",target:null,rel:null},"Environment variables"),", ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"Request storage")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"Result storage"),"."),(0,o.kt)("h2",{id:"local-usage-with-apify-command-line-interface-cli"},"Local usage with Apify command-line interface (CLI)"),(0,o.kt)("p",null,"To avoid the need to set the environment variables manually, to create a boilerplate of your project, and to enable pushing and running your code on\nthe ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can use the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify command-line interface (CLI)")," tool."),(0,o.kt)("p",null,"Install the CLI by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm -g install apify-cli\n")),(0,o.kt)("p",null,"Now create a boilerplate of your new web crawling project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - just pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world"),"\nwith a Node.js project files. You can run the project as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("p",null,"By default, the crawling data will be stored in a local directory at ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". For example, the input JSON file for the actor is expected to\nbe in the default key-value store in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/key_value_stores/default/INPUT.json"),"."),(0,o.kt)("p",null,"Now you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify login\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-the-apify-platform"},"Usage on the Apify platform"),(0,o.kt)("p",null,"You can also develop your web scraping project in an online code editor directly on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),".\nYou'll need to have an Apify Account. Go to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("i",null,"Create new"),"\nand then go to the ",(0,o.kt)("i",null,"Source")," tab and start writing your code or paste one of the examples from the Examples section."),(0,o.kt)("p",null,"For more information, view the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/quick-start",target:"_blank",rel:"noopener"},"Apify actors quick start guide"),"."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),f=r,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{a.d(t,{Z:()=>n});const n=a.p+"assets/images/chrome_scrape-a64af551de8be5fe1ced2182dc0a8dcc.gif"}}]); \ No newline at end of file diff --git a/assets/js/401b5d44.b9b85cb3.js b/assets/js/401b5d44.b9b85cb3.js deleted file mode 100644 index c429fabcf5..0000000000 --- a/assets/js/401b5d44.b9b85cb3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[576],{22961:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id:"quick-start",title:"Quick Start"},p=void 0,s={unversionedId:"guides/quick-start",id:"version-2.3/guides/quick-start",title:"Quick Start",description:"This short tutorial will set you up to start using Apify SDK in a minute or two.",source:"@site/versioned_docs/version-2.3/guides/quick_start.md",sourceDirName:"guides",slug:"/guides/quick-start",permalink:"/sdk/js/docs/2.3/guides/quick-start",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/quick_start.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"quick-start",title:"Quick Start"},sidebar:"version-2.3/docs",previous:{title:"Motivation",permalink:"/sdk/js/docs/2.3/guides/motivation"},next:{title:"Apify Platform",permalink:"/sdk/js/docs/2.3/guides/apify-platform"}},u={},c=[{value:"Local stand-alone usage",id:"local-stand-alone-usage",level:2},{value:"Local usage with Apify command-line interface (CLI)",id:"local-usage-with-apify-command-line-interface-cli",level:2},{value:"Usage on the Apify platform",id:"usage-on-the-apify-platform",level:2}],d={toc:c},f="wrapper";function m(e){var t=e.components,i=(0,r.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This short tutorial will set you up to start using Apify SDK in a minute or two.\nIf you want to learn more, proceed to the ",(0,o.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started"),"\ntutorial that will take you step by step through creating your first scraper."),(0,o.kt)("h2",{id:"local-stand-alone-usage"},"Local stand-alone usage"),(0,o.kt)("p",null,"Apify SDK requires ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/en/",target:"_blank",rel:"noopener"},"Node.js")," 15.10 or later.\nAdd Apify SDK to any Node.js project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Neither ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," nor ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," are bundled with the SDK to reduce install size and allow greater\nflexibility. That's why we install it with NPM. You can choose one, both, or neither.")),(0,o.kt)("p",null,"Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of the Apify SDK,\n",(0,o.kt)("a",{parentName:"p",href:"../examples/crawl-multiple-urls",target:null,rel:null},"see the Examples section of the documentation"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main is a helper function, you don't need to use it.\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n // Choose the first URL to open.\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n // Extract HTML title of the page.\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To read more about what pseudo-URL is, check the ",(0,o.kt)("a",{parentName:"p",href:"getting-started#introduction-to-pseudo-urls",target:null,rel:null},"getting-started"),".")),(0,o.kt)("p",null,"When you run the example, you should see Apify SDK automating a Chrome browser."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Chrome Scrape",src:a(91966).Z,width:"705",height:"529"})),(0,o.kt)("p",null,"By default, Apify SDK stores data to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory. You can override this behavior by setting either the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. For details, see ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables",target:null,rel:null},"Environment variables"),", ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"Request storage")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"Result storage"),"."),(0,o.kt)("h2",{id:"local-usage-with-apify-command-line-interface-cli"},"Local usage with Apify command-line interface (CLI)"),(0,o.kt)("p",null,"To avoid the need to set the environment variables manually, to create a boilerplate of your project, and to enable pushing and running your code on\nthe ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can use the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify command-line interface (CLI)")," tool."),(0,o.kt)("p",null,"Install the CLI by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm -g install apify-cli\n")),(0,o.kt)("p",null,"Now create a boilerplate of your new web crawling project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - just pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world"),"\nwith a Node.js project files. You can run the project as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("p",null,"By default, the crawling data will be stored in a local directory at ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". For example, the input JSON file for the actor is expected to\nbe in the default key-value store in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/key_value_stores/default/INPUT.json"),"."),(0,o.kt)("p",null,"Now you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify login\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-the-apify-platform"},"Usage on the Apify platform"),(0,o.kt)("p",null,"You can also develop your web scraping project in an online code editor directly on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),".\nYou'll need to have an Apify Account. Go to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("i",null,"Create new"),"\nand then go to the ",(0,o.kt)("i",null,"Source")," tab and start writing your code or paste one of the examples from the Examples section."),(0,o.kt)("p",null,"For more information, view the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/quick-start",target:"_blank",rel:"noopener"},"Apify actors quick start guide"),"."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),f=r,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{a.d(t,{Z:()=>n});const n=a.p+"assets/images/chrome_scrape-a64af551de8be5fe1ced2182dc0a8dcc.gif"}}]); \ No newline at end of file diff --git a/assets/js/40a504e1.8dec1b13.js b/assets/js/40a504e1.8dec1b13.js deleted file mode 100644 index f606f8403c..0000000000 --- a/assets/js/40a504e1.8dec1b13.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6326],{43966:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var s=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],r={id_old:"version-2.3.0-session",title:"Session",id:"session"},l=void 0,p={unversionedId:"api/session",id:"version-2.3/api/session",title:"Session",description:"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as",source:"@site/versioned_docs/version-2.3/api/Session.md",sourceDirName:"api",slug:"/api/session",permalink:"/sdk/js/docs/2.3/api/session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Session.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-session",title:"Session",id:"session"},sidebar:"version-2.3/docs",previous:{title:"AutoscaledPool",permalink:"/sdk/js/docs/2.3/api/autoscaled-pool"},next:{title:"SessionPool",permalink:"/sdk/js/docs/2.3/api/session-pool"}},u={},d=[{value:"new Session(options)",id:"new-sessionoptions",level:2},{value:"session.userData",id:"sessionuserdata",level:2},{value:"session.isBlocked()",id:"sessionisblocked",level:2},{value:"session.isExpired()",id:"sessionisexpired",level:2},{value:"session.isMaxUsageCountReached()",id:"sessionismaxusagecountreached",level:2},{value:"session.isUsable()",id:"sessionisusable",level:2},{value:"session.markGood()",id:"sessionmarkgood",level:2},{value:"session.getState()",id:"sessiongetstate",level:2},{value:"session.retire()",id:"sessionretire",level:2},{value:"session.markBad()",id:"sessionmarkbad",level:2},{value:"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])",id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes",level:2},{value:"session.setCookiesFromResponse(response)",id:"sessionsetcookiesfromresponseresponse",level:2},{value:"session.setPuppeteerCookies(cookies, url)",id:"sessionsetpuppeteercookiescookies-url",level:2},{value:"session.getPuppeteerCookies(url)",id:"sessiongetpuppeteercookiesurl",level:2},{value:"session.getCookieString(url)",id:"sessiongetcookiestringurl",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(c,(0,s.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"session"}),(0,a.kt)("p",null,"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as\na specific user, with its own cookies, IP (via proxy) and potentially a unique browser fingerprint. Session internal state can be enriched with custom\nuser data for example some authorization tokens and specific headers in general."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"exports.session"}),(0,a.kt)("h2",{id:"new-sessionoptions"},(0,a.kt)("inlineCode",{parentName:"h2"},"new Session(options)")),(0,a.kt)("p",null,"Session configuration."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionOptions")))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"userdata"}),(0,a.kt)("h2",{id:"sessionuserdata"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.userData")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isblocked"}),(0,a.kt)("h2",{id:"sessionisblocked"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isBlocked()")),(0,a.kt)("p",null,"indicates whether the session is blocked. Session is blocked once it reaches the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxErrorScore"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isexpired"}),(0,a.kt)("h2",{id:"sessionisexpired"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isExpired()")),(0,a.kt)("p",null,"Indicates whether the session is expired. Session expiration is determined by the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxAgeSecs"),". Once the session is older than\n",(0,a.kt)("inlineCode",{parentName:"p"},"createdAt + maxAgeSecs")," the session is considered expired."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"ismaxusagecountreached"}),(0,a.kt)("h2",{id:"sessionismaxusagecountreached"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isMaxUsageCountReached()")),(0,a.kt)("p",null,"Indicates whether the session is used maximum number of times. Session maximum usage count can be changed by ",(0,a.kt)("inlineCode",{parentName:"p"},"maxUsageCount")," parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isusable"}),(0,a.kt)("h2",{id:"sessionisusable"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isUsable()")),(0,a.kt)("p",null,"Indicates whether the session can be used for next requests. Session is usable when it is not expired, not blocked and the maximum usage count has not\nbe reached."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markgood"}),(0,a.kt)("h2",{id:"sessionmarkgood"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markGood()")),(0,a.kt)("p",null,"This method should be called after a successful session usage. It increases ",(0,a.kt)("inlineCode",{parentName:"p"},"usageCount")," and potentially lowers the ",(0,a.kt)("inlineCode",{parentName:"p"},"errorScore")," by the\n",(0,a.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement"),"."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getstate"}),(0,a.kt)("h2",{id:"sessiongetstate"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getState()")),(0,a.kt)("p",null,"Gets session state for persistence in KeyValueStore."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-state",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionState"))," - represents session internal state."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retire"}),(0,a.kt)("h2",{id:"sessionretire"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retire()")),(0,a.kt)("p",null,"Marks session as blocked and emits event on the ",(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool")," This method should be used if the session usage was unsuccessful and you are sure that\nit is because of the session configuration and not any external matters. For example when server returns 403 status code. If the session does not work\ndue to some external factors as server error such as 5XX you probably want to use ",(0,a.kt)("inlineCode",{parentName:"p"},"markBad")," method."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markbad"}),(0,a.kt)("h2",{id:"sessionmarkbad"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markBad()")),(0,a.kt)("p",null,"Increases usage and error count. Should be used when the session has been used unsuccessfully. For example because of timeouts."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retireonblockedstatuscodes"}),(0,a.kt)("h2",{id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])")),(0,a.kt)("p",null,"With certain status codes: ",(0,a.kt)("inlineCode",{parentName:"p"},"401"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"403")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"429")," we can be certain that the target website is blocking us. This function helps to do this conveniently\nby retiring the session when such code is received. Optionally the default status codes can be extended in the second parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"statusCode")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"number")," - HTTP status code"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"[blockedStatusCodes]")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Array")," - Custom HTTP status codes that means blocking on particular website.")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," - whether the session was retired."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setcookiesfromresponse"}),(0,a.kt)("h2",{id:"sessionsetcookiesfromresponseresponse"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setCookiesFromResponse(response)")),(0,a.kt)("p",null,"Saves cookies from an HTTP response to be used with the session. It expects an object with a ",(0,a.kt)("inlineCode",{parentName:"p"},"headers")," property that's either an ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")," (typical\nNode.js responses) or a ",(0,a.kt)("inlineCode",{parentName:"p"},"Function")," (Puppeteer Response)."),(0,a.kt)("p",null,"It then parses and saves the cookies from the ",(0,a.kt)("inlineCode",{parentName:"p"},"set-cookie")," header, if available."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"PuppeteerResponse")," | ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setpuppeteercookies"}),(0,a.kt)("h2",{id:"sessionsetpuppeteercookiescookies-url"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setPuppeteerCookies(cookies, url)")),(0,a.kt)("p",null,"Saves an array with cookie objects to be used with the session. The objects should be in the format that\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-pagecookiesurls",target:"_blank",rel:"noopener"},"Puppeteer uses"),", but you can also use this function to set cookies\nmanually:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"[\n { name: 'cookie1', value: 'my-cookie' },\n { name: 'cookie2', value: 'your-cookie' }\n]\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"cookies")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-cookie",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getpuppeteercookies"}),(0,a.kt)("h2",{id:"sessiongetpuppeteercookiesurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getPuppeteerCookies(url)")),(0,a.kt)("p",null,"Returns cookies in a format compatible with puppeteer and ready to be used with ",(0,a.kt)("inlineCode",{parentName:"p"},"page.setCookie"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string")," - website url. Only cookies stored for this url will be returned")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-cookie",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getcookiestring"}),(0,a.kt)("h2",{id:"sessiongetcookiestringurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getCookieString(url)")),(0,a.kt)("p",null,"Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"string")," - represents ",(0,a.kt)("inlineCode",{parentName:"p"},"Cookie")," header."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var s=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},c=s.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),d=p(n),c=o,m=d["".concat(l,".").concat(c)]||d[c]||k[c]||a;return n?s.createElement(m,i(i({ref:t},u),{},{components:n})):s.createElement(m,i({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=c;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r[d]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var s=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],r={id_old:"version-2.3.0-session",title:"Session",id:"session"},l=void 0,p={unversionedId:"api/session",id:"version-2.3/api/session",title:"Session",description:"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as",source:"@site/versioned_docs/version-2.3/api/Session.md",sourceDirName:"api",slug:"/api/session",permalink:"/sdk/js/docs/2.3/api/session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Session.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-session",title:"Session",id:"session"},sidebar:"version-2.3/docs",previous:{title:"AutoscaledPool",permalink:"/sdk/js/docs/2.3/api/autoscaled-pool"},next:{title:"SessionPool",permalink:"/sdk/js/docs/2.3/api/session-pool"}},u={},d=[{value:"new Session(options)",id:"new-sessionoptions",level:2},{value:"session.userData",id:"sessionuserdata",level:2},{value:"session.isBlocked()",id:"sessionisblocked",level:2},{value:"session.isExpired()",id:"sessionisexpired",level:2},{value:"session.isMaxUsageCountReached()",id:"sessionismaxusagecountreached",level:2},{value:"session.isUsable()",id:"sessionisusable",level:2},{value:"session.markGood()",id:"sessionmarkgood",level:2},{value:"session.getState()",id:"sessiongetstate",level:2},{value:"session.retire()",id:"sessionretire",level:2},{value:"session.markBad()",id:"sessionmarkbad",level:2},{value:"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])",id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes",level:2},{value:"session.setCookiesFromResponse(response)",id:"sessionsetcookiesfromresponseresponse",level:2},{value:"session.setPuppeteerCookies(cookies, url)",id:"sessionsetpuppeteercookiescookies-url",level:2},{value:"session.getPuppeteerCookies(url)",id:"sessiongetpuppeteercookiesurl",level:2},{value:"session.getCookieString(url)",id:"sessiongetcookiestringurl",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(c,(0,s.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"session"}),(0,a.kt)("p",null,"Sessions are used to store information such as cookies and can be used for generating fingerprints and proxy sessions. You can imagine each session as\na specific user, with its own cookies, IP (via proxy) and potentially a unique browser fingerprint. Session internal state can be enriched with custom\nuser data for example some authorization tokens and specific headers in general."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"exports.session"}),(0,a.kt)("h2",{id:"new-sessionoptions"},(0,a.kt)("inlineCode",{parentName:"h2"},"new Session(options)")),(0,a.kt)("p",null,"Session configuration."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionOptions")))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"userdata"}),(0,a.kt)("h2",{id:"sessionuserdata"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.userData")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isblocked"}),(0,a.kt)("h2",{id:"sessionisblocked"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isBlocked()")),(0,a.kt)("p",null,"indicates whether the session is blocked. Session is blocked once it reaches the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxErrorScore"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isexpired"}),(0,a.kt)("h2",{id:"sessionisexpired"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isExpired()")),(0,a.kt)("p",null,"Indicates whether the session is expired. Session expiration is determined by the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxAgeSecs"),". Once the session is older than\n",(0,a.kt)("inlineCode",{parentName:"p"},"createdAt + maxAgeSecs")," the session is considered expired."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"ismaxusagecountreached"}),(0,a.kt)("h2",{id:"sessionismaxusagecountreached"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isMaxUsageCountReached()")),(0,a.kt)("p",null,"Indicates whether the session is used maximum number of times. Session maximum usage count can be changed by ",(0,a.kt)("inlineCode",{parentName:"p"},"maxUsageCount")," parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"isusable"}),(0,a.kt)("h2",{id:"sessionisusable"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.isUsable()")),(0,a.kt)("p",null,"Indicates whether the session can be used for next requests. Session is usable when it is not expired, not blocked and the maximum usage count has not\nbe reached."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markgood"}),(0,a.kt)("h2",{id:"sessionmarkgood"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markGood()")),(0,a.kt)("p",null,"This method should be called after a successful session usage. It increases ",(0,a.kt)("inlineCode",{parentName:"p"},"usageCount")," and potentially lowers the ",(0,a.kt)("inlineCode",{parentName:"p"},"errorScore")," by the\n",(0,a.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement"),"."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getstate"}),(0,a.kt)("h2",{id:"sessiongetstate"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getState()")),(0,a.kt)("p",null,"Gets session state for persistence in KeyValueStore."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-state",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionState"))," - represents session internal state."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retire"}),(0,a.kt)("h2",{id:"sessionretire"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retire()")),(0,a.kt)("p",null,"Marks session as blocked and emits event on the ",(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool")," This method should be used if the session usage was unsuccessful and you are sure that\nit is because of the session configuration and not any external matters. For example when server returns 403 status code. If the session does not work\ndue to some external factors as server error such as 5XX you probably want to use ",(0,a.kt)("inlineCode",{parentName:"p"},"markBad")," method."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"markbad"}),(0,a.kt)("h2",{id:"sessionmarkbad"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.markBad()")),(0,a.kt)("p",null,"Increases usage and error count. Should be used when the session has been used unsuccessfully. For example because of timeouts."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"retireonblockedstatuscodes"}),(0,a.kt)("h2",{id:"sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])")),(0,a.kt)("p",null,"With certain status codes: ",(0,a.kt)("inlineCode",{parentName:"p"},"401"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"403")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"429")," we can be certain that the target website is blocking us. This function helps to do this conveniently\nby retiring the session when such code is received. Optionally the default status codes can be extended in the second parameter."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"statusCode")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"number")," - HTTP status code"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"[blockedStatusCodes]")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Array")," - Custom HTTP status codes that means blocking on particular website.")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," - whether the session was retired."),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setcookiesfromresponse"}),(0,a.kt)("h2",{id:"sessionsetcookiesfromresponseresponse"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setCookiesFromResponse(response)")),(0,a.kt)("p",null,"Saves cookies from an HTTP response to be used with the session. It expects an object with a ",(0,a.kt)("inlineCode",{parentName:"p"},"headers")," property that's either an ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")," (typical\nNode.js responses) or a ",(0,a.kt)("inlineCode",{parentName:"p"},"Function")," (Puppeteer Response)."),(0,a.kt)("p",null,"It then parses and saves the cookies from the ",(0,a.kt)("inlineCode",{parentName:"p"},"set-cookie")," header, if available."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"PuppeteerResponse")," | ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"setpuppeteercookies"}),(0,a.kt)("h2",{id:"sessionsetpuppeteercookiescookies-url"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.setPuppeteerCookies(cookies, url)")),(0,a.kt)("p",null,"Saves an array with cookie objects to be used with the session. The objects should be in the format that\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-pagecookiesurls",target:"_blank",rel:"noopener"},"Puppeteer uses"),", but you can also use this function to set cookies\nmanually:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"[\n { name: 'cookie1', value: 'my-cookie' },\n { name: 'cookie2', value: 'your-cookie' }\n]\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"cookies")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-cookie",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getpuppeteercookies"}),(0,a.kt)("h2",{id:"sessiongetpuppeteercookiesurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getPuppeteerCookies(url)")),(0,a.kt)("p",null,"Returns cookies in a format compatible with puppeteer and ready to be used with ",(0,a.kt)("inlineCode",{parentName:"p"},"page.setCookie"),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string")," - website url. Only cookies stored for this url will be returned")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-cookie",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"getcookiestring"}),(0,a.kt)("h2",{id:"sessiongetcookiestringurl"},(0,a.kt)("inlineCode",{parentName:"h2"},"session.getCookieString(url)")),(0,a.kt)("p",null,"Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"string"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"string")," - represents ",(0,a.kt)("inlineCode",{parentName:"p"},"Cookie")," header."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var s=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},c=s.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),d=p(n),c=o,m=d["".concat(l,".").concat(c)]||d[c]||k[c]||a;return n?s.createElement(m,i(i({ref:t},u),{},{components:n})):s.createElement(m,i({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=c;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r[d]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>m});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),s=a(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,a=e.block,l=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],d=(0,i.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,a=c.indexOf(t),n=p[a].value;n!==l&&(d(t),s(n))},h=function(e){var t,a=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},p.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:h,onClick:m},i,{className:(0,o.Z)("tabs__item",u.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function d(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",u.tabList)},r.createElement(p,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function m(e){var t=(0,s.Z)();return r.createElement(d,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function s(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,a])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),s=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(l.location.search);t.set(s,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[s,l])]}function d(e){var t,a,r,o,i=e.defaultValue,s=e.queryString,d=void 0!==s&&s,m=e.groupId,h=u(e),g=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!p({value:a,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:h})})),f=g[0],k=g[1],y=c({queryString:d,groupId:m}),b=y[0],v=y[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],C=w[1],P=function(){var e=null!=b?b:N;return p({value:e,tabValues:h})?e:null}();return(0,n.useLayoutEffect)((function(){P&&k(P)}),[P]),{selectedValue:f,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:h}))throw new Error("Can't select invalid tab value="+e);k(e),v(e),C(e)}),[v,C,h]),tabValues:h}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),s=l.version,u=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var p=s+"/";return"current"===s?p="next/":u&&(p=""),n.createElement(r.default,{to:"/api/"+p+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},13255:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>y,contentTitle:()=>f,default:()=>N,frontMatter:()=>g,metadata:()=>k,toc:()=>b});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(68889),a(26569)),l=a(65559),s=a(30433),u=a(14563);const p='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm start --silent\n',c='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder /usr/src/app/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm run start:prod --silent\n',d='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image.\nCMD npm start --silent\n',m='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY --chown=myuser . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder --chown=myuser /home/myuser/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image. If you know you won\'t need headful browsers,\n# you can remove the XVFB start script for a micro perf gain.\nCMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent\n';var h=["components"],g={id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},f=void 0,k={unversionedId:"guides/docker-images",id:"version-3.1/guides/docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers",source:"@site/versioned_docs/version-3.1/guides/docker_images.mdx",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/docker_images.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},sidebar:"docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/guides/type-script-actor"},next:{title:"Examples",permalink:"/sdk/js/docs/examples"}},y={},b=[{value:"Overview",id:"overview",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"Apify Docker Images",id:"apify-docker-images",level:2},{value:"actor-node",id:"actor-node",level:3},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:3},{value:"actor-node-playwright",id:"actor-node-playwright",level:3},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:3},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:3},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:3},{value:"Example Dockerfile",id:"example-dockerfile",level:2}],v={toc:b},w="wrapper";function N(e){var t=e.components,a=(0,r.Z)(e,h);return(0,o.kt)(w,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"./apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js ",(0,o.kt)("strong",{parentName:"p"},"versions 16 and 18 are supported")," (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 16\nFROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-13.7.0")," comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chromium that's pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.21.1")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Node.js version tag should ",(0,o.kt)("strong",{parentName:"li"},"always")," be used."),(0,o.kt)("li",{parentName:"ul"},"The automation library version tag should be used for ",(0,o.kt)("strong",{parentName:"li"},"added security"),"."),(0,o.kt)("li",{parentName:"ul"},"Asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," should be used as the automation library version in our ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "crawlee": "^3.0.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"When you use only what you need, you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"apify-docker-images"},"Apify Docker Images"),(0,o.kt)("h3",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,"\u200b",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"))," and other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"))," environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so we can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use the above images, it's necessary to have a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)(i.B,{to:"docs/introduction/setting-up",mdxType:"CrawleeLink"},"Crawlee CLI")," which automatically adds the correct Dockerfile into our project folder."),(0,o.kt)(l.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"node+js",label:"Node+JavaScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},p)),(0,o.kt)(s.Z,{value:"node+ts",label:"Node+TypeScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"browser+js",label:"Browser+JavaScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in the ",(0,o.kt)("code",null,"FROM")," declaration.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},d)),(0,o.kt)(s.Z,{value:"browser+ts",label:"Browser+TypeScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in both ",(0,o.kt)("code",null,"FROM")," declarations.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},m))))}N.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=u(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return a?n.createElement(h,i(i({ref:t},p),{},{components:a})):n.createElement(h,i({ref:t},p))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var u=2;u{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>m});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),s=a(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,a=e.block,l=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],d=(0,i.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,a=c.indexOf(t),n=p[a].value;n!==l&&(d(t),s(n))},h=function(e){var t,a=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},p.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:h,onClick:m},i,{className:(0,o.Z)("tabs__item",u.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function d(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",u.tabList)},r.createElement(p,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function m(e){var t=(0,s.Z)();return r.createElement(d,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function s(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,a])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),s=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(l.location.search);t.set(s,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[s,l])]}function d(e){var t,a,r,o,i=e.defaultValue,s=e.queryString,d=void 0!==s&&s,m=e.groupId,h=u(e),g=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!p({value:a,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:h})})),f=g[0],k=g[1],y=c({queryString:d,groupId:m}),b=y[0],v=y[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],C=w[1],P=function(){var e=null!=b?b:N;return p({value:e,tabValues:h})?e:null}();return(0,n.useLayoutEffect)((function(){P&&k(P)}),[P]),{selectedValue:f,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:h}))throw new Error("Can't select invalid tab value="+e);k(e),v(e),C(e)}),[v,C,h]),tabValues:h}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),s=l.version,u=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var p=s+"/";return"current"===s?p="next/":u&&(p=""),n.createElement(r.default,{to:"/api/"+p+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},13255:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>y,contentTitle:()=>f,default:()=>N,frontMatter:()=>g,metadata:()=>k,toc:()=>b});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(68889),a(26569)),l=a(65559),s=a(30433),u=a(14563);const p='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm start --silent\n',c='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder /usr/src/app/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm run start:prod --silent\n',d='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image.\nCMD npm start --silent\n',m='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY --chown=myuser . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder --chown=myuser /home/myuser/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image. If you know you won\'t need headful browsers,\n# you can remove the XVFB start script for a micro perf gain.\nCMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent\n';var h=["components"],g={id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},f=void 0,k={unversionedId:"guides/docker-images",id:"version-3.1/guides/docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers",source:"@site/versioned_docs/version-3.1/guides/docker_images.mdx",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/docker_images.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},sidebar:"docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/guides/type-script-actor"},next:{title:"Examples",permalink:"/sdk/js/docs/examples"}},y={},b=[{value:"Overview",id:"overview",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"Apify Docker Images",id:"apify-docker-images",level:2},{value:"actor-node",id:"actor-node",level:3},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:3},{value:"actor-node-playwright",id:"actor-node-playwright",level:3},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:3},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:3},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:3},{value:"Example Dockerfile",id:"example-dockerfile",level:2}],v={toc:b},w="wrapper";function N(e){var t=e.components,a=(0,r.Z)(e,h);return(0,o.kt)(w,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"./apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js ",(0,o.kt)("strong",{parentName:"p"},"versions 16 and 18 are supported")," (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 16\nFROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-13.7.0")," comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chromium that's pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.21.1")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Node.js version tag should ",(0,o.kt)("strong",{parentName:"li"},"always")," be used."),(0,o.kt)("li",{parentName:"ul"},"The automation library version tag should be used for ",(0,o.kt)("strong",{parentName:"li"},"added security"),"."),(0,o.kt)("li",{parentName:"ul"},"Asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," should be used as the automation library version in our ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "crawlee": "^3.0.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"When you use only what you need, you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"apify-docker-images"},"Apify Docker Images"),(0,o.kt)("h3",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,"\u200b",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"))," and other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"))," environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so we can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use the above images, it's necessary to have a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)(i.B,{to:"docs/introduction/setting-up",mdxType:"CrawleeLink"},"Crawlee CLI")," which automatically adds the correct Dockerfile into our project folder."),(0,o.kt)(l.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"node+js",label:"Node+JavaScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},p)),(0,o.kt)(s.Z,{value:"node+ts",label:"Node+TypeScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"browser+js",label:"Browser+JavaScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in the ",(0,o.kt)("code",null,"FROM")," declaration.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},d)),(0,o.kt)(s.Z,{value:"browser+ts",label:"Browser+TypeScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in both ",(0,o.kt)("code",null,"FROM")," declarations.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},m))))}N.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=u(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return a?n.createElement(h,i(i({ref:t},p),{},{components:a})):n.createElement(h,i({ref:t},p))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var u=2;u{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),s=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),p=i.version,l=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),n.createElement(a.default,{to:"/api/"+c+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>s});var n=r(67294),a=r(88746),o="https://crawlee.dev",s=function(e){var t=e.to,r=e.children,s=e.version;return n.createElement(a.default,{href:o+"/api"+(s?"/"+s:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},65940:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>m,contentTitle:()=>d,default:()=>g,frontMatter:()=>u,metadata:()=>f,toc:()=>h});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=r(14563),i=r(68889),p=r(26569);const l="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PuppeteerCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Puppeteer.\nconst crawler = new PuppeteerCrawler({\n // Here you can set options that are passed to the launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n";var c=["components"],u={id:"puppeteer-crawler",title:"Puppeteer crawler"},d=void 0,f={unversionedId:"examples/puppeteer-crawler",id:"version-3.0/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination",source:"@site/versioned_docs/version-3.0/examples/puppeteer_crawler.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/3.0/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"docs",previous:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/3.0/examples/capture-screenshot"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"}},m={},h=[],w={toc:h},y="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(y,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(p.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," in combination\nwith ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"\nto recursively scrape the ",(0,o.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer."),(0,o.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},l))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,s(s({ref:t},c),{},{components:r})):n.createElement(m,s({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var l=2;l{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),s=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),p=i.version,l=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),n.createElement(a.default,{to:"/api/"+c+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>s});var n=r(67294),a=r(88746),o="https://crawlee.dev",s=function(e){var t=e.to,r=e.children,s=e.version;return n.createElement(a.default,{href:o+"/api"+(s?"/"+s:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},65940:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>m,contentTitle:()=>d,default:()=>g,frontMatter:()=>u,metadata:()=>f,toc:()=>h});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=r(14563),i=r(68889),p=r(26569);const l="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PuppeteerCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Puppeteer.\nconst crawler = new PuppeteerCrawler({\n // Here you can set options that are passed to the launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n";var c=["components"],u={id:"puppeteer-crawler",title:"Puppeteer crawler"},d=void 0,f={unversionedId:"examples/puppeteer-crawler",id:"version-3.0/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination",source:"@site/versioned_docs/version-3.0/examples/puppeteer_crawler.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/3.0/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"docs",previous:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/3.0/examples/capture-screenshot"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"}},m={},h=[],w={toc:h},y="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(y,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(p.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," in combination\nwith ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"\nto recursively scrape the ",(0,o.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer."),(0,o.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},l))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,s(s({ref:t},c),{},{components:r})):n.createElement(m,s({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-crawl-some-links",title:"Crawl some links on a website",id:"crawl-some-links"},l=void 0,p={unversionedId:"examples/crawl-some-links",id:"version-1.3/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the Apify.enqueueLinks() method",source:"@site/versioned_docs/version-1.3/examples/crawl_some_links.md",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/1.3/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_some_links.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawl-some-links",title:"Crawl some links on a website",id:"crawl-some-links"},sidebar:"version-1.3/docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/1.3/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/1.3/examples/forms"}},u={},c=[],m={toc:c},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," example uses the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/pseudo-url",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"pseudoUrls"))," property in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method\nto only add links to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestList")," queue if they match the specified regular expression."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/store' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add some links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),d=a,f=c["".concat(l,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(f,s(s({ref:t},u),{},{components:r})):n.createElement(f,s({ref:t},u))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:a,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-crawl-some-links",title:"Crawl some links on a website",id:"crawl-some-links"},l=void 0,p={unversionedId:"examples/crawl-some-links",id:"version-1.3/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the Apify.enqueueLinks() method",source:"@site/versioned_docs/version-1.3/examples/crawl_some_links.md",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/1.3/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_some_links.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawl-some-links",title:"Crawl some links on a website",id:"crawl-some-links"},sidebar:"version-1.3/docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/1.3/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/1.3/examples/forms"}},u={},c=[],m={toc:c},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," example uses the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/pseudo-url",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"pseudoUrls"))," property in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method\nto only add links to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestList")," queue if they match the specified regular expression."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/store' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add some links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),d=a,f=c["".concat(l,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(f,s(s({ref:t},u),{},{components:r})):n.createElement(f,s({ref:t},u))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:a,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>c,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],s={id:"event-types",title:"EventTypes"},i=void 0,c={unversionedId:"typedefs/event-types",id:"version-2.3/typedefs/event-types",title:"EventTypes",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/EventTypes.md",sourceDirName:"typedefs",slug:"/typedefs/event-types",permalink:"/sdk/js/docs/2.3/typedefs/event-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/EventTypes.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"event-types",title:"EventTypes"}},l={},y=[],f={toc:y},u="wrapper";function d(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"eventtypes"}),(0,a.kt)("hr",null))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},y="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),y=c(r),u=o,d=y["".concat(i,".").concat(u)]||y[u]||f[u]||a;return r?n.createElement(d,p(p({ref:t},l),{},{components:r})):n.createElement(d,p({ref:t},l))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=u;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[y]="string"==typeof e?e:o,p[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>c,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],s={id:"event-types",title:"EventTypes"},i=void 0,c={unversionedId:"typedefs/event-types",id:"version-2.3/typedefs/event-types",title:"EventTypes",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/EventTypes.md",sourceDirName:"typedefs",slug:"/typedefs/event-types",permalink:"/sdk/js/docs/2.3/typedefs/event-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/EventTypes.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"event-types",title:"EventTypes"}},l={},y=[],f={toc:y},u="wrapper";function d(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"eventtypes"}),(0,a.kt)("hr",null))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},y="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),y=c(r),u=o,d=y["".concat(i,".").concat(u)]||y[u]||f[u]||a;return r?n.createElement(d,p(p({ref:t},l),{},{components:r})):n.createElement(d,p({ref:t},l))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=u;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[y]="string"==typeof e?e:o,p[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-playwright-handle-page-function",title:"PlaywrightHandlePageFunction",id:"playwright-handle-page-function"},p=void 0,c={unversionedId:"typedefs/playwright-handle-page-function",id:"version-1.3/typedefs/playwright-handle-page-function",title:"PlaywrightHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-handle-page-function",title:"PlaywrightHandlePageFunction",id:"playwright-handle-page-function"},sidebar:"version-1.3/docs",previous:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request-inputs"},next:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"}},s={},d=[],u={toc:d},f="wrapper";function g(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrighthandlepagefunction"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/playwright-handle-page-function-param",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunctionParam"))," |\n",(0,o.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}g.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,g=d["".concat(p,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(g,i(i({ref:t},s),{},{components:n})):r.createElement(g,i({ref:t},s))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-playwright-handle-page-function",title:"PlaywrightHandlePageFunction",id:"playwright-handle-page-function"},p=void 0,c={unversionedId:"typedefs/playwright-handle-page-function",id:"version-1.3/typedefs/playwright-handle-page-function",title:"PlaywrightHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-handle-page-function",title:"PlaywrightHandlePageFunction",id:"playwright-handle-page-function"},sidebar:"version-1.3/docs",previous:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request-inputs"},next:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"}},s={},d=[],u={toc:d},f="wrapper";function g(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrighthandlepagefunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-handle-page-function-param",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunctionParam"))," |\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null))}g.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=c(n),f=a,g=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return n?r.createElement(g,o(o({ref:t},s),{},{components:n})):r.createElement(g,o({ref:t},s))}));function g(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:a,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>h,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),s=["components"],l={id_old:"version-1.3-request-list",title:"RequestList",id:"request-list"},o=void 0,u={unversionedId:"api/request-list",id:"version-1.3/api/request-list",title:"RequestList",description:"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. RequestList is used",source:"@site/versioned_docs/version-1.3/api/RequestList.md",sourceDirName:"api",slug:"/api/request-list",permalink:"/sdk/js/docs/1.3/api/request-list",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestList.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-list",title:"RequestList",id:"request-list"},sidebar:"version-1.3/docs",previous:{title:"Request",permalink:"/sdk/js/docs/1.3/api/request"},next:{title:"RequestQueue",permalink:"/sdk/js/docs/1.3/api/request-queue"}},p={},d=[{value:"new RequestList(options)",id:"new-requestlistoptions",level:2},{value:"requestList.requests",id:"requestlistrequests",level:2},{value:"requestList.initialize()",id:"requestlistinitialize",level:2},{value:"requestList.persistState()",id:"requestlistpersiststate",level:2},{value:"requestList.getState()",id:"requestlistgetstate",level:2},{value:"requestList.isEmpty()",id:"requestlistisempty",level:2},{value:"requestList.isFinished()",id:"requestlistisfinished",level:2},{value:"requestList.fetchNextRequest()",id:"requestlistfetchnextrequest",level:2},{value:"requestList.markRequestHandled(request)",id:"requestlistmarkrequesthandledrequest",level:2},{value:"requestList.reclaimRequest(request)",id:"requestlistreclaimrequestrequest",level:2},{value:"requestList.length()",id:"requestlistlength",level:2},{value:"requestList.handledCount()",id:"requestlisthandledcount",level:2}],m={toc:d},c="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,s);return(0,i.kt)(c,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlist"}),(0,i.kt)("p",null,"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is used\nby ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl."),(0,i.kt)("p",null,"Each URL is represented using an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class. The list can only contain unique URLs. More precisely, it can only\ncontain ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances with distinct ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can also be overridden. To\nadd a single URL to the list multiple times, corresponding ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. You\ncan use the ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," option to do this for you when initializing the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," from sources."),(0,i.kt)("p",null,"Once you create an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", you need to call the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," function before the\ninstance can be used. After that, no more URLs can be added to the list. Unlike ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is static but it\ncan contain even millions of URLs."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," can be used together with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," by the same crawler. In such cases, each request from ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is enqueued\ninto ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," first and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list\nfirst and then possibly from the queue). In practical terms, such a combination can be useful when there is a large number of initial URLs, but more\nURLs would be added dynamically by the crawler.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," has an internal state where it stores information about which requests were already handled, which are in progress and which were\nreclaimed. The state may be automatically persisted to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," by setting the ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," option\nso that if the Node.js process is restarted, the crawling can continue where it left off. The automated persisting is launched upon receiving the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event that is periodically emitted by ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events")),"."),(0,i.kt)("p",null,"The internal state is closely tied to the provided sources (URLs). If the sources change on actor restart, the state will become corrupted and\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will raise an exception. This typically happens when the sources is a list of URLs downloaded from the web. In such case, use the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," option in conjunction with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey"),", to make the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," store the initial sources to the default key-value store\nand load them after restart, which will prevent any issues that a live list of URLs might cause."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Basic usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use a helper function to simplify request list initialization.\n// State and sources are automatically persisted. This is a preferred usage.\nconst requestList = await Apify.openRequestList('my-request-list', [\n 'http://www.example.com/page-1',\n { url: 'http://www.example.com/page-2', method: 'POST', userData: { foo: 'bar' } },\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n]);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use the constructor to get more control over the initialization.\nconst requestList = new Apify.RequestList({\n sources: [\n // Separate requests\n { url: 'http://www.example.com/page-1', method: 'GET', headers: { ... } },\n { url: 'http://www.example.com/page-2', userData: { foo: 'bar' }},\n\n // Bulk load of URLs from file `http://www.example.com/my-url-list.txt`\n // Note that all URLs must start with http:// or https://\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n ],\n\n // Persist the state to avoid re-crawling which can lead to data duplications.\n // Keep in mind that the sources have to be immutable or this will throw an error.\n persistStateKey: 'my-state',\n});\n\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"exports.requestlist"}),(0,i.kt)("h2",{id:"new-requestlistoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"new RequestList(options)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," configuration options")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"requests"}),(0,i.kt)("h2",{id:"requestlistrequests"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.requests")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"requestlistinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.initialize()")),(0,i.kt)("p",null,"Loads all remote sources of URLs and potentially starts periodic state persistence. This function must be called before you can start using the\ninstance in a meaningful way."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"requestlistpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals, but calling this method manually is useful in cases where you want to have the most current state available after you pause or stop\nfetching its requests. For example after you pause or abort a crawl. Or just before a server migration."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"requestlistgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isempty"}),(0,i.kt)("h2",{id:"requestlistisempty"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isEmpty()")),(0,i.kt)("p",null,"Resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#fetchnextrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.fetchNextRequest()"))," function would return ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),",\notherwise it resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the list is empty, there might be some pending requests currently being processed."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isfinished"}),(0,i.kt)("h2",{id:"requestlistisfinished"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isFinished()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"fetchnextrequest"}),(0,i.kt)("h2",{id:"requestlistfetchnextrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.fetchNextRequest()")),(0,i.kt)("p",null,"Gets the next ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," to process. First, the function gets a request previously reclaimed using the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#reclaimrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.reclaimRequest()"))," function, if there is any. Otherwise it gets the next request from sources."),(0,i.kt)("p",null,"The function's ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if there are no more requests to process."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"markrequesthandled"}),(0,i.kt)("h2",{id:"requestlistmarkrequesthandledrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.markRequestHandled(request)")),(0,i.kt)("p",null,"Marks request as handled after successful processing."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"reclaimrequest"}),(0,i.kt)("h2",{id:"requestlistreclaimrequestrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.reclaimRequest(request)")),(0,i.kt)("p",null,"Reclaims request to the list if its processing failed. The request will become available in the next ",(0,i.kt)("inlineCode",{parentName:"p"},"this.fetchNextRequest()"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"length"}),(0,i.kt)("h2",{id:"requestlistlength"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.length()")),(0,i.kt)("p",null,"Returns the total number of unique requests present in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"handledcount"}),(0,i.kt)("h2",{id:"requestlisthandledcount"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.handledCount()")),(0,i.kt)("p",null,"Returns number of handled requests."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var o=r.createContext({}),u=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=u(e.components);return r.createElement(o.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),c=a,h=d["".concat(o,".").concat(c)]||d[c]||m[c]||i;return n?r.createElement(h,s(s({ref:t},p),{},{components:n})):r.createElement(h,s({ref:t},p))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=c;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[d]="string"==typeof e?e:a,s[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>h,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),s=["components"],l={id_old:"version-1.3-request-list",title:"RequestList",id:"request-list"},u=void 0,o={unversionedId:"api/request-list",id:"version-1.3/api/request-list",title:"RequestList",description:"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. RequestList is used",source:"@site/versioned_docs/version-1.3/api/RequestList.md",sourceDirName:"api",slug:"/api/request-list",permalink:"/sdk/js/docs/1.3/api/request-list",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestList.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-list",title:"RequestList",id:"request-list"},sidebar:"version-1.3/docs",previous:{title:"Request",permalink:"/sdk/js/docs/1.3/api/request"},next:{title:"RequestQueue",permalink:"/sdk/js/docs/1.3/api/request-queue"}},p={},d=[{value:"new RequestList(options)",id:"new-requestlistoptions",level:2},{value:"requestList.requests",id:"requestlistrequests",level:2},{value:"requestList.initialize()",id:"requestlistinitialize",level:2},{value:"requestList.persistState()",id:"requestlistpersiststate",level:2},{value:"requestList.getState()",id:"requestlistgetstate",level:2},{value:"requestList.isEmpty()",id:"requestlistisempty",level:2},{value:"requestList.isFinished()",id:"requestlistisfinished",level:2},{value:"requestList.fetchNextRequest()",id:"requestlistfetchnextrequest",level:2},{value:"requestList.markRequestHandled(request)",id:"requestlistmarkrequesthandledrequest",level:2},{value:"requestList.reclaimRequest(request)",id:"requestlistreclaimrequestrequest",level:2},{value:"requestList.length()",id:"requestlistlength",level:2},{value:"requestList.handledCount()",id:"requestlisthandledcount",level:2}],m={toc:d},c="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(c,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlist"}),(0,i.kt)("p",null,"Represents a static list of URLs to crawl. The URLs can be provided either in code or parsed from a text file hosted on the web. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is used\nby ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl."),(0,i.kt)("p",null,"Each URL is represented using an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class. The list can only contain unique URLs. More precisely, it can only\ncontain ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances with distinct ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can also be overridden. To\nadd a single URL to the list multiple times, corresponding ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. You\ncan use the ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," option to do this for you when initializing the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," from sources."),(0,i.kt)("p",null,"Once you create an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", you need to call the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," function before the\ninstance can be used. After that, no more URLs can be added to the list. Unlike ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is static but it\ncan contain even millions of URLs."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," can be used together with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," by the same crawler. In such cases, each request from ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is enqueued\ninto ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," first and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list\nfirst and then possibly from the queue). In practical terms, such a combination can be useful when there is a large number of initial URLs, but more\nURLs would be added dynamically by the crawler.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," has an internal state where it stores information about which requests were already handled, which are in progress and which were\nreclaimed. The state may be automatically persisted to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," by setting the ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," option\nso that if the Node.js process is restarted, the crawling can continue where it left off. The automated persisting is launched upon receiving the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event that is periodically emitted by ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events")),"."),(0,i.kt)("p",null,"The internal state is closely tied to the provided sources (URLs). If the sources change on actor restart, the state will become corrupted and\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will raise an exception. This typically happens when the sources is a list of URLs downloaded from the web. In such case, use the\n",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," option in conjunction with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey"),", to make the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," store the initial sources to the default key-value store\nand load them after restart, which will prevent any issues that a live list of URLs might cause."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Basic usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use a helper function to simplify request list initialization.\n// State and sources are automatically persisted. This is a preferred usage.\nconst requestList = await Apify.openRequestList('my-request-list', [\n 'http://www.example.com/page-1',\n { url: 'http://www.example.com/page-2', method: 'POST', userData: { foo: 'bar' } },\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n]);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Use the constructor to get more control over the initialization.\nconst requestList = new Apify.RequestList({\n sources: [\n // Separate requests\n { url: 'http://www.example.com/page-1', method: 'GET', headers: { ... } },\n { url: 'http://www.example.com/page-2', userData: { foo: 'bar' }},\n\n // Bulk load of URLs from file `http://www.example.com/my-url-list.txt`\n // Note that all URLs must start with http:// or https://\n { requestsFromUrl: 'http://www.example.com/my-url-list.txt', userData: { isFromUrl: true } },\n ],\n\n // Persist the state to avoid re-crawling which can lead to data duplications.\n // Keep in mind that the sources have to be immutable or this will throw an error.\n persistStateKey: 'my-state',\n});\n\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"exports.requestlist"}),(0,i.kt)("h2",{id:"new-requestlistoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"new RequestList(options)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," configuration options")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"requests"}),(0,i.kt)("h2",{id:"requestlistrequests"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.requests")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"requestlistinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.initialize()")),(0,i.kt)("p",null,"Loads all remote sources of URLs and potentially starts periodic state persistence. This function must be called before you can start using the\ninstance in a meaningful way."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"requestlistpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals, but calling this method manually is useful in cases where you want to have the most current state available after you pause or stop\nfetching its requests. For example after you pause or abort a crawl. Or just before a server migration."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"requestlistgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isempty"}),(0,i.kt)("h2",{id:"requestlistisempty"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isEmpty()")),(0,i.kt)("p",null,"Resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#fetchnextrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.fetchNextRequest()"))," function would return ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),",\notherwise it resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the list is empty, there might be some pending requests currently being processed."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isfinished"}),(0,i.kt)("h2",{id:"requestlistisfinished"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.isFinished()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"fetchnextrequest"}),(0,i.kt)("h2",{id:"requestlistfetchnextrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.fetchNextRequest()")),(0,i.kt)("p",null,"Gets the next ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," to process. First, the function gets a request previously reclaimed using the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#reclaimrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.reclaimRequest()"))," function, if there is any. Otherwise it gets the next request from sources."),(0,i.kt)("p",null,"The function's ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," resolves to ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if there are no more requests to process."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"markrequesthandled"}),(0,i.kt)("h2",{id:"requestlistmarkrequesthandledrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.markRequestHandled(request)")),(0,i.kt)("p",null,"Marks request as handled after successful processing."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"reclaimrequest"}),(0,i.kt)("h2",{id:"requestlistreclaimrequestrequest"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.reclaimRequest(request)")),(0,i.kt)("p",null,"Reclaims request to the list if its processing failed. The request will become available in the next ",(0,i.kt)("inlineCode",{parentName:"p"},"this.fetchNextRequest()"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"length"}),(0,i.kt)("h2",{id:"requestlistlength"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.length()")),(0,i.kt)("p",null,"Returns the total number of unique requests present in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"handledcount"}),(0,i.kt)("h2",{id:"requestlisthandledcount"},(0,i.kt)("inlineCode",{parentName:"h2"},"requestList.handledCount()")),(0,i.kt)("p",null,"Returns number of handled requests."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),o=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=o(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,u=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=o(n),c=r,h=d["".concat(u,".").concat(c)]||d[c]||m[c]||i;return n?a.createElement(h,s(s({ref:t},p),{},{components:n})):a.createElement(h,s({ref:t},p))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,s=new Array(i);s[0]=c;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l[d]="string"==typeof e?e:r,s[1]=l;for(var o=2;o{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id_old:"version-1.3-cheerio-handle-page",title:"CheerioHandlePage",id:"cheerio-handle-page"},s=void 0,l={unversionedId:"typedefs/cheerio-handle-page",id:"version-1.3/typedefs/cheerio-handle-page",title:"CheerioHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/CheerioHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePage.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-cheerio-handle-page",title:"CheerioHandlePage",id:"cheerio-handle-page"},sidebar:"version-1.3/docs",previous:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/1.3/typedefs/system-status-options"},next:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepage"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/cheerio-handle-page-inputs",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioHandlePageInputs"))," - Arguments passed to this callback.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id_old:"version-1.3-cheerio-handle-page",title:"CheerioHandlePage",id:"cheerio-handle-page"},l=void 0,s={unversionedId:"typedefs/cheerio-handle-page",id:"version-1.3/typedefs/cheerio-handle-page",title:"CheerioHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/CheerioHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePage.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-cheerio-handle-page",title:"CheerioHandlePage",id:"cheerio-handle-page"},sidebar:"version-1.3/docs",previous:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/1.3/typedefs/system-status-options"},next:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepage"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/cheerio-handle-page-inputs",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioHandlePageInputs"))," - Arguments passed to this callback.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=s(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),s=(r(67294),r(3905)),o=["components"],l={id:"handle-request",title:"HandleRequest"},i=void 0,p={unversionedId:"typedefs/handle-request",id:"version-2.3/typedefs/handle-request",title:"HandleRequest",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/HandleRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request",permalink:"/sdk/js/docs/2.3/typedefs/handle-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequest.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"handle-request",title:"HandleRequest"},sidebar:"version-2.3/docs",previous:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request-input"},next:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/handle-request-inputs"}},u={},d=[],c={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,s.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"handlerequest"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/handle-request-inputs",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"HandleRequestInputs"))," - Arguments passed to this callback.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"Promise")),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(r),f=a,m=d["".concat(i,".").concat(f)]||d[f]||c[f]||s;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[d]="string"==typeof e?e:a,o[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],l={id:"handle-request",title:"HandleRequest"},i=void 0,p={unversionedId:"typedefs/handle-request",id:"version-2.3/typedefs/handle-request",title:"HandleRequest",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/HandleRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request",permalink:"/sdk/js/docs/2.3/typedefs/handle-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequest.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"handle-request",title:"HandleRequest"},sidebar:"version-2.3/docs",previous:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request-input"},next:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/handle-request-inputs"}},u={},d=[],c={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"handlerequest"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/handle-request-inputs",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleRequestInputs"))," - Arguments passed to this callback.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(r),f=a,m=d["".concat(i,".").concat(f)]||d[f]||c[f]||o;return r?n.createElement(m,s(s({ref:t},u),{},{components:r})):n.createElement(m,s({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[d]="string"==typeof e?e:a,s[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>p,toc:()=>m});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),l=["components"],o={id_old:"version-1.3-utils",title:"utils",id:"utils"},s=void 0,p={unversionedId:"api/utils",id:"version-1.3/api/utils",title:"utils",description:"A namespace that contains various utilities.",source:"@site/versioned_docs/version-1.3/api/utils.md",sourceDirName:"api",slug:"/api/utils",permalink:"/sdk/js/docs/1.3/api/utils",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/utils.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-utils",title:"utils",id:"utils"},sidebar:"version-1.3/docs",previous:{title:"PseudoUrl",permalink:"/sdk/js/docs/1.3/api/pseudo-url"},next:{title:"utils.log",permalink:"/sdk/js/docs/1.3/api/log"}},u={},m=[{value:"utils.URL_NO_COMMAS_REGEX",id:"utilsurl_no_commas_regex",level:2},{value:"utils.URL_WITH_COMMAS_REGEX",id:"utilsurl_with_commas_regex",level:2},{value:"utils.enqueueLinks(options)",id:"utilsenqueuelinksoptions",level:2},{value:"utils.requestAsBrowser(options)",id:"utilsrequestasbrowseroptions",level:2},{value:"utils.isDocker(forceReset)",id:"utilsisdockerforcereset",level:2},{value:"utils.sleep(millis)",id:"utilssleepmillis",level:2},{value:"utils.downloadListOfUrls(options)",id:"utilsdownloadlistofurlsoptions",level:2},{value:"utils.extractUrls(options)",id:"utilsextracturlsoptions",level:2},{value:"utils.htmlToText(html)",id:"utilshtmltotexthtml",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,l);return(0,i.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"utils"}),(0,i.kt)("p",null,"A namespace that contains various utilities."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"url_no_commas_regex"}),(0,i.kt)("h2",{id:"utilsurl_no_commas_regex"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.URL_NO_COMMAS_REGEX")),(0,i.kt)("p",null,"Default regular expression to match URLs in a string that may be plain text, JSON, CSV or other. It supports common URL characters and does not\nsupport URLs containing commas or spaces. The URLs also may contain Unicode letters (not symbols)."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"url_with_commas_regex"}),(0,i.kt)("h2",{id:"utilsurl_with_commas_regex"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.URL_WITH_COMMAS_REGEX")),(0,i.kt)("p",null,"Regular expression that, in addition to the default regular expression ",(0,i.kt)("inlineCode",{parentName:"p"},"URL_NO_COMMAS_REGEX"),", supports matching commas in URL path and query. Note,\nhowever, that this may prevent parsing URLs from comma delimited lists, or the URLs may become malformed."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"enqueuelinks"}),(0,i.kt)("h2",{id:"utilsenqueuelinksoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.enqueueLinks(options)")),(0,i.kt)("p",null,"The function finds elements matching a specific CSS selector (HTML anchor (",(0,i.kt)("inlineCode",{parentName:"p"},""),") by default) either in a Puppeteer page, or in a Cheerio object\n(parsed HTML), and enqueues the URLs in their ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attributes to the provided ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". If you're looking to find URLs\nin JavaScript heavy pages where links are not available in ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers see\n",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer#enqueuelinksbyclickingelements",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"puppeteer.enqueueLinksByClickingElements()")),"."),(0,i.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: ['https://www.example.com/handbags/[.*]', 'https://www.example.com/purses/[.*]'],\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameters are passed via an options object with the following keys:"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[page]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerPage")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"PlaywrightPage")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object. Either\n",(0,i.kt)("inlineCode",{parentName:"li"},"page")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"$")," option must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Number")," - Limit the count of actually enqueued URLs to this number. Useful for testing across the entire crawling scope."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[$]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio.Root")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio.Selector")," - ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/cheeriojs/cheerio",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Cheerio"))," function with loaded HTML. Either ",(0,i.kt)("inlineCode",{parentName:"li"},"page")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"$")," option must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[selector]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"'","a","'",'"')," - A CSS selector matching links to be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[baseUrl]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - A base URL that will be used to resolve relative URLs when using Cheerio. Ignored when using Puppeteer, since the\nrelative URL resolution is done inside the browser automatically."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"Array.<string>")," - An array of ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to\nbe enqueued, or an array of strings or RegExps or plain Objects from which the ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,i.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,i.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,i.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,i.kt)("p",{parentName:"li"},"For example: by adding ",(0,i.kt)("inlineCode",{parentName:"p"},"keepUrlFragment: true")," to the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," object, URL fragments will not be removed when ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.keepUrlFragment = true;\n return request;\n };\n}\n")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"requestasbrowser"}),(0,i.kt)("h2",{id:"utilsrequestasbrowseroptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.requestAsBrowser(options)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," This function uses an insecure version of HTTP parser by default and also ignores SSL/TLS errors. This is very useful in scraping,\nbecause it allows bypassing certain anti-scraping walls, but it also exposes some vulnerability. For other than scraping scenarios, please set\n",(0,i.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser: false")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ignoreSslErrors: false"),"."),(0,i.kt)("p",null,"Sends a HTTP request that looks like a request sent by a web browser, fully emulating browser's HTTP headers. It uses HTTP2 by default for Node 12+."),(0,i.kt)("p",null,"This function is useful for web scraping of websites that send the full HTML in the first response. Thanks to this function, the target web server has\nno simple way to find out the request hasn't been sent by a human's web browser. Using a headless browser for such requests is an order of magnitude\nmore resource-intensive than this function."),(0,i.kt)("p",null,"The function emulates the Chrome and Firefox web browsers. If you want more control over the browsers and their versions, use the\n",(0,i.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," property. You can find more info in the readme of the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"header-generator")),"\nlibrary."),(0,i.kt)("p",null,"Internally, the function uses the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"got-scraping"))," library to perform the request. All ",(0,i.kt)("inlineCode",{parentName:"p"},"options")," not recognized\nby this function are passed to it so see it for more details."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nconst { utils: { requestAsBrowser } } = Apify;\n\n...\n\nconst response = await requestAsBrowser({ url: 'https://www.example.com/' });\n\nconst html = response.body;\nconst status = response.statusCode;\nconst contentType = response.headers['content-type'];\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-as-browser-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestAsBrowserOptions"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"requestAsBrowser")," configuration options.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-as-browser-result",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))," - The result can be various objects, but it will always be like a\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"Node.js HTTP response stream")," with a 'body' property for the parsed response body,\nunless the 'stream' option is used."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isdocker"}),(0,i.kt)("h2",{id:"utilsisdockerforcereset"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.isDocker(forceReset)")),(0,i.kt)("p",null,"Returns a ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to true if the code is running in a Docker container."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"forceReset")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"sleep"}),(0,i.kt)("h2",{id:"utilssleepmillis"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.sleep(millis)")),(0,i.kt)("p",null,"Returns a ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves after a specific period of time. This is useful to implement waiting in your code, e.g. to prevent overloading of\ntarget website or to avoid bot detection."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"millis")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Period of time to sleep, in milliseconds. If not a positive number, the returned promise resolves immediately.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"downloadlistofurls"}),(0,i.kt)("h2",{id:"utilsdownloadlistofurlsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.downloadListOfUrls(options)")),(0,i.kt)("p",null,"Returns a promise that resolves to an array of urls parsed from the resource available at the provided url. Optionally, custom regular expression and\nencoding may be provided."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - URL to the file"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[encoding]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"'","utf8","'",'"')," - The encoding of the file."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,i.kt)("code",null," = URL_NO_COMMAS_REGEX")," - Custom regular expression to identify the URLs in the file to extract. The\nregular expression should be case-insensitive and have global flag set (i.e. ",(0,i.kt)("inlineCode",{parentName:"li"},"/something/gi"),").")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"extracturls"}),(0,i.kt)("h2",{id:"utilsextracturlsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.extractUrls(options)")),(0,i.kt)("p",null,"Collects all URLs in an arbitrary string to an array, optionally using a custom regular expression."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"string")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,i.kt)("code",null," = Apify.utils.URL_NO_COMMAS_REGEX"))))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"htmltotext"}),(0,i.kt)("h2",{id:"utilshtmltotexthtml"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.htmlToText(html)")),(0,i.kt)("p",null,"The function converts a HTML document to a plain text."),(0,i.kt)("p",null,"The plain text generated by the function is similar to a text captured by pressing Ctrl+A and Ctrl+C on a page when loaded in a web browser. The\nfunction doesn't aspire to preserve the formatting or to be perfectly correct with respect to HTML specifications. However, it attempts to generate\nnewlines and whitespaces in and around HTML elements to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g.\nphone numbers)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const text = htmlToText('Some text');\nconsole.log(text);\n")),(0,i.kt)("p",null,"Note that the function uses ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," to parse the HTML. Optionally, to avoid duplicate parsing of HTML and\nthus improve performance, you can pass an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed with the\n",(0,i.kt)("inlineCode",{parentName:"p"},"decodeEntities")," option set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),". For example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerio = require('cheerio');\nconst html = 'Some text';\nconst text = htmlToText(cheerio.load(html, { decodeEntities: true }));\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio.Root")," - HTML text or parsed HTML represented using a ",(0,i.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," function.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")," - Plain text"),(0,i.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(n),k=r,c=m["".concat(s,".").concat(k)]||m[k]||d[k]||i;return n?a.createElement(c,l(l({ref:t},u),{},{components:n})):a.createElement(c,l({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=k;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[m]="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>p,toc:()=>m});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),l=["components"],o={id_old:"version-1.3-utils",title:"utils",id:"utils"},s=void 0,p={unversionedId:"api/utils",id:"version-1.3/api/utils",title:"utils",description:"A namespace that contains various utilities.",source:"@site/versioned_docs/version-1.3/api/utils.md",sourceDirName:"api",slug:"/api/utils",permalink:"/sdk/js/docs/1.3/api/utils",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/utils.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-utils",title:"utils",id:"utils"},sidebar:"version-1.3/docs",previous:{title:"PseudoUrl",permalink:"/sdk/js/docs/1.3/api/pseudo-url"},next:{title:"utils.log",permalink:"/sdk/js/docs/1.3/api/log"}},u={},m=[{value:"utils.URL_NO_COMMAS_REGEX",id:"utilsurl_no_commas_regex",level:2},{value:"utils.URL_WITH_COMMAS_REGEX",id:"utilsurl_with_commas_regex",level:2},{value:"utils.enqueueLinks(options)",id:"utilsenqueuelinksoptions",level:2},{value:"utils.requestAsBrowser(options)",id:"utilsrequestasbrowseroptions",level:2},{value:"utils.isDocker(forceReset)",id:"utilsisdockerforcereset",level:2},{value:"utils.sleep(millis)",id:"utilssleepmillis",level:2},{value:"utils.downloadListOfUrls(options)",id:"utilsdownloadlistofurlsoptions",level:2},{value:"utils.extractUrls(options)",id:"utilsextracturlsoptions",level:2},{value:"utils.htmlToText(html)",id:"utilshtmltotexthtml",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,l);return(0,i.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"utils"}),(0,i.kt)("p",null,"A namespace that contains various utilities."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"url_no_commas_regex"}),(0,i.kt)("h2",{id:"utilsurl_no_commas_regex"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.URL_NO_COMMAS_REGEX")),(0,i.kt)("p",null,"Default regular expression to match URLs in a string that may be plain text, JSON, CSV or other. It supports common URL characters and does not\nsupport URLs containing commas or spaces. The URLs also may contain Unicode letters (not symbols)."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"url_with_commas_regex"}),(0,i.kt)("h2",{id:"utilsurl_with_commas_regex"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.URL_WITH_COMMAS_REGEX")),(0,i.kt)("p",null,"Regular expression that, in addition to the default regular expression ",(0,i.kt)("inlineCode",{parentName:"p"},"URL_NO_COMMAS_REGEX"),", supports matching commas in URL path and query. Note,\nhowever, that this may prevent parsing URLs from comma delimited lists, or the URLs may become malformed."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"enqueuelinks"}),(0,i.kt)("h2",{id:"utilsenqueuelinksoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.enqueueLinks(options)")),(0,i.kt)("p",null,"The function finds elements matching a specific CSS selector (HTML anchor (",(0,i.kt)("inlineCode",{parentName:"p"},""),") by default) either in a Puppeteer page, or in a Cheerio object\n(parsed HTML), and enqueues the URLs in their ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attributes to the provided ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". If you're looking to find URLs\nin JavaScript heavy pages where links are not available in ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers see\n",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer#enqueuelinksbyclickingelements",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"puppeteer.enqueueLinksByClickingElements()")),"."),(0,i.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: ['https://www.example.com/handbags/[.*]', 'https://www.example.com/purses/[.*]'],\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameters are passed via an options object with the following keys:"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[page]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerPage")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"PlaywrightPage")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object. Either\n",(0,i.kt)("inlineCode",{parentName:"li"},"page")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"$")," option must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Number")," - Limit the count of actually enqueued URLs to this number. Useful for testing across the entire crawling scope."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[$]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio.Root")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio.Selector")," - ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/cheeriojs/cheerio",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Cheerio"))," function with loaded HTML. Either ",(0,i.kt)("inlineCode",{parentName:"li"},"page")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"$")," option must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[selector]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"'","a","'",'"')," - A CSS selector matching links to be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[baseUrl]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - A base URL that will be used to resolve relative URLs when using Cheerio. Ignored when using Puppeteer, since the\nrelative URL resolution is done inside the browser automatically."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"Array.<string>")," - An array of ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to\nbe enqueued, or an array of strings or RegExps or plain Objects from which the ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,i.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,i.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,i.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,i.kt)("p",{parentName:"li"},"For example: by adding ",(0,i.kt)("inlineCode",{parentName:"p"},"keepUrlFragment: true")," to the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," object, URL fragments will not be removed when ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.keepUrlFragment = true;\n return request;\n };\n}\n")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"requestasbrowser"}),(0,i.kt)("h2",{id:"utilsrequestasbrowseroptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.requestAsBrowser(options)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," This function uses an insecure version of HTTP parser by default and also ignores SSL/TLS errors. This is very useful in scraping,\nbecause it allows bypassing certain anti-scraping walls, but it also exposes some vulnerability. For other than scraping scenarios, please set\n",(0,i.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser: false")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ignoreSslErrors: false"),"."),(0,i.kt)("p",null,"Sends a HTTP request that looks like a request sent by a web browser, fully emulating browser's HTTP headers. It uses HTTP2 by default for Node 12+."),(0,i.kt)("p",null,"This function is useful for web scraping of websites that send the full HTML in the first response. Thanks to this function, the target web server has\nno simple way to find out the request hasn't been sent by a human's web browser. Using a headless browser for such requests is an order of magnitude\nmore resource-intensive than this function."),(0,i.kt)("p",null,"The function emulates the Chrome and Firefox web browsers. If you want more control over the browsers and their versions, use the\n",(0,i.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," property. You can find more info in the readme of the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"header-generator")),"\nlibrary."),(0,i.kt)("p",null,"Internally, the function uses the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"got-scraping"))," library to perform the request. All ",(0,i.kt)("inlineCode",{parentName:"p"},"options")," not recognized\nby this function are passed to it so see it for more details."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nconst { utils: { requestAsBrowser } } = Apify;\n\n...\n\nconst response = await requestAsBrowser({ url: 'https://www.example.com/' });\n\nconst html = response.body;\nconst status = response.statusCode;\nconst contentType = response.headers['content-type'];\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-as-browser-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestAsBrowserOptions"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"requestAsBrowser")," configuration options.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-as-browser-result",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))," - The result can be various objects, but it will always be like a\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"Node.js HTTP response stream")," with a 'body' property for the parsed response body,\nunless the 'stream' option is used."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isdocker"}),(0,i.kt)("h2",{id:"utilsisdockerforcereset"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.isDocker(forceReset)")),(0,i.kt)("p",null,"Returns a ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to true if the code is running in a Docker container."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"forceReset")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"sleep"}),(0,i.kt)("h2",{id:"utilssleepmillis"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.sleep(millis)")),(0,i.kt)("p",null,"Returns a ",(0,i.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves after a specific period of time. This is useful to implement waiting in your code, e.g. to prevent overloading of\ntarget website or to avoid bot detection."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"const Apify = require('apify');\n\n...\n\n// Sleep 1.5 seconds\nawait Apify.utils.sleep(1500);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"millis")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Period of time to sleep, in milliseconds. If not a positive number, the returned promise resolves immediately.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"downloadlistofurls"}),(0,i.kt)("h2",{id:"utilsdownloadlistofurlsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.downloadListOfUrls(options)")),(0,i.kt)("p",null,"Returns a promise that resolves to an array of urls parsed from the resource available at the provided url. Optionally, custom regular expression and\nencoding may be provided."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - URL to the file"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[encoding]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"'","utf8","'",'"')," - The encoding of the file."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,i.kt)("code",null," = URL_NO_COMMAS_REGEX")," - Custom regular expression to identify the URLs in the file to extract. The\nregular expression should be case-insensitive and have global flag set (i.e. ",(0,i.kt)("inlineCode",{parentName:"li"},"/something/gi"),").")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"extracturls"}),(0,i.kt)("h2",{id:"utilsextracturlsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.extractUrls(options)")),(0,i.kt)("p",null,"Collects all URLs in an arbitrary string to an array, optionally using a custom regular expression."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"string")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlRegExp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"RegExp")," ",(0,i.kt)("code",null," = Apify.utils.URL_NO_COMMAS_REGEX"))))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"htmltotext"}),(0,i.kt)("h2",{id:"utilshtmltotexthtml"},(0,i.kt)("inlineCode",{parentName:"h2"},"utils.htmlToText(html)")),(0,i.kt)("p",null,"The function converts a HTML document to a plain text."),(0,i.kt)("p",null,"The plain text generated by the function is similar to a text captured by pressing Ctrl+A and Ctrl+C on a page when loaded in a web browser. The\nfunction doesn't aspire to preserve the formatting or to be perfectly correct with respect to HTML specifications. However, it attempts to generate\nnewlines and whitespaces in and around HTML elements to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g.\nphone numbers)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const text = htmlToText('Some text');\nconsole.log(text);\n")),(0,i.kt)("p",null,"Note that the function uses ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," to parse the HTML. Optionally, to avoid duplicate parsing of HTML and\nthus improve performance, you can pass an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed with the\n",(0,i.kt)("inlineCode",{parentName:"p"},"decodeEntities")," option set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),". For example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerio = require('cheerio');\nconst html = 'Some text';\nconst text = htmlToText(cheerio.load(html, { decodeEntities: true }));\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio.Root")," - HTML text or parsed HTML represented using a ",(0,i.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," function.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")," - Plain text"),(0,i.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),m=p(n),k=r,c=m["".concat(s,".").concat(k)]||m[k]||d[k]||i;return n?a.createElement(c,l(l({ref:t},u),{},{components:n})):a.createElement(c,l({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=k;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[m]="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var o=n(87462),a=n(63366),r=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-autoscaled-pool-options",title:"AutoscaledPoolOptions",id:"autoscaled-pool-options"},s=void 0,p={unversionedId:"typedefs/autoscaled-pool-options",id:"version-1.3/typedefs/autoscaled-pool-options",title:"AutoscaledPoolOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/AutoscaledPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/autoscaled-pool-options",permalink:"/sdk/js/docs/1.3/typedefs/autoscaled-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AutoscaledPoolOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-autoscaled-pool-options",title:"AutoscaledPoolOptions",id:"autoscaled-pool-options"},sidebar:"version-1.3/docs",previous:{title:"utils.social",permalink:"/sdk/js/docs/1.3/api/social"},next:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/basic-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"runTaskFunction",id:"runtaskfunction",level:3},{value:"isTaskReadyFunction",id:"istaskreadyfunction",level:3},{value:"isFinishedFunction",id:"isfinishedfunction",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"desiredConcurrency",id:"desiredconcurrency",level:3},{value:"desiredConcurrencyRatio",id:"desiredconcurrencyratio",level:3},{value:"scaleUpStepRatio",id:"scaleupstepratio",level:3},{value:"scaleDownStepRatio",id:"scaledownstepratio",level:3},{value:"maybeRunIntervalSecs",id:"mayberunintervalsecs",level:3},{value:"loggingIntervalSecs",id:"loggingintervalsecs",level:3},{value:"autoscaleIntervalSecs",id:"autoscaleintervalsecs",level:3},{value:"taskTimeoutSecs",id:"tasktimeoutsecs",level:3},{value:"snapshotterOptions",id:"snapshotteroptions",level:3},{value:"systemStatusOptions",id:"systemstatusoptions",level:3}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"autoscaledpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"runtaskfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"runTaskFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that performs an asynchronous resource-intensive task. The function must either be labeled ",(0,r.kt)("inlineCode",{parentName:"p"},"async")," or return a promise."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"istaskreadyfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isTaskReadyFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that indicates whether ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," should be called. This function is called every time there is free capacity for a new task and it\nshould indicate whether it should start a new task or not by resolving to either ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),". Besides its obvious use, it is also useful for\ntask throttling to save resources."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isfinishedfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isFinishedFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that is called only when there are no tasks to be processed. If it resolves to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," then the pool's run finishes. Being called only when\nthere are no tasks being processed means that as long as ",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction()")," keeps resolving to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction()")," will never be\ncalled. To abort a run, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()"))," method."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"The minimum number of tasks running in parallel."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"The maximum number of tasks running in parallel."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"The desired number of tasks that should be running parallel on the start of the pool, if there is a large enough supply of them. By default, it is\n",(0,r.kt)("inlineCode",{parentName:"p"},"minConcurrency"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrencyratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrencyRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.95")),(0,r.kt)("p",null,"Minimum level of desired concurrency to reach before more scaling up is allowed."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaleupstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleUpStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaledownstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleDownStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"mayberunintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"maybeRunIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.5")),(0,r.kt)("p",null,"Indicates how often the pool should call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction()")," to start a new task, in seconds. This has no effect on starting new tasks immediately\nafter a task completes."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"loggingintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"loggingIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Specifies a period in which the instance logs its state, in seconds. Set to ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," to disable periodic logging."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaleintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaleIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 10")),(0,r.kt)("p",null,"Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1\nmight have a severe impact on performance. We suggest using a value from 5 to 20."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tasktimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"taskTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0")),(0,r.kt)("p",null,"Timeout in which the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," needs to finish, given in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"snapshotteroptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"snapshotterOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," constructor. This is useful for fine-tuning the snapshot intervals and history."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"systemStatusOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," constructor. This is useful for fine-tuning the system status reports. If a\ncustom snapshotter is set in the options, it will be used by the pool."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||r;return n?o.createElement(k,i(i({ref:t},u),{},{components:n})):o.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var o=n(87462),a=n(63366),r=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-autoscaled-pool-options",title:"AutoscaledPoolOptions",id:"autoscaled-pool-options"},s=void 0,p={unversionedId:"typedefs/autoscaled-pool-options",id:"version-1.3/typedefs/autoscaled-pool-options",title:"AutoscaledPoolOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/AutoscaledPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/autoscaled-pool-options",permalink:"/sdk/js/docs/1.3/typedefs/autoscaled-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AutoscaledPoolOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-autoscaled-pool-options",title:"AutoscaledPoolOptions",id:"autoscaled-pool-options"},sidebar:"version-1.3/docs",previous:{title:"utils.social",permalink:"/sdk/js/docs/1.3/api/social"},next:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/basic-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"runTaskFunction",id:"runtaskfunction",level:3},{value:"isTaskReadyFunction",id:"istaskreadyfunction",level:3},{value:"isFinishedFunction",id:"isfinishedfunction",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"desiredConcurrency",id:"desiredconcurrency",level:3},{value:"desiredConcurrencyRatio",id:"desiredconcurrencyratio",level:3},{value:"scaleUpStepRatio",id:"scaleupstepratio",level:3},{value:"scaleDownStepRatio",id:"scaledownstepratio",level:3},{value:"maybeRunIntervalSecs",id:"mayberunintervalsecs",level:3},{value:"loggingIntervalSecs",id:"loggingintervalsecs",level:3},{value:"autoscaleIntervalSecs",id:"autoscaleintervalsecs",level:3},{value:"taskTimeoutSecs",id:"tasktimeoutsecs",level:3},{value:"snapshotterOptions",id:"snapshotteroptions",level:3},{value:"systemStatusOptions",id:"systemstatusoptions",level:3}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"autoscaledpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"runtaskfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"runTaskFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that performs an asynchronous resource-intensive task. The function must either be labeled ",(0,r.kt)("inlineCode",{parentName:"p"},"async")," or return a promise."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"istaskreadyfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isTaskReadyFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that indicates whether ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," should be called. This function is called every time there is free capacity for a new task and it\nshould indicate whether it should start a new task or not by resolving to either ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),". Besides its obvious use, it is also useful for\ntask throttling to save resources."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isfinishedfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isFinishedFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that is called only when there are no tasks to be processed. If it resolves to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," then the pool's run finishes. Being called only when\nthere are no tasks being processed means that as long as ",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction()")," keeps resolving to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction()")," will never be\ncalled. To abort a run, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()"))," method."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"The minimum number of tasks running in parallel."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"The maximum number of tasks running in parallel."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"The desired number of tasks that should be running parallel on the start of the pool, if there is a large enough supply of them. By default, it is\n",(0,r.kt)("inlineCode",{parentName:"p"},"minConcurrency"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrencyratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrencyRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.95")),(0,r.kt)("p",null,"Minimum level of desired concurrency to reach before more scaling up is allowed."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaleupstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleUpStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaledownstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleDownStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"mayberunintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"maybeRunIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.5")),(0,r.kt)("p",null,"Indicates how often the pool should call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction()")," to start a new task, in seconds. This has no effect on starting new tasks immediately\nafter a task completes."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"loggingintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"loggingIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Specifies a period in which the instance logs its state, in seconds. Set to ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," to disable periodic logging."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaleintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaleIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 10")),(0,r.kt)("p",null,"Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1\nmight have a severe impact on performance. We suggest using a value from 5 to 20."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tasktimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"taskTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0")),(0,r.kt)("p",null,"Timeout in which the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," needs to finish, given in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"snapshotteroptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"snapshotterOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," constructor. This is useful for fine-tuning the snapshot intervals and history."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"systemStatusOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," constructor. This is useful for fine-tuning the system status reports. If a\ncustom snapshotter is set in the options, it will be used by the pool."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||r;return n?o.createElement(k,i(i({ref:t},u),{},{components:n})):o.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id_old:"version-1.3-intercept-handler",title:"InterceptHandler",id:"intercept-handler"},l=void 0,c={unversionedId:"typedefs/intercept-handler",id:"version-1.3/typedefs/intercept-handler",title:"InterceptHandler",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/InterceptHandler.md",sourceDirName:"typedefs",slug:"/typedefs/intercept-handler",permalink:"/sdk/js/docs/1.3/typedefs/intercept-handler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/InterceptHandler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-intercept-handler",title:"InterceptHandler",id:"intercept-handler"}},s={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"intercepthandler"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerRequest")))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},s),{},{components:r})):n.createElement(m,i({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id_old:"version-1.3-intercept-handler",title:"InterceptHandler",id:"intercept-handler"},l=void 0,c={unversionedId:"typedefs/intercept-handler",id:"version-1.3/typedefs/intercept-handler",title:"InterceptHandler",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/InterceptHandler.md",sourceDirName:"typedefs",slug:"/typedefs/intercept-handler",permalink:"/sdk/js/docs/1.3/typedefs/intercept-handler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/InterceptHandler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-intercept-handler",title:"InterceptHandler",id:"intercept-handler"}},s={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"intercepthandler"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerRequest")))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},s),{},{components:r})):n.createElement(m,i({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var i=r(87462),n=r(63366),a=(r(67294),r(3905)),s=["components"],l={id_old:"version-1.3-statistic-persisted-state",title:"StatisticPersistedState",id:"statistic-persisted-state"},o=void 0,p={unversionedId:"typedefs/statistic-persisted-state",id:"version-1.3/typedefs/statistic-persisted-state",title:"StatisticPersistedState",description:"Format of the persisted stats",source:"@site/versioned_docs/version-1.3/typedefs/StatisticPersistedState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-persisted-state",permalink:"/sdk/js/docs/1.3/typedefs/statistic-persisted-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticPersistedState.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-statistic-persisted-state",title:"StatisticPersistedState",id:"statistic-persisted-state"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"requestRetryHistogram",id:"requestretryhistogram",level:3},{value:"statsId",id:"statsid",level:3},{value:"requestAvgFailedDurationMillis",id:"requestavgfaileddurationmillis",level:3},{value:"requestAvgFinishedDurationMillis",id:"requestavgfinisheddurationmillis",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestTotalDurationMillis",id:"requesttotaldurationmillis",level:3},{value:"requestsTotal",id:"requeststotal",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"crawlerLastStartTimestamp",id:"crawlerlaststarttimestamp",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,r=(0,n.Z)(e,s);return(0,a.kt)(m,(0,i.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticpersistedstate"}),(0,a.kt)("p",null,"Format of the persisted stats"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestretryhistogram"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statsid"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotaldurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requeststotal"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsTotal")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerlaststarttimestamp"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerLastStartTimestamp")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var i=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=i.createContext({}),p=function(e){var t=i.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return i.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=n,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return r?i.createElement(k,s(s({ref:t},d),{},{components:r})):i.createElement(k,s({ref:t},d))}));function k(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,s=new Array(a);s[0]=m;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[u]="string"==typeof e?e:n,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var i=r(87462),n=r(63366),a=(r(67294),r(3905)),s=["components"],l={id_old:"version-1.3-statistic-persisted-state",title:"StatisticPersistedState",id:"statistic-persisted-state"},o=void 0,p={unversionedId:"typedefs/statistic-persisted-state",id:"version-1.3/typedefs/statistic-persisted-state",title:"StatisticPersistedState",description:"Format of the persisted stats",source:"@site/versioned_docs/version-1.3/typedefs/StatisticPersistedState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-persisted-state",permalink:"/sdk/js/docs/1.3/typedefs/statistic-persisted-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticPersistedState.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-statistic-persisted-state",title:"StatisticPersistedState",id:"statistic-persisted-state"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"requestRetryHistogram",id:"requestretryhistogram",level:3},{value:"statsId",id:"statsid",level:3},{value:"requestAvgFailedDurationMillis",id:"requestavgfaileddurationmillis",level:3},{value:"requestAvgFinishedDurationMillis",id:"requestavgfinisheddurationmillis",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestTotalDurationMillis",id:"requesttotaldurationmillis",level:3},{value:"requestsTotal",id:"requeststotal",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"crawlerLastStartTimestamp",id:"crawlerlaststarttimestamp",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,r=(0,n.Z)(e,s);return(0,a.kt)(m,(0,i.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticpersistedstate"}),(0,a.kt)("p",null,"Format of the persisted stats"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestretryhistogram"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statsid"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotaldurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requeststotal"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsTotal")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerlaststarttimestamp"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerLastStartTimestamp")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var i=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=i.createContext({}),p=function(e){var t=i.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return i.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=n,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return r?i.createElement(k,s(s({ref:t},d),{},{components:r})):i.createElement(k,s({ref:t},d))}));function k(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,s=new Array(a);s[0]=m;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[u]="string"==typeof e?e:n,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-playwright-crawler",title:"Playwright crawler",id:"playwright-crawler"},l=void 0,c={unversionedId:"examples/playwright-crawler",id:"version-1.3/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler in combination with RequestQueue to",source:"@site/versioned_docs/version-1.3/examples/playwright_crawler.md",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/1.3/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/playwright_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-crawler",title:"Playwright crawler",id:"playwright-crawler"},sidebar:"version-1.3/docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/1.3/examples/map-and-reduce"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/1.3/examples/puppeteer-crawler"}},p={},u=[],h={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(d,(0,n.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"This example demonstrates how to use ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," in combination with ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," to\nrecursively scrape the ",(0,i.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,i.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,i.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PlaywrightCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Playwright.\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', $posts => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach($post => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),d=a,f=u["".concat(l,".").concat(d)]||u[d]||h[d]||i;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-playwright-crawler",title:"Playwright crawler",id:"playwright-crawler"},l=void 0,c={unversionedId:"examples/playwright-crawler",id:"version-1.3/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler in combination with RequestQueue to",source:"@site/versioned_docs/version-1.3/examples/playwright_crawler.md",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/1.3/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/playwright_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-crawler",title:"Playwright crawler",id:"playwright-crawler"},sidebar:"version-1.3/docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/1.3/examples/map-and-reduce"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/1.3/examples/puppeteer-crawler"}},p={},u=[],h={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(d,(0,n.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"This example demonstrates how to use ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," in combination with ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," to\nrecursively scrape the ",(0,i.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,i.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,i.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PlaywrightCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Playwright.\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', $posts => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach($post => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),d=a,f=u["".concat(l,".").concat(d)]||u[d]||h[d]||i;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.d(t,{Z:()=>o});var n=r(67294),a=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>d});var n=r(87462),a=r(67294),l=r(34334),o=r(63735),i=r(38224),u=r(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,r=e.block,i=e.selectedValue,u=e.selectValue,s=e.tabValues,p=[],m=(0,o.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,r=p.indexOf(t),n=s[r].value;n!==i&&(m(t),u(n))},f=function(e){var t,r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,a=p.indexOf(e.currentTarget)+1;r=null!=(n=p[a])?n:p[0];break;case"ArrowLeft":var l,o=p.indexOf(e.currentTarget)-1;r=null!=(l=p[o])?l:p[p.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},s.map((function(e){var t=e.value,r=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return p.push(e)},onKeyDown:f,onClick:d},o,{className:(0,l.Z)("tabs__item",c.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===t})}),null!=r?r:t)})))}function p(e){var t=e.lazy,r=e.children,n=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function m(e){var t=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},a.createElement(s,(0,n.Z)({},e,t)),a.createElement(p,(0,n.Z)({},e,t)))}function d(e){var t=(0,u.Z)();return a.createElement(m,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>m});var n=r(67294),a=r(16550),l=r(34423),o=r(20636),i=r(99200);function u(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:u(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,i=(0,a.k6)(),u=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:o});return[(0,l._X)(u),(0,n.useCallback)((function(e){if(u){var t=new URLSearchParams(i.location.search);t.set(u,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[u,i])]}function m(e){var t,r,a,l,o=e.defaultValue,u=e.queryString,m=void 0!==u&&u,d=e.groupId,f=c(e),w=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!s({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:f})})),v=w[0],b=w[1],h=p({queryString:m,groupId:d}),y=h[0],g=h[1],k=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),r=(0,i.Nk)(t),a=r[0],l=r[1],[a,(0,n.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=k[0],T=k[1],C=function(){var e=null!=y?y:x;return s({value:e,tabValues:f})?e:null}();return(0,n.useLayoutEffect)((function(){C&&b(C)}),[C]),{selectedValue:v,selectValue:(0,n.useCallback)((function(e){if(!s({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);b(e),g(e),T(e)}),[g,T,f]),tabValues:f}}},63129:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>v,contentTitle:()=>f,default:()=>g,frontMatter:()=>d,metadata:()=>w,toc:()=>b});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=r(65559),i=r(30433),u=r(14563);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, $ }) {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",s="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n";var m=["components"],d={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},f=void 0,w={unversionedId:"examples/crawl-multiple-urls",id:"version-3.0/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-3.0/examples/crawl_multiple_urls.mdx",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/3.0/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_multiple_urls.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/3.0/examples/crawl-relative-links"}},v={},b=[],h={toc:b},y="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,m);return(0,l.kt)(y,(0,n.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},s)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p))))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=n.createContext({}),c=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(u.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=c(r),d=a,f=p["".concat(u,".").concat(d)]||p[d]||m[d]||l;return r?n.createElement(f,o(o({ref:t},s),{},{components:r})):n.createElement(f,o({ref:t},s))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[p]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.d(t,{Z:()=>o});var n=r(67294),a=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>d});var n=r(87462),a=r(67294),l=r(34334),o=r(63735),i=r(38224),u=r(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,r=e.block,i=e.selectedValue,u=e.selectValue,s=e.tabValues,p=[],m=(0,o.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,r=p.indexOf(t),n=s[r].value;n!==i&&(m(t),u(n))},f=function(e){var t,r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,a=p.indexOf(e.currentTarget)+1;r=null!=(n=p[a])?n:p[0];break;case"ArrowLeft":var l,o=p.indexOf(e.currentTarget)-1;r=null!=(l=p[o])?l:p[p.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},s.map((function(e){var t=e.value,r=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return p.push(e)},onKeyDown:f,onClick:d},o,{className:(0,l.Z)("tabs__item",c.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===t})}),null!=r?r:t)})))}function p(e){var t=e.lazy,r=e.children,n=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function m(e){var t=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},a.createElement(s,(0,n.Z)({},e,t)),a.createElement(p,(0,n.Z)({},e,t)))}function d(e){var t=(0,u.Z)();return a.createElement(m,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>m});var n=r(67294),a=r(16550),l=r(34423),o=r(20636),i=r(99200);function u(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:u(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,i=(0,a.k6)(),u=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:o});return[(0,l._X)(u),(0,n.useCallback)((function(e){if(u){var t=new URLSearchParams(i.location.search);t.set(u,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[u,i])]}function m(e){var t,r,a,l,o=e.defaultValue,u=e.queryString,m=void 0!==u&&u,d=e.groupId,f=c(e),w=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!s({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:f})})),v=w[0],b=w[1],h=p({queryString:m,groupId:d}),y=h[0],g=h[1],k=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),r=(0,i.Nk)(t),a=r[0],l=r[1],[a,(0,n.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=k[0],T=k[1],C=function(){var e=null!=y?y:x;return s({value:e,tabValues:f})?e:null}();return(0,n.useLayoutEffect)((function(){C&&b(C)}),[C]),{selectedValue:v,selectValue:(0,n.useCallback)((function(e){if(!s({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);b(e),g(e),T(e)}),[g,T,f]),tabValues:f}}},63129:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>v,contentTitle:()=>f,default:()=>g,frontMatter:()=>d,metadata:()=>w,toc:()=>b});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=r(65559),i=r(30433),u=r(14563);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, $ }) {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",s="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n";var m=["components"],d={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},f=void 0,w={unversionedId:"examples/crawl-multiple-urls",id:"version-3.0/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-3.0/examples/crawl_multiple_urls.mdx",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/3.0/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_multiple_urls.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/3.0/examples/crawl-relative-links"}},v={},b=[],h={toc:b},y="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,m);return(0,l.kt)(y,(0,n.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},s)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p))))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=n.createContext({}),c=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(u.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=c(r),d=a,f=p["".concat(u,".").concat(d)]||p[d]||m[d]||l;return r?n.createElement(f,o(o({ref:t},s),{},{components:r})):n.createElement(f,o({ref:t},s))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[p]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.d(n,{Z:()=>s});var o=r(67294),t=r(88746),a=r(6141),i=r(6832);const s=function(e){var n=e.to,r=e.children,s=(0,a.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return o.createElement(t.default,{to:"/api/"+n},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),o.createElement(t.default,{to:"/api/"+c+n},r)}},26569:(e,n,r)=>{r.d(n,{B:()=>s,T:()=>i});var o=r(67294),t=r(88746),a="https://crawlee.dev",i=function(e){var n=e.to,r=e.children,i=e.version;return o.createElement(t.default,{href:a+"/api"+(i?"/"+i:"")+"/"+n},r)},s=function(e){var n=e.to,r=e.children;return o.createElement(t.default,{href:a+"/"+n},r)}},94577:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>y,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>u,toc:()=>f});var o=r(87462),t=r(63366),a=(r(67294),r(3905)),i=r(68889),s=r(26569),p=["components"],l={id:"proxy-management",title:"Proxy Management"},c=void 0,u={unversionedId:"guides/proxy-management",id:"version-3.0/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-3.0/guides/proxy_management.mdx",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/3.0/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/proxy_management.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/3.0/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/3.0/guides/session-management"}},y={},f=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],d={toc:f},m="wrapper";function g(e){var n=e.components,r=(0,t.Z)(e,p);return(0,a.kt)(m,(0,o.Z)({},d,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," class. You create an instance using the ",(0,a.kt)(i.Z,{to:"apify/class/Actor#createProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"Actor.createProxyConfiguration()"))," function. See the ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions"))," for all the possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,a.kt)(s.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,"\u200b",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration#newUrl",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyConfiguration.newUrl()"))," allows you to pass a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair, and subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression of a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and ",(0,a.kt)(s.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," class for more information on how keeping a real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas Apify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await SessionPool.open({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst crawler = new PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember. ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyInfo",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}g.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>d});var o=r(67294);function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,o)}return r}function i(e){for(var n=1;n=0||(t[r]=e[r]);return t}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}var p=o.createContext({}),l=function(e){var n=o.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},c=function(e){var n=l(e.components);return o.createElement(p.Provider,{value:n},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var r=e.components,t=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=t,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||a;return r?o.createElement(d,i(i({ref:n},c),{},{components:r})):o.createElement(d,i({ref:n},c))}));function d(e,n){var r=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[u]="string"==typeof e?e:t,i[1]=s;for(var l=2;l{r.d(n,{Z:()=>s});var o=r(67294),t=r(88746),a=r(6141),i=r(6832);const s=function(e){var n=e.to,r=e.children,s=(0,a.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return o.createElement(t.default,{to:"/api/"+n},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),o.createElement(t.default,{to:"/api/"+c+n},r)}},26569:(e,n,r)=>{r.d(n,{B:()=>s,T:()=>i});var o=r(67294),t=r(88746),a="https://crawlee.dev",i=function(e){var n=e.to,r=e.children,i=e.version;return o.createElement(t.default,{href:a+"/api"+(i?"/"+i:"")+"/"+n},r)},s=function(e){var n=e.to,r=e.children;return o.createElement(t.default,{href:a+"/"+n},r)}},94577:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>y,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>u,toc:()=>f});var o=r(87462),t=r(63366),a=(r(67294),r(3905)),i=r(68889),s=r(26569),p=["components"],l={id:"proxy-management",title:"Proxy Management"},c=void 0,u={unversionedId:"guides/proxy-management",id:"version-3.0/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-3.0/guides/proxy_management.mdx",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/3.0/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/proxy_management.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/3.0/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/3.0/guides/session-management"}},y={},f=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],d={toc:f},m="wrapper";function g(e){var n=e.components,r=(0,t.Z)(e,p);return(0,a.kt)(m,(0,o.Z)({},d,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," class. You create an instance using the ",(0,a.kt)(i.Z,{to:"apify/class/Actor#createProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"Actor.createProxyConfiguration()"))," function. See the ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions"))," for all the possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,a.kt)(s.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,"\u200b",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration#newUrl",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyConfiguration.newUrl()"))," allows you to pass a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair, and subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression of a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and ",(0,a.kt)(s.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," class for more information on how keeping a real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas Apify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await SessionPool.open({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst crawler = new PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember. ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyInfo",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}g.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>d});var o=r(67294);function t(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,o)}return r}function i(e){for(var n=1;n=0||(t[r]=e[r]);return t}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}var p=o.createContext({}),l=function(e){var n=o.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},c=function(e){var n=l(e.components);return o.createElement(p.Provider,{value:n},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},f=o.forwardRef((function(e,n){var r=e.components,t=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=t,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||a;return r?o.createElement(d,i(i({ref:n},c),{},{components:r})):o.createElement(d,i({ref:n},c))}));function d(e,n){var r=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[u]="string"==typeof e?e:t,i[1]=s;for(var l=2;l{r.d(t,{Z:()=>o});var a=r(67294),n=r(88746),l=r(6141),c=r(6832);const o=function(e){var t=e.to,r=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(n.default,{to:"/api/"+t},r);var d=i+"/";return"current"===i?d="next/":s&&(d=""),a.createElement(n.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>o,T:()=>c});var a=r(67294),n=r(88746),l="https://crawlee.dev",c=function(e){var t=e.to,r=e.children,c=e.version;return a.createElement(n.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},r)},o=function(e){var t=e.to,r=e.children;return a.createElement(n.default,{href:l+"/"+t},r)}},42327:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>I,frontMatter:()=>d,metadata:()=>g,toc:()=>b});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),c=(r(14563),r(68889),r(26569));const o={code:"import { Actor } from 'apify';\nimport { BasicCrawler } from 'crawlee';\nimport { gotScraping } from 'got-scraping';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\n// Create a BasicCrawler - the simplest crawler that enables\n// users to implement the crawling logic themselves.\nconst crawler = new BasicCrawler({\n // This function will be called for each URL to crawl.\n async requestHandler({ request }) {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils gotScraping\n const { body } = await gotScraping({ url });\n\n // Store the HTML and URL to the default dataset.\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.\nawait crawler.run([\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n]);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM"};var i,s=["components"],d={id:"basic-crawler",title:"Basic crawler"},p=void 0,g={unversionedId:"examples/basic-crawler",id:"version-3.1/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers",source:"@site/versioned_docs/version-3.1/examples/basic_crawler.mdx",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/basic_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"basic-crawler",title:"Basic crawler"},sidebar:"docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/examples/call-actor"}},u={},b=[],m=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:b},w="wrapper";function I(e){var t=e.components,r=(0,n.Z)(e,s);return(0,l.kt)(w,(0,a.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the ",(0,l.kt)(c.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers\nlike ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," or ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"got-scraping")),"\nnpm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,l.kt)(m,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}I.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>b});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},d=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=s(r),u=n,b=p["".concat(i,".").concat(u)]||p[u]||g[u]||l;return r?a.createElement(b,c(c({ref:t},d),{},{components:r})):a.createElement(b,c({ref:t},d))}));function b(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[p]="string"==typeof e?e:n,c[1]=o;for(var s=2;s{r.d(t,{Z:()=>o});var a=r(67294),n=r(88746),l=r(6141),c=r(6832);const o=function(e){var t=e.to,r=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(n.default,{to:"/api/"+t},r);var d=i+"/";return"current"===i?d="next/":s&&(d=""),a.createElement(n.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>o,T:()=>c});var a=r(67294),n=r(88746),l="https://crawlee.dev",c=function(e){var t=e.to,r=e.children,c=e.version;return a.createElement(n.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},r)},o=function(e){var t=e.to,r=e.children;return a.createElement(n.default,{href:l+"/"+t},r)}},42327:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>I,frontMatter:()=>d,metadata:()=>g,toc:()=>b});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),c=(r(14563),r(68889),r(26569));const o={code:"import { Actor } from 'apify';\nimport { BasicCrawler } from 'crawlee';\nimport { gotScraping } from 'got-scraping';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\n// Create a BasicCrawler - the simplest crawler that enables\n// users to implement the crawling logic themselves.\nconst crawler = new BasicCrawler({\n // This function will be called for each URL to crawl.\n async requestHandler({ request }) {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils gotScraping\n const { body } = await gotScraping({ url });\n\n // Store the HTML and URL to the default dataset.\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.\nawait crawler.run([\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n]);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM"};var i,s=["components"],d={id:"basic-crawler",title:"Basic crawler"},p=void 0,g={unversionedId:"examples/basic-crawler",id:"version-3.1/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers",source:"@site/versioned_docs/version-3.1/examples/basic_crawler.mdx",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/basic_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"basic-crawler",title:"Basic crawler"},sidebar:"docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/examples/call-actor"}},u={},b=[],m=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:b},w="wrapper";function I(e){var t=e.components,r=(0,n.Z)(e,s);return(0,l.kt)(w,(0,a.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the ",(0,l.kt)(c.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers\nlike ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," or ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"got-scraping")),"\nnpm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,l.kt)(m,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}I.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>b});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},d=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=s(r),u=n,b=p["".concat(i,".").concat(u)]||p[u]||g[u]||l;return r?a.createElement(b,c(c({ref:t},d),{},{components:r})):a.createElement(b,c({ref:t},d))}));function b(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[p]="string"==typeof e?e:n,c[1]=o;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],p={id:"request-options",title:"RequestOptions"},l=void 0,s={unversionedId:"typedefs/request-options",id:"version-2.3/typedefs/request-options",title:"RequestOptions",description:"Specifies required and optional fields for constructing a Request.",source:"@site/versioned_docs/version-2.3/typedefs/RequestOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-options",permalink:"/sdk/js/docs/2.3/typedefs/request-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-options",title:"RequestOptions"},sidebar:"version-2.3/docs",previous:{title:"LoggerOptions",permalink:"/sdk/js/docs/2.3/typedefs/logger-options"},next:{title:"RequestListOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-list-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"keepUrlFragment",id:"keepurlfragment",level:3},{value:"useExtendedUniqueKey",id:"useextendeduniquekey",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(c,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestoptions"}),(0,o.kt)("p",null,"Specifies required and optional fields for constructing a ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"url"},(0,o.kt)("inlineCode",{parentName:"h3"},"url")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL of the web page to crawl. It must be a non-empty string."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"uniquekey"},(0,o.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not provided, then it is automatically generated by normalizing the URL. For example, the URL of ",(0,o.kt)("inlineCode",{parentName:"p"},"HTTP://www.EXAMPLE.com/something/"),"\nwill produce the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com/something"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"keepUrlFragment")," option determines whether URL hash fragment is included in the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," or not."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey")," options determines whether method and payload are included in the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey"),", producing a ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," in the following\nformat: ",(0,o.kt)("inlineCode",{parentName:"p"},"METHOD(payloadHash):normalizedUrl"),". This is useful when requests point to the same URL, but with different methods and payloads. For example:\nform submits."),(0,o.kt)("p",null,"Pass an arbitrary non-empty text value to the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property to override the default behavior and specify which URLs shall be considered equal."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"method"},(0,o.kt)("inlineCode",{parentName:"h3"},"method")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," ",(0,o.kt)("code",null," = ",'"',"'","GET","'",'"')),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"payload"},(0,o.kt)("inlineCode",{parentName:"h3"},"payload")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"headers"},(0,o.kt)("inlineCode",{parentName:"h3"},"headers")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"HTTP headers in the following format:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n Accept: 'text/html',\n 'Content-Type': 'application/json'\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userdata"},(0,o.kt)("inlineCode",{parentName:"h3"},"userData")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Custom user data assigned to the request. Use this to save any request related data to the request's scope, keeping them accessible on retries,\nfailures etc."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"keepurlfragment"},(0,o.kt)("inlineCode",{parentName:"h3"},"keepUrlFragment")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"false")," then the hash part of a URL is removed when computing the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property. For example, this causes the ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com#foo"),"\nand ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com#bar")," URLs to have the same ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com")," and thus the URLs are considered equal. Note that this\noption only has an effect if ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not set."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useextendeduniquekey"},(0,o.kt)("inlineCode",{parentName:"h3"},"useExtendedUniqueKey")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," then the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed not only from the URL, but also from the method and payload properties. This is useful when making requests\nto the same URL that are differentiated by method or payload, such as form submit navigations in browsers."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),c=a,h=u["".concat(l,".").concat(c)]||u[c]||m[c]||o;return n?r.createElement(h,i(i({ref:t},d),{},{components:n})):r.createElement(h,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=c;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],p={id:"request-options",title:"RequestOptions"},l=void 0,s={unversionedId:"typedefs/request-options",id:"version-2.3/typedefs/request-options",title:"RequestOptions",description:"Specifies required and optional fields for constructing a Request.",source:"@site/versioned_docs/version-2.3/typedefs/RequestOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-options",permalink:"/sdk/js/docs/2.3/typedefs/request-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-options",title:"RequestOptions"},sidebar:"version-2.3/docs",previous:{title:"LoggerOptions",permalink:"/sdk/js/docs/2.3/typedefs/logger-options"},next:{title:"RequestListOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-list-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"keepUrlFragment",id:"keepurlfragment",level:3},{value:"useExtendedUniqueKey",id:"useextendeduniquekey",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(c,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestoptions"}),(0,o.kt)("p",null,"Specifies required and optional fields for constructing a ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"url"},(0,o.kt)("inlineCode",{parentName:"h3"},"url")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL of the web page to crawl. It must be a non-empty string."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"uniquekey"},(0,o.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not provided, then it is automatically generated by normalizing the URL. For example, the URL of ",(0,o.kt)("inlineCode",{parentName:"p"},"HTTP://www.EXAMPLE.com/something/"),"\nwill produce the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com/something"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"keepUrlFragment")," option determines whether URL hash fragment is included in the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," or not."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey")," options determines whether method and payload are included in the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey"),", producing a ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," in the following\nformat: ",(0,o.kt)("inlineCode",{parentName:"p"},"METHOD(payloadHash):normalizedUrl"),". This is useful when requests point to the same URL, but with different methods and payloads. For example:\nform submits."),(0,o.kt)("p",null,"Pass an arbitrary non-empty text value to the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property to override the default behavior and specify which URLs shall be considered equal."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"method"},(0,o.kt)("inlineCode",{parentName:"h3"},"method")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," ",(0,o.kt)("code",null," = ",'"',"'","GET","'",'"')),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"payload"},(0,o.kt)("inlineCode",{parentName:"h3"},"payload")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"headers"},(0,o.kt)("inlineCode",{parentName:"h3"},"headers")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"HTTP headers in the following format:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n Accept: 'text/html',\n 'Content-Type': 'application/json'\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userdata"},(0,o.kt)("inlineCode",{parentName:"h3"},"userData")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Custom user data assigned to the request. Use this to save any request related data to the request's scope, keeping them accessible on retries,\nfailures etc."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"keepurlfragment"},(0,o.kt)("inlineCode",{parentName:"h3"},"keepUrlFragment")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"false")," then the hash part of a URL is removed when computing the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property. For example, this causes the ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com#foo"),"\nand ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com#bar")," URLs to have the same ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com")," and thus the URLs are considered equal. Note that this\noption only has an effect if ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not set."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useextendeduniquekey"},(0,o.kt)("inlineCode",{parentName:"h3"},"useExtendedUniqueKey")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," then the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed not only from the URL, but also from the method and payload properties. This is useful when making requests\nto the same URL that are differentiated by method or payload, such as form submit navigations in browsers."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),c=a,h=u["".concat(l,".").concat(c)]||u[c]||m[c]||o;return n?r.createElement(h,i(i({ref:t},d),{},{components:n})):r.createElement(h,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=c;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=["components"],i={id_old:"version-1.3-result-storage",title:"Result Storage",id:"result-storage"},l=void 0,p={unversionedId:"guides/result-storage",id:"version-1.3/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-1.3/guides/result_storage.md",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/1.3/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/result_storage.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-result-storage",title:"Result Storage",id:"result-storage"},sidebar:"version-1.3/docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/1.3/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/1.3/guides/environment-variables"}},u={},d=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],c={toc:d},f="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Apify.getInput();\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/screenshots",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify app. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(a),f=n,h=d["".concat(l,".").concat(f)]||d[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},u),{},{components:a})):r.createElement(h,s({ref:t},u))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=["components"],i={id_old:"version-1.3-result-storage",title:"Result Storage",id:"result-storage"},l=void 0,p={unversionedId:"guides/result-storage",id:"version-1.3/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-1.3/guides/result_storage.md",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/1.3/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/result_storage.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-result-storage",title:"Result Storage",id:"result-storage"},sidebar:"version-1.3/docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/1.3/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/1.3/guides/environment-variables"}},u={},d=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],c={toc:d},f="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Apify.getInput();\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/screenshots",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify app. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(a),f=n,h=d["".concat(l,".").concat(f)]||d[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},u),{},{components:a})):r.createElement(h,s({ref:t},u))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],l={id_old:"version-1.3-browser-plugin",title:"BrowserPlugin",id:"browser-plugin"},p=void 0,s={unversionedId:"api/browser-plugin",id:"version-1.3/api/browser-plugin",title:"BrowserPlugin",description:"---",source:"@site/versioned_docs/version-1.3/api/BrowserPlugin.md",sourceDirName:"api",slug:"/api/browser-plugin",permalink:"/sdk/js/docs/1.3/api/browser-plugin",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BrowserPlugin.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-browser-plugin",title:"BrowserPlugin",id:"browser-plugin"}},c={},u=[{value:"new BrowserPlugin(launcher, context)",id:"new-browserpluginlauncher-context",level:2}],d={toc:u},m="wrapper";function f(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(m,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"browserplugin"}),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"exports.browserplugin"}),(0,i.kt)("h2",{id:"new-browserpluginlauncher-context"},(0,i.kt)("inlineCode",{parentName:"h2"},"new BrowserPlugin(launcher, context)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"launcher")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"*")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"))),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?n.createElement(f,a(a({ref:r},c),{},{components:t})):n.createElement(f,a({ref:r},c))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=m;var l={};for(var p in r)hasOwnProperty.call(r,p)&&(l[p]=r[p]);l.originalType=e,l[u]="string"==typeof e?e:o,a[1]=l;for(var s=2;s{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],l={id_old:"version-1.3-browser-plugin",title:"BrowserPlugin",id:"browser-plugin"},p=void 0,s={unversionedId:"api/browser-plugin",id:"version-1.3/api/browser-plugin",title:"BrowserPlugin",description:"---",source:"@site/versioned_docs/version-1.3/api/BrowserPlugin.md",sourceDirName:"api",slug:"/api/browser-plugin",permalink:"/sdk/js/docs/1.3/api/browser-plugin",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BrowserPlugin.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-browser-plugin",title:"BrowserPlugin",id:"browser-plugin"}},c={},u=[{value:"new BrowserPlugin(launcher, context)",id:"new-browserpluginlauncher-context",level:2}],d={toc:u},m="wrapper";function f(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(m,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"browserplugin"}),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"exports.browserplugin"}),(0,i.kt)("h2",{id:"new-browserpluginlauncher-context"},(0,i.kt)("inlineCode",{parentName:"h2"},"new BrowserPlugin(launcher, context)")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"launcher")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"*")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"))),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),s=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?n.createElement(f,a(a({ref:r},c),{},{components:t})):n.createElement(f,a({ref:r},c))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=m;var l={};for(var p in r)hasOwnProperty.call(r,p)&&(l[p]=r[p]);l.originalType=e,l[u]="string"==typeof e?e:o,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-request-options",title:"RequestOptions",id:"request-options"},l=void 0,s={unversionedId:"typedefs/request-options",id:"version-1.3/typedefs/request-options",title:"RequestOptions",description:"Specifies required and optional fields for constructing a Request.",source:"@site/versioned_docs/version-1.3/typedefs/RequestOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-options",permalink:"/sdk/js/docs/1.3/typedefs/request-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-options",title:"RequestOptions",id:"request-options"},sidebar:"version-1.3/docs",previous:{title:"LoggerOptions",permalink:"/sdk/js/docs/1.3/typedefs/logger-options"},next:{title:"RequestListOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-list-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"keepUrlFragment",id:"keepurlfragment",level:3},{value:"useExtendedUniqueKey",id:"useextendeduniquekey",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(c,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestoptions"}),(0,a.kt)("p",null,"Specifies required and optional fields for constructing a ",(0,a.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL of the web page to crawl. It must be a non-empty string."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"uniquekey"},(0,a.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not provided, then it is automatically generated by normalizing the URL. For example, the URL of ",(0,a.kt)("inlineCode",{parentName:"p"},"HTTP://www.EXAMPLE.com/something/"),"\nwill produce the ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,a.kt)("inlineCode",{parentName:"p"},"http://www.example.com/something"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"keepUrlFragment")," option determines whether URL hash fragment is included in the ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," or not."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey")," options determines whether method and payload are included in the ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey"),", producing a ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," in the following\nformat: ",(0,a.kt)("inlineCode",{parentName:"p"},"METHOD(payloadHash):normalizedUrl"),". This is useful when requests point to the same URL, but with different methods and payloads. For example:\nform submits."),(0,a.kt)("p",null,"Pass an arbitrary non-empty text value to the ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property to override the default behavior and specify which URLs shall be considered equal."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"method"},(0,a.kt)("inlineCode",{parentName:"h3"},"method")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"'","GET","'",'"')),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payload"},(0,a.kt)("inlineCode",{parentName:"h3"},"payload")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,a.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"headers"},(0,a.kt)("inlineCode",{parentName:"h3"},"headers")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"HTTP headers in the following format:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n Accept: 'text/html',\n 'Content-Type': 'application/json'\n}\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userdata"},(0,a.kt)("inlineCode",{parentName:"h3"},"userData")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"Custom user data assigned to the request. Use this to save any request related data to the request's scope, keeping them accessible on retries,\nfailures etc."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"keepurlfragment"},(0,a.kt)("inlineCode",{parentName:"h3"},"keepUrlFragment")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"false")," then the hash part of a URL is removed when computing the ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property. For example, this causes the ",(0,a.kt)("inlineCode",{parentName:"p"},"http://www.example.com#foo"),"\nand ",(0,a.kt)("inlineCode",{parentName:"p"},"http://www.example.com#bar")," URLs to have the same ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,a.kt)("inlineCode",{parentName:"p"},"http://www.example.com")," and thus the URLs are considered equal. Note that this\noption only has an effect if ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not set."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useextendeduniquekey"},(0,a.kt)("inlineCode",{parentName:"h3"},"useExtendedUniqueKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," then the ",(0,a.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed not only from the URL, but also from the method and payload properties. This is useful when making requests\nto the same URL that are differentiated by method or payload, such as form submit navigations in browsers."),(0,a.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),c=o,h=u["".concat(l,".").concat(c)]||u[c]||m[c]||a;return n?r.createElement(h,i(i({ref:t},d),{},{components:n})):r.createElement(h,i({ref:t},d))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=c;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-request-options",title:"RequestOptions",id:"request-options"},l=void 0,s={unversionedId:"typedefs/request-options",id:"version-1.3/typedefs/request-options",title:"RequestOptions",description:"Specifies required and optional fields for constructing a Request.",source:"@site/versioned_docs/version-1.3/typedefs/RequestOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-options",permalink:"/sdk/js/docs/1.3/typedefs/request-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-options",title:"RequestOptions",id:"request-options"},sidebar:"version-1.3/docs",previous:{title:"LoggerOptions",permalink:"/sdk/js/docs/1.3/typedefs/logger-options"},next:{title:"RequestListOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-list-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"keepUrlFragment",id:"keepurlfragment",level:3},{value:"useExtendedUniqueKey",id:"useextendeduniquekey",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(c,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestoptions"}),(0,o.kt)("p",null,"Specifies required and optional fields for constructing a ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"url"},(0,o.kt)("inlineCode",{parentName:"h3"},"url")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL of the web page to crawl. It must be a non-empty string."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"uniquekey"},(0,o.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not provided, then it is automatically generated by normalizing the URL. For example, the URL of ",(0,o.kt)("inlineCode",{parentName:"p"},"HTTP://www.EXAMPLE.com/something/"),"\nwill produce the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com/something"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"keepUrlFragment")," option determines whether URL hash fragment is included in the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," or not."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey")," options determines whether method and payload are included in the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey"),", producing a ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," in the following\nformat: ",(0,o.kt)("inlineCode",{parentName:"p"},"METHOD(payloadHash):normalizedUrl"),". This is useful when requests point to the same URL, but with different methods and payloads. For example:\nform submits."),(0,o.kt)("p",null,"Pass an arbitrary non-empty text value to the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property to override the default behavior and specify which URLs shall be considered equal."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"method"},(0,o.kt)("inlineCode",{parentName:"h3"},"method")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," ",(0,o.kt)("code",null," = ",'"',"'","GET","'",'"')),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"payload"},(0,o.kt)("inlineCode",{parentName:"h3"},"payload")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"headers"},(0,o.kt)("inlineCode",{parentName:"h3"},"headers")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"HTTP headers in the following format:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n Accept: 'text/html',\n 'Content-Type': 'application/json'\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userdata"},(0,o.kt)("inlineCode",{parentName:"h3"},"userData")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Custom user data assigned to the request. Use this to save any request related data to the request's scope, keeping them accessible on retries,\nfailures etc."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"keepurlfragment"},(0,o.kt)("inlineCode",{parentName:"h3"},"keepUrlFragment")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"false")," then the hash part of a URL is removed when computing the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property. For example, this causes the ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com#foo"),"\nand ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com#bar")," URLs to have the same ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of ",(0,o.kt)("inlineCode",{parentName:"p"},"http://www.example.com")," and thus the URLs are considered equal. Note that this\noption only has an effect if ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is not set."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useextendeduniquekey"},(0,o.kt)("inlineCode",{parentName:"h3"},"useExtendedUniqueKey")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," then the ",(0,o.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is computed not only from the URL, but also from the method and payload properties. This is useful when making requests\nto the same URL that are differentiated by method or payload, such as form submit navigations in browsers."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),c=a,h=u["".concat(l,".").concat(c)]||u[c]||m[c]||o;return n?r.createElement(h,i(i({ref:t},d),{},{components:n})):r.createElement(h,i({ref:t},d))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=c;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{n.r(s),n.d(s,{assets:()=>u,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var o=n(87462),t=n(63366),i=(n(67294),n(3905)),a=["components"],r={id_old:"version-1.3-session-pool",title:"SessionPool",id:"session-pool"},l=void 0,p={unversionedId:"api/session-pool",id:"version-1.3/api/session-pool",title:"SessionPool",description:"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of Session instances, that are randomly",source:"@site/versioned_docs/version-1.3/api/SessionPool.md",sourceDirName:"api",slug:"/api/session-pool",permalink:"/sdk/js/docs/1.3/api/session-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SessionPool.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-session-pool",title:"SessionPool",id:"session-pool"},sidebar:"version-1.3/docs",previous:{title:"Session",permalink:"/sdk/js/docs/1.3/api/session"},next:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/1.3/api/proxy-configuration"}},u={},d=[{value:"sessionPool.sessions",id:"sessionpoolsessions",level:2},{value:"sessionPool.usableSessionsCount",id:"sessionpoolusablesessionscount",level:2},{value:"sessionPool.retiredSessionsCount",id:"sessionpoolretiredsessionscount",level:2},{value:"sessionPool.initialize()",id:"sessionpoolinitialize",level:2},{value:"sessionPool.addSession([options])",id:"sessionpooladdsessionoptions",level:2},{value:"sessionPool.getSession([sessionId])",id:"sessionpoolgetsessionsessionid",level:2},{value:"sessionPool.getState()",id:"sessionpoolgetstate",level:2},{value:"sessionPool.persistState()",id:"sessionpoolpersiststate",level:2},{value:"sessionPool.teardown()",id:"sessionpoolteardown",level:2}],c={toc:d},m="wrapper";function k(e){var s=e.components,n=(0,t.Z)(e,a);return(0,i.kt)(m,(0,o.Z)({},c,n,{components:s,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"sessionpool"}),(0,i.kt)("p",null,"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," instances, that are randomly\nrotated. When some session is marked as blocked, it is removed and new one is created instead (the pool never returns an unusable session). Learn more\nin the ",(0,i.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session management guide")),"."),(0,i.kt)("p",null,"You can create one by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,"Session pool is already integrated into crawlers, and it can significantly improve your scraper performance with just 2 lines of code."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.CheerioCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n // ...\n});\n")),(0,i.kt)("p",null,"You can configure the pool with many options. See the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")),". Session pool is by default persisted\nin default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". If you want to have one pool for all runs you have to specify\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options#persiststatekeyvaluestoreid",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions.persistStateKeyValueStoreId")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sessionPool = await Apify.openSessionPool({\n maxPoolSize: 25,\n sessionOptions: {\n maxAgeSecs: 10,\n maxUsageCount: 150, // for example when you know that the site blocks after 150 requests.\n },\n persistStateKeyValueStoreId: 'my-key-value-store-for-sessions',\n persistStateKey: 'my-session-pool',\n});\n\n// Get random session from the pool\nconst session1 = await sessionPool.getSession();\nconst session2 = await sessionPool.getSession();\nconst session3 = await sessionPool.getSession();\n\n// Now you can mark the session either failed or successful\n\n// Marks session as bad after unsuccessful usage -> it increases error count (soft retire)\nsession1.markBad();\n\n// Marks as successful.\nsession2.markGood();\n\n// Retires session -> session is removed from the pool\nsession3.retire();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"sessions"}),(0,i.kt)("h2",{id:"sessionpoolsessions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.sessions")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"usablesessionscount"}),(0,i.kt)("h2",{id:"sessionpoolusablesessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.usableSessionsCount")),(0,i.kt)("p",null,"Gets count of usable sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"retiredsessionscount"}),(0,i.kt)("h2",{id:"sessionpoolretiredsessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.retiredSessionsCount")),(0,i.kt)("p",null,"Gets count of retired sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"sessionpoolinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.initialize()")),(0,i.kt)("p",null,"Starts periodic state persistence and potentially loads SessionPool state from ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". It is called automatically\nby the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addsession"}),(0,i.kt)("h2",{id:"sessionpooladdsessionoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.addSession([options])")),(0,i.kt)("p",null,"Adds a new session to the session pool. The pool automatically creates sessions up to the maximum size of the pool, but this allows you to add more\nsessions once the max pool size is reached. This also allows you to add session with overridden session options (e.g. with specific session id)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," | ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionOptions"))," - The configuration options for the session being\nadded to the session pool.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getsession"}),(0,i.kt)("h2",{id:"sessionpoolgetsessionsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getSession([sessionId])")),(0,i.kt)("p",null,"Gets session. If there is space for new session, it creates and returns new session. If the session pool is full, it picks a session from the pool, If\nthe picked session is usable it is returned, otherwise it creates and returns a new one."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," - If provided, it returns the usable session with this id, ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined")," otherwise.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"sessionpoolgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"sessionpoolpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"teardown"}),(0,i.kt)("h2",{id:"sessionpoolteardown"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.teardown()")),(0,i.kt)("p",null,"Removes listener from ",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event. This function should be called after you are done with using the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance."),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,s,n)=>{n.d(s,{Zo:()=>u,kt:()=>k});var o=n(67294);function t(e,s,n){return s in e?Object.defineProperty(e,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[s]=n,e}function i(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var s=1;s=0||(t[n]=e[n]);return t}(e,s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var l=o.createContext({}),p=function(e){var s=o.useContext(l),n=s;return e&&(n="function"==typeof e?e(s):a(a({},s),e)),n},u=function(e){var s=p(e.components);return o.createElement(l.Provider,{value:s},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var s=e.children;return o.createElement(o.Fragment,{},s)}},m=o.forwardRef((function(e,s){var n=e.components,t=e.mdxType,i=e.originalType,l=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),d=p(n),m=t,k=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?o.createElement(k,a(a({ref:s},u),{},{components:n})):o.createElement(k,a({ref:s},u))}));function k(e,s){var n=arguments,t=s&&s.mdxType;if("string"==typeof e||t){var i=n.length,a=new Array(i);a[0]=m;var r={};for(var l in s)hasOwnProperty.call(s,l)&&(r[l]=s[l]);r.originalType=e,r[d]="string"==typeof e?e:t,a[1]=r;for(var p=2;p{n.r(s),n.d(s,{assets:()=>u,contentTitle:()=>l,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var o=n(87462),t=n(63366),i=(n(67294),n(3905)),a=["components"],r={id_old:"version-1.3-session-pool",title:"SessionPool",id:"session-pool"},l=void 0,p={unversionedId:"api/session-pool",id:"version-1.3/api/session-pool",title:"SessionPool",description:"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of Session instances, that are randomly",source:"@site/versioned_docs/version-1.3/api/SessionPool.md",sourceDirName:"api",slug:"/api/session-pool",permalink:"/sdk/js/docs/1.3/api/session-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SessionPool.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-session-pool",title:"SessionPool",id:"session-pool"},sidebar:"version-1.3/docs",previous:{title:"Session",permalink:"/sdk/js/docs/1.3/api/session"},next:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/1.3/api/proxy-configuration"}},u={},d=[{value:"sessionPool.sessions",id:"sessionpoolsessions",level:2},{value:"sessionPool.usableSessionsCount",id:"sessionpoolusablesessionscount",level:2},{value:"sessionPool.retiredSessionsCount",id:"sessionpoolretiredsessionscount",level:2},{value:"sessionPool.initialize()",id:"sessionpoolinitialize",level:2},{value:"sessionPool.addSession([options])",id:"sessionpooladdsessionoptions",level:2},{value:"sessionPool.getSession([sessionId])",id:"sessionpoolgetsessionsessionid",level:2},{value:"sessionPool.getState()",id:"sessionpoolgetstate",level:2},{value:"sessionPool.persistState()",id:"sessionpoolpersiststate",level:2},{value:"sessionPool.teardown()",id:"sessionpoolteardown",level:2}],c={toc:d},m="wrapper";function k(e){var s=e.components,n=(0,t.Z)(e,a);return(0,i.kt)(m,(0,o.Z)({},c,n,{components:s,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"sessionpool"}),(0,i.kt)("p",null,"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," instances, that are randomly\nrotated. When some session is marked as blocked, it is removed and new one is created instead (the pool never returns an unusable session). Learn more\nin the ",(0,i.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session management guide")),"."),(0,i.kt)("p",null,"You can create one by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,"Session pool is already integrated into crawlers, and it can significantly improve your scraper performance with just 2 lines of code."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.CheerioCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n // ...\n});\n")),(0,i.kt)("p",null,"You can configure the pool with many options. See the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")),". Session pool is by default persisted\nin default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". If you want to have one pool for all runs you have to specify\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options#persiststatekeyvaluestoreid",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions.persistStateKeyValueStoreId")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sessionPool = await Apify.openSessionPool({\n maxPoolSize: 25,\n sessionOptions: {\n maxAgeSecs: 10,\n maxUsageCount: 150, // for example when you know that the site blocks after 150 requests.\n },\n persistStateKeyValueStoreId: 'my-key-value-store-for-sessions',\n persistStateKey: 'my-session-pool',\n});\n\n// Get random session from the pool\nconst session1 = await sessionPool.getSession();\nconst session2 = await sessionPool.getSession();\nconst session3 = await sessionPool.getSession();\n\n// Now you can mark the session either failed or successful\n\n// Marks session as bad after unsuccessful usage -> it increases error count (soft retire)\nsession1.markBad();\n\n// Marks as successful.\nsession2.markGood();\n\n// Retires session -> session is removed from the pool\nsession3.retire();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"sessions"}),(0,i.kt)("h2",{id:"sessionpoolsessions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.sessions")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"usablesessionscount"}),(0,i.kt)("h2",{id:"sessionpoolusablesessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.usableSessionsCount")),(0,i.kt)("p",null,"Gets count of usable sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"retiredsessionscount"}),(0,i.kt)("h2",{id:"sessionpoolretiredsessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.retiredSessionsCount")),(0,i.kt)("p",null,"Gets count of retired sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"sessionpoolinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.initialize()")),(0,i.kt)("p",null,"Starts periodic state persistence and potentially loads SessionPool state from ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". It is called automatically\nby the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addsession"}),(0,i.kt)("h2",{id:"sessionpooladdsessionoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.addSession([options])")),(0,i.kt)("p",null,"Adds a new session to the session pool. The pool automatically creates sessions up to the maximum size of the pool, but this allows you to add more\nsessions once the max pool size is reached. This also allows you to add session with overridden session options (e.g. with specific session id)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," | ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionOptions"))," - The configuration options for the session being\nadded to the session pool.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getsession"}),(0,i.kt)("h2",{id:"sessionpoolgetsessionsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getSession([sessionId])")),(0,i.kt)("p",null,"Gets session. If there is space for new session, it creates and returns new session. If the session pool is full, it picks a session from the pool, If\nthe picked session is usable it is returned, otherwise it creates and returns a new one."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," - If provided, it returns the usable session with this id, ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined")," otherwise.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"sessionpoolgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"sessionpoolpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"teardown"}),(0,i.kt)("h2",{id:"sessionpoolteardown"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.teardown()")),(0,i.kt)("p",null,"Removes listener from ",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event. This function should be called after you are done with using the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance."),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,s,n)=>{n.d(s,{Zo:()=>u,kt:()=>k});var o=n(67294);function t(e,s,n){return s in e?Object.defineProperty(e,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[s]=n,e}function i(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var s=1;s=0||(t[n]=e[n]);return t}(e,s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var l=o.createContext({}),p=function(e){var s=o.useContext(l),n=s;return e&&(n="function"==typeof e?e(s):a(a({},s),e)),n},u=function(e){var s=p(e.components);return o.createElement(l.Provider,{value:s},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var s=e.children;return o.createElement(o.Fragment,{},s)}},m=o.forwardRef((function(e,s){var n=e.components,t=e.mdxType,i=e.originalType,l=e.parentName,u=r(e,["components","mdxType","originalType","parentName"]),d=p(n),m=t,k=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?o.createElement(k,a(a({ref:s},u),{},{components:n})):o.createElement(k,a({ref:s},u))}));function k(e,s){var n=arguments,t=s&&s.mdxType;if("string"==typeof e||t){var i=n.length,a=new Array(i);a[0]=m;var r={};for(var l in s)hasOwnProperty.call(s,l)&&(r[l]=s[l]);r.originalType=e,r[d]="string"==typeof e?e:t,a[1]=r;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,l={unversionedId:"readme/support",id:"version-2.3/readme/support",title:"support",description:"Support",source:"@site/versioned_docs/version-2.3/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/2.3/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/support.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,l={unversionedId:"readme/support",id:"version-2.3/readme/support",title:"support",description:"Support",source:"@site/versioned_docs/version-2.3/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/2.3/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/support.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],s={id_old:"version-1.3-event-types",title:"EventTypes",id:"event-types"},i=void 0,c={unversionedId:"typedefs/event-types",id:"version-1.3/typedefs/event-types",title:"EventTypes",description:"---",source:"@site/versioned_docs/version-1.3/typedefs/EventTypes.md",sourceDirName:"typedefs",slug:"/typedefs/event-types",permalink:"/sdk/js/docs/1.3/typedefs/event-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/EventTypes.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-event-types",title:"EventTypes",id:"event-types"}},l={},y=[],d={toc:y},f="wrapper";function u(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"eventtypes"}),(0,a.kt)("hr",null))}u.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},y="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),y=c(r),f=o,u=y["".concat(i,".").concat(f)]||y[f]||d[f]||a;return r?n.createElement(u,p(p({ref:t},l),{},{components:r})):n.createElement(u,p({ref:t},l))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[y]="string"==typeof e?e:o,p[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>s,metadata:()=>c,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],s={id_old:"version-1.3-event-types",title:"EventTypes",id:"event-types"},i=void 0,c={unversionedId:"typedefs/event-types",id:"version-1.3/typedefs/event-types",title:"EventTypes",description:"---",source:"@site/versioned_docs/version-1.3/typedefs/EventTypes.md",sourceDirName:"typedefs",slug:"/typedefs/event-types",permalink:"/sdk/js/docs/1.3/typedefs/event-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/EventTypes.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-event-types",title:"EventTypes",id:"event-types"}},l={},y=[],d={toc:y},f="wrapper";function u(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"eventtypes"}),(0,a.kt)("hr",null))}u.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},y="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),y=c(r),f=o,u=y["".concat(i,".").concat(f)]||y[f]||d[f]||a;return r?n.createElement(u,p(p({ref:t},l),{},{components:r})):n.createElement(u,p({ref:t},l))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[y]="string"==typeof e?e:o,p[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),i=["components"],l={id:"environment-variables",title:"Environment Variables"},s=void 0,p={unversionedId:"guides/environment-variables",id:"version-2.3/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-2.3/guides/environment_variables.md",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/2.3/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/environment_variables.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"version-2.3/docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/2.3/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/2.3/guides/proxy-management"}},d={},u=[{value:"Important env vars:",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars:",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,o.kt)("h2",{id:"important-env-vars"},"Important env vars:"),(0,o.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,o.kt)("h3",{id:"apify_local_storage_dir"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("p",null,"Defines the path to a local directory where ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),",\n",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset")),", and ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," store their data.\nTypically it is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". If omitted, you should define the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variable instead."),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,o.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Apify.openDataset('my-local-data');\nconst remoteDataset = await Apify.openDataset('my-remote-data', { forceCloud: true });\n")),(0,o.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars:"),(0,o.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,o.kt)("h3",{id:"apify_headless"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,o.kt)("p",null,"If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,o.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," function. But having this setting\nin an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging,\nand only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers\nare launched in headful mode, i.e. with windows."),(0,o.kt)("h3",{id:"apify_log_level"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,o.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,o.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.log")),"\nnamespace for logging utilities."),(0,o.kt)("h3",{id:"apify_memory_mbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,o.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i. e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify app. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=r,f=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:r,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),i=["components"],l={id:"environment-variables",title:"Environment Variables"},s=void 0,p={unversionedId:"guides/environment-variables",id:"version-2.3/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-2.3/guides/environment_variables.md",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/2.3/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/environment_variables.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"version-2.3/docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/2.3/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/2.3/guides/proxy-management"}},d={},u=[{value:"Important env vars:",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars:",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,o.kt)("h2",{id:"important-env-vars"},"Important env vars:"),(0,o.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,o.kt)("h3",{id:"apify_local_storage_dir"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("p",null,"Defines the path to a local directory where ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),",\n",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset")),", and ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," store their data.\nTypically it is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". If omitted, you should define the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variable instead."),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,o.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Apify.openDataset('my-local-data');\nconst remoteDataset = await Apify.openDataset('my-remote-data', { forceCloud: true });\n")),(0,o.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars:"),(0,o.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,o.kt)("h3",{id:"apify_headless"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,o.kt)("p",null,"If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,o.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," function. But having this setting\nin an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging,\nand only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers\nare launched in headful mode, i.e. with windows."),(0,o.kt)("h3",{id:"apify_log_level"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,o.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,o.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.log")),"\nnamespace for logging utilities."),(0,o.kt)("h3",{id:"apify_memory_mbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,o.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i. e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify app. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=r,f=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},d),{},{components:n})):a.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:r,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"browser-launch-context",title:"BrowserLaunchContext"},p=void 0,s={unversionedId:"typedefs/browser-launch-context",id:"version-2.3/typedefs/browser-launch-context",title:"BrowserLaunchContext",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/BrowserLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-launch-context",permalink:"/sdk/js/docs/2.3/typedefs/browser-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserLaunchContext.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"browser-launch-context",title:"BrowserLaunchContext"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"userDataDir",id:"userdatadir",level:3},{value:"launcher",id:"launcher",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserlaunchcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"launchoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"`Options passed to the browser launcher function. Options are based on underlying library."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useincognitopages"},(0,a.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their\nresources will not be throttled by one another."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userdatadir"},(0,a.kt)("inlineCode",{parentName:"h3"},"userDataDir")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Sets the ",(0,a.kt)("a",{parentName:"p",href:"https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md",target:"_blank",rel:"noopener"},"User Data Directory")," path. The user data directory contains\nprofile data such as history, bookmarks, and cookies, as well as other per-installation local state. If not specified, a temporary directory is used\ninstead."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launcher"},(0,a.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("p",null,'By default this function uses\nrequire("playwright").chromium',(0,a.kt)("inlineCode",{parentName:"p"},". If you want to use a different browser you can pass it by this property as"),'require("playwright").firefox'),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),h=o,m=u["".concat(p,".").concat(h)]||u[h]||d[h]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=h;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"browser-launch-context",title:"BrowserLaunchContext"},p=void 0,s={unversionedId:"typedefs/browser-launch-context",id:"version-2.3/typedefs/browser-launch-context",title:"BrowserLaunchContext",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/BrowserLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/browser-launch-context",permalink:"/sdk/js/docs/2.3/typedefs/browser-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserLaunchContext.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"browser-launch-context",title:"BrowserLaunchContext"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"userDataDir",id:"userdatadir",level:3},{value:"launcher",id:"launcher",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserlaunchcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"launchoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"`Options passed to the browser launcher function. Options are based on underlying library."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useincognitopages"},(0,a.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their\nresources will not be throttled by one another."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userdatadir"},(0,a.kt)("inlineCode",{parentName:"h3"},"userDataDir")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Sets the ",(0,a.kt)("a",{parentName:"p",href:"https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md",target:"_blank",rel:"noopener"},"User Data Directory")," path. The user data directory contains\nprofile data such as history, bookmarks, and cookies, as well as other per-installation local state. If not specified, a temporary directory is used\ninstead."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launcher"},(0,a.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("p",null,'By default this function uses\nrequire("playwright").chromium',(0,a.kt)("inlineCode",{parentName:"p"},". If you want to use a different browser you can pass it by this property as"),'require("playwright").firefox'),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),h=o,m=u["".concat(p,".").concat(h)]||u[h]||d[h]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=h;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>y,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=n(87462),s=n(63366),a=(n(67294),n(3905)),i=["components"],o={id:"request-list-state",title:"RequestListState"},l=void 0,p={unversionedId:"typedefs/request-list-state",id:"version-2.3/typedefs/request-list-state",title:"RequestListState",description:"Represents state of a RequestList. It can be used to resume a RequestList which has been previously",source:"@site/versioned_docs/version-2.3/typedefs/RequestListState.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-state",permalink:"/sdk/js/docs/2.3/typedefs/request-list-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListState.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-list-state",title:"RequestListState"},sidebar:"version-2.3/docs",previous:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/2.3/typedefs/queue-operation-info"},next:{title:"SessionState",permalink:"/sdk/js/docs/2.3/typedefs/session-state"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"nextIndex",id:"nextindex",level:3},{value:"nextUniqueKey",id:"nextuniquekey",level:3},{value:"inProgress",id:"inprogress",level:3}],d={toc:c},f="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestliststate"}),(0,a.kt)("p",null,"Represents state of a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be used to resume a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))," which has been previously\nprocessed. You can obtain the state by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list#getstate",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList.getState()"))," and receive an object with the following\nstructure:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true\n },\n}\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"nextindex"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextIndex")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nextuniquekey"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextUniqueKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Key of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"inprogress"},(0,a.kt)("inlineCode",{parentName:"h3"},"inProgress")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"An object mapping request keys to a boolean value respresenting whether they are being processed at the moment."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var r=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,s=e.mdxType,a=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(n),f=s,y=c["".concat(l,".").concat(f)]||c[f]||d[f]||a;return n?r.createElement(y,i(i({ref:t},u),{},{components:n})):r.createElement(y,i({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=n.length,i=new Array(a);i[0]=f;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[c]="string"==typeof e?e:s,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>y,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=n(87462),s=n(63366),a=(n(67294),n(3905)),i=["components"],o={id:"request-list-state",title:"RequestListState"},l=void 0,p={unversionedId:"typedefs/request-list-state",id:"version-2.3/typedefs/request-list-state",title:"RequestListState",description:"Represents state of a RequestList. It can be used to resume a RequestList which has been previously",source:"@site/versioned_docs/version-2.3/typedefs/RequestListState.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-state",permalink:"/sdk/js/docs/2.3/typedefs/request-list-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListState.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-list-state",title:"RequestListState"},sidebar:"version-2.3/docs",previous:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/2.3/typedefs/queue-operation-info"},next:{title:"SessionState",permalink:"/sdk/js/docs/2.3/typedefs/session-state"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"nextIndex",id:"nextindex",level:3},{value:"nextUniqueKey",id:"nextuniquekey",level:3},{value:"inProgress",id:"inprogress",level:3}],d={toc:c},f="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestliststate"}),(0,a.kt)("p",null,"Represents state of a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be used to resume a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))," which has been previously\nprocessed. You can obtain the state by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list#getstate",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList.getState()"))," and receive an object with the following\nstructure:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true\n },\n}\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"nextindex"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextIndex")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nextuniquekey"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextUniqueKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Key of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"inprogress"},(0,a.kt)("inlineCode",{parentName:"h3"},"inProgress")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"An object mapping request keys to a boolean value respresenting whether they are being processed at the moment."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var r=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,s=e.mdxType,a=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(n),f=s,y=c["".concat(l,".").concat(f)]||c[f]||d[f]||a;return n?r.createElement(y,i(i({ref:t},u),{},{components:n})):r.createElement(y,i({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=n.length,i=new Array(a);i[0]=f;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[c]="string"==typeof e?e:s,i[1]=o;for(var p=2;p{a.d(t,{Z:()=>d});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const d=function(e){var t=e.to,a=e.children,d=(0,o.E)(),s=d.version,p=d.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var l=s+"/";return"current"===s?l="next/":p&&(l=""),n.createElement(r.default,{to:"/api/"+l+t},a)}},36782:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>h,contentTitle:()=>u,default:()=>k,frontMatter:()=>c,metadata:()=>m,toc:()=>y});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(14563),a(68889));const d={code:"import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst dataset = await Actor.openDataset<{ headingCount: number }>();\n\n// calling map function and filtering through mapped items\nconst moreThan5headers = (await dataset.map((item) => item.headingCount)).filter((count) => count > 5);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_with_more_than_5_headers', moreThan5headers);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBkYXRhc2V0ID0gYXdhaXQgQWN0b3Iub3BlbkRhdGFzZXQ8eyBoZWFkaW5nQ291bnQ6IG51bWJlciB9PigpO1xcblxcbi8vIGNhbGxpbmcgbWFwIGZ1bmN0aW9uIGFuZCBmaWx0ZXJpbmcgdGhyb3VnaCBtYXBwZWQgaXRlbXNcXG5jb25zdCBtb3JlVGhhbjVoZWFkZXJzID0gKGF3YWl0IGRhdGFzZXQubWFwKChpdGVtKSA9PiBpdGVtLmhlYWRpbmdDb3VudCkpLmZpbHRlcigoY291bnQpID0-IGNvdW50ID4gNSk7XFxuXFxuLy8gc2F2aW5nIHJlc3VsdCBvZiBtYXAgdG8gZGVmYXVsdCBLZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgncGFnZXNfd2l0aF9tb3JlX3RoYW5fNV9oZWFkZXJzJywgbW9yZVRoYW41aGVhZGVycyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.Q-rNIQYAy8a-1WsGs9suJ81WRuf_op1ZO2rCzoYyeAs"},s={code:"import { Actor } from 'apify';\n\nconst dataset = await Actor.openDataset();\n\n// calling reduce function and using memo to calculate number of headers\nconst pagesHeadingCount = await dataset.reduce((memo, value) => {\n return memo += value.headingCount;\n}, 0);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_heading_count', pagesHeadingCount);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmNvbnN0IGRhdGFzZXQgPSBhd2FpdCBBY3Rvci5vcGVuRGF0YXNldCgpO1xcblxcbi8vIGNhbGxpbmcgcmVkdWNlIGZ1bmN0aW9uIGFuZCB1c2luZyBtZW1vIHRvIGNhbGN1bGF0ZSBudW1iZXIgb2YgaGVhZGVyc1xcbmNvbnN0IHBhZ2VzSGVhZGluZ0NvdW50ID0gYXdhaXQgZGF0YXNldC5yZWR1Y2UoKG1lbW8sIHZhbHVlKSA9PiB7XFxuICAgIHJldHVybiBtZW1vICs9IHZhbHVlLmhlYWRpbmdDb3VudDtcXG59LCAwKTtcXG5cXG4vLyBzYXZpbmcgcmVzdWx0IG9mIG1hcCB0byBkZWZhdWx0IEtleS12YWx1ZSBzdG9yZVxcbmF3YWl0IEFjdG9yLnNldFZhbHVlKCdwYWdlc19oZWFkaW5nX2NvdW50JywgcGFnZXNIZWFkaW5nQ291bnQpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.1ViXq6_den8WcUl-TG3DdWceExG2yJNw4qobM_aNXao"};var p,l=["components"],c={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},u=void 0,m={unversionedId:"examples/map-and-reduce",id:"examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Dataset map",source:"@site/../docs/examples/map_and_reduce.mdx",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/next/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/map_and_reduce.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"docs",previous:{title:"Forms",permalink:"/sdk/js/docs/next/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/next/examples/playwright-crawler"}},h={},y=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],b=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:y},g="wrapper";function k(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(g,(0,n.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#map",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"map")),"\nand ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"reduce"))," methods. Both methods can be used to simplify\nthe dataset results workflow process. Both can be called on the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()")),"\nmethod to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>l,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return a?n.createElement(h,i(i({ref:t},l),{},{components:a})):n.createElement(h,i({ref:t},l))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var d={};for(var s in t)hasOwnProperty.call(t,s)&&(d[s]=t[s]);d.originalType=e,d[c]="string"==typeof e?e:r,i[1]=d;for(var p=2;p{a.d(t,{Z:()=>d});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const d=function(e){var t=e.to,a=e.children,d=(0,o.E)(),s=d.version,p=d.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var l=s+"/";return"current"===s?l="next/":p&&(l=""),n.createElement(r.default,{to:"/api/"+l+t},a)}},36782:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>h,contentTitle:()=>u,default:()=>k,frontMatter:()=>c,metadata:()=>m,toc:()=>y});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(14563),a(68889));const d={code:"import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst dataset = await Actor.openDataset<{ headingCount: number }>();\n\n// calling map function and filtering through mapped items\nconst moreThan5headers = (await dataset.map((item) => item.headingCount)).filter((count) => count > 5);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_with_more_than_5_headers', moreThan5headers);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBkYXRhc2V0ID0gYXdhaXQgQWN0b3Iub3BlbkRhdGFzZXQ8eyBoZWFkaW5nQ291bnQ6IG51bWJlciB9PigpO1xcblxcbi8vIGNhbGxpbmcgbWFwIGZ1bmN0aW9uIGFuZCBmaWx0ZXJpbmcgdGhyb3VnaCBtYXBwZWQgaXRlbXNcXG5jb25zdCBtb3JlVGhhbjVoZWFkZXJzID0gKGF3YWl0IGRhdGFzZXQubWFwKChpdGVtKSA9PiBpdGVtLmhlYWRpbmdDb3VudCkpLmZpbHRlcigoY291bnQpID0-IGNvdW50ID4gNSk7XFxuXFxuLy8gc2F2aW5nIHJlc3VsdCBvZiBtYXAgdG8gZGVmYXVsdCBLZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgncGFnZXNfd2l0aF9tb3JlX3RoYW5fNV9oZWFkZXJzJywgbW9yZVRoYW41aGVhZGVycyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.Q-rNIQYAy8a-1WsGs9suJ81WRuf_op1ZO2rCzoYyeAs"},s={code:"import { Actor } from 'apify';\n\nconst dataset = await Actor.openDataset();\n\n// calling reduce function and using memo to calculate number of headers\nconst pagesHeadingCount = await dataset.reduce((memo, value) => {\n return memo += value.headingCount;\n}, 0);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_heading_count', pagesHeadingCount);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmNvbnN0IGRhdGFzZXQgPSBhd2FpdCBBY3Rvci5vcGVuRGF0YXNldCgpO1xcblxcbi8vIGNhbGxpbmcgcmVkdWNlIGZ1bmN0aW9uIGFuZCB1c2luZyBtZW1vIHRvIGNhbGN1bGF0ZSBudW1iZXIgb2YgaGVhZGVyc1xcbmNvbnN0IHBhZ2VzSGVhZGluZ0NvdW50ID0gYXdhaXQgZGF0YXNldC5yZWR1Y2UoKG1lbW8sIHZhbHVlKSA9PiB7XFxuICAgIHJldHVybiBtZW1vICs9IHZhbHVlLmhlYWRpbmdDb3VudDtcXG59LCAwKTtcXG5cXG4vLyBzYXZpbmcgcmVzdWx0IG9mIG1hcCB0byBkZWZhdWx0IEtleS12YWx1ZSBzdG9yZVxcbmF3YWl0IEFjdG9yLnNldFZhbHVlKCdwYWdlc19oZWFkaW5nX2NvdW50JywgcGFnZXNIZWFkaW5nQ291bnQpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.1ViXq6_den8WcUl-TG3DdWceExG2yJNw4qobM_aNXao"};var p,l=["components"],c={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},u=void 0,m={unversionedId:"examples/map-and-reduce",id:"examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Dataset map",source:"@site/../docs/examples/map_and_reduce.mdx",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/next/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/map_and_reduce.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"docs",previous:{title:"Forms",permalink:"/sdk/js/docs/next/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/next/examples/playwright-crawler"}},h={},y=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],b=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:y},g="wrapper";function k(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(g,(0,n.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#map",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"map")),"\nand ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"reduce"))," methods. Both methods can be used to simplify\nthe dataset results workflow process. Both can be called on the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()")),"\nmethod to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>l,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return a?n.createElement(h,i(i({ref:t},l),{},{components:a})):n.createElement(h,i({ref:t},l))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var d={};for(var s in t)hasOwnProperty.call(t,s)&&(d[s]=t[s]);d.originalType=e,d[c]="string"==typeof e?e:r,i[1]=d;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),a=["components"],i={id:"request-as-browser-options",title:"RequestAsBrowserOptions"},l=void 0,p={unversionedId:"typedefs/request-as-browser-options",id:"version-2.3/typedefs/request-as-browser-options",title:"RequestAsBrowserOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/RequestAsBrowserOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-options",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-as-browser-options",title:"RequestAsBrowserOptions"},sidebar:"version-2.3/docs",previous:{title:"RequestListOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-list-options"},next:{title:"SessionOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"method",id:"method",level:3},{value:"headers",id:"headers",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"headerGeneratorOptions",id:"headergeneratoroptions",level:3},{value:"languageCode",id:"languagecode",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"useMobileVersion",id:"usemobileversion",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"useInsecureHttpParser",id:"useinsecurehttpparser",level:3},{value:"abortFunction",id:"abortfunction",level:3},{value:"useHttp2",id:"usehttp2",level:3},{value:"sessionToken",id:"sessiontoken",level:3}],c={toc:u},k="wrapper";function h(e){var t=e.components,r=(0,o.Z)(e,a);return(0,s.kt)(k,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requestasbrowseroptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"url"},(0,s.kt)("inlineCode",{parentName:"h3"},"url")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"URL of the target endpoint. Supports both HTTP and HTTPS schemes."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"method"},(0,s.kt)("inlineCode",{parentName:"h3"},"method")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")," ",(0,s.kt)("code",null," = ",'"',"\\",'"',"GET\\",'"','"')),(0,s.kt)("p",null,"HTTP method."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"headers"},(0,s.kt)("inlineCode",{parentName:"h3"},"headers")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Object")),(0,s.kt)("p",null,"Additional HTTP headers to add. It's only recommended to use this option, with headers that are typically added by websites, such as cookies.\nOverriding default browser headers will remove the masking this function provides."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"proxyurl"},(0,s.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"An HTTP proxy to be passed down to the HTTP request. Supports proxy authentication with Basic Auth."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"headergeneratoroptions"},(0,s.kt)("inlineCode",{parentName:"h3"},"headerGeneratorOptions")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"object")),(0,s.kt)("p",null,"Configuration to be used for generating correct browser headers. See the ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,s.kt)("inlineCode",{parentName:"a"},"header-generator"))," library."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"languagecode"},(0,s.kt)("inlineCode",{parentName:"h3"},"languageCode")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")," ",(0,s.kt)("code",null," = ",'"',"en",'"')),(0,s.kt)("p",null,"Two-letter ISO 639 language code."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"countrycode"},(0,s.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")," ",(0,s.kt)("code",null," = ",'"',"US",'"')),(0,s.kt)("p",null,"Two-letter ISO 3166 country code."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usemobileversion"},(0,s.kt)("inlineCode",{parentName:"h3"},"useMobileVersion")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")),(0,s.kt)("p",null,"If ",(0,s.kt)("inlineCode",{parentName:"p"},"true"),", the function uses User-Agent of a mobile browser."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"ignoresslerrors"},(0,s.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,s.kt)("code",null," = true")),(0,s.kt)("p",null,"If set to true, SSL/TLS certificate errors will be ignored."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"useinsecurehttpparser"},(0,s.kt)("inlineCode",{parentName:"h3"},"useInsecureHttpParser")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,s.kt)("code",null," = true")),(0,s.kt)("p",null,"Node.js' HTTP parser is stricter than parsers used by web browsers, which prevents scraping of websites whose servers do not comply with HTTP specs,\neither by accident or due to some anti-scraping protections, causing e.g. the ",(0,s.kt)("inlineCode",{parentName:"p"},"invalid header value char")," error. The ",(0,s.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option\nforces the HTTP parser to ignore certain errors which lets you scrape such websites. However, it will also open your application to some security\nvulnerabilities, although the risk should be negligible as these vulnerabilities mainly relate to server applications, not clients. Learn more in this\n",(0,s.kt)("a",{parentName:"p",href:"https://snyk.io/blog/node-js-release-fixes-a-critical-http-security-vulnerability/",target:"_blank",rel:"noopener"},"blog post"),"."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"abortfunction"},(0,s.kt)("inlineCode",{parentName:"h3"},"abortFunction")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../typedefs/abort-function",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"AbortFunction"))),(0,s.kt)("p",null,"Function accepts ",(0,s.kt)("inlineCode",{parentName:"p"},"response")," object as a single parameter and should return ",(0,s.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,s.kt)("inlineCode",{parentName:"p"},"false"),". If function returns true, request gets aborted."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usehttp2"},(0,s.kt)("inlineCode",{parentName:"h3"},"useHttp2")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,s.kt)("code",null," = true")),(0,s.kt)("p",null,"If set to false, it will prevent use of HTTP2 requests. This is strongly discouraged. Websites expect HTTP2 connections, because browsers use HTTP2 by\ndefault. It will automatically downgrade to HTTP/1.1 for websites that do not support HTTP2."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"sessiontoken"},(0,s.kt)("inlineCode",{parentName:"h3"},"sessionToken")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"object")),(0,s.kt)("p",null,"A unique object used to generate browser headers. By default, new headers are generated on every call. Set this option to make these headers\npersistent."),(0,s.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>h});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,h=u["".concat(l,".").concat(k)]||u[k]||c[k]||s;return r?n.createElement(h,a(a({ref:t},d),{},{components:r})):n.createElement(h,a({ref:t},d))}));function h(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=k;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),a=["components"],i={id:"request-as-browser-options",title:"RequestAsBrowserOptions"},l=void 0,p={unversionedId:"typedefs/request-as-browser-options",id:"version-2.3/typedefs/request-as-browser-options",title:"RequestAsBrowserOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/RequestAsBrowserOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-options",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-as-browser-options",title:"RequestAsBrowserOptions"},sidebar:"version-2.3/docs",previous:{title:"RequestListOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-list-options"},next:{title:"SessionOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"method",id:"method",level:3},{value:"headers",id:"headers",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"headerGeneratorOptions",id:"headergeneratoroptions",level:3},{value:"languageCode",id:"languagecode",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"useMobileVersion",id:"usemobileversion",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"useInsecureHttpParser",id:"useinsecurehttpparser",level:3},{value:"abortFunction",id:"abortfunction",level:3},{value:"useHttp2",id:"usehttp2",level:3},{value:"sessionToken",id:"sessiontoken",level:3}],c={toc:u},k="wrapper";function h(e){var t=e.components,r=(0,o.Z)(e,a);return(0,s.kt)(k,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requestasbrowseroptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"url"},(0,s.kt)("inlineCode",{parentName:"h3"},"url")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"URL of the target endpoint. Supports both HTTP and HTTPS schemes."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"method"},(0,s.kt)("inlineCode",{parentName:"h3"},"method")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")," ",(0,s.kt)("code",null," = ",'"',"\\",'"',"GET\\",'"','"')),(0,s.kt)("p",null,"HTTP method."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"headers"},(0,s.kt)("inlineCode",{parentName:"h3"},"headers")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Object")),(0,s.kt)("p",null,"Additional HTTP headers to add. It's only recommended to use this option, with headers that are typically added by websites, such as cookies.\nOverriding default browser headers will remove the masking this function provides."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"proxyurl"},(0,s.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"An HTTP proxy to be passed down to the HTTP request. Supports proxy authentication with Basic Auth."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"headergeneratoroptions"},(0,s.kt)("inlineCode",{parentName:"h3"},"headerGeneratorOptions")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"object")),(0,s.kt)("p",null,"Configuration to be used for generating correct browser headers. See the ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,s.kt)("inlineCode",{parentName:"a"},"header-generator"))," library."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"languagecode"},(0,s.kt)("inlineCode",{parentName:"h3"},"languageCode")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")," ",(0,s.kt)("code",null," = ",'"',"en",'"')),(0,s.kt)("p",null,"Two-letter ISO 639 language code."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"countrycode"},(0,s.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")," ",(0,s.kt)("code",null," = ",'"',"US",'"')),(0,s.kt)("p",null,"Two-letter ISO 3166 country code."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usemobileversion"},(0,s.kt)("inlineCode",{parentName:"h3"},"useMobileVersion")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")),(0,s.kt)("p",null,"If ",(0,s.kt)("inlineCode",{parentName:"p"},"true"),", the function uses User-Agent of a mobile browser."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"ignoresslerrors"},(0,s.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,s.kt)("code",null," = true")),(0,s.kt)("p",null,"If set to true, SSL/TLS certificate errors will be ignored."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"useinsecurehttpparser"},(0,s.kt)("inlineCode",{parentName:"h3"},"useInsecureHttpParser")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,s.kt)("code",null," = true")),(0,s.kt)("p",null,"Node.js' HTTP parser is stricter than parsers used by web browsers, which prevents scraping of websites whose servers do not comply with HTTP specs,\neither by accident or due to some anti-scraping protections, causing e.g. the ",(0,s.kt)("inlineCode",{parentName:"p"},"invalid header value char")," error. The ",(0,s.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option\nforces the HTTP parser to ignore certain errors which lets you scrape such websites. However, it will also open your application to some security\nvulnerabilities, although the risk should be negligible as these vulnerabilities mainly relate to server applications, not clients. Learn more in this\n",(0,s.kt)("a",{parentName:"p",href:"https://snyk.io/blog/node-js-release-fixes-a-critical-http-security-vulnerability/",target:"_blank",rel:"noopener"},"blog post"),"."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"abortfunction"},(0,s.kt)("inlineCode",{parentName:"h3"},"abortFunction")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../typedefs/abort-function",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"AbortFunction"))),(0,s.kt)("p",null,"Function accepts ",(0,s.kt)("inlineCode",{parentName:"p"},"response")," object as a single parameter and should return ",(0,s.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,s.kt)("inlineCode",{parentName:"p"},"false"),". If function returns true, request gets aborted."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usehttp2"},(0,s.kt)("inlineCode",{parentName:"h3"},"useHttp2")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,s.kt)("code",null," = true")),(0,s.kt)("p",null,"If set to false, it will prevent use of HTTP2 requests. This is strongly discouraged. Websites expect HTTP2 connections, because browsers use HTTP2 by\ndefault. It will automatically downgrade to HTTP/1.1 for websites that do not support HTTP2."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"sessiontoken"},(0,s.kt)("inlineCode",{parentName:"h3"},"sessionToken")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"object")),(0,s.kt)("p",null,"A unique object used to generate browser headers. By default, new headers are generated on every call. Set this option to make these headers\npersistent."),(0,s.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>h});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,h=u["".concat(l,".").concat(k)]||u[k]||c[k]||s;return r?n.createElement(h,a(a({ref:t},d),{},{components:r})):n.createElement(h,a({ref:t},d))}));function h(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=k;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var p=2;p{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>d});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),p=a(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function u(e){var t=e.className,a=e.block,l=e.selectedValue,p=e.selectValue,u=e.tabValues,c=[],f=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==l&&(f(t),p(n))},m=function(e){var t,a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",s.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function f(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",s.tabList)},r.createElement(u,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function d(e){var t=(0,p.Z)();return r.createElement(f,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>f});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function p(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:p(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,a])}function u(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),p=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(p),(0,n.useCallback)((function(e){if(p){var t=new URLSearchParams(l.location.search);t.set(p,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[p,l])]}function f(e){var t,a,r,o,i=e.defaultValue,p=e.queryString,f=void 0!==p&&p,d=e.groupId,m=s(e),y=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!u({value:a,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:m})})),h=y[0],k=y[1],g=c({queryString:f,groupId:d}),v=g[0],b=g[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],A=w[1],C=function(){var e=null!=v?v:N;return u({value:e,tabValues:m})?e:null}();return(0,n.useLayoutEffect)((function(){C&&k(C)}),[C]),{selectedValue:h,selectValue:(0,n.useCallback)((function(e){if(!u({value:e,tabValues:m}))throw new Error("Can't select invalid tab value="+e);k(e),b(e),A(e)}),[b,A,m]),tabValues:m}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),p=l.version,s=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var u=p+"/";return"current"===p?u="next/":s&&(u=""),n.createElement(r.default,{to:"/api/"+u+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},75502:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>k,contentTitle:()=>y,default:()=>w,frontMatter:()=>m,metadata:()=>h,toc:()=>g});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=a(68889),l=a(26569),p=a(65559),s=a(30433),u=a(14563);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.main(async () => {\n const crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n });\n\n // Enqueue the initial request and run the crawler\n await crawler.run(['https://www.iana.org/']);\n});\n",f="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n});\n\n// Enqueue the initial request and run the crawler\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n";var d=["components"],m={id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},y=void 0,h={unversionedId:"guides/apify-platform",id:"version-3.1/guides/apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping",source:"@site/versioned_docs/version-3.1/guides/apify_platform.mdx",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/apify_platform.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},sidebar:"docs",previous:{title:"Guides",permalink:"/sdk/js/docs/guides"},next:{title:"Request Storage",permalink:"/sdk/js/docs/guides/request-storage"}},k={},g=[{value:"Logging into Apify platform from Crawlee",id:"logging-into-apify-platform-from-crawlee",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"Log in with Configuration",id:"log-in-with-configuration",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2},{value:"Running an actor locally",id:"running-an-actor-locally",level:2},{value:"Running Crawlee code as an actor",id:"running-crawlee-code-as-an-actor",level:2},{value:"Deploying an actor to Apify platform",id:"deploying-an-actor-to-apify-platform",level:2},{value:"Usage on Apify platform",id:"usage-on-apify-platform",level:2},{value:"Storages",id:"storages",level:2},{value:"Helper functions for default Key-Value Store and Dataset",id:"helper-functions-for-default-key-value-store-and-dataset",level:3},{value:"Using platform storage in a local actor",id:"using-platform-storage-in-a-local-actor",level:3},{value:"Getting public url of an item in the platform storage",id:"getting-public-url-of-an-item-in-the-platform-storage",level:3},{value:"Exporting dataset data",id:"exporting-dataset-data",level:3},{value:"Environment variables",id:"environment-variables",level:2},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_TOKEN and CRAWLEE_STORAGE_DIR",id:"combinations-of-apify_token-and-crawlee_storage_dir",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3},{value:"Proxy management",id:"proxy-management",level:2},{value:"Apify Proxy",id:"apify-proxy",level:3},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:3},{value:"Apify Proxy vs. Own proxies",id:"apify-proxy-vs-own-proxies",level:3}],v={toc:g},b="wrapper";function w(e){var t=e.components,a=(0,r.Z)(e,d);return(0,o.kt)(b,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"./request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"./result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"./proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and it's definitely worth signing up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Crawlee is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"We do not test Crawlee in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-crawlee"},"Logging into Apify platform from Crawlee"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from Crawlee, you must provide\ncredentials - your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\napify login -t YOUR_API_TOKEN\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"Alternatively, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. Actor automatically infers that from your token, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h3",{id:"log-in-with-configuration"},"Log in with Configuration"),(0,o.kt)("p",null,"Another option is to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance and set your api token there."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst sdk = new Actor({ token: 'your_api_token' });\n")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actors",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))),(0,o.kt)("h2",{id:"running-an-actor-locally"},"Running an actor locally"),(0,o.kt)("p",null,"First let's create a boilerplate of the new actor. You could use Apify CLI and just run:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - let\'s pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world")," with a Node.js project files. You can run the actor as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("h2",{id:"running-crawlee-code-as-an-actor"},"Running Crawlee code as an actor"),(0,o.kt)("p",null,"For running Crawlee code as an actor on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform")," you should either:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"use a combination of ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," functions;"),(0,o.kt)("li",{parentName:"ul"},"or wrap it into ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," function.")),(0,o.kt)("admonition",{title:"NOTE",type:"info"},(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Adding ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," to your code are the only two important things needed to run it on Apify platform as an actor. ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," is needed to initialize your actor (e.g. to set the correct storage implementation), while without ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," the process will simply never stop."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," is an alternative to ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," as it calls both behind the scenes."))),(0,o.kt)("p",null,"Let's look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," example from the ",(0,o.kt)(l.B,{to:"docs/quick-start",mdxType:"CrawleeLink"},"Quick Start")," guide:"),(0,o.kt)(p.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"main",label:"Using Actor.main()",default:!0,mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"init_exit",label:"Using Actor.init() and Actor.exit()",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},f))),(0,o.kt)("p",null,"Note that you could also run your actor (that is using Crawlee) locally with Apify CLI. You could start it via the following command in your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify run\n")),(0,o.kt)("h2",{id:"deploying-an-actor-to-apify-platform"},"Deploying an actor to Apify platform"),(0,o.kt)("p",null,"Now (assuming you are already logged in to your Apify account) you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to and built on the Apify platform so that it can be run there. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-apify-platform"},"Usage on Apify platform"),(0,o.kt)("p",null,"You can also develop your actor in an online code editor directly on the platform (you'll need an Apify Account). Let's go to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("em",{parentName:"p"},"Create new")," and then go to the ",(0,o.kt)("em",{parentName:"p"},"Source")," tab and start writing the code or paste one of the examples from the ",(0,o.kt)("a",{parentName:"p",href:"../examples",target:null,rel:null},"Examples")," section."),(0,o.kt)("h2",{id:"storages"},"Storages"),(0,o.kt)("p",null,"There are several things worth mentioning here."),(0,o.kt)("h3",{id:"helper-functions-for-default-key-value-store-and-dataset"},"Helper functions for default Key-Value Store and Dataset"),(0,o.kt)("p",null,"To simplify access to the ",(0,o.kt)("em",{parentName:"p"},"default")," storages, instead of using the helper functions of respective storage classes, you could use:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#setValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.setValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getInput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getInput()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Key-Value Store")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#pushData",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.pushData()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Dataset"))),(0,o.kt)("h3",{id:"using-platform-storage-in-a-local-actor"},"Using platform storage in a local actor"),(0,o.kt)("p",null,"When you plan to use the platform storage while developing and running your actor locally, you should use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openKeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openKeyValueStore()")),", ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openDataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openDataset()"))," and ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openRequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openRequestQueue()"))," to open the respective storage."),(0,o.kt)("p",null,"Using each of these methods allows to pass the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"OpenStorageOptions"))," as a second argument, which has only one optional property: ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions#forceCloud",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"forceCloud")),". If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," - cloud storage will be used instead of the folder on the local disk."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"If you don't plan to force usage of the platform storages when running the actor locally, there is no need to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," class for it. The Crawlee variants ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore.open()")),", ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.open()"))," and ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue.open()"))," will work the same.")),(0,o.kt)("h3",{id:"getting-public-url-of-an-item-in-the-platform-storage"},"Getting public url of an item in the platform storage"),(0,o.kt)("p",null,"If you need to share a link to some file stored in a Key-Value Store on Apify Platform, you can use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore#getPublicUrl",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"getPublicUrl()"))," method. It accepts only one parameter: ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," - the key of the item you want to share."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { KeyValueStore } from 'apify';\n\nconst store = await KeyValueStore.open();\nawait store.setValue('your-file', { foo: 'bar' });\nconst url = store.getPublicUrl('your-file');\n// https://api.apify.com/v2/key-value-stores//records/your-file\n")),(0,o.kt)("h3",{id:"exporting-dataset-data"},"Exporting dataset data"),(0,o.kt)("p",null,"When the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," is stored on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),", you can export its data to the following formats: HTML, JSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This way you can easily share the crawling results."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,o.kt)("p",null,"The following are some additional environment variables specific to Apify platform. More Crawlee specific environment variables could be found in the ",(0,o.kt)(l.B,{to:"docs/guides/configuration#environment-variables",mdxType:"CrawleeLink"},"Environment Variables")," guide."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"It's important to notice that ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_")," environment variables don't need to be replaced with equivalent ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," ones. Likewise, Crawlee understands ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," environment variables after calling ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.init()")," or when using ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.main()"),".")),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Account Settings / Integrations")," page."),(0,o.kt)("h3",{id:"combinations-of-apify_token-and-crawlee_storage_dir"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR")," env variable description could be found in ",(0,o.kt)(l.B,{to:"docs/guides/configuration#crawlee_storage_dir",mdxType:"CrawleeLink"},"Environment Variables")," guide.")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the actor's behavior."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local + platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { Actor } from 'apify';\nimport { Dataset } from 'crawlee';\n\n// or Dataset.open('my-local-data')\nconst localDataset = await Actor.openDataset('my-local-data');\n// but here we need the `Actor` class\nconst remoteDataset = await Actor.openDataset('my-dataset', { forceCloud: true });\n")),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nAssuming Apify Account was already created, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but not access to Apify API, or when you need access to\nproxy from a different account than your token represents."),(0,o.kt)("h2",{id:"proxy-management"},"Proxy management"),(0,o.kt)("p",null,"In addition to your own proxy servers and proxy servers acquired from\nthird-party providers used together with Crawlee, you can also rely on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,o.kt)("h3",{id:"apify-proxy"},"Apify Proxy"),(0,o.kt)("p",null,"If you are already subscribed to Apify Proxy, you can start using them immediately in only a few lines of code (for local usage you first should be ",(0,o.kt)("a",{parentName:"p",href:"#logging-into-apify-platform-from-crawlee",target:null,rel:null},"logged in")," to your Apify account."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Note that unlike using your own proxies in Crawlee, you shouldn't use the constructor to create ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," instance. For using Apify Proxy you should create an instance using the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function instead."),(0,o.kt)("h3",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,o.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can check proxy groups available to you\nin the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,o.kt)("h3",{id:"apify-proxy-vs-own-proxies"},"Apify Proxy vs. Own proxies"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers. However, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Own (third party) proxy."),(0,o.kt)("p",null,"The difference is easy to remember."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"If you're using your own proxies - you should create an instance with the ProxyConfiguration ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration#constructor",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"constructor"))," function based on the provided ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions")),"."),(0,o.kt)("li",{parentName:"ul"},"If you are planning to use Apify Proxy - you should create an instance using the ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function. ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs"))))}w.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(a),d=r,m=c["".concat(p,".").concat(d)]||c[d]||f[d]||o;return a?n.createElement(m,i(i({ref:t},u),{},{components:a})):n.createElement(m,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var s=2;s{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>d});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),p=a(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function u(e){var t=e.className,a=e.block,l=e.selectedValue,p=e.selectValue,u=e.tabValues,c=[],f=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==l&&(f(t),p(n))},m=function(e){var t,a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",s.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function f(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",s.tabList)},r.createElement(u,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function d(e){var t=(0,p.Z)();return r.createElement(f,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>f});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function p(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:p(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,a])}function u(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),p=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(p),(0,n.useCallback)((function(e){if(p){var t=new URLSearchParams(l.location.search);t.set(p,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[p,l])]}function f(e){var t,a,r,o,i=e.defaultValue,p=e.queryString,f=void 0!==p&&p,d=e.groupId,m=s(e),y=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!u({value:a,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:m})})),h=y[0],k=y[1],g=c({queryString:f,groupId:d}),v=g[0],b=g[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],A=w[1],C=function(){var e=null!=v?v:N;return u({value:e,tabValues:m})?e:null}();return(0,n.useLayoutEffect)((function(){C&&k(C)}),[C]),{selectedValue:h,selectValue:(0,n.useCallback)((function(e){if(!u({value:e,tabValues:m}))throw new Error("Can't select invalid tab value="+e);k(e),b(e),A(e)}),[b,A,m]),tabValues:m}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),p=l.version,s=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var u=p+"/";return"current"===p?u="next/":s&&(u=""),n.createElement(r.default,{to:"/api/"+u+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},75502:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>k,contentTitle:()=>y,default:()=>w,frontMatter:()=>m,metadata:()=>h,toc:()=>g});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=a(68889),l=a(26569),p=a(65559),s=a(30433),u=a(14563);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.main(async () => {\n const crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n });\n\n // Enqueue the initial request and run the crawler\n await crawler.run(['https://www.iana.org/']);\n});\n",f="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, $, enqueueLinks }) {\n const { url } = request;\n\n // Extract HTML title of the page.\n const title = $('title').text();\n console.log(`Title of ${url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await enqueueLinks({\n globs: ['https://www.iana.org/*'],\n });\n\n // Save extracted data to dataset.\n await Actor.pushData({ url, title });\n },\n});\n\n// Enqueue the initial request and run the crawler\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n";var d=["components"],m={id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},y=void 0,h={unversionedId:"guides/apify-platform",id:"version-3.1/guides/apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping",source:"@site/versioned_docs/version-3.1/guides/apify_platform.mdx",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/apify_platform.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform",description:"Apify platform - large-scale and high-performance web scraping"},sidebar:"docs",previous:{title:"Guides",permalink:"/sdk/js/docs/guides"},next:{title:"Request Storage",permalink:"/sdk/js/docs/guides/request-storage"}},k={},g=[{value:"Logging into Apify platform from Crawlee",id:"logging-into-apify-platform-from-crawlee",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"Log in with Configuration",id:"log-in-with-configuration",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2},{value:"Running an actor locally",id:"running-an-actor-locally",level:2},{value:"Running Crawlee code as an actor",id:"running-crawlee-code-as-an-actor",level:2},{value:"Deploying an actor to Apify platform",id:"deploying-an-actor-to-apify-platform",level:2},{value:"Usage on Apify platform",id:"usage-on-apify-platform",level:2},{value:"Storages",id:"storages",level:2},{value:"Helper functions for default Key-Value Store and Dataset",id:"helper-functions-for-default-key-value-store-and-dataset",level:3},{value:"Using platform storage in a local actor",id:"using-platform-storage-in-a-local-actor",level:3},{value:"Getting public url of an item in the platform storage",id:"getting-public-url-of-an-item-in-the-platform-storage",level:3},{value:"Exporting dataset data",id:"exporting-dataset-data",level:3},{value:"Environment variables",id:"environment-variables",level:2},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_TOKEN and CRAWLEE_STORAGE_DIR",id:"combinations-of-apify_token-and-crawlee_storage_dir",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3},{value:"Proxy management",id:"proxy-management",level:2},{value:"Apify Proxy",id:"apify-proxy",level:3},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:3},{value:"Apify Proxy vs. Own proxies",id:"apify-proxy-vs-own-proxies",level:3}],v={toc:g},b="wrapper";function w(e){var t=e.components,a=(0,r.Z)(e,d);return(0,o.kt)(b,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"./request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"./result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"./proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and it's definitely worth signing up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Crawlee is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"We do not test Crawlee in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-crawlee"},"Logging into Apify platform from Crawlee"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from Crawlee, you must provide\ncredentials - your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\napify login -t YOUR_API_TOKEN\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"Alternatively, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. Actor automatically infers that from your token, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h3",{id:"log-in-with-configuration"},"Log in with Configuration"),(0,o.kt)("p",null,"Another option is to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance and set your api token there."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst sdk = new Actor({ token: 'your_api_token' });\n")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actors",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))),(0,o.kt)("h2",{id:"running-an-actor-locally"},"Running an actor locally"),(0,o.kt)("p",null,"First let's create a boilerplate of the new actor. You could use Apify CLI and just run:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - let\'s pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world")," with a Node.js project files. You can run the actor as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("h2",{id:"running-crawlee-code-as-an-actor"},"Running Crawlee code as an actor"),(0,o.kt)("p",null,"For running Crawlee code as an actor on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform")," you should either:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"use a combination of ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," functions;"),(0,o.kt)("li",{parentName:"ul"},"or wrap it into ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," function.")),(0,o.kt)("admonition",{title:"NOTE",type:"info"},(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},"Adding ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#init",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.init()"))," and ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#exit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.exit()"))," to your code are the only two important things needed to run it on Apify platform as an actor. ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," is needed to initialize your actor (e.g. to set the correct storage implementation), while without ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," the process will simply never stop."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#main",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.main()"))," is an alternative to ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.init()")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"Actor.exit()")," as it calls both behind the scenes."))),(0,o.kt)("p",null,"Let's look at the ",(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," example from the ",(0,o.kt)(l.B,{to:"docs/quick-start",mdxType:"CrawleeLink"},"Quick Start")," guide:"),(0,o.kt)(p.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"main",label:"Using Actor.main()",default:!0,mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"init_exit",label:"Using Actor.init() and Actor.exit()",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"js",mdxType:"CodeBlock"},f))),(0,o.kt)("p",null,"Note that you could also run your actor (that is using Crawlee) locally with Apify CLI. You could start it via the following command in your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify run\n")),(0,o.kt)("h2",{id:"deploying-an-actor-to-apify-platform"},"Deploying an actor to Apify platform"),(0,o.kt)("p",null,"Now (assuming you are already logged in to your Apify account) you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to and built on the Apify platform so that it can be run there. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-apify-platform"},"Usage on Apify platform"),(0,o.kt)("p",null,"You can also develop your actor in an online code editor directly on the platform (you'll need an Apify Account). Let's go to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("em",{parentName:"p"},"Create new")," and then go to the ",(0,o.kt)("em",{parentName:"p"},"Source")," tab and start writing the code or paste one of the examples from the ",(0,o.kt)("a",{parentName:"p",href:"../examples",target:null,rel:null},"Examples")," section."),(0,o.kt)("h2",{id:"storages"},"Storages"),(0,o.kt)("p",null,"There are several things worth mentioning here."),(0,o.kt)("h3",{id:"helper-functions-for-default-key-value-store-and-dataset"},"Helper functions for default Key-Value Store and Dataset"),(0,o.kt)("p",null,"To simplify access to the ",(0,o.kt)("em",{parentName:"p"},"default")," storages, instead of using the helper functions of respective storage classes, you could use:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#setValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.setValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getValue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getValue()")),", ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#getInput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.getInput()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Key-Value Store")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#pushData",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.pushData()"))," for ",(0,o.kt)("inlineCode",{parentName:"li"},"Dataset"))),(0,o.kt)("h3",{id:"using-platform-storage-in-a-local-actor"},"Using platform storage in a local actor"),(0,o.kt)("p",null,"When you plan to use the platform storage while developing and running your actor locally, you should use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openKeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openKeyValueStore()")),", ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openDataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openDataset()"))," and ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#openRequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.openRequestQueue()"))," to open the respective storage."),(0,o.kt)("p",null,"Using each of these methods allows to pass the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"OpenStorageOptions"))," as a second argument, which has only one optional property: ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/interface/OpenStorageOptions#forceCloud",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"forceCloud")),". If set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," - cloud storage will be used instead of the folder on the local disk."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"If you don't plan to force usage of the platform storages when running the actor locally, there is no need to use the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," class for it. The Crawlee variants ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore.open()")),", ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.open()"))," and ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue.open()"))," will work the same.")),(0,o.kt)("h3",{id:"getting-public-url-of-an-item-in-the-platform-storage"},"Getting public url of an item in the platform storage"),(0,o.kt)("p",null,"If you need to share a link to some file stored in a Key-Value Store on Apify Platform, you can use ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore#getPublicUrl",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"getPublicUrl()"))," method. It accepts only one parameter: ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," - the key of the item you want to share."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { KeyValueStore } from 'apify';\n\nconst store = await KeyValueStore.open();\nawait store.setValue('your-file', { foo: 'bar' });\nconst url = store.getPublicUrl('your-file');\n// https://api.apify.com/v2/key-value-stores//records/your-file\n")),(0,o.kt)("h3",{id:"exporting-dataset-data"},"Exporting dataset data"),(0,o.kt)("p",null,"When the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," is stored on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),", you can export its data to the following formats: HTML, JSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This way you can easily share the crawling results."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"environment-variables"},"Environment variables"),(0,o.kt)("p",null,"The following are some additional environment variables specific to Apify platform. More Crawlee specific environment variables could be found in the ",(0,o.kt)(l.B,{to:"docs/guides/configuration#environment-variables",mdxType:"CrawleeLink"},"Environment Variables")," guide."),(0,o.kt)("admonition",{type:"note"},(0,o.kt)("p",{parentName:"admonition"},"It's important to notice that ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_")," environment variables don't need to be replaced with equivalent ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," ones. Likewise, Crawlee understands ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_")," environment variables after calling ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.init()")," or when using ",(0,o.kt)("inlineCode",{parentName:"p"},"Actor.main()"),".")),(0,o.kt)("h3",{id:"apify_token"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,o.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Account Settings / Integrations")," page."),(0,o.kt)("h3",{id:"combinations-of-apify_token-and-crawlee_storage_dir"},"Combinations of ",(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"h3"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR")," env variable description could be found in ",(0,o.kt)(l.B,{to:"docs/guides/configuration#crawlee_storage_dir",mdxType:"CrawleeLink"},"Environment Variables")," guide.")),(0,o.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the actor's behavior."),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,o.kt)("th",{parentName:"tr",align:null},"API"),(0,o.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"none OR ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"no"),(0,o.kt)("td",{parentName:"tr",align:null},"local")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,o.kt)("inlineCode",{parentName:"td"},"CRAWLEE_STORAGE_DIR")),(0,o.kt)("td",{parentName:"tr",align:null},"yes"),(0,o.kt)("td",{parentName:"tr",align:null},"local + platform")))),(0,o.kt)("p",null,"When using both ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"CRAWLEE_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import { Actor } from 'apify';\nimport { Dataset } from 'crawlee';\n\n// or Dataset.open('my-local-data')\nconst localDataset = await Actor.openDataset('my-local-data');\n// but here we need the `Actor` class\nconst remoteDataset = await Actor.openDataset('my-dataset', { forceCloud: true });\n")),(0,o.kt)("h3",{id:"apify_proxy_password"},(0,o.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,o.kt)("p",null,"Optional password to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nAssuming Apify Account was already created, you can find the password on the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but not access to Apify API, or when you need access to\nproxy from a different account than your token represents."),(0,o.kt)("h2",{id:"proxy-management"},"Proxy management"),(0,o.kt)("p",null,"In addition to your own proxy servers and proxy servers acquired from\nthird-party providers used together with Crawlee, you can also rely on ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,o.kt)("h3",{id:"apify-proxy"},"Apify Proxy"),(0,o.kt)("p",null,"If you are already subscribed to Apify Proxy, you can start using them immediately in only a few lines of code (for local usage you first should be ",(0,o.kt)("a",{parentName:"p",href:"#logging-into-apify-platform-from-crawlee",target:null,rel:null},"logged in")," to your Apify account."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Note that unlike using your own proxies in Crawlee, you shouldn't use the constructor to create ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," instance. For using Apify Proxy you should create an instance using the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function instead."),(0,o.kt)("h3",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,o.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\n\nconst proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = await proxyConfiguration.newUrl();\n")),(0,o.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can check proxy groups available to you\nin the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,o.kt)("h3",{id:"apify-proxy-vs-own-proxies"},"Apify Proxy vs. Own proxies"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers. However, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Own (third party) proxy."),(0,o.kt)("p",null,"The difference is easy to remember."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"If you're using your own proxies - you should create an instance with the ProxyConfiguration ",(0,o.kt)(i.Z,{to:"apify/class/ProxyConfiguration#constructor",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"constructor"))," function based on the provided ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions")),"."),(0,o.kt)("li",{parentName:"ul"},"If you are planning to use Apify Proxy - you should create an instance using the ",(0,o.kt)("a",{parentName:"li",href:"https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.createProxyConfiguration()"))," function. ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,o.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"li"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs"))))}w.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(a),d=r,m=c["".concat(p,".").concat(d)]||c[d]||f[d]||o;return a?n.createElement(m,i(i({ref:t},u),{},{components:a})):n.createElement(m,i({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var s=2;s{e.exports=JSON.parse('[{"entryPoints":[{"index":true,"label":"Index","reflection":{"id":0,"name":"apify","kind":1,"kindString":"Project","flags":{},"originalName":"","children":[{"id":305,"name":"LogLevel","kind":8,"kindString":"Enumeration","flags":{"isExternal":true},"children":[{"id":311,"name":"DEBUG","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":7,"character":4}],"type":{"type":"literal","value":5}},{"id":307,"name":"ERROR","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":3,"character":4}],"type":{"type":"literal","value":1}},{"id":310,"name":"INFO","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":6,"character":4}],"type":{"type":"literal","value":4}},{"id":306,"name":"OFF","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":2,"character":4}],"type":{"type":"literal","value":0}},{"id":312,"name":"PERF","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":8,"character":4}],"type":{"type":"literal","value":6}},{"id":308,"name":"SOFT_FAIL","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":4,"character":4}],"type":{"type":"literal","value":2}},{"id":309,"name":"WARNING","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":5,"character":4}],"type":{"type":"literal","value":3}}],"groups":[{"title":"Enumeration Members","children":[311,307,310,306,312,308,309]}],"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":1,"character":20}],"permalink":"/sdk/js/reference/next/enum/LogLevel","previousId":122,"nextId":1127},{"id":830,"name":"Actor","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"code","text":"`Actor`"},{"kind":"text","text":" class serves as an alternative approach to the static helpers exported from the package. It allows to pass configuration\\nthat will be used on the instance methods. Environment variables will have precedence over this configuration.\\nSee "},{"kind":"inline-tag","tag":"@apilink","text":"Configuration"},{"kind":"text","text":" for details about what can be configured and what are the default values."}]},"children":[{"id":953,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":82,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L82"}],"signatures":[{"id":954,"name":"new Actor","kind":16384,"kindString":"Constructor signature","flags":{},"typeParameter":[{"id":955,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":956,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"},"defaultValue":"{}"}],"type":{"type":"reference","id":830,"typeArguments":[{"type":"reference","id":955,"name":"Data"}],"name":"Actor"}}]},{"id":960,"name":"initialized","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Whether the actor instance was initialized. This is set by calling "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.init"},{"kind":"text","text":"."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":74,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L74"}],"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"},{"id":947,"name":"apifyClient","kind":262144,"kindString":"Accessor","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1503,"character":15,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1503"}],"getSignature":{"id":948,"name":"apifyClient","kind":524288,"kindString":"Get signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Default "},{"kind":"inline-tag","tag":"@apilink","text":"ApifyClient"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","id":750,"name":"ApifyClient","qualifiedName":"ApifyClient","package":"apify-client"}}},{"id":949,"name":"config","kind":262144,"kindString":"Accessor","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1508,"character":15,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1508"}],"getSignature":{"id":950,"name":"config","kind":524288,"kindString":"Get signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Default "},{"kind":"inline-tag","tag":"@apilink","text":"Configuration"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","id":1237,"name":"Configuration"}}},{"id":1046,"name":"getInputOrThrow","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":760,"character":10,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L760"}],"signatures":[{"id":1047,"name":"getInputOrThrow","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets the actor input value just like the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getInput"},{"kind":"text","text":" method,\\nbut throws if it is not found."}]},"typeParameter":[{"id":1048,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"Buffer","qualifiedName":"global.Buffer","package":"@types/node"}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1048,"name":"T"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":1071,"name":"useState","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":963,"character":10,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L963"}],"signatures":[{"id":1072,"name":"useState","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Easily create and manage state values. All state values are automatically persisted.\\n\\nValues can be modified by simply using the assignment operator."}]},"typeParameter":[{"id":1073,"name":"State","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":1074,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The name of the store to use."}]},"type":{"type":"intrinsic","name":"string"}},{"id":1075,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"If the store does not yet have a value in it, the value will be initialized with the "},{"kind":"code","text":"`defaultValue`"},{"kind":"text","text":" you provide."}]},"type":{"type":"reference","id":1073,"name":"State"},"defaultValue":"..."},{"id":1076,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional object parameter where a custom "},{"kind":"code","text":"`keyValueStoreName`"},{"kind":"text","text":" and "},{"kind":"code","text":"`config`"},{"kind":"text","text":" can be passed in."}]},"type":{"type":"reference","name":"UseStateOptions","qualifiedName":"UseStateOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1073,"name":"State"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":883,"name":"abort","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1184,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1184"}],"signatures":[{"id":884,"name":"abort","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Aborts given actor run on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable).\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nFor more information about actors, read the\\n[documentation](https://docs.apify.com/actor).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.abort(runId);\\n```"}]},"parameters":[{"id":885,"name":"runId","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":886,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1127,"name":"AbortOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":895,"name":"addWebhook","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1225,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1225"}],"signatures":[{"id":896,"name":"addWebhook","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed.\\nFor more information about Apify actor webhooks, please see the [documentation](https://docs.apify.com/webhooks).\\n\\nNote that webhooks are only supported for actors running on the Apify platform.\\nIn local environment, the function will print a warning and have no effect."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The return value is the Webhook object.\\nFor more information, see the [Get webhook](https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook) API endpoint."}]}]},"parameters":[{"id":897,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1131,"name":"WebhookOptions"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"Webhook","qualifiedName":"Webhook","package":"apify-client"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":868,"name":"call","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1110,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1110"}],"signatures":[{"id":869,"name":"call","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs an actor on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable).\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nIf you want to run an actor task rather than an actor, please use the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.callTask"},{"kind":"text","text":" function instead.\\n\\nFor more information about actors, read the [documentation](https://docs.apify.com/actor).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.call(\'apify/hello-world\', { myInput: 123 });\\n```"}]},"parameters":[{"id":870,"name":"actorId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Allowed formats are "},{"kind":"code","text":"`username/actor-name`"},{"kind":"text","text":", "},{"kind":"code","text":"`userId/actor-name`"},{"kind":"text","text":" or actor ID."}]},"type":{"type":"intrinsic","name":"string"}},{"id":871,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input for the actor. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Otherwise the "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" parameter must be provided."}]},"type":{"type":"intrinsic","name":"unknown"}},{"id":872,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1110,"name":"CallOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":873,"name":"callTask","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1139,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1139"}],"signatures":[{"id":874,"name":"callTask","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs an actor task on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable).\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nNote that an actor task is a saved input configuration and options for an actor.\\nIf you want to run an actor directly rather than an actor task, please use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"Actor.call"},{"kind":"text","text":" function instead.\\n\\nFor more information about actor tasks, read the [documentation](https://docs.apify.com/tasks).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.callTask(\'bob/some-task\');\\n```"}]},"parameters":[{"id":875,"name":"taskId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Allowed formats are "},{"kind":"code","text":"`username/task-name`"},{"kind":"text","text":", "},{"kind":"code","text":"`userId/task-name`"},{"kind":"text","text":" or task ID."}]},"type":{"type":"intrinsic","name":"string"}},{"id":876,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input overrides for the actor task. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Provided input will be merged with actor task input."}]},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}},{"id":877,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1119,"name":"CallTaskOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":935,"name":"createProxyConfiguration","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1467,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1467"}],"signatures":[{"id":936,"name":"createProxyConfiguration","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Creates a proxy configuration and returns a promise resolving to an instance\\nof the "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration"},{"kind":"text","text":" class that is already initialized.\\n\\nConfigures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking\\nyour crawlers based on IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures\\nthem to use the selected proxies for all connections.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration"},{"kind":"text","text":" class.\\n\\n"},{"kind":"code","text":"```javascript\\n\\n// Returns initialized proxy configuration class\\nconst proxyConfiguration = await Actor.createProxyConfiguration({\\n groups: [\'GROUP1\', \'GROUP2\'] // List of Apify proxy groups\\n countryCode: \'US\'\\n});\\n\\nconst crawler = new CheerioCrawler({\\n // ...\\n proxyConfiguration,\\n requestHandler({ proxyInfo }) {\\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\\n }\\n})\\n\\n```"},{"kind":"text","text":"\\n\\nFor compatibility with existing Actor Input UI (Input Schema), this function\\nreturns "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":" when the following object is passed as "},{"kind":"code","text":"`proxyConfigurationOptions`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```\\n{ useApifyProxy: false }\\n```"}]},"parameters":[{"id":937,"name":"proxyConfigurationOptions","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intersection","types":[{"type":"reference","id":1393,"name":"ProxyConfigurationOptions"},{"type":"reflection","declaration":{"id":938,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":939,"name":"useApifyProxy","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1468,"character":65,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1468"}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[939]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1468,"character":63,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1468"}]}}]},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","id":1410,"name":"ProxyConfiguration"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":846,"name":"exit","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1066,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1066"}],"signatures":[{"id":847,"name":"exit","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gracefully exits the actor run with the provided status message and exit code."}]},"parameters":[{"id":848,"name":"messageOrOptions","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"First parameter accepts either a string (a terminal status message) or an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","id":1142,"name":"ExitOptions"}]}},{"id":849,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Second parameter accepts an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"reference","id":1142,"name":"ExitOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":850,"name":"fail","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1075,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1075"}],"signatures":[{"id":851,"name":"fail","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Calls "},{"kind":"code","text":"`Actor.exit()`"},{"kind":"text","text":" with "},{"kind":"code","text":"`options.exitCode`"},{"kind":"text","text":" set to "},{"kind":"code","text":"`1`"},{"kind":"text","text":"."}]},"parameters":[{"id":852,"name":"messageOrOptions","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"First parameter accepts either a string (a terminal status message) or an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","id":1142,"name":"ExitOptions"}]}},{"id":853,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Second parameter accepts an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"reference","id":1142,"name":"ExitOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":940,"name":"getEnv","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1480,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1480"}],"signatures":[{"id":941,"name":"getEnv","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a new "},{"kind":"inline-tag","tag":"@apilink","text":"ApifyEnv"},{"kind":"text","text":" object which contains information parsed from all the Apify environment variables.\\n\\nFor the list of the Apify environment variables, see\\n[Actor documentation](https://docs.apify.com/actor/run#environment-variables).\\nIf some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null."}]},"type":{"type":"reference","id":1095,"name":"ApifyEnv"}}]},{"id":921,"name":"getInput","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1382,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1382"}],"signatures":[{"id":922,"name":"getInput","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets the actor input value from the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue | `keyValueStore.getValue(\'INPUT\')`"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nconst input = await Actor.getInput();\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst store = await Actor.openKeyValueStore();\\nawait store.getValue(\'INPUT\');\\n```"},{"kind":"text","text":"\\n\\nNote that the "},{"kind":"code","text":"`getInput()`"},{"kind":"text","text":" function does not cache the value read from the key-value store.\\nIf you need to use the input multiple times in your actor,\\nit is far more efficient to read it once and store it locally.\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openKeyValueStore"},{"kind":"text","text":" and "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":"\\n if the record is missing."}]}]},"typeParameter":[{"id":923,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"Buffer","qualifiedName":"global.Buffer","package":"@types/node"}]}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":923,"name":"T"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":924,"name":"getInputOrThrow","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1390,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1390"}],"signatures":[{"id":925,"name":"getInputOrThrow","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets the actor input value just like the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getInput"},{"kind":"text","text":" method,\\nbut throws if it is not found."}]},"typeParameter":[{"id":926,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"Buffer","qualifiedName":"global.Buffer","package":"@types/node"}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":926,"name":"T"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":911,"name":"getValue","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1317,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1317"}],"signatures":[{"id":912,"name":"getValue","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets a value from the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nconst value = await Actor.getValue(\'my-key\');\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst store = await Actor.openKeyValueStore();\\nconst value = await store.getValue(\'my-key\');\\n```"},{"kind":"text","text":"\\n\\nTo store the value to the default key-value store, you can use the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.setValue"},{"kind":"text","text":" function.\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openKeyValueStore"},{"kind":"text","text":"\\nand "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":"\\n if the record is missing."}]}]},"typeParameter":[{"id":913,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"parameters":[{"id":914,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Unique record key."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":913,"name":"T"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":843,"name":"init","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1057,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1057"}],"signatures":[{"id":844,"name":"init","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":845,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1087,"name":"InitOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":945,"name":"isAtHome","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1498,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1498"}],"signatures":[{"id":946,"name":"isAtHome","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" when code is running on Apify platform and "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise (for example locally)."}]},"type":{"type":"intrinsic","name":"boolean"}}]},{"id":838,"name":"main","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1053,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1053"}],"signatures":[{"id":839,"name":"main","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs the main user function that performs the job of the actor\\nand terminates the process when the user function finishes.\\n\\n**The "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":" function is optional** and is provided merely for your convenience.\\nIt is mainly useful when you\'re running your code as an actor on the [Apify platform](https://apify.com/actors).\\nHowever, if you want to use Apify SDK tools directly inside your existing projects, e.g.\\nrunning in an [Express](https://expressjs.com/) server, on\\n[Google Cloud functions](https://cloud.google.com/functions)\\nor [AWS Lambda](https://aws.amazon.com/lambda/), it\'s better to avoid\\nit since the function terminates the main process when it finishes!\\n\\nThe "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":" function performs the following actions:\\n\\n- When running on the Apify platform (i.e. "},{"kind":"code","text":"`APIFY_IS_AT_HOME`"},{"kind":"text","text":" environment variable is set),\\n it sets up a connection to listen for platform events.\\n For example, to get a notification about an imminent migration to another server.\\n See "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.events"},{"kind":"text","text":" for details.\\n- It checks that either "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" or "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" environment variable\\n is defined. If not, the functions sets "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" to "},{"kind":"code","text":"`./apify_storage`"},{"kind":"text","text":"\\n inside the current working directory. This is to simplify running code examples.\\n- It invokes the user function passed as the "},{"kind":"code","text":"`userFunc`"},{"kind":"text","text":" parameter.\\n- If the user function returned a promise, waits for it to resolve.\\n- If the user function throws an exception or some other error is encountered,\\n prints error details to console so that they are stored to the log.\\n- Exits the Node.js process, with zero exit code on success and non-zero on errors.\\n\\nThe user function can be synchronous:\\n\\n"},{"kind":"code","text":"```javascript\\nawait Actor.main(() => {\\n // My synchronous function that returns immediately\\n console.log(\'Hello world from actor!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nIf the user function returns a promise, it is considered asynchronous:\\n"},{"kind":"code","text":"```javascript\\nimport { gotScraping } from \'got-scraping\';\\n\\nawait Actor.main(() => {\\n // My asynchronous function that returns a promise\\n return gotScraping(\'http://www.example.com\').then((html) => {\\n console.log(html);\\n });\\n});\\n```"},{"kind":"text","text":"\\n\\nTo simplify your code, you can take advantage of the "},{"kind":"code","text":"`async`"},{"kind":"text","text":"/"},{"kind":"code","text":"`await`"},{"kind":"text","text":" keywords:\\n\\n"},{"kind":"code","text":"```javascript\\nimport { gotScraping } from \'got-scraping\';\\n\\nawait Actor.main(async () => {\\n // My asynchronous function\\n const html = await gotScraping(\'http://www.example.com\');\\n console.log(html);\\n});\\n```"}]},"typeParameter":[{"id":840,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":841,"name":"userFunc","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"User function to be executed. If it returns a promise,\\nthe promise will be awaited. The user function is called with no arguments."}]},"type":{"type":"reference","id":1106,"typeArguments":[{"type":"reference","id":840,"name":"T"}],"name":"UserFunc"}},{"id":842,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1089,"name":"MainOptions"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":840,"name":"T"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":887,"name":"metamorph","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1201,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1201"}],"signatures":[{"id":888,"name":"metamorph","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms this actor run to an actor run of a given actor. The system stops the current container and starts\\nthe new container instead. All the default storages are preserved and the new input is stored under the "},{"kind":"code","text":"`INPUT-METAMORPH-1`"},{"kind":"text","text":" key\\nin the same default key-value store."}]},"parameters":[{"id":889,"name":"targetActorId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Either "},{"kind":"code","text":"`username/actor-name`"},{"kind":"text","text":" or actor ID of an actor to which we want to metamorph."}]},"type":{"type":"intrinsic","name":"string"}},{"id":890,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input for the actor. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Otherwise, the "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" parameter must be provided."}]},"type":{"type":"intrinsic","name":"unknown"}},{"id":891,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1136,"name":"MetamorphOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":942,"name":"newClient","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1491,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1491"}],"signatures":[{"id":943,"name":"newClient","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a new instance of the Apify API client. The "},{"kind":"code","text":"`ApifyClient`"},{"kind":"text","text":" class is provided\\nby the [apify-client](https://www.npmjs.com/package/apify-client)\\nNPM package, and it is automatically configured using the "},{"kind":"code","text":"`APIFY_API_BASE_URL`"},{"kind":"text","text":", and "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":"\\nenvironment variables. You can override the token via the available options. That\'s useful\\nif you want to use the client as a different Apify user than the SDK internals are using."}]},"parameters":[{"id":944,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":820,"name":"ApifyClientOptions","qualifiedName":"ApifyClientOptions","package":"apify-client"},"defaultValue":"{}"}],"type":{"type":"reference","id":750,"name":"ApifyClient","qualifiedName":"ApifyClient","package":"apify-client"}}]},{"id":861,"name":"off","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1083,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1083"}],"signatures":[{"id":862,"name":"off","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":863,"name":"event","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":864,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":865,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1083,"character":48,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1083"}],"signatures":[{"id":866,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":867,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":854,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1079,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1079"}],"signatures":[{"id":855,"name":"on","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":856,"name":"event","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":857,"name":"listener","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":858,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1079,"character":46,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1079"}],"signatures":[{"id":859,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":860,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":906,"name":"openDataset","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1284,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1284"}],"signatures":[{"id":907,"name":"openDataset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Opens a dataset and returns a promise resolving to an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class.\\n\\nDatasets are used to store structured data where each object stored has the same attributes,\\nsuch as online store products or real estate offers.\\nThe actual data is stored either on the local filesystem or in the cloud.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class."}]},"typeParameter":[{"id":908,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":909,"name":"datasetIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the dataset to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default dataset associated with the actor run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":910,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1147,"name":"OpenStorageOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1,"typeArguments":[{"type":"reference","id":908,"name":"Data"}],"name":"Dataset","qualifiedName":"Dataset","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":927,"name":"openKeyValueStore","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1408,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1408"}],"signatures":[{"id":928,"name":"openKeyValueStore","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Opens a key-value store and returns a promise resolving to an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" class.\\n\\nKey-value stores are used to store records or files, along with their MIME content type.\\nThe records are stored and retrieved using a unique key.\\nThe actual data is stored either on a local filesystem or in the Apify cloud.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" class."}]},"parameters":[{"id":929,"name":"storeIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the key-value store to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default key-value store associated with the actor run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":930,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1147,"name":"OpenStorageOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1514,"name":"KeyValueStore"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":931,"name":"openRequestQueue","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1428,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1428"}],"signatures":[{"id":932,"name":"openRequestQueue","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Opens a request queue and returns a promise resolving to an instance\\nof the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" class.\\n\\n"},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud.\\nThe queue is used for deep crawling of websites, where you start with several URLs and then\\nrecursively follow links to other pages. The data structure supports both breadth-first\\nand depth-first crawling orders.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" class."}]},"parameters":[{"id":933,"name":"queueIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the request queue to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default request queue associated with the actor run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":934,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1147,"name":"OpenStorageOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":122,"name":"RequestQueue","qualifiedName":"RequestQueue","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":902,"name":"pushData","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1266,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1266"}],"signatures":[{"id":903,"name":"pushData","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Stores an object or an array of objects to the default "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" of the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.pushData"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nawait Actor.pushData({ myValue: 123 });\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst dataset = await Actor.openDataset();\\nawait dataset.pushData({ myValue: 123 });\\n```"},{"kind":"text","text":"\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openDataset"},{"kind":"text","text":" and "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.pushData"},{"kind":"text","text":"\\n\\n**IMPORTANT**: Make sure to use the "},{"kind":"code","text":"`await`"},{"kind":"text","text":" keyword when calling "},{"kind":"code","text":"`pushData()`"},{"kind":"text","text":",\\notherwise the actor process might finish before the data are stored!"}]},"typeParameter":[{"id":904,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":905,"name":"item","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Object or array of objects containing data to be stored in the default dataset.\\nThe objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB."}]},"type":{"type":"union","types":[{"type":"reference","id":904,"name":"Data"},{"type":"array","elementType":{"type":"reference","id":904,"name":"Data"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":892,"name":"reboot","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1210,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1210"}],"signatures":[{"id":893,"name":"reboot","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Internally reboots this actor run. The system stops the current container and starts\\na new container with the same run id.\\nThis can be used to get the Actor out of irrecoverable error state and continue where it left off."}]},"parameters":[{"id":894,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1140,"name":"RebootOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":898,"name":"setStatusMessage","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1239,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1239"}],"signatures":[{"id":899,"name":"setStatusMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Sets the status message for the current actor run."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The return value is the Run object. When run locally, this method returns empty object ("},{"kind":"code","text":"`{}`"},{"kind":"text","text":").\\nFor more information, see the [Actor Runs](https://docs.apify.com/api/v2#/reference/actor-runs/) API endpoints."}]}]},"parameters":[{"id":900,"name":"statusMessage","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"The status message to set."}]},"type":{"type":"intrinsic","name":"string"}},{"id":901,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"SetStatusMessageOptions","qualifiedName":"SetStatusMessageOptions","package":"@crawlee/types"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":915,"name":"setValue","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1351,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1351"}],"signatures":[{"id":916,"name":"setValue","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Stores or deletes a value in the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.setValue"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nawait Actor.setValue(\'OUTPUT\', { foo: \\"bar\\" });\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst store = await Actor.openKeyValueStore();\\nawait store.setValue(\'OUTPUT\', { foo: \\"bar\\" });\\n```"},{"kind":"text","text":"\\n\\nTo get a value from the default key-value store, you can use the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getValue"},{"kind":"text","text":" function.\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openKeyValueStore"},{"kind":"text","text":"\\nand "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":"."}]},"typeParameter":[{"id":917,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":918,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Unique record key."}]},"type":{"type":"intrinsic","name":"string"}},{"id":919,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Record data, which can be one of the following values:\\n - If "},{"kind":"code","text":"`null`"},{"kind":"text","text":", the record in the key-value store is deleted.\\n - If no "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" can be any JavaScript object, and it will be stringified to JSON.\\n - If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is set, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is taken as is, and it must be a "},{"kind":"code","text":"`String`"},{"kind":"text","text":" or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html).\\n For any other value an error will be thrown."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":917,"name":"T"}]}},{"id":920,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":230,"name":"RecordOptions","qualifiedName":"RecordOptions","package":"@crawlee/core"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":878,"name":"start","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1166,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1166"}],"signatures":[{"id":879,"name":"start","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs an actor on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable),\\nunlike "},{"kind":"code","text":"`Actor.call`"},{"kind":"text","text":", this method just starts the run without waiting for finish.\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nFor more information about actors, read the\\n[documentation](https://docs.apify.com/actor).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.start(\'apify/hello-world\', { myInput: 123 });\\n```"}]},"parameters":[{"id":880,"name":"actorId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Allowed formats are "},{"kind":"code","text":"`username/actor-name`"},{"kind":"text","text":", "},{"kind":"code","text":"`userId/actor-name`"},{"kind":"text","text":" or actor ID."}]},"type":{"type":"intrinsic","name":"string"}},{"id":881,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input for the actor. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Otherwise the "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" parameter must be provided."}]},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}},{"id":882,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1110,"name":"CallOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":832,"name":"useState","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":981,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L981"}],"signatures":[{"id":833,"name":"useState","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Easily create and manage state values. All state values are automatically persisted.\\n\\nValues can be modified by simply using the assignment operator."}]},"typeParameter":[{"id":834,"name":"State","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":835,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The name of the store to use."}]},"type":{"type":"intrinsic","name":"string"}},{"id":836,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"If the store does not yet have a value in it, the value will be initialized with the "},{"kind":"code","text":"`defaultValue`"},{"kind":"text","text":" you provide."}]},"type":{"type":"reference","id":834,"name":"State"},"defaultValue":"..."},{"id":837,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional object parameter where a custom "},{"kind":"code","text":"`keyValueStoreName`"},{"kind":"text","text":" and "},{"kind":"code","text":"`config`"},{"kind":"text","text":" can be passed in."}]},"type":{"type":"reference","name":"UseStateOptions","qualifiedName":"UseStateOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":834,"name":"State"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]}],"groups":[{"title":"Constructors","children":[953]},{"title":"Properties","children":[960]},{"title":"Accessors","children":[947,949]},{"title":"Methods","children":[1046,1071,883,895,868,873,935,846,850,940,921,924,911,843,945,838,887,942,861,854,906,927,931,902,892,898,915,878,832]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":49,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L49"}],"typeParameters":[{"id":1086,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"permalink":"/sdk/js/reference/next/class/Actor","nextId":750},{"id":750,"name":"ApifyClient","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"ApifyClient is the official library to access [Apify API](https://docs.apify.com/api/v2) from your\\nJavaScript applications. It runs both in Node.js and browser."}]},"children":[{"id":751,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":37,"character":4}],"signatures":[{"id":752,"name":"new ApifyClient","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":753,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":820,"name":"ApifyClientOptions","qualifiedName":"ApifyClientOptions","package":"apify-client"}}],"type":{"type":"reference","id":750,"name":"ApifyClient","qualifiedName":"ApifyClient","package":"apify-client"}}]},{"id":754,"name":"baseUrl","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":32,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":758,"name":"httpClient","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":36,"character":4}],"type":{"type":"reference","name":"HttpClient","qualifiedName":"HttpClient","package":"apify-client"}},{"id":757,"name":"logger","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":35,"character":4}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}},{"id":756,"name":"stats","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":34,"character":4}],"type":{"type":"reference","name":"Statistics","qualifiedName":"Statistics","package":"apify-client"}},{"id":755,"name":"token","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":33,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":762,"name":"actor","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":46,"character":4}],"signatures":[{"id":763,"name":"actor","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actors/actor-object"}]},"parameters":[{"id":764,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ActorClient","qualifiedName":"ActorClient","package":"apify-client"}}]},{"id":760,"name":"actors","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":42,"character":4}],"signatures":[{"id":761,"name":"actors","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actors/actor-collection"}]},"type":{"type":"reference","name":"ActorCollectionClient","qualifiedName":"ActorCollectionClient","package":"apify-client"}}]},{"id":765,"name":"build","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":50,"character":4}],"signatures":[{"id":766,"name":"build","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-builds/build-object"}]},"parameters":[{"id":767,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"BuildClient","qualifiedName":"BuildClient","package":"apify-client"}}]},{"id":770,"name":"dataset","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":58,"character":4}],"signatures":[{"id":771,"name":"dataset","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/datasets/dataset"}]},"typeParameter":[{"id":772,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"},"default":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]},{"type":"intrinsic","name":"unknown"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"parameters":[{"id":773,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":772,"name":"Data","qualifiedName":"Data","package":"apify-client"}],"name":"DatasetClient","qualifiedName":"DatasetClient","package":"apify-client"}}]},{"id":768,"name":"datasets","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":54,"character":4}],"signatures":[{"id":769,"name":"datasets","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/datasets/dataset-collection"}]},"type":{"type":"reference","name":"DatasetCollectionClient","qualifiedName":"DatasetCollectionClient","package":"apify-client"}}]},{"id":776,"name":"keyValueStore","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":66,"character":4}],"signatures":[{"id":777,"name":"keyValueStore","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/key-value-stores/store-object"}]},"parameters":[{"id":778,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"KeyValueStoreClient","qualifiedName":"KeyValueStoreClient","package":"apify-client"}}]},{"id":774,"name":"keyValueStores","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":62,"character":4}],"signatures":[{"id":775,"name":"keyValueStores","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection"}]},"type":{"type":"reference","name":"KeyValueStoreCollectionClient","qualifiedName":"KeyValueStoreCollectionClient","package":"apify-client"}}]},{"id":779,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":70,"character":4}],"signatures":[{"id":780,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/logs"}]},"parameters":[{"id":781,"name":"buildOrRunId","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"LogClient","qualifiedName":"LogClient","package":"apify-client"}}]},{"id":784,"name":"requestQueue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":78,"character":4}],"signatures":[{"id":785,"name":"requestQueue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/request-queues/queue"}]},"parameters":[{"id":786,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":787,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"RequestQueueUserOptions","qualifiedName":"RequestQueueUserOptions","package":"apify-client"}}],"type":{"type":"reference","name":"RequestQueueClient","qualifiedName":"RequestQueueClient","package":"apify-client"}}]},{"id":782,"name":"requestQueues","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":74,"character":4}],"signatures":[{"id":783,"name":"requestQueues","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/request-queues/queue-collection"}]},"type":{"type":"reference","name":"RequestQueueCollectionClient","qualifiedName":"RequestQueueCollectionClient","package":"apify-client"}}]},{"id":788,"name":"run","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":82,"character":4}],"signatures":[{"id":789,"name":"run","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages"}]},"parameters":[{"id":790,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"RunClient","qualifiedName":"RunClient","package":"apify-client"}}]},{"id":798,"name":"schedule","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":98,"character":4}],"signatures":[{"id":799,"name":"schedule","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/schedules/schedule-object"}]},"parameters":[{"id":800,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ScheduleClient","qualifiedName":"ScheduleClient","package":"apify-client"}}]},{"id":796,"name":"schedules","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":94,"character":4}],"signatures":[{"id":797,"name":"schedules","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/schedules/schedules-collection"}]},"type":{"type":"reference","name":"ScheduleCollectionClient","qualifiedName":"ScheduleCollectionClient","package":"apify-client"}}]},{"id":816,"name":"setStatusMessage","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":123,"character":4}],"signatures":[{"id":817,"name":"setStatusMessage","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":818,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":819,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"SetStatusMessageOptions","qualifiedName":"SetStatusMessageOptions","package":"@crawlee/types"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":814,"name":"store","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":122,"character":4}],"signatures":[{"id":815,"name":"store","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2/#/reference/store"}]},"type":{"type":"reference","name":"StoreCollectionClient","qualifiedName":"StoreCollectionClient","package":"apify-client"}}]},{"id":793,"name":"task","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":90,"character":4}],"signatures":[{"id":794,"name":"task","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-tasks/task-object"}]},"parameters":[{"id":795,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"TaskClient","qualifiedName":"TaskClient","package":"apify-client"}}]},{"id":791,"name":"tasks","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":86,"character":4}],"signatures":[{"id":792,"name":"tasks","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection"}]},"type":{"type":"reference","name":"TaskCollectionClient","qualifiedName":"TaskCollectionClient","package":"apify-client"}}]},{"id":801,"name":"user","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":102,"character":4}],"signatures":[{"id":802,"name":"user","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/users"}]},"parameters":[{"id":803,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"UserClient","qualifiedName":"UserClient","package":"apify-client"}}]},{"id":806,"name":"webhook","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":110,"character":4}],"signatures":[{"id":807,"name":"webhook","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhooks/webhook-object"}]},"parameters":[{"id":808,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"WebhookClient","qualifiedName":"WebhookClient","package":"apify-client"}}]},{"id":811,"name":"webhookDispatch","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":118,"character":4}],"signatures":[{"id":812,"name":"webhookDispatch","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object"}]},"parameters":[{"id":813,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"WebhookDispatchClient","qualifiedName":"WebhookDispatchClient","package":"apify-client"}}]},{"id":809,"name":"webhookDispatches","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":114,"character":4}],"signatures":[{"id":810,"name":"webhookDispatches","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhook-dispatches"}]},"type":{"type":"reference","name":"WebhookDispatchCollectionClient","qualifiedName":"WebhookDispatchCollectionClient","package":"apify-client"}}]},{"id":804,"name":"webhooks","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":106,"character":4}],"signatures":[{"id":805,"name":"webhooks","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection"}]},"type":{"type":"reference","name":"WebhookCollectionClient","qualifiedName":"WebhookCollectionClient","package":"apify-client"}}]}],"groups":[{"title":"Constructors","children":[751]},{"title":"Properties","children":[754,758,757,756,755]},{"title":"Methods","children":[762,760,765,770,768,776,774,779,784,782,788,798,796,816,814,793,791,801,806,811,809,804]}],"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":31,"character":21}],"permalink":"/sdk/js/reference/next/class/ApifyClient","previousId":830,"nextId":1237},{"id":1237,"name":"Configuration","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"code","text":"`Configuration`"},{"kind":"text","text":" is a value object holding the SDK configuration. We can use it in two ways:\\n\\n1. When using "},{"kind":"code","text":"`Actor`"},{"kind":"text","text":" class, we can get the instance configuration via "},{"kind":"code","text":"`sdk.config`"},{"kind":"text","text":"\\n\\n "},{"kind":"code","text":"```javascript\\n import { Actor } from \'apify\';\\n import { BasicCrawler } from \'crawlee\';\\n\\n const sdk = new Actor({ token: \'123\' });\\n console.log(sdk.config.get(\'token\')); // \'123\'\\n\\n const crawler = new BasicCrawler({\\n // ... crawler options\\n }, sdk.config);\\n ```"},{"kind":"text","text":"\\n\\n2. To get the global configuration (singleton instance). It will respect the environment variables.\\n\\n "},{"kind":"code","text":"```javascript\\n import { BasicCrawler, Configuration } from \'crawlee\';\\n\\n // Get the global configuration\\n const config = Configuration.getGlobalConfig();\\n // Set the \'persistStateIntervalMillis\' option\\n // of global configuration to 30 seconds\\n config.set(\'persistStateIntervalMillis\', 30_000);\\n\\n // No need to pass the configuration to the crawler,\\n // as it\'s using the global configuration by default\\n const crawler = new BasicCrawler();\\n ```"},{"kind":"text","text":"\\n\\n## Supported Configuration Options\\n\\nKey | Environment Variable | Default Value\\n---|---|---\\n"},{"kind":"code","text":"`memoryMbytes`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_MEMORY_MBYTES`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`headless`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_HEADLESS`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`persistStateIntervalMillis`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PERSIST_STATE_INTERVAL_MILLIS`"},{"kind":"text","text":" | "},{"kind":"code","text":"`60e3`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`token`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`isAtHome`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_IS_AT_HOME`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`defaultDatasetId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_DEFAULT_DATASET_ID`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'default\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`defaultKeyValueStoreId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_DEFAULT_KEY_VALUE_STORE_ID`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'default\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`defaultRequestQueueId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_DEFAULT_REQUEST_QUEUE_ID`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'default\'`"},{"kind":"text","text":"\\n\\n## Advanced Configuration Options\\n\\nKey | Environment Variable | Default Value\\n---|---|---\\n"},{"kind":"code","text":"`actorEventsWsUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_EVENTS_WEBSOCKET_URL`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`actorId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`actorRunId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_RUN_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`actorTaskId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_TASK_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`apiBaseUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_API_BASE_URL`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'https://api.apify.com\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`containerPort`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_WEB_SERVER_PORT`"},{"kind":"text","text":" | "},{"kind":"code","text":"`4321`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`containerUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_WEB_SERVER_URL`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'http://localhost:4321\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`inputKey`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_INPUT_KEY`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'INPUT\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`metamorphAfterSleepMillis`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_METAMORPH_AFTER_SLEEP_MILLIS`"},{"kind":"text","text":" | "},{"kind":"code","text":"`300e3`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`proxyHostname`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_HOSTNAME`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'proxy.apify.com\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`proxyPassword`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_PASSWORD`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`proxyPort`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_PORT`"},{"kind":"text","text":" | "},{"kind":"code","text":"`8000`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`proxyStatusUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_STATUS_URL`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'http://proxy.apify.com\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`userId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_USER_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`xvfb`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_XVFB`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`chromeExecutablePath`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_CHROME_EXECUTABLE_PATH`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`defaultBrowserPath`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_DEFAULT_BROWSER_PATH`"},{"kind":"text","text":" | -"}]},"children":[{"id":1315,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":226,"character":4}],"signatures":[{"id":1316,"name":"new Configuration","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates new "},{"kind":"code","text":"`Configuration`"},{"kind":"text","text":" instance with provided options. Env vars will have precedence over those."}]},"parameters":[{"id":1317,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"}}],"type":{"type":"reference","id":1237,"name":"Configuration"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.constructor"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.constructor"}},{"id":1372,"name":"storageManagers","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":222,"character":13}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"Constructor","qualifiedName":"Constructor","package":"@crawlee/core"},{"type":"reference","typeArguments":[{"type":"reference","name":"IStorage","qualifiedName":"IStorage","package":"@crawlee/core"}],"name":"StorageManager","qualifiedName":"StorageManager","package":"@crawlee/core"}],"name":"Map","qualifiedName":"Map","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.storageManagers"}},{"id":1238,"name":"globalConfig","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":100,"character":20,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L100"}],"type":{"type":"reference","id":1237,"name":"Configuration"},"overwrites":{"type":"reference","name":"CoreConfiguration.globalConfig"}},{"id":1318,"name":"get","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":179,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L179"}],"signatures":[{"id":1319,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"typeParameter":[{"id":1320,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"typeOperator","operator":"keyof","target":{"type":"reference","id":1178,"name":"ConfigurationOptions"}}},{"id":1342,"name":"U","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"},{"type":"intrinsic","name":"boolean"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},{"type":"reflection","declaration":{"id":1321,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":551,"character":4}],"signatures":[{"id":1322,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string representation of an object."}]},"parameters":[{"id":1323,"name":"radix","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a radix for converting numeric values to strings. This value is only used for numbers."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1324,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":557,"character":4}],"signatures":[{"id":1325,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string representing a number in fixed-point notation."}]},"parameters":[{"id":1326,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of digits after the decimal point. Must be in the range 0 - 20, inclusive."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1327,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":563,"character":4}],"signatures":[{"id":1328,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string containing a number represented in exponential notation."}]},"parameters":[{"id":1329,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of digits after the decimal point. Must be in the range 0 - 20, inclusive."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1330,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":569,"character":4}],"signatures":[{"id":1331,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits."}]},"parameters":[{"id":1332,"name":"precision","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of significant digits. Must be in the range 1 - 21, inclusive."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1333,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":572,"character":4}],"signatures":[{"id":1334,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the primitive value of the specified object."}]},"type":{"type":"intrinsic","name":"number"}}]}},{"type":"reflection","declaration":{"id":1335,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":4499,"character":4},{"fileName":"website/node_modules/typescript/lib/lib.es2020.number.d.ts","line":27,"character":4}],"signatures":[{"id":1336,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Converts a number to a string by using the current or specified locale."}]},"parameters":[{"id":1337,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]}},{"id":1338,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An object that contains one or more properties that specify comparison options."}]},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}},{"id":1339,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Converts a number to a string by using the current or specified locale."}]},"parameters":[{"id":1340,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used."}]},"type":{"type":"reference","name":"LocalesArgument","qualifiedName":"Intl.LocalesArgument","package":"typescript"}},{"id":1341,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An object that contains one or more properties that specify comparison options."}]},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}}]}}]}}],"parameters":[{"id":1343,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1320,"name":"T"}},{"id":1344,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1342,"name":"U"}}],"type":{"type":"reference","id":1342,"name":"U"},"overwrites":{"type":"reference","name":"CoreConfiguration.get"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.get"}},{"id":1379,"name":"getEventManager","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":254,"character":4}],"signatures":[{"id":1380,"name":"getEventManager","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}},{"id":1345,"name":"set","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":186,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L186"}],"signatures":[{"id":1346,"name":"set","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"parameters":[{"id":1347,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeOperator","operator":"keyof","target":{"type":"reference","id":1178,"name":"ConfigurationOptions"}}},{"id":1348,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"overwrites":{"type":"reference","name":"CoreConfiguration.set"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.set"}},{"id":1387,"name":"useEventManager","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":262,"character":4}],"signatures":[{"id":1388,"name":"useEventManager","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1389,"name":"events","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useEventManager"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useEventManager"}},{"id":1384,"name":"useStorageClient","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":260,"character":4}],"signatures":[{"id":1385,"name":"useStorageClient","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1386,"name":"client","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}},{"id":1313,"name":"getEventManager","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":274,"character":11}],"signatures":[{"id":1314,"name":"getEventManager","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets default "},{"kind":"inline-tag","tag":"@apilink","text":"EventManager"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}},{"id":1299,"name":"getGlobalConfig","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":193,"character":20,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L193"}],"signatures":[{"id":1300,"name":"getGlobalConfig","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"type":{"type":"reference","id":1237,"name":"Configuration"},"overwrites":{"type":"reference","name":"CoreConfiguration.getGlobalConfig"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.getGlobalConfig"}},{"id":1311,"name":"getStorageClient","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":270,"character":11}],"signatures":[{"id":1312,"name":"getStorageClient","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets default "},{"kind":"inline-tag","tag":"@apilink","text":"StorageClient"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getStorageClient"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getStorageClient"}},{"id":1301,"name":"resetGlobalState","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":206,"character":20,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L206"}],"signatures":[{"id":1302,"name":"resetGlobalState","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Resets global configuration instance. The default instance holds configuration based on env vars,\\nif we want to change them, we need to first reset the global state. Used mainly for testing purposes."}]},"type":{"type":"intrinsic","name":"void"},"overwrites":{"type":"reference","name":"CoreConfiguration.resetGlobalState"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.resetGlobalState"}},{"id":1304,"name":"set","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":243,"character":11}],"signatures":[{"id":1305,"name":"set","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Sets value for given option. Only affects the global "},{"kind":"code","text":"`Configuration`"},{"kind":"text","text":" instance, the value will not be propagated down to the env var.\\nTo reset a value, we can omit the "},{"kind":"code","text":"`value`"},{"kind":"text","text":" argument or pass "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":" there."}]},"parameters":[{"id":1306,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"typeOperator","operator":"keyof","target":{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"}}},{"id":1307,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.set"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.set"}},{"id":1308,"name":"useStorageClient","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":261,"character":11}],"signatures":[{"id":1309,"name":"useStorageClient","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1310,"name":"client","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}}],"groups":[{"title":"Constructors","children":[1315]},{"title":"Properties","children":[1372,1238]},{"title":"Methods","children":[1318,1379,1345,1387,1384,1313,1299,1311,1301,1304,1308]}],"sources":[{"fileName":"packages/apify/src/configuration.ts","line":98,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L98"}],"extendedTypes":[{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/Configuration","previousId":750,"nextId":1},{"id":1,"name":"Dataset","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The "},{"kind":"code","text":"`Dataset`"},{"kind":"text","text":" class represents a store for structured data where each object stored has the same attributes,\\nsuch as online store products or real estate offers. You can imagine it as a table,\\nwhere each object is a row and its attributes are columns.\\nDataset is an append-only storage - you can only add new records to it but you cannot modify or remove existing records.\\nTypically it is used to store crawling results.\\n\\nDo not instantiate this class directly, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.open"},{"kind":"text","text":" function instead.\\n\\n"},{"kind":"code","text":"`Dataset`"},{"kind":"text","text":" stores its data either on local disk or in the Apify cloud,\\ndepending on whether the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" or "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variables are set.\\n\\nIf the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" environment variable is set, the data is stored in\\nthe local directory in the following files:\\n"},{"kind":"code","text":"```\\n{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\\n```"},{"kind":"text","text":"\\nNote that "},{"kind":"code","text":"`{DATASET_ID}`"},{"kind":"text","text":" is the name or ID of the dataset. The default dataset has ID: "},{"kind":"code","text":"`default`"},{"kind":"text","text":",\\nunless you override it by setting the "},{"kind":"code","text":"`APIFY_DEFAULT_DATASET_ID`"},{"kind":"text","text":" environment variable.\\nEach dataset item is stored as a separate JSON file, where "},{"kind":"code","text":"`{INDEX}`"},{"kind":"text","text":" is a zero-based index of the item in the dataset.\\n\\nIf the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable is set but "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" not, the data is stored in the\\n[Apify Dataset](https://docs.apify.com/storage/dataset)\\ncloud storage. Note that you can force usage of the cloud storage also by passing the "},{"kind":"code","text":"`forceCloud`"},{"kind":"text","text":"\\noption to "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.open"},{"kind":"text","text":" function,\\neven if the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" variable is set.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n// Write a single row to the default dataset\\nawait Dataset.pushData({ col1: 123, col2: \'val2\' });\\n\\n// Open a named dataset\\nconst dataset = await Dataset.open(\'some-name\');\\n\\n// Write a single row\\nawait dataset.pushData({ foo: \'bar\' });\\n\\n// Write multiple rows\\nawait dataset.pushData([\\n { foo: \'bar2\', col2: \'val2\' },\\n { col3: 123 },\\n]);\\n\\n// Export the entirety of the dataset to one file in the key-value store\\nawait dataset.exportToCSV(\'MY-DATA\');\\n```"}]},"children":[{"id":31,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":144,"character":4}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetClient","qualifiedName":"DatasetClient","package":"@crawlee/types"}},{"id":28,"name":"config","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":141,"character":13}],"type":{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"}},{"id":29,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":142,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":32,"name":"log","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":145,"character":4}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}},{"id":30,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":143,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":70,"name":"drop","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":289,"character":4}],"signatures":[{"id":71,"name":"drop","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the dataset either from the Apify cloud storage or from the local directory,\\ndepending on the mode of operation."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":39,"name":"exportTo","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":186,"character":4}],"signatures":[{"id":40,"name":"exportTo","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save the entirety of the dataset\'s contents into one file within a key-value store."}]},"parameters":[{"id":41,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":42,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the dataset and target KVS name."}]},"type":{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"}},{"id":43,"name":"contentType","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Only JSON and CSV are supported currently, defaults to JSON."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":48,"name":"exportToCSV","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":200,"character":4}],"signatures":[{"id":49,"name":"exportToCSV","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one CSV file within a key-value store."}]},"parameters":[{"id":50,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":51,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the target KVS name."}]},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"},{"type":"literal","value":"fromDataset"}],"name":"Omit","qualifiedName":"Omit","package":"typescript"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":44,"name":"exportToJSON","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":193,"character":4}],"signatures":[{"id":45,"name":"exportToJSON","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one JSON file within a key-value store."}]},"parameters":[{"id":46,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":47,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the target KVS name."}]},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"},{"type":"literal","value":"fromDataset"}],"name":"Omit","qualifiedName":"Omit","package":"typescript"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":54,"name":"forEach","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":258,"character":4}],"signatures":[{"id":55,"name":"forEach","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Iterates over dataset items, yielding each in turn to an "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function.\\nEach invocation of "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" is called with two arguments: "},{"kind":"code","text":"`(item, index)`"},{"kind":"text","text":".\\n\\nIf the "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function returns a Promise then it is awaited before the next call.\\nIf it throws an error, the iteration is aborted and the "},{"kind":"code","text":"`forEach`"},{"kind":"text","text":" function throws the error.\\n\\n**Example usage**\\n"},{"kind":"code","text":"```javascript\\nconst dataset = await Dataset.open(\'my-results\');\\nawait dataset.forEach(async (item, index) => {\\n console.log(`Item at ${index}: ${JSON.stringify(item)}`);\\n});\\n```"}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0"}]}]},"parameters":[{"id":56,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A function that is called for every item in the dataset."}]},"type":{"type":"reference","id":92,"typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetConsumer","qualifiedName":"DatasetConsumer","package":"@crawlee/core"}},{"id":57,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`forEach()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":82,"name":"DatasetIteratorOptions","qualifiedName":"DatasetIteratorOptions","package":"@crawlee/core"}},{"id":58,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies the initial index number passed to the "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":36,"name":"getData","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":178,"character":4}],"signatures":[{"id":37,"name":"getData","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns "},{"kind":"inline-tag","tag":"@apilink","text":"DatasetContent"},{"kind":"text","text":" object holding the items in the dataset based on the provided parameters."}]},"parameters":[{"id":38,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":73,"name":"DatasetDataOptions","qualifiedName":"DatasetDataOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":114,"typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetContent","qualifiedName":"DatasetContent","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":52,"name":"getInfo","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":237,"character":4}],"signatures":[{"id":53,"name":"getInfo","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an object containing general information about the dataset.\\n\\nThe function returns the same object as the Apify API Client\'s\\n[getDataset](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-datasets-getDataset)\\nfunction, which in turn calls the\\n[Get dataset](https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset)\\nAPI endpoint.\\n\\n**Example:**\\n"},{"kind":"code","text":"```\\n{\\n id: \\"WkzbQMuFYuamGv3YF\\",\\n name: \\"my-dataset\\",\\n userId: \\"wRsJZtadYvn4mBZmm\\",\\n createdAt: new Date(\\"2015-12-12T07:34:14.202Z\\"),\\n modifiedAt: new Date(\\"2015-12-13T08:36:13.202Z\\"),\\n accessedAt: new Date(\\"2015-12-14T08:36:13.202Z\\"),\\n itemCount: 14,\\n}\\n```"}]},"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"DatasetInfo","qualifiedName":"DatasetInfo","package":"@crawlee/types"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":59,"name":"map","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":268,"character":4}],"signatures":[{"id":60,"name":"map","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Produces a new array of values by mapping each value in list through a transformation function "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":".\\nEach invocation of "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" is called with two arguments: "},{"kind":"code","text":"`(element, index)`"},{"kind":"text","text":".\\n\\nIf "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" then it\'s awaited before a next call."}]},"typeParameter":[{"id":61,"name":"R","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"parameters":[{"id":62,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":97,"typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"},{"type":"reference","id":61,"name":"R","qualifiedName":"R","package":"@crawlee/core"}],"name":"DatasetMapper","qualifiedName":"DatasetMapper","package":"@crawlee/core"}},{"id":63,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`map()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":82,"name":"DatasetIteratorOptions","qualifiedName":"DatasetIteratorOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"reference","id":61,"name":"R","qualifiedName":"R","package":"@crawlee/core"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":33,"name":"pushData","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":174,"character":4}],"signatures":[{"id":34,"name":"pushData","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Stores an object or an array of objects to the dataset.\\nThe function returns a promise that resolves when the operation finishes.\\nIt has no result, but throws on invalid args or other errors.\\n\\n**IMPORTANT**: Make sure to use the "},{"kind":"code","text":"`await`"},{"kind":"text","text":" keyword when calling "},{"kind":"code","text":"`pushData()`"},{"kind":"text","text":",\\notherwise the crawler process might finish before the data is stored!\\n\\nThe size of the data is limited by the receiving API and therefore "},{"kind":"code","text":"`pushData()`"},{"kind":"text","text":" will only\\nallow objects whose JSON representation is smaller than 9MB. When an array is passed,\\nnone of the included objects\\nmay be larger than 9MB, but the array itself may be of any size.\\n\\nThe function internally\\nchunks the array into separate items and pushes them sequentially.\\nThe chunking process is stable (keeps order of data), but it does not provide a transaction\\nsafety mechanism. Therefore, in the event of an uploading error (after several automatic retries),\\nthe function\'s Promise will reject and the dataset will be left in a state where some of\\nthe items have already been saved to the dataset while other items from the source array were not.\\nTo overcome this limitation, the developer may, for example, read the last item saved in the dataset\\nand re-attempt the save of the data from this item onwards to prevent duplicates."}]},"parameters":[{"id":35,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Object or array of objects containing data to be stored in the default dataset.\\n The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB."}]},"type":{"type":"union","types":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"},{"type":"array","elementType":{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":64,"name":"reduce","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":284,"character":4}],"signatures":[{"id":65,"name":"reduce","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Reduces a list of values down to a single value.\\n\\nMemo is the initial state of the reduction, and each successive step of it should be returned by "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":".\\nThe "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" is passed three arguments: the "},{"kind":"code","text":"`memo`"},{"kind":"text","text":", then the "},{"kind":"code","text":"`value`"},{"kind":"text","text":" and "},{"kind":"code","text":"`index`"},{"kind":"text","text":" of the iteration.\\n\\nIf no "},{"kind":"code","text":"`memo`"},{"kind":"text","text":" is passed to the initial invocation of reduce, the "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" is not invoked on the first element of the list.\\nThe first element is instead passed as the memo in the invocation of the "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" on the next element in the list.\\n\\nIf "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" then it\'s awaited before a next call."}]},"typeParameter":[{"id":66,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"parameters":[{"id":67,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":103,"typeArguments":[{"type":"reference","id":66,"name":"T","qualifiedName":"T","package":"@crawlee/core"},{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetReducer","qualifiedName":"DatasetReducer","package":"@crawlee/core"}},{"id":68,"name":"memo","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Initial state of the reduction."}]},"type":{"type":"reference","id":66,"name":"T","qualifiedName":"T","package":"@crawlee/core"}},{"id":69,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`reduce()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":82,"name":"DatasetIteratorOptions","qualifiedName":"DatasetIteratorOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":66,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":6,"name":"exportToCSV","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":214,"character":11}],"signatures":[{"id":7,"name":"exportToCSV","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one CSV file within a key-value store."}]},"parameters":[{"id":8,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":9,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the dataset and target KVS name."}]},"type":{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":2,"name":"exportToJSON","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":207,"character":11}],"signatures":[{"id":3,"name":"exportToJSON","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one JSON file within a key-value store."}]},"parameters":[{"id":4,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":5,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the dataset and target KVS name."}]},"type":{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":19,"name":"getData","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":333,"character":11}],"signatures":[{"id":20,"name":"getData","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns "},{"kind":"inline-tag","tag":"@apilink","text":"DatasetContent"},{"kind":"text","text":" object holding the items in the dataset based on the provided parameters."}]},"typeParameter":[{"id":21,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":22,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":73,"name":"DatasetDataOptions","qualifiedName":"DatasetDataOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":114,"typeArguments":[{"type":"reference","id":21,"name":"Data","qualifiedName":"Data","package":"@crawlee/core"}],"name":"DatasetContent","qualifiedName":"DatasetContent","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":10,"name":"open","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":304,"character":11}],"signatures":[{"id":11,"name":"open","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Opens a dataset and returns a promise resolving to an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class.\\n\\nDatasets are used to store structured data where each object stored has the same attributes,\\nsuch as online store products or real estate offers.\\nThe actual data is stored either on the local filesystem or in the cloud.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class."}]},"typeParameter":[{"id":12,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":13,"name":"datasetIdOrName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the dataset to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default dataset associated with the crawler run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":14,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Storage manager options."}]},"type":{"type":"reference","name":"StorageManagerOptions","qualifiedName":"StorageManagerOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1,"typeArguments":[{"type":"reference","id":12,"name":"Data","qualifiedName":"Data","package":"@crawlee/core"}],"name":"Dataset","qualifiedName":"Dataset","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]}],"groups":[{"title":"Properties","children":[31,28,29,32,30]},{"title":"Methods","children":[70,39,48,44,54,36,52,59,33,64,6,2,19,10]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":140,"character":21}],"typeParameters":[{"id":72,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"permalink":"/sdk/js/reference/next/class/Dataset","previousId":1237,"nextId":1514},{"id":1514,"name":"KeyValueStore","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"children":[{"id":1548,"name":"config","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":71,"character":13}],"type":{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.config"}},{"id":1549,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":72,"character":13}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.id"}},{"id":1550,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":73,"character":13}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.name"}},{"id":1570,"name":"drop","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":196,"character":4}],"signatures":[{"id":1571,"name":"drop","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the key-value store either from the Apify cloud storage or from the local directory,\\ndepending on the mode of operation."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.drop"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.drop"}},{"id":1574,"name":"forEachKey","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":220,"character":4}],"signatures":[{"id":1575,"name":"forEachKey","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Iterates over key-value store keys, yielding each in turn to an "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function.\\nEach invocation of "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" is called with three arguments: "},{"kind":"code","text":"`(key, index, info)`"},{"kind":"text","text":", where "},{"kind":"code","text":"`key`"},{"kind":"text","text":"\\nis the record key, "},{"kind":"code","text":"`index`"},{"kind":"text","text":" is a zero-based index of the key in the current iteration\\n(regardless of "},{"kind":"code","text":"`options.exclusiveStartKey`"},{"kind":"text","text":") and "},{"kind":"code","text":"`info`"},{"kind":"text","text":" is an object that contains a single property "},{"kind":"code","text":"`size`"},{"kind":"text","text":"\\nindicating size of the record in bytes.\\n\\nIf the "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function returns a Promise then it is awaited before the next call.\\nIf it throws an error, the iteration is aborted and the "},{"kind":"code","text":"`forEachKey`"},{"kind":"text","text":" function throws the error.\\n\\n**Example usage**\\n"},{"kind":"code","text":"```javascript\\nconst keyValueStore = await KeyValueStore.open();\\nawait keyValueStore.forEachKey(async (key, index, info) => {\\n console.log(`Key at ${index}: ${key} has size ${info.size}`);\\n});\\n```"}]},"parameters":[{"id":1576,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A function that is called for every key in the key-value store."}]},"type":{"type":"reference","id":219,"name":"KeyConsumer","qualifiedName":"KeyConsumer","package":"@crawlee/core"}},{"id":1577,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`forEachKey()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":232,"name":"KeyValueStoreIteratorOptions","qualifiedName":"KeyValueStoreIteratorOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.forEachKey"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.forEachKey"}},{"id":1559,"name":"getAutoSavedValue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":146,"character":4}],"signatures":[{"id":1560,"name":"getAutoSavedValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"typeParameter":[{"id":1561,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":1562,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":1563,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":1561,"name":"T","qualifiedName":"T","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1561,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}},{"id":1545,"name":"getPublicUrl","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/key_value_store.ts","line":12,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/key_value_store.ts#L12"}],"signatures":[{"id":1546,"name":"getPublicUrl","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a URL for the given key that may be used to publicly\\naccess the value in the remote key-value store."}]},"parameters":[{"id":1547,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"string"}}]},{"id":1551,"name":"getValue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":112,"character":4},{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":145,"character":4}],"signatures":[{"id":1552,"name":"getValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets a value from the key-value store.\\n\\nThe function returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that resolves to the record value,\\nwhose JavaScript type depends on the MIME content type of the record.\\nRecords with the "},{"kind":"code","text":"`application/json`"},{"kind":"text","text":"\\ncontent type are automatically parsed and returned as a JavaScript object.\\nSimilarly, records with "},{"kind":"code","text":"`text/plain`"},{"kind":"text","text":" content types are returned as a string.\\nFor all other content types, the value is returned as a raw\\n["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html) instance.\\n\\nIf the record does not exist, the function resolves to "},{"kind":"code","text":"`null`"},{"kind":"text","text":".\\n\\nTo save or delete a value in the key-value store, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.setValue"},{"kind":"text","text":" function.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open();\\nconst buffer = await store.getValue(\'screenshot1.png\');\\n```"}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record."}]}]},"typeParameter":[{"id":1553,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"default":{"type":"intrinsic","name":"unknown"}}],"parameters":[{"id":1554,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Unique key of the record. It can be at most 256 characters long and only consist\\n of the following characters: "},{"kind":"code","text":"`a`"},{"kind":"text","text":"-"},{"kind":"code","text":"`z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A`"},{"kind":"text","text":"-"},{"kind":"code","text":"`Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`0`"},{"kind":"text","text":"-"},{"kind":"code","text":"`9`"},{"kind":"text","text":" and "},{"kind":"code","text":"`!-_.\'()`"}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":1553,"name":"T","qualifiedName":"T","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getValue"}},{"id":1555,"name":"getValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets a value from the key-value store.\\n\\nThe function returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that resolves to the record value,\\nwhose JavaScript type depends on the MIME content type of the record.\\nRecords with the "},{"kind":"code","text":"`application/json`"},{"kind":"text","text":"\\ncontent type are automatically parsed and returned as a JavaScript object.\\nSimilarly, records with "},{"kind":"code","text":"`text/plain`"},{"kind":"text","text":" content types are returned as a string.\\nFor all other content types, the value is returned as a raw\\n["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html) instance.\\n\\nIf the record does not exist, the function resolves to "},{"kind":"code","text":"`null`"},{"kind":"text","text":".\\n\\nTo save or delete a value in the key-value store, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.setValue"},{"kind":"text","text":" function.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open();\\nconst buffer = await store.getValue(\'screenshot1.png\');\\n```"}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record, or the default value if the key is missing from the store."}]}]},"typeParameter":[{"id":1556,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"default":{"type":"intrinsic","name":"unknown"}}],"parameters":[{"id":1557,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Unique key of the record. It can be at most 256 characters long and only consist\\n of the following characters: "},{"kind":"code","text":"`a`"},{"kind":"text","text":"-"},{"kind":"code","text":"`z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A`"},{"kind":"text","text":"-"},{"kind":"code","text":"`Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`0`"},{"kind":"text","text":"-"},{"kind":"code","text":"`9`"},{"kind":"text","text":" and "},{"kind":"code","text":"`!-_.\'()`"}]},"type":{"type":"intrinsic","name":"string"}},{"id":1558,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Fallback that will be returned if no value if present in the storage."}]},"type":{"type":"reference","id":1556,"name":"T","qualifiedName":"T","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1556,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getValue"}},{"id":1564,"name":"setValue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":191,"character":4}],"signatures":[{"id":1565,"name":"setValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Saves or deletes a record in the key-value store.\\nThe function returns a promise that resolves once the record has been saved or deleted.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open();\\nawait store.setValue(\'OUTPUT\', { foo: \'bar\' });\\n```"},{"kind":"text","text":"\\n\\nBeware that the key can be at most 256 characters long and only contain the following characters: "},{"kind":"code","text":"`a-zA-Z0-9!-_.\'()`"},{"kind":"text","text":"\\n\\nBy default, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is converted to JSON and stored with the\\n"},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":" MIME content type.\\nTo store the value with another content type, pass it in the options as follows:\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open(\'my-text-store\');\\nawait store.setValue(\'RESULTS\', \'my text data\', { contentType: \'text/plain\' });\\n```"},{"kind":"text","text":"\\nIf you set custom content type, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" must be either a string or\\n["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), otherwise an error will be thrown.\\n\\nIf "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is "},{"kind":"code","text":"`null`"},{"kind":"text","text":", the record is deleted instead. Note that the "},{"kind":"code","text":"`setValue()`"},{"kind":"text","text":" function succeeds\\nregardless whether the record existed or not.\\n\\nTo retrieve a value from the key-value store, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":" function.\\n\\n**IMPORTANT:** Always make sure to use the "},{"kind":"code","text":"`await`"},{"kind":"text","text":" keyword when calling "},{"kind":"code","text":"`setValue()`"},{"kind":"text","text":",\\notherwise the crawler process might finish before the value is stored!"}]},"typeParameter":[{"id":1566,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"parameters":[{"id":1567,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Unique key of the record. It can be at most 256 characters long and only consist\\n of the following characters: "},{"kind":"code","text":"`a`"},{"kind":"text","text":"-"},{"kind":"code","text":"`z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A`"},{"kind":"text","text":"-"},{"kind":"code","text":"`Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`0`"},{"kind":"text","text":"-"},{"kind":"code","text":"`9`"},{"kind":"text","text":" and "},{"kind":"code","text":"`!-_.\'()`"}]},"type":{"type":"intrinsic","name":"string"}},{"id":1568,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Record data, which can be one of the following values:\\n - If "},{"kind":"code","text":"`null`"},{"kind":"text","text":", the record in the key-value store is deleted.\\n - If no "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" can be any JavaScript object and it will be stringified to JSON.\\n - If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is set, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is taken as is and it must be a "},{"kind":"code","text":"`String`"},{"kind":"text","text":" or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html).\\n For any other value an error will be thrown."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":1566,"name":"T","qualifiedName":"T","package":"@crawlee/core"}]}},{"id":1569,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Record options."}]},"type":{"type":"reference","id":230,"name":"RecordOptions","qualifiedName":"RecordOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.setValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.setValue"}},{"id":1527,"name":"getAutoSavedValue","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":295,"character":11}],"signatures":[{"id":1528,"name":"getAutoSavedValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"typeParameter":[{"id":1529,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":1530,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":1531,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":1529,"name":"T","qualifiedName":"T","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1529,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}},{"id":1515,"name":"open","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/key_value_store.ts","line":19,"character":26,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/key_value_store.ts#L19"}],"signatures":[{"id":1516,"name":"open","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"parameters":[{"id":1517,"name":"storeIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1518,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"StorageManagerOptions","qualifiedName":"StorageManagerOptions","package":"@crawlee/core"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1514,"name":"KeyValueStore"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"CoreKeyValueStore.open"}}],"overwrites":{"type":"reference","name":"CoreKeyValueStore.open"}}],"groups":[{"title":"Properties","children":[1548,1549,1550]},{"title":"Methods","children":[1570,1574,1559,1545,1551,1564,1527,1515]}],"sources":[{"fileName":"packages/apify/src/key_value_store.ts","line":7,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/key_value_store.ts#L7"}],"extendedTypes":[{"type":"reference","name":"KeyValueStore","qualifiedName":"KeyValueStore","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/KeyValueStore","previousId":1,"nextId":235},{"id":235,"name":"Log","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The log instance enables level aware logging of messages and we advise\\nto use it instead of "},{"kind":"code","text":"`console.log()`"},{"kind":"text","text":" and its aliases in most development\\nscenarios.\\n\\nA very useful use case for "},{"kind":"code","text":"`log`"},{"kind":"text","text":" is using "},{"kind":"code","text":"`log.debug`"},{"kind":"text","text":" liberally throughout\\nthe codebase to get useful logging messages only when appropriate log level is set\\nand keeping the console tidy in production environments.\\n\\nThe available logging levels are, in this order: "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":", "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":", "},{"kind":"code","text":"`WARNING`"},{"kind":"text","text":", "},{"kind":"code","text":"`ERROR`"},{"kind":"text","text":", "},{"kind":"code","text":"`OFF`"},{"kind":"text","text":"\\nand can be referenced from the "},{"kind":"code","text":"`log.LEVELS`"},{"kind":"text","text":" constant, such as "},{"kind":"code","text":"`log.LEVELS.ERROR`"},{"kind":"text","text":".\\n\\nTo log messages to the system console, use the "},{"kind":"code","text":"`log.level(message)`"},{"kind":"text","text":" invocation,\\nsuch as "},{"kind":"code","text":"`log.debug(\'this is a debug message\')`"},{"kind":"text","text":".\\n\\nTo prevent writing of messages above a certain log level to the console, simply\\nset the appropriate level. The default log level is "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":", which means that\\n"},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":" messages will not be printed, unless enabled.\\n\\n**Example:**\\n"},{"kind":"code","text":"```js\\nimport log from \'@apify/log\';\\n\\n// importing from the Apify SDK or Crawlee is also supported:\\n// import { log } from \'apify\';\\n// import { log } from \'crawlee\';\\n\\nlog.info(\'Information message\', { someData: 123 }); // prints message\\nlog.debug(\'Debug message\', { debugData: \'hello\' }); // doesn\'t print anything\\n\\nlog.setLevel(log.LEVELS.DEBUG);\\nlog.debug(\'Debug message\'); // prints message\\n\\nlog.setLevel(log.LEVELS.ERROR);\\nlog.debug(\'Debug message\'); // doesn\'t print anything\\nlog.info(\'Info message\'); // doesn\'t print anything\\nlog.error(\'Error message\', { errorDetails: \'This is bad!\' }); // prints message\\n\\ntry {\\n throw new Error(\'Not good!\');\\n} catch (e) {\\n log.exception(e, \'Exception occurred\', { errorDetails: \'This is really bad!\' }); // prints message\\n}\\n\\nlog.setOptions({ prefix: \'My actor\' });\\nlog.info(\'I am running!\'); // prints \\"My actor: I am running\\"\\n\\nconst childLog = log.child({ prefix: \'Crawler\' });\\nlog.info(\'I am crawling!\'); // prints \\"My actor:Crawler: I am crawling\\"\\n```"},{"kind":"text","text":"\\n\\nAnother very useful way of setting the log level is by setting the "},{"kind":"code","text":"`APIFY_LOG_LEVEL`"},{"kind":"text","text":"\\nenvironment variable, such as "},{"kind":"code","text":"`APIFY_LOG_LEVEL=DEBUG`"},{"kind":"text","text":". This way, no code changes\\nare necessary to turn on your debug messages and start debugging right away.\\n\\nTo add timestamps to your logs, you can override the default logger settings:\\n"},{"kind":"code","text":"```js\\nlog.setOptions({\\n logger: new log.LoggerText({ skipTime: false }),\\n});\\n```"},{"kind":"text","text":"\\nYou can customize your logging further by extending or replacing the default\\nlogger instances with your own implementations."}]},"children":[{"id":236,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":98,"character":4}],"signatures":[{"id":237,"name":"new Log","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":238,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Partial","qualifiedName":"Partial","package":"typescript"}}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}}]},{"id":239,"name":"LEVELS","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Map of available log levels that\'s useful for easy setting of appropriate log levels.\\nEach log level is represented internally by a number. Eg. "},{"kind":"code","text":"`log.LEVELS.DEBUG === 5`"},{"kind":"text","text":"."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":95,"character":13}],"type":{"type":"query","queryType":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}}},{"id":259,"name":"child","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":130,"character":4}],"signatures":[{"id":260,"name":"child","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a new instance of logger that inherits settings from a parent logger."}]},"parameters":[{"id":261,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Partial","qualifiedName":"Partial","package":"typescript"}}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}}]},{"id":283,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":157,"character":4}],"signatures":[{"id":284,"name":"debug","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs a "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":" message. By default, it will not be written to the console. To see "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":"\\nmessages in the console, set the log level to "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":" either using the "},{"kind":"code","text":"`log.setLevel(log.LEVELS.DEBUG)`"},{"kind":"text","text":"\\nmethod or using the environment variable "},{"kind":"code","text":"`APIFY_LOG_LEVEL=DEBUG`"},{"kind":"text","text":". Data are stringified and appended\\nto the message."}]},"parameters":[{"id":285,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":286,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":294,"name":"deprecated","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":166,"character":4}],"signatures":[{"id":295,"name":"deprecated","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs given message only once as WARNING. It\'s used to warn user that some feature he is using has been deprecated."}]},"parameters":[{"id":296,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":262,"name":"error","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":135,"character":4}],"signatures":[{"id":263,"name":"error","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs an "},{"kind":"code","text":"`ERROR`"},{"kind":"text","text":" message. Use this method to log error messages that are not directly connected\\nto an exception. For logging exceptions, use the "},{"kind":"code","text":"`log.exception`"},{"kind":"text","text":" method."}]},"parameters":[{"id":264,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":265,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":266,"name":"exception","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":140,"character":4}],"signatures":[{"id":267,"name":"exception","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs an "},{"kind":"code","text":"`ERROR`"},{"kind":"text","text":" level message with a nicely formatted exception. Note that the exception is the first parameter\\nhere and an additional message is only optional."}]},"parameters":[{"id":268,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":269,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":270,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":243,"name":"getLevel","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":106,"character":4}],"signatures":[{"id":244,"name":"getLevel","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently selected logging level. This is useful for checking whether a message\\nwill actually be printed to the console before one actually performs a resource intensive operation\\nto construct the message, such as querying a DB for some metadata that need to be added. If the log\\nlevel is not high enough at the moment, it doesn\'t make sense to execute the query."}]},"type":{"type":"intrinsic","name":"number"}}]},{"id":257,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":126,"character":4}],"signatures":[{"id":258,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the logger configuration."}]},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Required","qualifiedName":"Required","package":"typescript"}}]},{"id":279,"name":"info","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":150,"character":4}],"signatures":[{"id":280,"name":"info","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs an "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":" message. "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":" is the default log level so info messages will be always logged,\\nunless the log level is changed. Data are stringified and appended to the message."}]},"parameters":[{"id":281,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":282,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":248,"name":"internal","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":118,"character":4}],"signatures":[{"id":249,"name":"internal","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":250,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":251,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":252,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":253,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":287,"name":"perf","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":158,"character":4}],"signatures":[{"id":288,"name":"perf","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":289,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":290,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":245,"name":"setLevel","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":117,"character":4}],"signatures":[{"id":246,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Sets the log level to the given value, preventing messages from less important log levels\\nfrom being printed to the console. Use in conjunction with the "},{"kind":"code","text":"`log.LEVELS`"},{"kind":"text","text":" constants such as\\n\\n"},{"kind":"code","text":"```\\nlog.setLevel(log.LEVELS.DEBUG);\\n```"},{"kind":"text","text":"\\n\\nDefault log level is INFO."}]},"parameters":[{"id":247,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":254,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":122,"character":4}],"signatures":[{"id":255,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Configures logger."}]},"parameters":[{"id":256,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Partial","qualifiedName":"Partial","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":271,"name":"softFail","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":141,"character":4}],"signatures":[{"id":272,"name":"softFail","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":273,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":274,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":275,"name":"warning","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":145,"character":4}],"signatures":[{"id":276,"name":"warning","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs a "},{"kind":"code","text":"`WARNING`"},{"kind":"text","text":" level message. Data are stringified and appended to the message."}]},"parameters":[{"id":277,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":278,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":291,"name":"warningOnce","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":162,"character":4}],"signatures":[{"id":292,"name":"warningOnce","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs a "},{"kind":"code","text":"`WARNING`"},{"kind":"text","text":" level message only once."}]},"parameters":[{"id":293,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Constructors","children":[236]},{"title":"Properties","children":[239]},{"title":"Methods","children":[259,283,294,262,266,243,257,279,248,287,245,254,271,275,291]}],"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":90,"character":21}],"permalink":"/sdk/js/reference/next/class/Log","previousId":1514,"nextId":313},{"id":313,"name":"Logger","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"This is an abstract class that should\\nbe extended by custom logger classes.\\n\\nthis._log() method must be implemented by them."}]},"children":[{"id":354,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":13,"character":4}],"signatures":[{"id":355,"name":"new Logger","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":356,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"overwrites":{"type":"reference","name":"EventEmitter.constructor"}}],"overwrites":{"type":"reference","name":"EventEmitter.constructor"}},{"id":351,"name":"captureRejectionSymbol","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Value: "},{"kind":"code","text":"`Symbol.for(\'nodejs.rejection\')`"},{"kind":"text","text":"\\n\\nSee how to write a custom "},{"kind":"code","text":"`rejection handler`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":402,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":351,"name":"captureRejectionSymbol","qualifiedName":"EventEmitter.captureRejectionSymbol","package":"@types/node"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.captureRejectionSymbol"}},{"id":352,"name":"captureRejections","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\\n\\nChange the default "},{"kind":"code","text":"`captureRejections`"},{"kind":"text","text":" option on all new "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" objects."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":409,"character":15}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"EventEmitter.captureRejections"}},{"id":353,"name":"defaultMaxListeners","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default, a maximum of "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners can be registered for any single\\nevent. This limit can be changed for individual "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances\\nusing the "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" method. To change the default\\nfor _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":"property can be used. If this value is not a positive number, a "},{"kind":"code","text":"`RangeError`"},{"kind":"text","text":"is thrown.\\n\\nTake caution when setting the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":" because the\\nchange affects _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, including those created before\\nthe change is made. However, calling "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" still has\\nprecedence over "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":".\\n\\nThis is not a hard limit. The "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance will allow\\nmore listeners to be added but will output a trace warning to stderr indicating\\nthat a \\"possible EventEmitter memory leak\\" has been detected. For any single"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", the "},{"kind":"code","text":"`emitter.getMaxListeners()`"},{"kind":"text","text":" and "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":"methods can be used to\\ntemporarily avoid this warning:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.setMaxListeners(emitter.getMaxListeners() + 1);\\nemitter.once(\'event\', () => {\\n // do stuff\\n emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));\\n});\\n```"},{"kind":"text","text":"\\n\\nThe "},{"kind":"code","text":"`--trace-warnings`"},{"kind":"text","text":" command-line flag can be used to display the\\nstack trace for such warnings.\\n\\nThe emitted warning can be inspected with "},{"kind":"code","text":"`process.on(\'warning\')`"},{"kind":"text","text":" and will\\nhave the additional "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":", "},{"kind":"code","text":"`type`"},{"kind":"text","text":", and "},{"kind":"code","text":"`count`"},{"kind":"text","text":" properties, referring to\\nthe event emitter instance, the event\'s name and the number of attached\\nlisteners, respectively.\\nIts "},{"kind":"code","text":"`name`"},{"kind":"text","text":" property is set to "},{"kind":"code","text":"`\'MaxListenersExceededWarning\'`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.11.2"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":446,"character":15}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.defaultMaxListeners"}},{"id":350,"name":"errorMonitor","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"This symbol shall be used to install a listener for only monitoring "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":"events. Listeners installed using this symbol are called before the regular"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listeners are called.\\n\\nInstalling a listener using this symbol does not change the behavior once an"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is emitted. Therefore, the process will still crash if no\\nregular "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listener is installed."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.17.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":395,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":350,"name":"errorMonitor","qualifiedName":"EventEmitter.errorMonitor","package":"@types/node"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.errorMonitor"}},{"id":379,"name":"[captureRejectionSymbol]","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":112,"character":8}],"signatures":[{"id":380,"name":"[captureRejectionSymbol]","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":381,"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":382,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":383,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventEmitter.__@captureRejectionSymbol@599"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.__@captureRejectionSymbol@599"}},{"id":367,"name":"_log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":17,"character":4}],"signatures":[{"id":368,"name":"_log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":369,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":370,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":371,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":372,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}},{"id":373,"name":"opts","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":363,"name":"_outputWithConsole","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":16,"character":4}],"signatures":[{"id":364,"name":"_outputWithConsole","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":365,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":366,"name":"line","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":384,"name":"addListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":16}],"signatures":[{"id":385,"name":"addListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.on(eventName, listener)`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":386,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":387,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":388,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":66}],"signatures":[{"id":389,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":390,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.addListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.addListener"}},{"id":433,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":772,"character":16}],"signatures":[{"id":434,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Synchronously calls each of the listeners registered for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", in the order they were registered, passing the supplied arguments\\nto each.\\n\\nReturns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the event had listeners, "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEmitter = new EventEmitter();\\n\\n// First listener\\nmyEmitter.on(\'event\', function firstListener() {\\n console.log(\'Helloooo! first listener\');\\n});\\n// Second listener\\nmyEmitter.on(\'event\', function secondListener(arg1, arg2) {\\n console.log(`event with parameters ${arg1}, ${arg2} in second listener`);\\n});\\n// Third listener\\nmyEmitter.on(\'event\', function thirdListener(...args) {\\n const parameters = args.join(\', \');\\n console.log(`event with parameters ${parameters} in third listener`);\\n});\\n\\nconsole.log(myEmitter.listeners(\'event\'));\\n\\nmyEmitter.emit(\'event\', 1, 2, 3, 4, 5);\\n\\n// Prints:\\n// [\\n// [Function: firstListener],\\n// [Function: secondListener],\\n// [Function: thirdListener]\\n// ]\\n// Helloooo! first listener\\n// event with parameters 1, 2 in second listener\\n// event with parameters 1, 2, 3, 4, 5 in third listener\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":435,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":436,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"EventEmitter.emit"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.emit"}},{"id":455,"name":"eventNames","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":835,"character":16}],"signatures":[{"id":456,"name":"eventNames","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an array listing the events for which the emitter has registered\\nlisteners. The values in the array are strings or "},{"kind":"code","text":"`Symbol`"},{"kind":"text","text":"s.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\n\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => {});\\nmyEE.on(\'bar\', () => {});\\n\\nconst sym = Symbol(\'symbol\');\\nmyEE.on(sym, () => {});\\n\\nconsole.log(myEE.eventNames());\\n// Prints: [ \'foo\', \'bar\', Symbol(symbol) ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},"inheritedFrom":{"type":"reference","name":"EventEmitter.eventNames"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.eventNames"}},{"id":425,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":687,"character":16}],"signatures":[{"id":426,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the current max listener value for the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" which is either\\nset by "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" or defaults to "},{"kind":"inline-tag","tag":"@link","text":"defaultMaxListeners","target":353},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v1.0.0"}]}]},"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}},{"id":361,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":15,"character":4}],"signatures":[{"id":362,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}]},{"id":437,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":781,"character":16}],"signatures":[{"id":438,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of listeners listening for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\nIf "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" is provided, it will return how many times the listener is found\\nin the list of the listeners of the event."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v3.2.0"}]}]},"parameters":[{"id":439,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":440,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The event handler function"}]},"type":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}},{"id":427,"name":"listeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":700,"character":16}],"signatures":[{"id":428,"name":"listeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\nconsole.log(util.inspect(server.listeners(\'connection\')));\\n// Prints: [ [Function] ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":429,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.listeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.listeners"}},{"id":374,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":18,"character":4}],"signatures":[{"id":375,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":376,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":377,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":378,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":412,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":16}],"signatures":[{"id":413,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.removeListener()`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v10.0.0"}]}]},"parameters":[{"id":414,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":415,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":416,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":58}],"signatures":[{"id":417,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":418,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.off"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.off"}},{"id":391,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":16}],"signatures":[{"id":392,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the end of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => console.log(\'a\'));\\nmyEE.prependListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.101"}]}]},"parameters":[{"id":393,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":394,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":395,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":57}],"signatures":[{"id":396,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":397,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}},{"id":398,"name":"once","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":16}],"signatures":[{"id":399,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". The\\nnext time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this listener is removed and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.once(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependOnceListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.once(\'foo\', () => console.log(\'a\'));\\nmyEE.prependOnceListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.0"}]}]},"parameters":[{"id":400,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":401,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":402,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":59}],"signatures":[{"id":403,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":404,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}},{"id":441,"name":"prependListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":16}],"signatures":[{"id":442,"name":"prependListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the _beginning_ of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependListener(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":443,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":444,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":445,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":70}],"signatures":[{"id":446,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":447,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.prependListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.prependListener"}},{"id":448,"name":"prependOnceListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":16}],"signatures":[{"id":449,"name":"prependOnceListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" to the _beginning_ of the listeners array. The next time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this\\nlistener is removed, and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependOnceListener(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":450,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":451,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":452,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":74}],"signatures":[{"id":453,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":454,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.prependOnceListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.prependOnceListener"}},{"id":430,"name":"rawListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":731,"character":16}],"signatures":[{"id":431,"name":"rawListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":",\\nincluding any wrappers (such as those created by "},{"kind":"code","text":"`.once()`"},{"kind":"text","text":").\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.once(\'log\', () => console.log(\'log once\'));\\n\\n// Returns a new Array with a function `onceWrapper` which has a property\\n// `listener` which contains the original listener bound above\\nconst listeners = emitter.rawListeners(\'log\');\\nconst logFnWrapper = listeners[0];\\n\\n// Logs \\"log once\\" to the console and does not unbind the `once` event\\nlogFnWrapper.listener();\\n\\n// Logs \\"log once\\" to the console and removes the listener\\nlogFnWrapper();\\n\\nemitter.on(\'log\', () => console.log(\'log persistently\'));\\n// Will return a new Array with a single function bound by `.on()` above\\nconst newListeners = emitter.rawListeners(\'log\');\\n\\n// Logs \\"log persistently\\" twice\\nnewListeners[0]();\\nemitter.emit(\'log\');\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v9.4.0"}]}]},"parameters":[{"id":432,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.rawListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.rawListeners"}},{"id":419,"name":"removeAllListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":671,"character":16}],"signatures":[{"id":420,"name":"removeAllListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes all listeners, or those of the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nIt is bad practice to remove listeners added elsewhere in the code,\\nparticularly when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance was created by some other\\ncomponent or module (e.g. sockets or file streams).\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":421,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.removeAllListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.removeAllListeners"}},{"id":405,"name":"removeListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":16}],"signatures":[{"id":406,"name":"removeListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the specified "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" from the listener array for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nconst callback = (stream) => {\\n console.log(\'someone connected!\');\\n};\\nserver.on(\'connection\', callback);\\n// ...\\nserver.removeListener(\'connection\', callback);\\n```"},{"kind":"text","text":"\\n\\n"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove, at most, one instance of a listener from the\\nlistener array. If any single listener has been added multiple times to the\\nlistener array for the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", then "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" must be\\ncalled multiple times to remove each instance.\\n\\nOnce an event is emitted, all listeners attached to it at the\\ntime of emitting are called in order. This implies that any"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" or "},{"kind":"code","text":"`removeAllListeners()`"},{"kind":"text","text":" calls _after_ emitting and _before_ the last listener finishes execution\\nwill not remove them from"},{"kind":"code","text":"`emit()`"},{"kind":"text","text":" in progress. Subsequent events behave as expected.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nclass MyEmitter extends EventEmitter {}\\nconst myEmitter = new MyEmitter();\\n\\nconst callbackA = () => {\\n console.log(\'A\');\\n myEmitter.removeListener(\'event\', callbackB);\\n};\\n\\nconst callbackB = () => {\\n console.log(\'B\');\\n};\\n\\nmyEmitter.on(\'event\', callbackA);\\n\\nmyEmitter.on(\'event\', callbackB);\\n\\n// callbackA removes listener callbackB but it will still be called.\\n// Internal listener array at time of emit [callbackA, callbackB]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n// B\\n\\n// callbackB is now removed.\\n// Internal listener array [callbackA]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n```"},{"kind":"text","text":"\\n\\nBecause listeners are managed using an internal array, calling this will\\nchange the position indices of any listener registered _after_ the listener\\nbeing removed. This will not impact the order in which listeners are called,\\nbut it means that any copies of the listener array as returned by\\nthe "},{"kind":"code","text":"`emitter.listeners()`"},{"kind":"text","text":" method will need to be recreated.\\n\\nWhen a single function has been added as a handler multiple times for a single\\nevent (as in the example below), "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove the most\\nrecently added instance. In the example the "},{"kind":"code","text":"`once(\'ping\')`"},{"kind":"text","text":"listener is removed:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst ee = new EventEmitter();\\n\\nfunction pong() {\\n console.log(\'pong\');\\n}\\n\\nee.on(\'ping\', pong);\\nee.once(\'ping\', pong);\\nee.removeListener(\'ping\', pong);\\n\\nee.emit(\'ping\');\\nee.emit(\'ping\');\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":407,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":408,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":409,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":69}],"signatures":[{"id":410,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":411,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.removeListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.removeListener"}},{"id":422,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":681,"character":16}],"signatures":[{"id":423,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s will print a warning if more than "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners are\\nadded for a particular event. This is a useful default that helps finding\\nmemory leaks. The "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":" method allows the limit to be\\nmodified for this specific "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance. The value can be set to"},{"kind":"code","text":"`Infinity`"},{"kind":"text","text":" (or "},{"kind":"code","text":"`0`"},{"kind":"text","text":") to indicate an unlimited number of listeners.\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.5"}]}]},"parameters":[{"id":424,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}},{"id":358,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":14,"character":4}],"signatures":[{"id":359,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":360,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":343,"name":"addAbortListener","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":15}],"signatures":[{"id":344,"name":"addAbortListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Listens once to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on the provided "},{"kind":"code","text":"`signal`"},{"kind":"text","text":".\\n\\nListening to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on abort signals is unsafe and may\\nlead to resource leaks since another third party with the signal can\\ncall "},{"kind":"code","text":"`e.stopImmediatePropagation()`"},{"kind":"text","text":". Unfortunately Node.js cannot change\\nthis since it would violate the web standard. Additionally, the original\\nAPI makes it easy to forget to remove listeners.\\n\\nThis API allows safely using "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":"s in Node.js APIs by solving these\\ntwo issues by listening to the event such that "},{"kind":"code","text":"`stopImmediatePropagation`"},{"kind":"text","text":" does\\nnot prevent the listener from running.\\n\\nReturns a disposable so that it may be unsubscribed from more easily.\\n\\n"},{"kind":"code","text":"```js\\nimport { addAbortListener } from \'node:events\';\\n\\nfunction example(signal) {\\n let disposable;\\n try {\\n signal.addEventListener(\'abort\', (e) => e.stopImmediatePropagation());\\n disposable = addAbortListener(signal, (e) => {\\n // Do something when signal is aborted.\\n });\\n } finally {\\n disposable?.[Symbol.dispose]();\\n }\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v20.5.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"Disposable that removes the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" listener."}]}],"modifierTags":["@experimental"]},"parameters":[{"id":345,"name":"signal","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"AbortSignal","qualifiedName":"AbortSignal","package":"typescript"}},{"id":346,"name":"resource","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":347,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":63}],"signatures":[{"id":348,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":349,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Event","qualifiedName":"Event","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","name":"Disposable","qualifiedName":"Disposable","package":"@types/node"},"inheritedFrom":{"type":"reference","name":"EventEmitter.addAbortListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.addAbortListener"}},{"id":332,"name":"getEventListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":308,"character":15}],"signatures":[{"id":333,"name":"getEventListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.listeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the event listeners for the\\nevent target. This is useful for debugging and diagnostic purposes.\\n\\n"},{"kind":"code","text":"```js\\nimport { getEventListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n const listener = () => console.log(\'Events are fun\');\\n ee.on(\'foo\', listener);\\n console.log(getEventListeners(ee, \'foo\')); // [ [Function: listener] ]\\n}\\n{\\n const et = new EventTarget();\\n const listener = () => console.log(\'Events are fun\');\\n et.addEventListener(\'foo\', listener);\\n console.log(getEventListeners(et, \'foo\')); // [ [Function: listener] ]\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.2.0, v14.17.0"}]}]},"parameters":[{"id":334,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}},{"id":335,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.getEventListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.getEventListeners"}},{"id":336,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":337,"character":15}],"signatures":[{"id":337,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently set max amount of listeners.\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.getMaxListeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the max event listeners for the\\nevent target. If the number of event handlers on a single EventTarget exceeds\\nthe max set, the EventTarget will print a warning.\\n\\n"},{"kind":"code","text":"```js\\nimport { getMaxListeners, setMaxListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n console.log(getMaxListeners(ee)); // 10\\n setMaxListeners(11, ee);\\n console.log(getMaxListeners(ee)); // 11\\n}\\n{\\n const et = new EventTarget();\\n console.log(getMaxListeners(et)); // 10\\n setMaxListeners(11, et);\\n console.log(getMaxListeners(et)); // 11\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v19.9.0"}]}]},"parameters":[{"id":338,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}},{"id":328,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":280,"character":15}],"signatures":[{"id":329,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A class method that returns the number of listeners for the given "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"registered on the given "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, listenerCount } from \'node:events\';\\n\\nconst myEmitter = new EventEmitter();\\nmyEmitter.on(\'event\', () => {});\\nmyEmitter.on(\'event\', () => {});\\nconsole.log(listenerCount(myEmitter, \'event\'));\\n// Prints: 2\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.9.12"}]},{"tag":"@deprecated","content":[{"kind":"text","text":"Since v3.2.0 - Use "},{"kind":"code","text":"`listenerCount`"},{"kind":"text","text":" instead."}]}]},"parameters":[{"id":330,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The emitter to query"}]},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":331,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The event name"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}},{"id":323,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":258,"character":15}],"signatures":[{"id":324,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\n// Emit later on\\nprocess.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n});\\n\\nfor await (const event of on(ee, \'foo\')) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n}\\n// Unreachable here\\n```"},{"kind":"text","text":"\\n\\nReturns an "},{"kind":"code","text":"`AsyncIterator`"},{"kind":"text","text":" that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events. It will throw\\nif the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":". It removes all listeners when\\nexiting the loop. The "},{"kind":"code","text":"`value`"},{"kind":"text","text":" returned by each iteration is an array\\ncomposed of the emitted event arguments.\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting on events:\\n\\n"},{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ac = new AbortController();\\n\\n(async () => {\\n const ee = new EventEmitter();\\n\\n // Emit later on\\n process.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n });\\n\\n for await (const event of on(ee, \'foo\', { signal: ac.signal })) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n }\\n // Unreachable here\\n})();\\n\\nprocess.nextTick(() => ac.abort());\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.16.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events emitted by the "},{"kind":"code","text":"`emitter`"}]}]},"parameters":[{"id":325,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":326,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"intrinsic","name":"string"}},{"id":327,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"AsyncIterableIterator","qualifiedName":"AsyncIterableIterator","package":"typescript"},"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}},{"id":314,"name":"once","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":193,"character":15},{"fileName":"node_modules/@types/node/events.d.ts","line":198,"character":15}],"signatures":[{"id":315,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that is fulfilled when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits the given\\nevent or that is rejected if the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" while waiting.\\nThe "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" will resolve with an array of all the arguments emitted to the\\ngiven event.\\n\\nThis method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event\\nsemantics and does not listen to the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event.\\n\\n"},{"kind":"code","text":"```js\\nimport { once, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\nprocess.nextTick(() => {\\n ee.emit(\'myevent\', 42);\\n});\\n\\nconst [value] = await once(ee, \'myevent\');\\nconsole.log(value);\\n\\nconst err = new Error(\'kaboom\');\\nprocess.nextTick(() => {\\n ee.emit(\'error\', err);\\n});\\n\\ntry {\\n await once(ee, \'myevent\');\\n} catch (err) {\\n console.error(\'error happened\', err);\\n}\\n```"},{"kind":"text","text":"\\n\\nThe special handling of the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is only used when "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":"is used to wait for another event. If "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":" is used to wait for the\\n\'"},{"kind":"code","text":"`error\'`"},{"kind":"text","text":" event itself, then it is treated as any other kind of event without\\nspecial handling:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\n\\nonce(ee, \'error\')\\n .then(([err]) => console.log(\'ok\', err.message))\\n .catch((err) => console.error(\'error\', err.message));\\n\\nee.emit(\'error\', new Error(\'boom\'));\\n\\n// Prints: ok boom\\n```"},{"kind":"text","text":"\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting for the event:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\nconst ac = new AbortController();\\n\\nasync function foo(emitter, event, signal) {\\n try {\\n await once(emitter, event, { signal });\\n console.log(\'event emitted!\');\\n } catch (error) {\\n if (error.name === \'AbortError\') {\\n console.error(\'Waiting for the event was canceled!\');\\n } else {\\n console.error(\'There was an error\', error.message);\\n }\\n }\\n}\\n\\nfoo(ee, \'foo\', ac.signal);\\nac.abort(); // Abort waiting for the event\\nee.emit(\'foo\'); // Prints: Waiting for the event was canceled!\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v11.13.0, v10.16.0"}]}]},"parameters":[{"id":316,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_NodeEventTarget","qualifiedName":"_NodeEventTarget","package":"@types/node"}},{"id":317,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":318,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}},{"id":319,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":320,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"}},{"id":321,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":322,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}},{"id":339,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":352,"character":15}],"signatures":[{"id":340,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { setMaxListeners, EventEmitter } from \'node:events\';\\n\\nconst target = new EventTarget();\\nconst emitter = new EventEmitter();\\n\\nsetMaxListeners(5, target, emitter);\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.4.0"}]}]},"parameters":[{"id":341,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A non-negative number. The maximum number of listeners per "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":" event."}]},"type":{"type":"intrinsic","name":"number"}},{"id":342,"name":"eventTargets","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}}],"groups":[{"title":"Constructors","children":[354]},{"title":"Properties","children":[351,352,353,350]},{"title":"Methods","children":[379,367,363,384,433,455,425,361,437,427,374,412,391,398,441,448,430,419,405,422,358,343,332,336,328,323,314,339]}],"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":11,"character":21}],"extendedTypes":[{"type":"reference","name":"EventEmitter","qualifiedName":"EventEmitter","package":"@types/node"}],"extendedBy":[{"type":"reference","id":457,"name":"LoggerJson"},{"type":"reference","id":602,"name":"LoggerText"}],"permalink":"/sdk/js/reference/next/class/Logger","previousId":235,"nextId":457},{"id":457,"name":"LoggerJson","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"This is an abstract class that should\\nbe extended by custom logger classes.\\n\\nthis._log() method must be implemented by them."}]},"children":[{"id":498,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_json.d.ts","line":5,"character":4}],"signatures":[{"id":499,"name":"new LoggerJson","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":500,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"id":501,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"overwrites":{"type":"reference","id":355,"name":"Logger.constructor"}}],"overwrites":{"type":"reference","id":354,"name":"Logger.constructor"}},{"id":495,"name":"captureRejectionSymbol","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Value: "},{"kind":"code","text":"`Symbol.for(\'nodejs.rejection\')`"},{"kind":"text","text":"\\n\\nSee how to write a custom "},{"kind":"code","text":"`rejection handler`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":402,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":351,"name":"captureRejectionSymbol","qualifiedName":"EventEmitter.captureRejectionSymbol","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":351,"name":"Logger.captureRejectionSymbol"}},{"id":496,"name":"captureRejections","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\\n\\nChange the default "},{"kind":"code","text":"`captureRejections`"},{"kind":"text","text":" option on all new "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" objects."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":409,"character":15}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":352,"name":"Logger.captureRejections"}},{"id":497,"name":"defaultMaxListeners","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default, a maximum of "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners can be registered for any single\\nevent. This limit can be changed for individual "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances\\nusing the "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" method. To change the default\\nfor _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":"property can be used. If this value is not a positive number, a "},{"kind":"code","text":"`RangeError`"},{"kind":"text","text":"is thrown.\\n\\nTake caution when setting the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":" because the\\nchange affects _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, including those created before\\nthe change is made. However, calling "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" still has\\nprecedence over "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":".\\n\\nThis is not a hard limit. The "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance will allow\\nmore listeners to be added but will output a trace warning to stderr indicating\\nthat a \\"possible EventEmitter memory leak\\" has been detected. For any single"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", the "},{"kind":"code","text":"`emitter.getMaxListeners()`"},{"kind":"text","text":" and "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":"methods can be used to\\ntemporarily avoid this warning:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.setMaxListeners(emitter.getMaxListeners() + 1);\\nemitter.once(\'event\', () => {\\n // do stuff\\n emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));\\n});\\n```"},{"kind":"text","text":"\\n\\nThe "},{"kind":"code","text":"`--trace-warnings`"},{"kind":"text","text":" command-line flag can be used to display the\\nstack trace for such warnings.\\n\\nThe emitted warning can be inspected with "},{"kind":"code","text":"`process.on(\'warning\')`"},{"kind":"text","text":" and will\\nhave the additional "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":", "},{"kind":"code","text":"`type`"},{"kind":"text","text":", and "},{"kind":"code","text":"`count`"},{"kind":"text","text":" properties, referring to\\nthe event emitter instance, the event\'s name and the number of attached\\nlisteners, respectively.\\nIts "},{"kind":"code","text":"`name`"},{"kind":"text","text":" property is set to "},{"kind":"code","text":"`\'MaxListenersExceededWarning\'`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.11.2"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":446,"character":15}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":353,"name":"Logger.defaultMaxListeners"}},{"id":494,"name":"errorMonitor","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"This symbol shall be used to install a listener for only monitoring "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":"events. Listeners installed using this symbol are called before the regular"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listeners are called.\\n\\nInstalling a listener using this symbol does not change the behavior once an"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is emitted. Therefore, the process will still crash if no\\nregular "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listener is installed."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.17.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":395,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":350,"name":"errorMonitor","qualifiedName":"EventEmitter.errorMonitor","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":350,"name":"Logger.errorMonitor"}},{"id":524,"name":"[captureRejectionSymbol]","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":112,"character":8}],"signatures":[{"id":525,"name":"[captureRejectionSymbol]","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":526,"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":527,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":528,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":380,"name":"Logger.[captureRejectionSymbol]"}}],"inheritedFrom":{"type":"reference","id":379,"name":"Logger.[captureRejectionSymbol]"}},{"id":502,"name":"_log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_json.d.ts","line":6,"character":4}],"signatures":[{"id":503,"name":"_log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":504,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":505,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":506,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":507,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}},{"id":508,"name":"opts","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"},"overwrites":{"type":"reference","id":368,"name":"Logger._log"}}],"overwrites":{"type":"reference","id":367,"name":"Logger._log"}},{"id":515,"name":"_outputWithConsole","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":16,"character":4}],"signatures":[{"id":516,"name":"_outputWithConsole","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":517,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":518,"name":"line","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":364,"name":"Logger._outputWithConsole"}}],"inheritedFrom":{"type":"reference","id":363,"name":"Logger._outputWithConsole"}},{"id":529,"name":"addListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":16}],"signatures":[{"id":530,"name":"addListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.on(eventName, listener)`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":531,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":532,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":533,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":66}],"signatures":[{"id":534,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":535,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":385,"name":"Logger.addListener"}}],"inheritedFrom":{"type":"reference","id":384,"name":"Logger.addListener"}},{"id":578,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":772,"character":16}],"signatures":[{"id":579,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Synchronously calls each of the listeners registered for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", in the order they were registered, passing the supplied arguments\\nto each.\\n\\nReturns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the event had listeners, "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEmitter = new EventEmitter();\\n\\n// First listener\\nmyEmitter.on(\'event\', function firstListener() {\\n console.log(\'Helloooo! first listener\');\\n});\\n// Second listener\\nmyEmitter.on(\'event\', function secondListener(arg1, arg2) {\\n console.log(`event with parameters ${arg1}, ${arg2} in second listener`);\\n});\\n// Third listener\\nmyEmitter.on(\'event\', function thirdListener(...args) {\\n const parameters = args.join(\', \');\\n console.log(`event with parameters ${parameters} in third listener`);\\n});\\n\\nconsole.log(myEmitter.listeners(\'event\'));\\n\\nmyEmitter.emit(\'event\', 1, 2, 3, 4, 5);\\n\\n// Prints:\\n// [\\n// [Function: firstListener],\\n// [Function: secondListener],\\n// [Function: thirdListener]\\n// ]\\n// Helloooo! first listener\\n// event with parameters 1, 2 in second listener\\n// event with parameters 1, 2, 3, 4, 5 in third listener\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":580,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":581,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":434,"name":"Logger.emit"}}],"inheritedFrom":{"type":"reference","id":433,"name":"Logger.emit"}},{"id":600,"name":"eventNames","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":835,"character":16}],"signatures":[{"id":601,"name":"eventNames","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an array listing the events for which the emitter has registered\\nlisteners. The values in the array are strings or "},{"kind":"code","text":"`Symbol`"},{"kind":"text","text":"s.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\n\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => {});\\nmyEE.on(\'bar\', () => {});\\n\\nconst sym = Symbol(\'symbol\');\\nmyEE.on(sym, () => {});\\n\\nconsole.log(myEE.eventNames());\\n// Prints: [ \'foo\', \'bar\', Symbol(symbol) ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},"inheritedFrom":{"type":"reference","id":456,"name":"Logger.eventNames"}}],"inheritedFrom":{"type":"reference","id":455,"name":"Logger.eventNames"}},{"id":570,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":687,"character":16}],"signatures":[{"id":571,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the current max listener value for the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" which is either\\nset by "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" or defaults to "},{"kind":"inline-tag","tag":"@link","text":"defaultMaxListeners","target":497},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v1.0.0"}]}]},"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":426,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":425,"name":"Logger.getMaxListeners"}},{"id":513,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":15,"character":4}],"signatures":[{"id":514,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"},"inheritedFrom":{"type":"reference","id":362,"name":"Logger.getOptions"}}],"inheritedFrom":{"type":"reference","id":361,"name":"Logger.getOptions"}},{"id":582,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":781,"character":16}],"signatures":[{"id":583,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of listeners listening for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\nIf "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" is provided, it will return how many times the listener is found\\nin the list of the listeners of the event."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v3.2.0"}]}]},"parameters":[{"id":584,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":585,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The event handler function"}]},"type":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":438,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":437,"name":"Logger.listenerCount"}},{"id":572,"name":"listeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":700,"character":16}],"signatures":[{"id":573,"name":"listeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\nconsole.log(util.inspect(server.listeners(\'connection\')));\\n// Prints: [ [Function] ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":574,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":428,"name":"Logger.listeners"}}],"inheritedFrom":{"type":"reference","id":427,"name":"Logger.listeners"}},{"id":519,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":18,"character":4}],"signatures":[{"id":520,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":521,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":522,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":523,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":375,"name":"Logger.log"}}],"inheritedFrom":{"type":"reference","id":374,"name":"Logger.log"}},{"id":557,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":16}],"signatures":[{"id":558,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.removeListener()`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v10.0.0"}]}]},"parameters":[{"id":559,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":560,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":561,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":58}],"signatures":[{"id":562,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":563,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":413,"name":"Logger.off"}}],"inheritedFrom":{"type":"reference","id":412,"name":"Logger.off"}},{"id":536,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":16}],"signatures":[{"id":537,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the end of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => console.log(\'a\'));\\nmyEE.prependListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.101"}]}]},"parameters":[{"id":538,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":539,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":540,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":57}],"signatures":[{"id":541,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":542,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":392,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":391,"name":"Logger.on"}},{"id":543,"name":"once","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":16}],"signatures":[{"id":544,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". The\\nnext time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this listener is removed and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.once(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependOnceListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.once(\'foo\', () => console.log(\'a\'));\\nmyEE.prependOnceListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.0"}]}]},"parameters":[{"id":545,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":546,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":547,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":59}],"signatures":[{"id":548,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":549,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":399,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":398,"name":"Logger.once"}},{"id":586,"name":"prependListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":16}],"signatures":[{"id":587,"name":"prependListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the _beginning_ of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependListener(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":588,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":589,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":590,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":70}],"signatures":[{"id":591,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":592,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":442,"name":"Logger.prependListener"}}],"inheritedFrom":{"type":"reference","id":441,"name":"Logger.prependListener"}},{"id":593,"name":"prependOnceListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":16}],"signatures":[{"id":594,"name":"prependOnceListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" to the _beginning_ of the listeners array. The next time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this\\nlistener is removed, and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependOnceListener(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":595,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":596,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":597,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":74}],"signatures":[{"id":598,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":599,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":449,"name":"Logger.prependOnceListener"}}],"inheritedFrom":{"type":"reference","id":448,"name":"Logger.prependOnceListener"}},{"id":575,"name":"rawListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":731,"character":16}],"signatures":[{"id":576,"name":"rawListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":",\\nincluding any wrappers (such as those created by "},{"kind":"code","text":"`.once()`"},{"kind":"text","text":").\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.once(\'log\', () => console.log(\'log once\'));\\n\\n// Returns a new Array with a function `onceWrapper` which has a property\\n// `listener` which contains the original listener bound above\\nconst listeners = emitter.rawListeners(\'log\');\\nconst logFnWrapper = listeners[0];\\n\\n// Logs \\"log once\\" to the console and does not unbind the `once` event\\nlogFnWrapper.listener();\\n\\n// Logs \\"log once\\" to the console and removes the listener\\nlogFnWrapper();\\n\\nemitter.on(\'log\', () => console.log(\'log persistently\'));\\n// Will return a new Array with a single function bound by `.on()` above\\nconst newListeners = emitter.rawListeners(\'log\');\\n\\n// Logs \\"log persistently\\" twice\\nnewListeners[0]();\\nemitter.emit(\'log\');\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v9.4.0"}]}]},"parameters":[{"id":577,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":431,"name":"Logger.rawListeners"}}],"inheritedFrom":{"type":"reference","id":430,"name":"Logger.rawListeners"}},{"id":564,"name":"removeAllListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":671,"character":16}],"signatures":[{"id":565,"name":"removeAllListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes all listeners, or those of the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nIt is bad practice to remove listeners added elsewhere in the code,\\nparticularly when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance was created by some other\\ncomponent or module (e.g. sockets or file streams).\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":566,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":420,"name":"Logger.removeAllListeners"}}],"inheritedFrom":{"type":"reference","id":419,"name":"Logger.removeAllListeners"}},{"id":550,"name":"removeListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":16}],"signatures":[{"id":551,"name":"removeListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the specified "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" from the listener array for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nconst callback = (stream) => {\\n console.log(\'someone connected!\');\\n};\\nserver.on(\'connection\', callback);\\n// ...\\nserver.removeListener(\'connection\', callback);\\n```"},{"kind":"text","text":"\\n\\n"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove, at most, one instance of a listener from the\\nlistener array. If any single listener has been added multiple times to the\\nlistener array for the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", then "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" must be\\ncalled multiple times to remove each instance.\\n\\nOnce an event is emitted, all listeners attached to it at the\\ntime of emitting are called in order. This implies that any"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" or "},{"kind":"code","text":"`removeAllListeners()`"},{"kind":"text","text":" calls _after_ emitting and _before_ the last listener finishes execution\\nwill not remove them from"},{"kind":"code","text":"`emit()`"},{"kind":"text","text":" in progress. Subsequent events behave as expected.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nclass MyEmitter extends EventEmitter {}\\nconst myEmitter = new MyEmitter();\\n\\nconst callbackA = () => {\\n console.log(\'A\');\\n myEmitter.removeListener(\'event\', callbackB);\\n};\\n\\nconst callbackB = () => {\\n console.log(\'B\');\\n};\\n\\nmyEmitter.on(\'event\', callbackA);\\n\\nmyEmitter.on(\'event\', callbackB);\\n\\n// callbackA removes listener callbackB but it will still be called.\\n// Internal listener array at time of emit [callbackA, callbackB]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n// B\\n\\n// callbackB is now removed.\\n// Internal listener array [callbackA]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n```"},{"kind":"text","text":"\\n\\nBecause listeners are managed using an internal array, calling this will\\nchange the position indices of any listener registered _after_ the listener\\nbeing removed. This will not impact the order in which listeners are called,\\nbut it means that any copies of the listener array as returned by\\nthe "},{"kind":"code","text":"`emitter.listeners()`"},{"kind":"text","text":" method will need to be recreated.\\n\\nWhen a single function has been added as a handler multiple times for a single\\nevent (as in the example below), "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove the most\\nrecently added instance. In the example the "},{"kind":"code","text":"`once(\'ping\')`"},{"kind":"text","text":"listener is removed:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst ee = new EventEmitter();\\n\\nfunction pong() {\\n console.log(\'pong\');\\n}\\n\\nee.on(\'ping\', pong);\\nee.once(\'ping\', pong);\\nee.removeListener(\'ping\', pong);\\n\\nee.emit(\'ping\');\\nee.emit(\'ping\');\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":552,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":553,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":554,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":69}],"signatures":[{"id":555,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":556,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":406,"name":"Logger.removeListener"}}],"inheritedFrom":{"type":"reference","id":405,"name":"Logger.removeListener"}},{"id":567,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":681,"character":16}],"signatures":[{"id":568,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s will print a warning if more than "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners are\\nadded for a particular event. This is a useful default that helps finding\\nmemory leaks. The "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":" method allows the limit to be\\nmodified for this specific "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance. The value can be set to"},{"kind":"code","text":"`Infinity`"},{"kind":"text","text":" (or "},{"kind":"code","text":"`0`"},{"kind":"text","text":") to indicate an unlimited number of listeners.\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.5"}]}]},"parameters":[{"id":569,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":423,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":422,"name":"Logger.setMaxListeners"}},{"id":510,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":14,"character":4}],"signatures":[{"id":511,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":512,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":359,"name":"Logger.setOptions"}}],"inheritedFrom":{"type":"reference","id":358,"name":"Logger.setOptions"}},{"id":487,"name":"addAbortListener","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":15}],"signatures":[{"id":488,"name":"addAbortListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Listens once to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on the provided "},{"kind":"code","text":"`signal`"},{"kind":"text","text":".\\n\\nListening to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on abort signals is unsafe and may\\nlead to resource leaks since another third party with the signal can\\ncall "},{"kind":"code","text":"`e.stopImmediatePropagation()`"},{"kind":"text","text":". Unfortunately Node.js cannot change\\nthis since it would violate the web standard. Additionally, the original\\nAPI makes it easy to forget to remove listeners.\\n\\nThis API allows safely using "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":"s in Node.js APIs by solving these\\ntwo issues by listening to the event such that "},{"kind":"code","text":"`stopImmediatePropagation`"},{"kind":"text","text":" does\\nnot prevent the listener from running.\\n\\nReturns a disposable so that it may be unsubscribed from more easily.\\n\\n"},{"kind":"code","text":"```js\\nimport { addAbortListener } from \'node:events\';\\n\\nfunction example(signal) {\\n let disposable;\\n try {\\n signal.addEventListener(\'abort\', (e) => e.stopImmediatePropagation());\\n disposable = addAbortListener(signal, (e) => {\\n // Do something when signal is aborted.\\n });\\n } finally {\\n disposable?.[Symbol.dispose]();\\n }\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v20.5.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"Disposable that removes the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" listener."}]}],"modifierTags":["@experimental"]},"parameters":[{"id":489,"name":"signal","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"AbortSignal","qualifiedName":"AbortSignal","package":"typescript"}},{"id":490,"name":"resource","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":491,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":63}],"signatures":[{"id":492,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":493,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Event","qualifiedName":"Event","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","name":"Disposable","qualifiedName":"Disposable","package":"@types/node"},"inheritedFrom":{"type":"reference","id":344,"name":"Logger.addAbortListener"}}],"inheritedFrom":{"type":"reference","id":343,"name":"Logger.addAbortListener"}},{"id":476,"name":"getEventListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":308,"character":15}],"signatures":[{"id":477,"name":"getEventListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.listeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the event listeners for the\\nevent target. This is useful for debugging and diagnostic purposes.\\n\\n"},{"kind":"code","text":"```js\\nimport { getEventListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n const listener = () => console.log(\'Events are fun\');\\n ee.on(\'foo\', listener);\\n console.log(getEventListeners(ee, \'foo\')); // [ [Function: listener] ]\\n}\\n{\\n const et = new EventTarget();\\n const listener = () => console.log(\'Events are fun\');\\n et.addEventListener(\'foo\', listener);\\n console.log(getEventListeners(et, \'foo\')); // [ [Function: listener] ]\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.2.0, v14.17.0"}]}]},"parameters":[{"id":478,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}},{"id":479,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":333,"name":"Logger.getEventListeners"}}],"inheritedFrom":{"type":"reference","id":332,"name":"Logger.getEventListeners"}},{"id":480,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":337,"character":15}],"signatures":[{"id":481,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently set max amount of listeners.\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.getMaxListeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the max event listeners for the\\nevent target. If the number of event handlers on a single EventTarget exceeds\\nthe max set, the EventTarget will print a warning.\\n\\n"},{"kind":"code","text":"```js\\nimport { getMaxListeners, setMaxListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n console.log(getMaxListeners(ee)); // 10\\n setMaxListeners(11, ee);\\n console.log(getMaxListeners(ee)); // 11\\n}\\n{\\n const et = new EventTarget();\\n console.log(getMaxListeners(et)); // 10\\n setMaxListeners(11, et);\\n console.log(getMaxListeners(et)); // 11\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v19.9.0"}]}]},"parameters":[{"id":482,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":337,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":336,"name":"Logger.getMaxListeners"}},{"id":472,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":280,"character":15}],"signatures":[{"id":473,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A class method that returns the number of listeners for the given "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"registered on the given "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, listenerCount } from \'node:events\';\\n\\nconst myEmitter = new EventEmitter();\\nmyEmitter.on(\'event\', () => {});\\nmyEmitter.on(\'event\', () => {});\\nconsole.log(listenerCount(myEmitter, \'event\'));\\n// Prints: 2\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.9.12"}]},{"tag":"@deprecated","content":[{"kind":"text","text":"Since v3.2.0 - Use "},{"kind":"code","text":"`listenerCount`"},{"kind":"text","text":" instead."}]}]},"parameters":[{"id":474,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The emitter to query"}]},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":475,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The event name"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":329,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":328,"name":"Logger.listenerCount"}},{"id":467,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":258,"character":15}],"signatures":[{"id":468,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\n// Emit later on\\nprocess.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n});\\n\\nfor await (const event of on(ee, \'foo\')) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n}\\n// Unreachable here\\n```"},{"kind":"text","text":"\\n\\nReturns an "},{"kind":"code","text":"`AsyncIterator`"},{"kind":"text","text":" that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events. It will throw\\nif the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":". It removes all listeners when\\nexiting the loop. The "},{"kind":"code","text":"`value`"},{"kind":"text","text":" returned by each iteration is an array\\ncomposed of the emitted event arguments.\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting on events:\\n\\n"},{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ac = new AbortController();\\n\\n(async () => {\\n const ee = new EventEmitter();\\n\\n // Emit later on\\n process.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n });\\n\\n for await (const event of on(ee, \'foo\', { signal: ac.signal })) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n }\\n // Unreachable here\\n})();\\n\\nprocess.nextTick(() => ac.abort());\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.16.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events emitted by the "},{"kind":"code","text":"`emitter`"}]}]},"parameters":[{"id":469,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":470,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"intrinsic","name":"string"}},{"id":471,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"AsyncIterableIterator","qualifiedName":"AsyncIterableIterator","package":"typescript"},"inheritedFrom":{"type":"reference","id":324,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":323,"name":"Logger.on"}},{"id":458,"name":"once","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":193,"character":15},{"fileName":"node_modules/@types/node/events.d.ts","line":198,"character":15}],"signatures":[{"id":459,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that is fulfilled when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits the given\\nevent or that is rejected if the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" while waiting.\\nThe "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" will resolve with an array of all the arguments emitted to the\\ngiven event.\\n\\nThis method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event\\nsemantics and does not listen to the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event.\\n\\n"},{"kind":"code","text":"```js\\nimport { once, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\nprocess.nextTick(() => {\\n ee.emit(\'myevent\', 42);\\n});\\n\\nconst [value] = await once(ee, \'myevent\');\\nconsole.log(value);\\n\\nconst err = new Error(\'kaboom\');\\nprocess.nextTick(() => {\\n ee.emit(\'error\', err);\\n});\\n\\ntry {\\n await once(ee, \'myevent\');\\n} catch (err) {\\n console.error(\'error happened\', err);\\n}\\n```"},{"kind":"text","text":"\\n\\nThe special handling of the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is only used when "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":"is used to wait for another event. If "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":" is used to wait for the\\n\'"},{"kind":"code","text":"`error\'`"},{"kind":"text","text":" event itself, then it is treated as any other kind of event without\\nspecial handling:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\n\\nonce(ee, \'error\')\\n .then(([err]) => console.log(\'ok\', err.message))\\n .catch((err) => console.error(\'error\', err.message));\\n\\nee.emit(\'error\', new Error(\'boom\'));\\n\\n// Prints: ok boom\\n```"},{"kind":"text","text":"\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting for the event:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\nconst ac = new AbortController();\\n\\nasync function foo(emitter, event, signal) {\\n try {\\n await once(emitter, event, { signal });\\n console.log(\'event emitted!\');\\n } catch (error) {\\n if (error.name === \'AbortError\') {\\n console.error(\'Waiting for the event was canceled!\');\\n } else {\\n console.error(\'There was an error\', error.message);\\n }\\n }\\n}\\n\\nfoo(ee, \'foo\', ac.signal);\\nac.abort(); // Abort waiting for the event\\nee.emit(\'foo\'); // Prints: Waiting for the event was canceled!\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v11.13.0, v10.16.0"}]}]},"parameters":[{"id":460,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_NodeEventTarget","qualifiedName":"_NodeEventTarget","package":"@types/node"}},{"id":461,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":462,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":315,"name":"Logger.once"}},{"id":463,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":464,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"}},{"id":465,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":466,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":319,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":314,"name":"Logger.once"}},{"id":483,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":352,"character":15}],"signatures":[{"id":484,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { setMaxListeners, EventEmitter } from \'node:events\';\\n\\nconst target = new EventTarget();\\nconst emitter = new EventEmitter();\\n\\nsetMaxListeners(5, target, emitter);\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.4.0"}]}]},"parameters":[{"id":485,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A non-negative number. The maximum number of listeners per "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":" event."}]},"type":{"type":"intrinsic","name":"number"}},{"id":486,"name":"eventTargets","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":340,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":339,"name":"Logger.setMaxListeners"}}],"groups":[{"title":"Constructors","children":[498]},{"title":"Properties","children":[495,496,497,494]},{"title":"Methods","children":[524,502,515,529,578,600,570,513,582,572,519,557,536,543,586,593,575,564,550,567,510,487,476,480,472,467,458,483]}],"sources":[{"fileName":"node_modules/@apify/log/logger_json.d.ts","line":4,"character":21}],"extendedTypes":[{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"}],"permalink":"/sdk/js/reference/next/class/LoggerJson","previousId":313,"nextId":602},{"id":602,"name":"LoggerText","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"This is an abstract class that should\\nbe extended by custom logger classes.\\n\\nthis._log() method must be implemented by them."}]},"children":[{"id":643,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":9,"character":4}],"signatures":[{"id":644,"name":"new LoggerText","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":645,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"id":646,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"overwrites":{"type":"reference","id":355,"name":"Logger.constructor"}}],"overwrites":{"type":"reference","id":354,"name":"Logger.constructor"}},{"id":640,"name":"captureRejectionSymbol","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Value: "},{"kind":"code","text":"`Symbol.for(\'nodejs.rejection\')`"},{"kind":"text","text":"\\n\\nSee how to write a custom "},{"kind":"code","text":"`rejection handler`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":402,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":351,"name":"captureRejectionSymbol","qualifiedName":"EventEmitter.captureRejectionSymbol","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":351,"name":"Logger.captureRejectionSymbol"}},{"id":641,"name":"captureRejections","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\\n\\nChange the default "},{"kind":"code","text":"`captureRejections`"},{"kind":"text","text":" option on all new "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" objects."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":409,"character":15}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":352,"name":"Logger.captureRejections"}},{"id":642,"name":"defaultMaxListeners","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default, a maximum of "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners can be registered for any single\\nevent. This limit can be changed for individual "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances\\nusing the "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" method. To change the default\\nfor _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":"property can be used. If this value is not a positive number, a "},{"kind":"code","text":"`RangeError`"},{"kind":"text","text":"is thrown.\\n\\nTake caution when setting the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":" because the\\nchange affects _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, including those created before\\nthe change is made. However, calling "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" still has\\nprecedence over "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":".\\n\\nThis is not a hard limit. The "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance will allow\\nmore listeners to be added but will output a trace warning to stderr indicating\\nthat a \\"possible EventEmitter memory leak\\" has been detected. For any single"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", the "},{"kind":"code","text":"`emitter.getMaxListeners()`"},{"kind":"text","text":" and "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":"methods can be used to\\ntemporarily avoid this warning:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.setMaxListeners(emitter.getMaxListeners() + 1);\\nemitter.once(\'event\', () => {\\n // do stuff\\n emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));\\n});\\n```"},{"kind":"text","text":"\\n\\nThe "},{"kind":"code","text":"`--trace-warnings`"},{"kind":"text","text":" command-line flag can be used to display the\\nstack trace for such warnings.\\n\\nThe emitted warning can be inspected with "},{"kind":"code","text":"`process.on(\'warning\')`"},{"kind":"text","text":" and will\\nhave the additional "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":", "},{"kind":"code","text":"`type`"},{"kind":"text","text":", and "},{"kind":"code","text":"`count`"},{"kind":"text","text":" properties, referring to\\nthe event emitter instance, the event\'s name and the number of attached\\nlisteners, respectively.\\nIts "},{"kind":"code","text":"`name`"},{"kind":"text","text":" property is set to "},{"kind":"code","text":"`\'MaxListenersExceededWarning\'`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.11.2"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":446,"character":15}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":353,"name":"Logger.defaultMaxListeners"}},{"id":639,"name":"errorMonitor","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"This symbol shall be used to install a listener for only monitoring "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":"events. Listeners installed using this symbol are called before the regular"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listeners are called.\\n\\nInstalling a listener using this symbol does not change the behavior once an"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is emitted. Therefore, the process will still crash if no\\nregular "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listener is installed."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.17.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":395,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":350,"name":"errorMonitor","qualifiedName":"EventEmitter.errorMonitor","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":350,"name":"Logger.errorMonitor"}},{"id":672,"name":"[captureRejectionSymbol]","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":112,"character":8}],"signatures":[{"id":673,"name":"[captureRejectionSymbol]","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":674,"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":675,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":676,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":380,"name":"Logger.[captureRejectionSymbol]"}}],"inheritedFrom":{"type":"reference","id":379,"name":"Logger.[captureRejectionSymbol]"}},{"id":647,"name":"_log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":10,"character":4}],"signatures":[{"id":648,"name":"_log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":649,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":650,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":651,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":652,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}},{"id":653,"name":"opts","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"},"overwrites":{"type":"reference","id":368,"name":"Logger._log"}}],"overwrites":{"type":"reference","id":367,"name":"Logger._log"}},{"id":663,"name":"_outputWithConsole","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":16,"character":4}],"signatures":[{"id":664,"name":"_outputWithConsole","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":665,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":666,"name":"line","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":364,"name":"Logger._outputWithConsole"}}],"inheritedFrom":{"type":"reference","id":363,"name":"Logger._outputWithConsole"}},{"id":654,"name":"_parseException","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":11,"character":4}],"signatures":[{"id":655,"name":"_parseException","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":656,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"string"}}]},{"id":677,"name":"addListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":16}],"signatures":[{"id":678,"name":"addListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.on(eventName, listener)`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":679,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":680,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":681,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":66}],"signatures":[{"id":682,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":683,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":385,"name":"Logger.addListener"}}],"inheritedFrom":{"type":"reference","id":384,"name":"Logger.addListener"}},{"id":726,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":772,"character":16}],"signatures":[{"id":727,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Synchronously calls each of the listeners registered for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", in the order they were registered, passing the supplied arguments\\nto each.\\n\\nReturns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the event had listeners, "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEmitter = new EventEmitter();\\n\\n// First listener\\nmyEmitter.on(\'event\', function firstListener() {\\n console.log(\'Helloooo! first listener\');\\n});\\n// Second listener\\nmyEmitter.on(\'event\', function secondListener(arg1, arg2) {\\n console.log(`event with parameters ${arg1}, ${arg2} in second listener`);\\n});\\n// Third listener\\nmyEmitter.on(\'event\', function thirdListener(...args) {\\n const parameters = args.join(\', \');\\n console.log(`event with parameters ${parameters} in third listener`);\\n});\\n\\nconsole.log(myEmitter.listeners(\'event\'));\\n\\nmyEmitter.emit(\'event\', 1, 2, 3, 4, 5);\\n\\n// Prints:\\n// [\\n// [Function: firstListener],\\n// [Function: secondListener],\\n// [Function: thirdListener]\\n// ]\\n// Helloooo! first listener\\n// event with parameters 1, 2 in second listener\\n// event with parameters 1, 2, 3, 4, 5 in third listener\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":728,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":729,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":434,"name":"Logger.emit"}}],"inheritedFrom":{"type":"reference","id":433,"name":"Logger.emit"}},{"id":748,"name":"eventNames","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":835,"character":16}],"signatures":[{"id":749,"name":"eventNames","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an array listing the events for which the emitter has registered\\nlisteners. The values in the array are strings or "},{"kind":"code","text":"`Symbol`"},{"kind":"text","text":"s.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\n\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => {});\\nmyEE.on(\'bar\', () => {});\\n\\nconst sym = Symbol(\'symbol\');\\nmyEE.on(sym, () => {});\\n\\nconsole.log(myEE.eventNames());\\n// Prints: [ \'foo\', \'bar\', Symbol(symbol) ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},"inheritedFrom":{"type":"reference","id":456,"name":"Logger.eventNames"}}],"inheritedFrom":{"type":"reference","id":455,"name":"Logger.eventNames"}},{"id":718,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":687,"character":16}],"signatures":[{"id":719,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the current max listener value for the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" which is either\\nset by "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" or defaults to "},{"kind":"inline-tag","tag":"@link","text":"defaultMaxListeners","target":642},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v1.0.0"}]}]},"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":426,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":425,"name":"Logger.getMaxListeners"}},{"id":661,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":15,"character":4}],"signatures":[{"id":662,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"},"inheritedFrom":{"type":"reference","id":362,"name":"Logger.getOptions"}}],"inheritedFrom":{"type":"reference","id":361,"name":"Logger.getOptions"}},{"id":730,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":781,"character":16}],"signatures":[{"id":731,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of listeners listening for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\nIf "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" is provided, it will return how many times the listener is found\\nin the list of the listeners of the event."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v3.2.0"}]}]},"parameters":[{"id":732,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":733,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The event handler function"}]},"type":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":438,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":437,"name":"Logger.listenerCount"}},{"id":720,"name":"listeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":700,"character":16}],"signatures":[{"id":721,"name":"listeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\nconsole.log(util.inspect(server.listeners(\'connection\')));\\n// Prints: [ [Function] ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":722,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":428,"name":"Logger.listeners"}}],"inheritedFrom":{"type":"reference","id":427,"name":"Logger.listeners"}},{"id":667,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":18,"character":4}],"signatures":[{"id":668,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":669,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":670,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":671,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":375,"name":"Logger.log"}}],"inheritedFrom":{"type":"reference","id":374,"name":"Logger.log"}},{"id":705,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":16}],"signatures":[{"id":706,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.removeListener()`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v10.0.0"}]}]},"parameters":[{"id":707,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":708,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":709,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":58}],"signatures":[{"id":710,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":711,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":413,"name":"Logger.off"}}],"inheritedFrom":{"type":"reference","id":412,"name":"Logger.off"}},{"id":684,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":16}],"signatures":[{"id":685,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the end of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => console.log(\'a\'));\\nmyEE.prependListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.101"}]}]},"parameters":[{"id":686,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":687,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":688,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":57}],"signatures":[{"id":689,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":690,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":392,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":391,"name":"Logger.on"}},{"id":691,"name":"once","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":16}],"signatures":[{"id":692,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". The\\nnext time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this listener is removed and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.once(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependOnceListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.once(\'foo\', () => console.log(\'a\'));\\nmyEE.prependOnceListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.0"}]}]},"parameters":[{"id":693,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":694,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":695,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":59}],"signatures":[{"id":696,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":697,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":399,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":398,"name":"Logger.once"}},{"id":734,"name":"prependListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":16}],"signatures":[{"id":735,"name":"prependListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the _beginning_ of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependListener(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":736,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":737,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":738,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":70}],"signatures":[{"id":739,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":740,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":442,"name":"Logger.prependListener"}}],"inheritedFrom":{"type":"reference","id":441,"name":"Logger.prependListener"}},{"id":741,"name":"prependOnceListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":16}],"signatures":[{"id":742,"name":"prependOnceListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" to the _beginning_ of the listeners array. The next time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this\\nlistener is removed, and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependOnceListener(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":743,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":744,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":745,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":74}],"signatures":[{"id":746,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":747,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":449,"name":"Logger.prependOnceListener"}}],"inheritedFrom":{"type":"reference","id":448,"name":"Logger.prependOnceListener"}},{"id":723,"name":"rawListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":731,"character":16}],"signatures":[{"id":724,"name":"rawListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":",\\nincluding any wrappers (such as those created by "},{"kind":"code","text":"`.once()`"},{"kind":"text","text":").\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.once(\'log\', () => console.log(\'log once\'));\\n\\n// Returns a new Array with a function `onceWrapper` which has a property\\n// `listener` which contains the original listener bound above\\nconst listeners = emitter.rawListeners(\'log\');\\nconst logFnWrapper = listeners[0];\\n\\n// Logs \\"log once\\" to the console and does not unbind the `once` event\\nlogFnWrapper.listener();\\n\\n// Logs \\"log once\\" to the console and removes the listener\\nlogFnWrapper();\\n\\nemitter.on(\'log\', () => console.log(\'log persistently\'));\\n// Will return a new Array with a single function bound by `.on()` above\\nconst newListeners = emitter.rawListeners(\'log\');\\n\\n// Logs \\"log persistently\\" twice\\nnewListeners[0]();\\nemitter.emit(\'log\');\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v9.4.0"}]}]},"parameters":[{"id":725,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":431,"name":"Logger.rawListeners"}}],"inheritedFrom":{"type":"reference","id":430,"name":"Logger.rawListeners"}},{"id":712,"name":"removeAllListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":671,"character":16}],"signatures":[{"id":713,"name":"removeAllListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes all listeners, or those of the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nIt is bad practice to remove listeners added elsewhere in the code,\\nparticularly when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance was created by some other\\ncomponent or module (e.g. sockets or file streams).\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":714,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":420,"name":"Logger.removeAllListeners"}}],"inheritedFrom":{"type":"reference","id":419,"name":"Logger.removeAllListeners"}},{"id":698,"name":"removeListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":16}],"signatures":[{"id":699,"name":"removeListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the specified "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" from the listener array for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nconst callback = (stream) => {\\n console.log(\'someone connected!\');\\n};\\nserver.on(\'connection\', callback);\\n// ...\\nserver.removeListener(\'connection\', callback);\\n```"},{"kind":"text","text":"\\n\\n"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove, at most, one instance of a listener from the\\nlistener array. If any single listener has been added multiple times to the\\nlistener array for the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", then "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" must be\\ncalled multiple times to remove each instance.\\n\\nOnce an event is emitted, all listeners attached to it at the\\ntime of emitting are called in order. This implies that any"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" or "},{"kind":"code","text":"`removeAllListeners()`"},{"kind":"text","text":" calls _after_ emitting and _before_ the last listener finishes execution\\nwill not remove them from"},{"kind":"code","text":"`emit()`"},{"kind":"text","text":" in progress. Subsequent events behave as expected.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nclass MyEmitter extends EventEmitter {}\\nconst myEmitter = new MyEmitter();\\n\\nconst callbackA = () => {\\n console.log(\'A\');\\n myEmitter.removeListener(\'event\', callbackB);\\n};\\n\\nconst callbackB = () => {\\n console.log(\'B\');\\n};\\n\\nmyEmitter.on(\'event\', callbackA);\\n\\nmyEmitter.on(\'event\', callbackB);\\n\\n// callbackA removes listener callbackB but it will still be called.\\n// Internal listener array at time of emit [callbackA, callbackB]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n// B\\n\\n// callbackB is now removed.\\n// Internal listener array [callbackA]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n```"},{"kind":"text","text":"\\n\\nBecause listeners are managed using an internal array, calling this will\\nchange the position indices of any listener registered _after_ the listener\\nbeing removed. This will not impact the order in which listeners are called,\\nbut it means that any copies of the listener array as returned by\\nthe "},{"kind":"code","text":"`emitter.listeners()`"},{"kind":"text","text":" method will need to be recreated.\\n\\nWhen a single function has been added as a handler multiple times for a single\\nevent (as in the example below), "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove the most\\nrecently added instance. In the example the "},{"kind":"code","text":"`once(\'ping\')`"},{"kind":"text","text":"listener is removed:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst ee = new EventEmitter();\\n\\nfunction pong() {\\n console.log(\'pong\');\\n}\\n\\nee.on(\'ping\', pong);\\nee.once(\'ping\', pong);\\nee.removeListener(\'ping\', pong);\\n\\nee.emit(\'ping\');\\nee.emit(\'ping\');\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":700,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":701,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":702,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":69}],"signatures":[{"id":703,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":704,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":406,"name":"Logger.removeListener"}}],"inheritedFrom":{"type":"reference","id":405,"name":"Logger.removeListener"}},{"id":715,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":681,"character":16}],"signatures":[{"id":716,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s will print a warning if more than "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners are\\nadded for a particular event. This is a useful default that helps finding\\nmemory leaks. The "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":" method allows the limit to be\\nmodified for this specific "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance. The value can be set to"},{"kind":"code","text":"`Infinity`"},{"kind":"text","text":" (or "},{"kind":"code","text":"`0`"},{"kind":"text","text":") to indicate an unlimited number of listeners.\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.5"}]}]},"parameters":[{"id":717,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":423,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":422,"name":"Logger.setMaxListeners"}},{"id":658,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":14,"character":4}],"signatures":[{"id":659,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":660,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":359,"name":"Logger.setOptions"}}],"inheritedFrom":{"type":"reference","id":358,"name":"Logger.setOptions"}},{"id":632,"name":"addAbortListener","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":15}],"signatures":[{"id":633,"name":"addAbortListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Listens once to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on the provided "},{"kind":"code","text":"`signal`"},{"kind":"text","text":".\\n\\nListening to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on abort signals is unsafe and may\\nlead to resource leaks since another third party with the signal can\\ncall "},{"kind":"code","text":"`e.stopImmediatePropagation()`"},{"kind":"text","text":". Unfortunately Node.js cannot change\\nthis since it would violate the web standard. Additionally, the original\\nAPI makes it easy to forget to remove listeners.\\n\\nThis API allows safely using "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":"s in Node.js APIs by solving these\\ntwo issues by listening to the event such that "},{"kind":"code","text":"`stopImmediatePropagation`"},{"kind":"text","text":" does\\nnot prevent the listener from running.\\n\\nReturns a disposable so that it may be unsubscribed from more easily.\\n\\n"},{"kind":"code","text":"```js\\nimport { addAbortListener } from \'node:events\';\\n\\nfunction example(signal) {\\n let disposable;\\n try {\\n signal.addEventListener(\'abort\', (e) => e.stopImmediatePropagation());\\n disposable = addAbortListener(signal, (e) => {\\n // Do something when signal is aborted.\\n });\\n } finally {\\n disposable?.[Symbol.dispose]();\\n }\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v20.5.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"Disposable that removes the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" listener."}]}],"modifierTags":["@experimental"]},"parameters":[{"id":634,"name":"signal","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"AbortSignal","qualifiedName":"AbortSignal","package":"typescript"}},{"id":635,"name":"resource","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":636,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":63}],"signatures":[{"id":637,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":638,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Event","qualifiedName":"Event","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","name":"Disposable","qualifiedName":"Disposable","package":"@types/node"},"inheritedFrom":{"type":"reference","id":344,"name":"Logger.addAbortListener"}}],"inheritedFrom":{"type":"reference","id":343,"name":"Logger.addAbortListener"}},{"id":621,"name":"getEventListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":308,"character":15}],"signatures":[{"id":622,"name":"getEventListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.listeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the event listeners for the\\nevent target. This is useful for debugging and diagnostic purposes.\\n\\n"},{"kind":"code","text":"```js\\nimport { getEventListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n const listener = () => console.log(\'Events are fun\');\\n ee.on(\'foo\', listener);\\n console.log(getEventListeners(ee, \'foo\')); // [ [Function: listener] ]\\n}\\n{\\n const et = new EventTarget();\\n const listener = () => console.log(\'Events are fun\');\\n et.addEventListener(\'foo\', listener);\\n console.log(getEventListeners(et, \'foo\')); // [ [Function: listener] ]\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.2.0, v14.17.0"}]}]},"parameters":[{"id":623,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}},{"id":624,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":333,"name":"Logger.getEventListeners"}}],"inheritedFrom":{"type":"reference","id":332,"name":"Logger.getEventListeners"}},{"id":625,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":337,"character":15}],"signatures":[{"id":626,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently set max amount of listeners.\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.getMaxListeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the max event listeners for the\\nevent target. If the number of event handlers on a single EventTarget exceeds\\nthe max set, the EventTarget will print a warning.\\n\\n"},{"kind":"code","text":"```js\\nimport { getMaxListeners, setMaxListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n console.log(getMaxListeners(ee)); // 10\\n setMaxListeners(11, ee);\\n console.log(getMaxListeners(ee)); // 11\\n}\\n{\\n const et = new EventTarget();\\n console.log(getMaxListeners(et)); // 10\\n setMaxListeners(11, et);\\n console.log(getMaxListeners(et)); // 11\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v19.9.0"}]}]},"parameters":[{"id":627,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":337,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":336,"name":"Logger.getMaxListeners"}},{"id":617,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":280,"character":15}],"signatures":[{"id":618,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A class method that returns the number of listeners for the given "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"registered on the given "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, listenerCount } from \'node:events\';\\n\\nconst myEmitter = new EventEmitter();\\nmyEmitter.on(\'event\', () => {});\\nmyEmitter.on(\'event\', () => {});\\nconsole.log(listenerCount(myEmitter, \'event\'));\\n// Prints: 2\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.9.12"}]},{"tag":"@deprecated","content":[{"kind":"text","text":"Since v3.2.0 - Use "},{"kind":"code","text":"`listenerCount`"},{"kind":"text","text":" instead."}]}]},"parameters":[{"id":619,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The emitter to query"}]},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":620,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The event name"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":329,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":328,"name":"Logger.listenerCount"}},{"id":612,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":258,"character":15}],"signatures":[{"id":613,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\n// Emit later on\\nprocess.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n});\\n\\nfor await (const event of on(ee, \'foo\')) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n}\\n// Unreachable here\\n```"},{"kind":"text","text":"\\n\\nReturns an "},{"kind":"code","text":"`AsyncIterator`"},{"kind":"text","text":" that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events. It will throw\\nif the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":". It removes all listeners when\\nexiting the loop. The "},{"kind":"code","text":"`value`"},{"kind":"text","text":" returned by each iteration is an array\\ncomposed of the emitted event arguments.\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting on events:\\n\\n"},{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ac = new AbortController();\\n\\n(async () => {\\n const ee = new EventEmitter();\\n\\n // Emit later on\\n process.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n });\\n\\n for await (const event of on(ee, \'foo\', { signal: ac.signal })) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n }\\n // Unreachable here\\n})();\\n\\nprocess.nextTick(() => ac.abort());\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.16.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events emitted by the "},{"kind":"code","text":"`emitter`"}]}]},"parameters":[{"id":614,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":615,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"intrinsic","name":"string"}},{"id":616,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"AsyncIterableIterator","qualifiedName":"AsyncIterableIterator","package":"typescript"},"inheritedFrom":{"type":"reference","id":324,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":323,"name":"Logger.on"}},{"id":603,"name":"once","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":193,"character":15},{"fileName":"node_modules/@types/node/events.d.ts","line":198,"character":15}],"signatures":[{"id":604,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that is fulfilled when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits the given\\nevent or that is rejected if the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" while waiting.\\nThe "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" will resolve with an array of all the arguments emitted to the\\ngiven event.\\n\\nThis method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event\\nsemantics and does not listen to the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event.\\n\\n"},{"kind":"code","text":"```js\\nimport { once, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\nprocess.nextTick(() => {\\n ee.emit(\'myevent\', 42);\\n});\\n\\nconst [value] = await once(ee, \'myevent\');\\nconsole.log(value);\\n\\nconst err = new Error(\'kaboom\');\\nprocess.nextTick(() => {\\n ee.emit(\'error\', err);\\n});\\n\\ntry {\\n await once(ee, \'myevent\');\\n} catch (err) {\\n console.error(\'error happened\', err);\\n}\\n```"},{"kind":"text","text":"\\n\\nThe special handling of the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is only used when "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":"is used to wait for another event. If "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":" is used to wait for the\\n\'"},{"kind":"code","text":"`error\'`"},{"kind":"text","text":" event itself, then it is treated as any other kind of event without\\nspecial handling:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\n\\nonce(ee, \'error\')\\n .then(([err]) => console.log(\'ok\', err.message))\\n .catch((err) => console.error(\'error\', err.message));\\n\\nee.emit(\'error\', new Error(\'boom\'));\\n\\n// Prints: ok boom\\n```"},{"kind":"text","text":"\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting for the event:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\nconst ac = new AbortController();\\n\\nasync function foo(emitter, event, signal) {\\n try {\\n await once(emitter, event, { signal });\\n console.log(\'event emitted!\');\\n } catch (error) {\\n if (error.name === \'AbortError\') {\\n console.error(\'Waiting for the event was canceled!\');\\n } else {\\n console.error(\'There was an error\', error.message);\\n }\\n }\\n}\\n\\nfoo(ee, \'foo\', ac.signal);\\nac.abort(); // Abort waiting for the event\\nee.emit(\'foo\'); // Prints: Waiting for the event was canceled!\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v11.13.0, v10.16.0"}]}]},"parameters":[{"id":605,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_NodeEventTarget","qualifiedName":"_NodeEventTarget","package":"@types/node"}},{"id":606,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":607,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":315,"name":"Logger.once"}},{"id":608,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":609,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"}},{"id":610,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":611,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":319,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":314,"name":"Logger.once"}},{"id":628,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":352,"character":15}],"signatures":[{"id":629,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { setMaxListeners, EventEmitter } from \'node:events\';\\n\\nconst target = new EventTarget();\\nconst emitter = new EventEmitter();\\n\\nsetMaxListeners(5, target, emitter);\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.4.0"}]}]},"parameters":[{"id":630,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A non-negative number. The maximum number of listeners per "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":" event."}]},"type":{"type":"intrinsic","name":"number"}},{"id":631,"name":"eventTargets","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":340,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":339,"name":"Logger.setMaxListeners"}}],"groups":[{"title":"Constructors","children":[643]},{"title":"Properties","children":[640,641,642,639]},{"title":"Methods","children":[672,647,663,654,677,726,748,718,661,730,720,667,705,684,691,734,741,723,712,698,715,658,632,621,625,617,612,603,628]}],"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":8,"character":21}],"extendedTypes":[{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"}],"permalink":"/sdk/js/reference/next/class/LoggerText","previousId":457,"nextId":1467},{"id":1467,"name":"PlatformEventManager","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets an instance of a Node.js\'\\n[EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)\\nclass that emits various events from the SDK or the Apify platform.\\nThe event emitter is initialized by calling the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.main"},{"kind":"text","text":" function.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nActor.on(\'cpuInfo\', (data) => {\\n if (data.isCpuOverloaded) console.log(\'Oh no, the CPU is overloaded!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nThe following events are emitted:\\n\\n- "},{"kind":"code","text":"`cpuInfo`"},{"kind":"text","text":": "},{"kind":"code","text":"`{ \\"isCpuOverloaded\\": Boolean }`"},{"kind":"text","text":"\\n The event is emitted approximately every second\\n and it indicates whether the actor is using the maximum of available CPU resources.\\n If that\'s the case, the actor should not add more workload.\\n For example, this event is used by the "},{"kind":"inline-tag","tag":"@apilink","text":"AutoscaledPool"},{"kind":"text","text":" class.\\n- "},{"kind":"code","text":"`migrating`"},{"kind":"text","text":": "},{"kind":"code","text":"`void`"},{"kind":"text","text":"\\n Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon.\\n You can use it to persist the state of the actor and gracefully stop your in-progress tasks,\\n so that they are not interrupted by the migration.\\n For example, this is used by the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestList"},{"kind":"text","text":" class.\\n- "},{"kind":"code","text":"`aborting`"},{"kind":"text","text":": "},{"kind":"code","text":"`void`"},{"kind":"text","text":"\\n When a user aborts an actor run on the Apify platform, they can choose to abort gracefully to allow\\n the actor some time before getting killed. This graceful abort emits the "},{"kind":"code","text":"`aborting`"},{"kind":"text","text":" event which the SDK\\n uses to gracefully stop running crawls and you can use it to do your own cleanup as well.\\n- "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":": "},{"kind":"code","text":"`{ \\"isMigrating\\": Boolean }`"},{"kind":"text","text":"\\n Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is time to persist\\n their state, in order to avoid repeating all work when the actor restarts.\\n This event is automatically emitted together with the "},{"kind":"code","text":"`migrating`"},{"kind":"text","text":" event,\\n in which case the "},{"kind":"code","text":"`isMigrating`"},{"kind":"text","text":" flag is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":". Otherwise the flag is "},{"kind":"code","text":"`false`"},{"kind":"text","text":".\\n Note that the "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":" event is provided merely for user convenience,\\n you can achieve the same effect using "},{"kind":"code","text":"`setInterval()`"},{"kind":"text","text":" and listening for the "},{"kind":"code","text":"`migrating`"},{"kind":"text","text":" event."}]},"children":[{"id":1468,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":49,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L49"}],"signatures":[{"id":1469,"name":"new PlatformEventManager","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":1470,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1237,"name":"Configuration"},"defaultValue":"..."}],"type":{"type":"reference","id":1467,"name":"PlatformEventManager"},"overwrites":{"type":"reference","name":"EventManager.constructor"}}],"overwrites":{"type":"reference","name":"EventManager.constructor"}},{"id":1472,"name":"config","kind":1024,"kindString":"Property","flags":{"isReadonly":true},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":49,"character":34,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L49"}],"type":{"type":"reference","id":1237,"name":"Configuration"},"defaultValue":"...","inheritedFrom":{"type":"reference","name":"EventManager.config"}},{"id":1478,"name":"close","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":111,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L111"}],"signatures":[{"id":1479,"name":"close","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Closes websocket providing events from Actor infrastructure and also stops sending internal events\\nof Apify package such as "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":".\\nThis is automatically called at the end of "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":"."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"EventManager.close"}}],"overwrites":{"type":"reference","name":"EventManager.close"}},{"id":1498,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":35,"character":4}],"signatures":[{"id":1499,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1500,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":1501,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"unknown"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventManager.emit"}}],"inheritedFrom":{"type":"reference","name":"EventManager.emit"}},{"id":1473,"name":"init","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":57,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L57"}],"signatures":[{"id":1474,"name":"init","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Initializes "},{"kind":"code","text":"`Actor.events`"},{"kind":"text","text":" event emitter by creating a connection to a websocket that provides them.\\nThis is an internal function that is automatically called by "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":"."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"EventManager.init"}}],"overwrites":{"type":"reference","name":"EventManager.init"}},{"id":1502,"name":"isInitialized","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":36,"character":4}],"signatures":[{"id":1503,"name":"isInitialized","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"EventManager.isInitialized"}}],"inheritedFrom":{"type":"reference","name":"EventManager.isInitialized"}},{"id":1491,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":34,"character":4}],"signatures":[{"id":1492,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1493,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":1494,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"id":1495,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":34,"character":41}],"signatures":[{"id":1496,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1497,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventManager.off"}}],"inheritedFrom":{"type":"reference","name":"EventManager.off"}},{"id":1484,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":33,"character":4}],"signatures":[{"id":1485,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1486,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":1487,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":1488,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":33,"character":39}],"signatures":[{"id":1489,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1490,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventManager.on"}}],"inheritedFrom":{"type":"reference","name":"EventManager.on"}}],"groups":[{"title":"Constructors","children":[1468]},{"title":"Properties","children":[1472]},{"title":"Methods","children":[1478,1498,1473,1502,1491,1484]}],"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":45,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L45"}],"extendedTypes":[{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/PlatformEventManager","previousId":602,"nextId":1410},{"id":1410,"name":"ProxyConfiguration","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"text","text":"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking\\nyour crawlers based on IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures\\nthem to use the selected proxies for all connections. You can get information about the currently used proxy by inspecting\\nthe "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyInfo"},{"kind":"text","text":" property in your crawler\'s page function. There, you can inspect the proxy\'s URL and other attributes.\\n\\nThe proxy servers are managed by [Apify Proxy](https://docs.apify.com/proxy). To be able to use Apify Proxy,\\nyou need an Apify account and access to the selected proxies. If you provide no configuration option,\\nthe proxies will be managed automatically using a smart algorithm.\\n\\nIf you want to use your own proxies, use the "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfigurationOptions.proxyUrls"},{"kind":"text","text":" option. Your list of proxy URLs will\\nbe rotated by the configuration if this option is provided.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n\\nconst proxyConfiguration = await Actor.createProxyConfiguration({\\n groups: [\'GROUP1\', \'GROUP2\'] // List of Apify Proxy groups\\n countryCode: \'US\',\\n});\\n\\nconst crawler = new CheerioCrawler({\\n // ...\\n proxyConfiguration,\\n requestHandler({ proxyInfo }) {\\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\\n }\\n})\\n\\n```"}]},"children":[{"id":1421,"name":"config","kind":1024,"kindString":"Property","flags":{"isReadonly":true},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":162,"character":66,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L162"}],"type":{"type":"reference","id":1237,"name":"Configuration"},"defaultValue":"..."},{"id":1448,"name":"isManInTheMiddle","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":103,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreProxyConfiguration.isManInTheMiddle"}},{"id":1422,"name":"initialize","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":215,"character":10,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L215"}],"signatures":[{"id":1423,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups\\nif Apify Proxy configuration is used.\\nAlso checks if country has access to Apify Proxy groups if the country code is provided.\\n\\nYou should use the "},{"kind":"inline-tag","tag":"@apilink","text":"createProxyConfiguration"},{"kind":"text","text":" function to create a pre-initialized\\n"},{"kind":"code","text":"`ProxyConfiguration`"},{"kind":"text","text":" instance instead of calling this manually."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":1424,"name":"newProxyInfo","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":239,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L239"}],"signatures":[{"id":1425,"name":"newProxyInfo","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"This function creates a new "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyInfo"},{"kind":"text","text":" info object.\\nIt is used by CheerioCrawler and PuppeteerCrawler to generate proxy URLs and also to allow the user to inspect\\nthe currently used proxy via the requestHandler parameter "},{"kind":"code","text":"`proxyInfo`"},{"kind":"text","text":".\\nUse it if you want to work with a rich representation of a proxy URL.\\nIf you need the URL string only, use "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newUrl"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Represents information about used proxy and its configuration."}]}]},"parameters":[{"id":1426,"name":"sessionId","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Represents the identifier of user "},{"kind":"inline-tag","tag":"@apilink","text":"Session"},{"kind":"text","text":" that can be managed by the "},{"kind":"inline-tag","tag":"@apilink","text":"SessionPool"},{"kind":"text","text":" or\\n you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.\\n When the provided sessionId is a number, it\'s converted to a string. Property sessionId of\\n "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyInfo"},{"kind":"text","text":" is always returned as a type string.\\n\\n All the HTTP requests going through the proxy with the same session identifier\\n will use the same target proxy server (i.e. the same IP address).\\n The identifier must not be longer than 50 characters and include only the following: "},{"kind":"code","text":"`0-9`"},{"kind":"text","text":", "},{"kind":"code","text":"`a-z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A-Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\".\\"`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\"_\\"`"},{"kind":"text","text":" and "},{"kind":"code","text":"`\\"~\\"`"},{"kind":"text","text":"."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1401,"name":"ProxyInfo"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newProxyInfo"}}],"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newProxyInfo"}},{"id":1427,"name":"newUrl","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":270,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L270"}],"signatures":[{"id":1428,"name":"newUrl","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a new proxy URL based on provided configuration options and the "},{"kind":"code","text":"`sessionId`"},{"kind":"text","text":" parameter."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A string with a proxy URL, including authentication credentials and port number.\\n For example, "},{"kind":"code","text":"`http://bob:password123@proxy.example.com:8000`"}]}]},"parameters":[{"id":1429,"name":"sessionId","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Represents the identifier of user "},{"kind":"inline-tag","tag":"@apilink","text":"Session"},{"kind":"text","text":" that can be managed by the "},{"kind":"inline-tag","tag":"@apilink","text":"SessionPool"},{"kind":"text","text":" or\\n you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.\\n When the provided sessionId is a number, it\'s converted to a string.\\n\\n All the HTTP requests going through the proxy with the same session identifier\\n will use the same target proxy server (i.e. the same IP address).\\n The identifier must not be longer than 50 characters and include only the following: "},{"kind":"code","text":"`0-9`"},{"kind":"text","text":", "},{"kind":"code","text":"`a-z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A-Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\".\\"`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\"_\\"`"},{"kind":"text","text":" and "},{"kind":"code","text":"`\\"~\\"`"},{"kind":"text","text":"."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newUrl"}}],"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newUrl"}}],"groups":[{"title":"Properties","children":[1421,1448]},{"title":"Methods","children":[1422,1424,1427]}],"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":151,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L151"}],"extendedTypes":[{"type":"reference","name":"ProxyConfiguration","qualifiedName":"ProxyConfiguration","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/ProxyConfiguration","previousId":1467,"nextId":122},{"id":122,"name":"RequestQueue","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Represents a queue of URLs to crawl, which is used for deep crawling of websites\\nwhere you start with several URLs and then recursively\\nfollow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.\\n\\nEach URL is represented using an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"Request"},{"kind":"text","text":" class.\\nThe queue can only contain unique URLs. More precisely, it can only contain "},{"kind":"inline-tag","tag":"@apilink","text":"Request"},{"kind":"text","text":" instances\\nwith distinct "},{"kind":"code","text":"`uniqueKey`"},{"kind":"text","text":" properties. By default, "},{"kind":"code","text":"`uniqueKey`"},{"kind":"text","text":" is generated from the URL, but it can also be overridden.\\nTo add a single URL multiple times to the queue,\\ncorresponding "},{"kind":"inline-tag","tag":"@apilink","text":"Request"},{"kind":"text","text":" objects will need to have different "},{"kind":"code","text":"`uniqueKey`"},{"kind":"text","text":" properties.\\n\\nDo not instantiate this class directly, use the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.open"},{"kind":"text","text":" function instead.\\n\\n"},{"kind":"code","text":"`RequestQueue`"},{"kind":"text","text":" is used by "},{"kind":"inline-tag","tag":"@apilink","text":"BasicCrawler"},{"kind":"text","text":", "},{"kind":"inline-tag","tag":"@apilink","text":"CheerioCrawler"},{"kind":"text","text":", "},{"kind":"inline-tag","tag":"@apilink","text":"PuppeteerCrawler"},{"kind":"text","text":"\\nand "},{"kind":"inline-tag","tag":"@apilink","text":"PlaywrightCrawler"},{"kind":"text","text":" as a source of URLs to crawl.\\nUnlike "},{"kind":"inline-tag","tag":"@apilink","text":"RequestList"},{"kind":"text","text":", "},{"kind":"code","text":"`RequestQueue`"},{"kind":"text","text":" supports dynamic adding and removing of requests.\\nOn the other hand, the queue is not optimized for operations that add or remove a large number of URLs in a batch.\\n\\n"},{"kind":"code","text":"`RequestQueue`"},{"kind":"text","text":" stores its data either on local disk or in the Apify Cloud,\\ndepending on whether the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" or "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable is set.\\n\\nIf the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" environment variable is set, the queue data is stored in\\nthat directory in an SQLite database file.\\n\\nIf the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable is set but "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" is not, the data is stored in the\\n[Apify Request Queue](https://docs.apify.com/storage/request-queue)\\ncloud storage. Note that you can force usage of the cloud storage also by passing the "},{"kind":"code","text":"`forceCloud`"},{"kind":"text","text":"\\noption to "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.open"},{"kind":"text","text":" function,\\neven if the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" variable is set.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n// Open the default request queue associated with the crawler run\\nconst queue = await RequestQueue.open();\\n\\n// Open a named request queue\\nconst queueWithName = await RequestQueue.open(\'some-name\');\\n\\n// Enqueue few requests\\nawait queue.addRequest({ url: \'http://example.com/aaa\' });\\nawait queue.addRequest({ url: \'http://example.com/bbb\' });\\nawait queue.addRequest({ url: \'http://example.com/foo/bar\' }, { forefront: true });\\n```"}]},"children":[{"id":172,"name":"assumedHandledCount","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":21,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.assumedHandledCount"}},{"id":171,"name":"assumedTotalCount","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":20,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.assumedTotalCount"}},{"id":166,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":15,"character":4}],"type":{"type":"reference","name":"RequestQueueClient","qualifiedName":"RequestQueueClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"RequestProvider.client"}},{"id":165,"name":"clientKey","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":14,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProvider.clientKey"}},{"id":161,"name":"config","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":10,"character":13}],"type":{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"RequestProvider.config"}},{"id":162,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":11,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProvider.id"}},{"id":169,"name":"internalTimeoutMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":18,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.internalTimeoutMillis"}},{"id":168,"name":"log","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":17,"character":4}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"RequestProvider.log"}},{"id":163,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":12,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProvider.name"}},{"id":170,"name":"requestLockSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":19,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.requestLockSecs"}},{"id":164,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":13,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.timeoutSecs"}},{"id":144,"name":"addRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":91,"character":4}],"signatures":[{"id":145,"name":"addRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":146,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"requestLike","isOptional":false,"element":{"type":"reference","name":"Source","qualifiedName":"Source","package":"@crawlee/core"}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","id":212,"name":"RequestQueueOperationOptions","qualifiedName":"RequestQueueOperationOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"RequestQueueOperationInfo","qualifiedName":"RequestQueueOperationInfo","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.addRequest"}}],"overwrites":{"type":"reference","name":"RequestProvider.addRequest"}},{"id":147,"name":"addRequests","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":92,"character":4}],"signatures":[{"id":148,"name":"addRequests","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":149,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"requestsLike","isOptional":false,"element":{"type":"array","elementType":{"type":"reference","name":"Source","qualifiedName":"Source","package":"@crawlee/core"}}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","id":212,"name":"RequestQueueOperationOptions","qualifiedName":"RequestQueueOperationOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"BatchAddRequestsResult","qualifiedName":"BatchAddRequestsResult","package":"@crawlee/types"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.addRequests"}}],"overwrites":{"type":"reference","name":"RequestProvider.addRequests"}},{"id":150,"name":"addRequestsBatched","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":93,"character":4}],"signatures":[{"id":151,"name":"addRequestsBatched","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":152,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"requests","isOptional":false,"element":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Source","qualifiedName":"Source","package":"@crawlee/core"}]}}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","name":"AddRequestsBatchedOptions","qualifiedName":"AddRequestsBatchedOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"AddRequestsBatchedResult","qualifiedName":"AddRequestsBatchedResult","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.addRequestsBatched"}}],"overwrites":{"type":"reference","name":"RequestProvider.addRequestsBatched"}},{"id":194,"name":"drop","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":120,"character":4}],"signatures":[{"id":195,"name":"drop","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the queue either from the Apify Cloud storage or from the local database,\\ndepending on the mode of operation."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.drop"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.drop"}},{"id":132,"name":"fetchNextRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":76,"character":4}],"signatures":[{"id":133,"name":"fetchNextRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a next request in the queue to be processed, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":" if there are no more pending requests.\\n\\nOnce you successfully finish processing of the request, you need to call\\n"},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.markRequestHandled"},{"kind":"text","text":"\\nto mark the request as handled in the queue. If there was some error in processing the request,\\ncall "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.reclaimRequest"},{"kind":"text","text":" instead,\\nso that the queue will give the request to some other consumer in another call to the "},{"kind":"code","text":"`fetchNextRequest`"},{"kind":"text","text":" function.\\n\\nNote that the "},{"kind":"code","text":"`null`"},{"kind":"text","text":" return value doesn\'t mean the queue processing finished,\\nit means there are currently no pending requests.\\nTo check whether all requests in queue were finished,\\nuse "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.isFinished"},{"kind":"text","text":" instead."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns the request object or "},{"kind":"code","text":"`null`"},{"kind":"text","text":" if there are no more pending requests."}]}]},"typeParameter":[{"id":134,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","typeArguments":[{"type":"reference","id":134,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.fetchNextRequest"}}],"overwrites":{"type":"reference","name":"RequestProvider.fetchNextRequest"}},{"id":198,"name":"getInfo","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":155,"character":4}],"signatures":[{"id":199,"name":"getInfo","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an object containing general information about the request queue.\\n\\nThe function returns the same object as the Apify API Client\'s\\n[getQueue](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues)\\nfunction, which in turn calls the\\n[Get request queue](https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue)\\nAPI endpoint.\\n\\n**Example:**\\n"},{"kind":"code","text":"```\\n{\\n id: \\"WkzbQMuFYuamGv3YF\\",\\n name: \\"my-queue\\",\\n userId: \\"wRsJZtadYvn4mBZmm\\",\\n createdAt: new Date(\\"2015-12-12T07:34:14.202Z\\"),\\n modifiedAt: new Date(\\"2015-12-13T08:36:13.202Z\\"),\\n accessedAt: new Date(\\"2015-12-14T08:36:13.202Z\\"),\\n totalRequestCount: 25,\\n handledRequestCount: 5,\\n pendingRequestCount: 20,\\n}\\n```"}]},"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"RequestQueueInfo","qualifiedName":"RequestQueueInfo","package":"@crawlee/types"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.getInfo"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.getInfo"}},{"id":180,"name":"getRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":76,"character":4}],"signatures":[{"id":181,"name":"getRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets the request from the queue specified by ID."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns the request object, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":" if it was not found."}]}]},"typeParameter":[{"id":182,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":183,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"ID of the request."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","typeArguments":[{"type":"reference","id":182,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.getRequest"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.getRequest"}},{"id":196,"name":"handledCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":130,"character":4}],"signatures":[{"id":197,"name":"handledCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of handled requests.\\n\\nThis function is just a convenient shortcut for:\\n\\n"},{"kind":"code","text":"```javascript\\nconst { handledRequestCount } = await queue.getInfo();\\n```"}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"number"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.handledCount"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.handledCount"}},{"id":184,"name":"isEmpty","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":99,"character":4}],"signatures":[{"id":185,"name":"isEmpty","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Resolves to "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the next call to "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.fetchNextRequest"},{"kind":"text","text":"\\nwould return "},{"kind":"code","text":"`null`"},{"kind":"text","text":", otherwise it resolves to "},{"kind":"code","text":"`false`"},{"kind":"text","text":".\\nNote that even if the queue is empty, there might be some pending requests currently being processed.\\nIf you need to ensure that there is no activity in the queue, use "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.isFinished"},{"kind":"text","text":"."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.isEmpty"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.isEmpty"}},{"id":142,"name":"isFinished","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":90,"character":4}],"signatures":[{"id":143,"name":"isFinished","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.isFinished"}}],"overwrites":{"type":"reference","name":"RequestProvider.isFinished"}},{"id":153,"name":"markRequestHandled","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":94,"character":4}],"signatures":[{"id":154,"name":"markRequestHandled","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":155,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"request","isOptional":false,"element":{"type":"reference","typeArguments":[{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"RequestQueueOperationInfo","qualifiedName":"RequestQueueOperationInfo","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.markRequestHandled"}}],"overwrites":{"type":"reference","name":"RequestProvider.markRequestHandled"}},{"id":156,"name":"reclaimRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":95,"character":4}],"signatures":[{"id":157,"name":"reclaimRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":158,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"request","isOptional":false,"element":{"type":"reference","typeArguments":[{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","id":212,"name":"RequestQueueOperationOptions","qualifiedName":"RequestQueueOperationOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"RequestQueueOperationInfo","qualifiedName":"RequestQueueOperationInfo","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.reclaimRequest"}}],"overwrites":{"type":"reference","name":"RequestProvider.reclaimRequest"}},{"id":123,"name":"open","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":97,"character":11}],"signatures":[{"id":124,"name":"open","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":125,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"queueIdOrName","isOptional":true,"element":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","name":"StorageManagerOptions","qualifiedName":"StorageManagerOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":122,"name":"RequestQueue","qualifiedName":"RequestQueue","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.open"}}],"overwrites":{"type":"reference","name":"RequestProvider.open"}}],"groups":[{"title":"Properties","children":[172,171,166,165,161,162,169,168,163,170,164]},{"title":"Methods","children":[144,147,150,194,132,198,180,196,184,142,153,156,123]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":52,"character":21}],"extendedTypes":[{"type":"reference","name":"RequestProvider","qualifiedName":"RequestProvider","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/RequestQueue","previousId":1410,"nextId":305},{"id":1127,"name":"AbortOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1130,"name":"gracefully","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/run.d.ts","line":80,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"RunAbortOptions.gracefully"}},{"id":1129,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit with given status message"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1632,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1632"}],"type":{"type":"intrinsic","name":"string"}},{"id":1128,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User API token that is used to run the actor. By default, it is taken from the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1629,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1629"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1130,1129,1128]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1625,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1625"}],"extendedTypes":[{"type":"reference","name":"RunAbortOptions","qualifiedName":"RunAbortOptions","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/AbortOptions","previousId":305,"nextId":1149},{"id":1149,"name":"ActorRun","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":1161,"name":"actId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":172,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.actId"}},{"id":1162,"name":"actorTaskId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":173,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.actorTaskId"}},{"id":1167,"name":"buildId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":178,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.buildId"}},{"id":1168,"name":"buildNumber","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":179,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.buildNumber"}},{"id":1155,"name":"containerUrl","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":191,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":1170,"name":"defaultDatasetId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":181,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.defaultDatasetId"}},{"id":1169,"name":"defaultKeyValueStoreId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":180,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.defaultKeyValueStoreId"}},{"id":1171,"name":"defaultRequestQueueId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":182,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.defaultRequestQueueId"}},{"id":1154,"name":"exitCode","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":190,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":1164,"name":"finishedAt","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":175,"character":4}],"type":{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.finishedAt"}},{"id":1157,"name":"gitBranchName","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":193,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":1160,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":171,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.id"}},{"id":1156,"name":"isContainerServerReady","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":192,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":1166,"name":"meta","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":177,"character":4}],"type":{"type":"reference","name":"ActorRunMeta","qualifiedName":"ActorRunMeta","package":"apify-client"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.meta"}},{"id":1153,"name":"options","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":189,"character":4}],"type":{"type":"reference","name":"ActorRunOptions","qualifiedName":"ActorRunOptions","package":"apify-client"}},{"id":1163,"name":"startedAt","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":174,"character":4}],"type":{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.startedAt"}},{"id":1152,"name":"stats","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":188,"character":4}],"type":{"type":"reference","name":"ActorRunStats","qualifiedName":"ActorRunStats","package":"apify-client"}},{"id":1165,"name":"status","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":176,"character":4}],"type":{"type":"union","types":[{"type":"literal","value":"READY"},{"type":"literal","value":"RUNNING"},{"type":"literal","value":"SUCCEEDED"},{"type":"literal","value":"FAILED"},{"type":"literal","value":"ABORTING"},{"type":"literal","value":"ABORTED"},{"type":"literal","value":"TIMING-OUT"},{"type":"literal","value":"TIMED-OUT"}]},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.status"}},{"id":1151,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":187,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":1158,"name":"usage","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":194,"character":4}],"type":{"type":"reference","name":"ActorRunUsage","qualifiedName":"ActorRunUsage","package":"apify-client"}},{"id":1172,"name":"usageTotalUsd","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":183,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.usageTotalUsd"}},{"id":1159,"name":"usageUsd","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":195,"character":4}],"type":{"type":"reference","name":"ActorRunUsage","qualifiedName":"ActorRunUsage","package":"apify-client"}},{"id":1150,"name":"userId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":186,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1161,1162,1167,1168,1155,1170,1169,1171,1154,1164,1157,1160,1156,1166,1153,1163,1152,1165,1151,1158,1172,1159,1150]}],"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":185,"character":17}],"extendedTypes":[{"type":"reference","name":"ActorRunListItem","qualifiedName":"ActorRunListItem","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/ActorRun","previousId":1127,"nextId":820},{"id":820,"name":"ApifyClientOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":821,"name":"baseUrl","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"https://api.apify.com"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":127,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":822,"name":"maxRetries","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"8"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":129,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":823,"name":"minDelayBetweenRetriesMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"500"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":131,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":824,"name":"requestInterceptors","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"[]"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":133,"character":4}],"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reflection","declaration":{"id":825,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/node_modules/axios/index.d.ts","line":133,"character":27}],"signatures":[{"id":826,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":827,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"ApifyRequestConfig","qualifiedName":"ApifyRequestConfig","package":"apify-client"}}],"type":{"type":"intrinsic","name":"unknown"}}]}}]}}},{"id":828,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"360"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":135,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":829,"name":"token","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":136,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[821,822,823,824,828,829]}],"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":125,"character":17}],"permalink":"/sdk/js/reference/next/interface/ApifyClientOptions","previousId":1149,"nextId":1095},{"id":1095,"name":"ApifyEnv","kind":256,"kindString":"Interface","flags":{},"comment":{"summary":[{"kind":"text","text":"Parsed representation of the Apify environment variables.\\nThis object is returned by the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getEnv"},{"kind":"text","text":" function."}]},"children":[{"id":1096,"name":"actorId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the actor (ACTOR_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1556,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1556"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1097,"name":"actorRunId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the actor run (ACTOR_RUN_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1561,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1561"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1098,"name":"actorTaskId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the actor task (ACTOR_TASK_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1566,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1566"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1104,"name":"defaultDatasetId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the dataset where input and output data of this\\nactor is stored (ACTOR_DEFAULT_DATASET_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1600,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1600"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1103,"name":"defaultKeyValueStoreId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the key-value store where input and output data of this\\nactor is stored (ACTOR_DEFAULT_KEY_VALUE_STORE_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1594,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1594"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1105,"name":"memoryMbytes","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Amount of memory allocated for the actor,\\nin megabytes (ACTOR_MEMORY_MBYTES)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1606,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1606"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"number"}]}},{"id":1101,"name":"startedAt","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Date when the actor was started (ACTOR_STARTED_AT)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1583,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1583"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"}]}},{"id":1102,"name":"timeoutAt","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Date when the actor will time out (ACTOR_TIMEOUT_AT)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1588,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1588"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"}]}},{"id":1100,"name":"token","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Authentication token representing privileges given to the actor run,\\nit can be passed to various Apify APIs (APIFY_TOKEN)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1578,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1578"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1099,"name":"userId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the user who started the actor - note that it might be\\ndifferent than the owner ofthe actor (APIFY_USER_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1572,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1572"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}}],"groups":[{"title":"Properties","children":[1096,1097,1098,1104,1103,1105,1101,1102,1100,1099]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1552,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1552"}],"permalink":"/sdk/js/reference/next/interface/ApifyEnv","previousId":820,"nextId":1110},{"id":1110,"name":"CallOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1113,"name":"build","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Tag or number of the actor build to run (e.g. "},{"kind":"code","text":"`beta`"},{"kind":"text","text":" or "},{"kind":"code","text":"`1.2.345`"},{"kind":"text","text":").\\nIf not provided, the run uses build tag or number from the default actor run configuration (typically "},{"kind":"code","text":"`latest`"},{"kind":"text","text":")."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":129,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.build"}},{"id":1114,"name":"contentType","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Content type for the "},{"kind":"code","text":"`input`"},{"kind":"text","text":". If not specified,\\n"},{"kind":"code","text":"`input`"},{"kind":"text","text":" is expected to be an object that will be stringified to JSON and content type set to\\n"},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":". If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, then "},{"kind":"code","text":"`input`"},{"kind":"text","text":" must be a\\n"},{"kind":"code","text":"`String`"},{"kind":"text","text":" or "},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":136,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.contentType"}},{"id":1118,"name":"maxItems","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies maximum number of items that the actor run should return.\\nThis is used by pay per result actors to limit the maximum number of results that will be charged to customer.\\nValue can be accessed in actor run using "},{"kind":"code","text":"`ACTOR_MAX_PAID_DATASET_ITEMS`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":165,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.maxItems"}},{"id":1115,"name":"memory","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Memory in megabytes which will be allocated for the new actor run.\\nIf not provided, the run uses memory of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":141,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.memory"}},{"id":1116,"name":"timeout","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Timeout for the actor run in seconds. Zero value means there is no timeout.\\nIf not provided, the run uses timeout of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":146,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.timeout"}},{"id":1111,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User API token that is used to run the actor. By default, it is taken from the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1615,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1615"}],"type":{"type":"intrinsic","name":"string"}},{"id":1112,"name":"waitSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":168,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.waitSecs"}},{"id":1117,"name":"webhooks","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies optional webhooks associated with the actor run, which can be used\\nto receive a notification e.g. when the actor finished or failed, see\\n[ad hook webhooks documentation](https://docs.apify.com/webhooks/ad-hoc-webhooks) for detailed description."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":159,"character":4}],"type":{"type":"typeOperator","operator":"readonly","target":{"type":"array","elementType":{"type":"reference","name":"WebhookUpdateData","qualifiedName":"WebhookUpdateData","package":"apify-client"}}},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.webhooks"}}],"groups":[{"title":"Properties","children":[1113,1114,1118,1115,1116,1111,1112,1117]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1611,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1611"}],"extendedTypes":[{"type":"reference","name":"ActorCallOptions","qualifiedName":"ActorCallOptions","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/CallOptions","previousId":1095,"nextId":1119},{"id":1119,"name":"CallTaskOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1122,"name":"build","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Tag or number of the actor build to run (e.g. "},{"kind":"code","text":"`beta`"},{"kind":"text","text":" or "},{"kind":"code","text":"`1.2.345`"},{"kind":"text","text":").\\nIf not provided, the run uses build tag or number from the default actor run configuration (typically "},{"kind":"code","text":"`latest`"},{"kind":"text","text":")."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":129,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.build"}},{"id":1126,"name":"maxItems","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies maximum number of items that the actor run should return.\\nThis is used by pay per result actors to limit the maximum number of results that will be charged to customer.\\nValue can be accessed in actor run using "},{"kind":"code","text":"`ACTOR_MAX_PAID_DATASET_ITEMS`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":165,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.maxItems"}},{"id":1123,"name":"memory","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Memory in megabytes which will be allocated for the new actor run.\\nIf not provided, the run uses memory of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":141,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.memory"}},{"id":1124,"name":"timeout","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Timeout for the actor run in seconds. Zero value means there is no timeout.\\nIf not provided, the run uses timeout of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":146,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.timeout"}},{"id":1120,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User API token that is used to run the actor. By default, it is taken from the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1622,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1622"}],"type":{"type":"intrinsic","name":"string"}},{"id":1121,"name":"waitSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/task.d.ts","line":86,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.waitSecs"}},{"id":1125,"name":"webhooks","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies optional webhooks associated with the actor run, which can be used\\nto receive a notification e.g. when the actor finished or failed, see\\n[ad hook webhooks documentation](https://docs.apify.com/webhooks/ad-hoc-webhooks) for detailed description."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":159,"character":4}],"type":{"type":"typeOperator","operator":"readonly","target":{"type":"array","elementType":{"type":"reference","name":"WebhookUpdateData","qualifiedName":"WebhookUpdateData","package":"apify-client"}}},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.webhooks"}}],"groups":[{"title":"Properties","children":[1122,1126,1123,1124,1120,1121,1125]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1618,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1618"}],"extendedTypes":[{"type":"reference","name":"TaskCallOptions","qualifiedName":"TaskCallOptions","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/CallTaskOptions","previousId":1110,"nextId":1178},{"id":1178,"name":"ConfigurationOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1180,"name":"actorEventsWsUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":12,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L12"}],"type":{"type":"intrinsic","name":"string"}},{"id":1182,"name":"actorId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":14,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L14"}],"type":{"type":"intrinsic","name":"string"}},{"id":1183,"name":"actorRunId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":15,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L15"}],"type":{"type":"intrinsic","name":"string"}},{"id":1184,"name":"actorTaskId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":16,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L16"}],"type":{"type":"intrinsic","name":"string"}},{"id":1185,"name":"apiBaseUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":17,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L17"}],"type":{"type":"intrinsic","name":"string"}},{"id":1204,"name":"availableMemoryRatio","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the ratio, defining the amount of system memory that could be used by the "},{"kind":"inline-tag","tag":"@apilink","text":"AutoscaledPool"},{"kind":"text","text":".\\nWhen the memory usage is more than the provided ratio, the memory is considered overloaded.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_AVAILABLE_MEMORY_RATIO`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0.25"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":67,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.availableMemoryRatio"}},{"id":1211,"name":"chromeExecutablePath","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines a path to Chrome executable.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_CHROME_EXECUTABLE_PATH`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":114,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.chromeExecutablePath"}},{"id":1186,"name":"containerPort","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":18,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L18"}],"type":{"type":"intrinsic","name":"number"}},{"id":1187,"name":"containerUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":19,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L19"}],"type":{"type":"intrinsic","name":"string"}},{"id":1212,"name":"defaultBrowserPath","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines a path to default browser executable.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_BROWSER_PATH`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":120,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultBrowserPath"}},{"id":1199,"name":"defaultDatasetId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Default dataset id.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_DATASET_ID`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'default\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":32,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultDatasetId"}},{"id":1201,"name":"defaultKeyValueStoreId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Default key-value store id.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_KEY_VALUE_STORE_ID`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'default\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":46,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultKeyValueStoreId"}},{"id":1202,"name":"defaultRequestQueueId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Default request queue id.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_REQUEST_QUEUE_ID`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'default\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":53,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultRequestQueueId"}},{"id":1213,"name":"disableBrowserSandbox","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether to disable browser sandbox by adding "},{"kind":"code","text":"`--no-sandbox`"},{"kind":"text","text":" flag to "},{"kind":"code","text":"`launchOptions`"},{"kind":"text","text":".\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DISABLE_BROWSER_SANDBOX`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":126,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.disableBrowserSandbox"}},{"id":1197,"name":"eventManager","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the Event Manager to be used."}],"blockTags":[{"tag":"@default","content":[{"kind":"inline-tag","tag":"@apilink","text":"EventManager"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":20,"character":4}],"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.eventManager"}},{"id":1209,"name":"headless","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether web browsers launched by Crawlee will run in the headless mode.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_HEADLESS`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"true"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":101,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.headless"}},{"id":1208,"name":"inputKey","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the default input key, i.e. the key that is used to get the crawler input value\\nfrom the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current crawler run.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_INPUT_KEY`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'INPUT\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":94,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.inputKey"}},{"id":1195,"name":"inputSecretsPrivateKeyFile","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":27,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L27"}],"type":{"type":"intrinsic","name":"string"}},{"id":1194,"name":"inputSecretsPrivateKeyPassphrase","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":26,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L26"}],"type":{"type":"intrinsic","name":"string"}},{"id":1192,"name":"isAtHome","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":24,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L24"}],"type":{"type":"intrinsic","name":"boolean"}},{"id":1214,"name":"logLevel","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the log level to the given value.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_LOG_LEVEL`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'INFO\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":133,"character":4}],"type":{"type":"union","types":[{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"},{"type":"reflection","declaration":{"id":1215,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":551,"character":4}],"signatures":[{"id":1216,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1217,"name":"radix","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1218,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":557,"character":4}],"signatures":[{"id":1219,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1220,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1221,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":563,"character":4}],"signatures":[{"id":1222,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1223,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1224,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":569,"character":4}],"signatures":[{"id":1225,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1226,"name":"precision","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1227,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":572,"character":4}],"signatures":[{"id":1228,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}]}},{"type":"reflection","declaration":{"id":1229,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":4499,"character":4},{"fileName":"website/node_modules/typescript/lib/lib.es2020.number.d.ts","line":27,"character":4}],"signatures":[{"id":1230,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1231,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]}},{"id":1232,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}},{"id":1233,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1234,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"LocalesArgument","qualifiedName":"Intl.LocalesArgument","package":"typescript"}},{"id":1235,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}}]}}]},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.logLevel"}},{"id":1203,"name":"maxUsedCpuRatio","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the ratio, defining the maximum CPU usage.\\nWhen the CPU usage is higher than the provided ratio, the CPU is considered overloaded."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0.95"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":59,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.maxUsedCpuRatio"}},{"id":1205,"name":"memoryMbytes","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the amount of system memory in megabytes to be used by the "},{"kind":"inline-tag","tag":"@apilink","text":"AutoscaledPool"},{"kind":"text","text":".\\nBy default, the maximum memory is set to one quarter of total system memory.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_MEMORY_MBYTES`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":74,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.memoryMbytes"}},{"id":1179,"name":"metamorphAfterSleepMillis","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":11,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L11"}],"type":{"type":"intrinsic","name":"number"}},{"id":1206,"name":"persistStateIntervalMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the interval of emitting the "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":" event.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_PERSIST_STATE_INTERVAL_MILLIS`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"60_000"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":81,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.persistStateIntervalMillis"}},{"id":1236,"name":"persistStorage","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether the storage client used should persist the data it stores.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_PERSIST_STORAGE`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":139,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.persistStorage"}},{"id":1188,"name":"proxyHostname","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":20,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L20"}],"type":{"type":"intrinsic","name":"string"}},{"id":1189,"name":"proxyPassword","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":21,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L21"}],"type":{"type":"intrinsic","name":"string"}},{"id":1190,"name":"proxyPort","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":22,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L22"}],"type":{"type":"intrinsic","name":"number"}},{"id":1191,"name":"proxyStatusUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":23,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L23"}],"type":{"type":"intrinsic","name":"string"}},{"id":1200,"name":"purgeOnStart","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether to purge the default storage folders before starting the crawler run.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_PURGE_ON_START`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"true"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":39,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.purgeOnStart"}},{"id":1196,"name":"storageClient","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines storage client to be used."}],"blockTags":[{"tag":"@default","content":[{"kind":"inline-tag","tag":"@apilink","text":"MemoryStorage"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":15,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.storageClient"}},{"id":1198,"name":"storageClientOptions","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Could be used to adjust the storage client behavior\\ne.g. "},{"kind":"inline-tag","tag":"@apilink","text":"MemoryStorageOptions"},{"kind":"text","text":" could be used to adjust the "},{"kind":"inline-tag","tag":"@apilink","text":"MemoryStorage"},{"kind":"text","text":" behavior."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":25,"character":4}],"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.storageClientOptions"}},{"id":1207,"name":"systemInfoIntervalMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the interval of emitting the "},{"kind":"code","text":"`systemInfo`"},{"kind":"text","text":" event."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"60_000"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":86,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.systemInfoIntervalMillis"}},{"id":1181,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":13,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L13"}],"type":{"type":"intrinsic","name":"string"}},{"id":1193,"name":"userId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":25,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L25"}],"type":{"type":"intrinsic","name":"string"}},{"id":1210,"name":"xvfb","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether to run X virtual framebuffer on the web browsers launched by Crawlee.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_XVFB`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":108,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.xvfb"}}],"groups":[{"title":"Properties","children":[1180,1182,1183,1184,1185,1204,1211,1186,1187,1212,1199,1201,1202,1213,1197,1209,1208,1195,1194,1192,1214,1203,1205,1179,1206,1236,1188,1189,1190,1191,1200,1196,1198,1207,1181,1193,1210]}],"sources":[{"fileName":"packages/apify/src/configuration.ts","line":10,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L10"}],"extendedTypes":[{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/ConfigurationOptions","previousId":1119,"nextId":92},{"id":92,"name":"DatasetConsumer","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":338,"character":17}],"typeParameters":[{"id":93,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"signatures":[{"id":94,"name":"DatasetConsumer","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":95,"name":"item","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry being processed."}]},"type":{"type":"reference","id":93,"name":"Data","qualifiedName":"DatasetConsumer.Data","package":"@crawlee/core"}},{"id":96,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/DatasetConsumer","previousId":1178,"nextId":114},{"id":114,"name":"DatasetContent","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":116,"name":"count","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Count of dataset entries returned in this set."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":376,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":120,"name":"desc","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Should the results be in descending order."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":384,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":119,"name":"items","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Dataset entries based on chosen format parameter."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":382,"character":4}],"type":{"type":"array","elementType":{"type":"reference","id":121,"name":"Data","qualifiedName":"DatasetContent.Data","package":"@crawlee/core"}}},{"id":118,"name":"limit","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Maximum number of dataset entries requested."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":380,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":117,"name":"offset","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of the first returned entry in the dataset."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":378,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":115,"name":"total","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Total count of entries in the dataset."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":374,"character":4}],"type":{"type":"intrinsic","name":"number"}}],"groups":[{"title":"Properties","children":[116,120,119,118,117,115]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":372,"character":17}],"typeParameters":[{"id":121,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"permalink":"/sdk/js/reference/next/interface/DatasetContent","previousId":92,"nextId":73},{"id":73,"name":"DatasetDataOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":79,"name":"clean","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the function returns only non-empty items and skips hidden fields (i.e. fields starting with "},{"kind":"code","text":"`#`"},{"kind":"text","text":" character).\\nNote that the "},{"kind":"code","text":"`clean`"},{"kind":"text","text":" parameter is a shortcut for "},{"kind":"code","text":"`skipHidden: true`"},{"kind":"text","text":" and "},{"kind":"code","text":"`skipEmpty: true`"},{"kind":"text","text":" options."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":55,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":76,"name":"desc","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the objects are sorted by "},{"kind":"code","text":"`createdAt`"},{"kind":"text","text":" in descending order.\\nOtherwise they are sorted in ascending order."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":40,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":77,"name":"fields","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of field names that will be included in the result. If omitted, all fields are included in the results."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":44,"character":4}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":75,"name":"limit","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Maximum number of array elements to return."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"250000"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":34,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":74,"name":"offset","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of array elements that should be skipped at the start."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":29,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":81,"name":"skipEmpty","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the function doesn\'t return empty items.\\nNote that in this case the returned number of items might be lower than limit parameter and pagination must be done using the "},{"kind":"code","text":"`limit`"},{"kind":"text","text":" value."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":66,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":80,"name":"skipHidden","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the function doesn\'t return hidden fields (fields starting with \\"#\\" character)."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":60,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":78,"name":"unwind","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a name of the field in the result objects that will be used to unwind the resulting objects.\\nBy default, the results are returned as they are."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":49,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[79,76,77,75,74,81,80,78]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":24,"character":17}],"permalink":"/sdk/js/reference/next/interface/DatasetDataOptions","previousId":114,"nextId":82},{"id":82,"name":"DatasetIteratorOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":89,"name":"desc","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the objects are sorted by "},{"kind":"code","text":"`createdAt`"},{"kind":"text","text":" in descending order.\\nOtherwise they are sorted in ascending order."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":40,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"Omit.desc"}},{"id":90,"name":"fields","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of field names that will be included in the result. If omitted, all fields are included in the results."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":44,"character":4}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}},"inheritedFrom":{"type":"reference","name":"Omit.fields"}},{"id":91,"name":"unwind","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a name of the field in the result objects that will be used to unwind the resulting objects.\\nBy default, the results are returned as they are."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":49,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"Omit.unwind"}}],"groups":[{"title":"Properties","children":[89,90,91]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":68,"character":17}],"extendedTypes":[{"type":"reference","typeArguments":[{"type":"reference","id":73,"name":"DatasetDataOptions","qualifiedName":"DatasetDataOptions","package":"@crawlee/core"},{"type":"union","types":[{"type":"literal","value":"offset"},{"type":"literal","value":"limit"},{"type":"literal","value":"clean"},{"type":"literal","value":"skipHidden"},{"type":"literal","value":"skipEmpty"}]}],"name":"Omit","qualifiedName":"Omit","package":"typescript"}],"permalink":"/sdk/js/reference/next/interface/DatasetIteratorOptions","previousId":73,"nextId":97},{"id":97,"name":"DatasetMapper","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":348,"character":17}],"typeParameters":[{"id":98,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}},{"id":99,"name":"R","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"signatures":[{"id":100,"name":"DatasetMapper","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"User-function used in the "},{"kind":"code","text":"`Dataset.map()`"},{"kind":"text","text":" API."}]},"parameters":[{"id":101,"name":"item","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry being processed."}]},"type":{"type":"reference","id":98,"name":"Data","qualifiedName":"DatasetMapper.Data","package":"@crawlee/core"}},{"id":102,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":99,"name":"R","qualifiedName":"DatasetMapper.R","package":"@crawlee/core"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/DatasetMapper","previousId":82,"nextId":110},{"id":110,"name":"DatasetOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":113,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":370,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}},{"id":111,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":368,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":369,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[113,111,112]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":367,"character":17}],"permalink":"/sdk/js/reference/next/interface/DatasetOptions","previousId":97,"nextId":103},{"id":103,"name":"DatasetReducer","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":359,"character":17}],"typeParameters":[{"id":104,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}},{"id":105,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"signatures":[{"id":106,"name":"DatasetReducer","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":107,"name":"memo","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Previous state of the reduction."}]},"type":{"type":"reference","id":104,"name":"T","qualifiedName":"DatasetReducer.T","package":"@crawlee/core"}},{"id":108,"name":"item","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry being processed."}]},"type":{"type":"reference","id":105,"name":"Data","qualifiedName":"DatasetReducer.Data","package":"@crawlee/core"}},{"id":109,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":104,"name":"T","qualifiedName":"DatasetReducer.T","package":"@crawlee/core"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/DatasetReducer","previousId":110,"nextId":1142},{"id":1142,"name":"ExitOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1146,"name":"exit","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Call "},{"kind":"code","text":"`process.exit()`"},{"kind":"text","text":"? Defaults to true"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1701,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1701"}],"type":{"type":"intrinsic","name":"boolean"}},{"id":1145,"name":"exitCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit code, defaults to 0"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1699,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1699"}],"type":{"type":"intrinsic","name":"number"}},{"id":1143,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit with given status message"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1692,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1692"}],"type":{"type":"intrinsic","name":"string"}},{"id":1144,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Amount of time, in seconds, to wait for all event handlers to finish before exiting the process."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"30"}]}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1697,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1697"}],"type":{"type":"intrinsic","name":"number"}}],"groups":[{"title":"Properties","children":[1146,1145,1143,1144]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1690,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1690"}],"extendedBy":[{"type":"reference","id":1089,"name":"MainOptions"}],"permalink":"/sdk/js/reference/next/interface/ExitOptions","previousId":103,"nextId":1087},{"id":1087,"name":"InitOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1088,"name":"storage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1543,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1543"}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}}],"groups":[{"title":"Properties","children":[1088]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1542,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1542"}],"extendedBy":[{"type":"reference","id":1089,"name":"MainOptions"}],"permalink":"/sdk/js/reference/next/interface/InitOptions","previousId":1142,"nextId":219},{"id":219,"name":"KeyConsumer","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":352,"character":17}],"signatures":[{"id":220,"name":"KeyConsumer","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":221,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" key being processed."}]},"type":{"type":"intrinsic","name":"string"}},{"id":222,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of the current key in "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"number"}},{"id":223,"name":"info","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Information about the current "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" entry."}]},"type":{"type":"reflection","declaration":{"id":224,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"children":[{"id":225,"name":"size","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Size of the value associated with the current key in bytes."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":360,"character":8}],"type":{"type":"intrinsic","name":"number"}}],"groups":[{"title":"Properties","children":[225]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":359,"character":39}]}}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/KeyConsumer","previousId":1087,"nextId":232},{"id":232,"name":"KeyValueStoreIteratorOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":233,"name":"exclusiveStartKey","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All keys up to this one (including) are skipped from the result."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":378,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[233]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":374,"character":17}],"permalink":"/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions","previousId":219,"nextId":226},{"id":226,"name":"KeyValueStoreOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":229,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":366,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}},{"id":227,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":364,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":228,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":365,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[229,227,228]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":363,"character":17}],"permalink":"/sdk/js/reference/next/interface/KeyValueStoreOptions","previousId":232,"nextId":297},{"id":297,"name":"LoggerOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":304,"name":"data","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Additional data to be added to each log line."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":23,"character":4}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","qualifiedName":"Record","package":"typescript"}},{"id":298,"name":"level","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the log level to the given value, preventing messages from less important log levels\\nfrom being printed to the console. Use in conjunction with the "},{"kind":"code","text":"`log.LEVELS`"},{"kind":"text","text":" constants."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":8,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":303,"name":"logger","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable\\nstrings. Optionally you can use "},{"kind":"code","text":"`log.LoggerJson`"},{"kind":"text","text":" that formats each log line as a JSON."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":21,"character":4}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"}},{"id":299,"name":"maxDepth","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Max depth of data object that will be logged. Anything deeper than the limit will be stripped off."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":10,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":300,"name":"maxStringLength","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Max length of the string to be logged. Longer strings will be truncated."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":12,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":301,"name":"prefix","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Prefix to be prepended the each logged line."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":14,"character":4}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":302,"name":"suffix","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Suffix that will be appended the each logged line."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":16,"character":4}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}}],"groups":[{"title":"Properties","children":[304,298,303,299,300,301,302]}],"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":3,"character":17}],"permalink":"/sdk/js/reference/next/interface/LoggerOptions","previousId":226,"nextId":1089},{"id":1089,"name":"MainOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1093,"name":"exit","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Call "},{"kind":"code","text":"`process.exit()`"},{"kind":"text","text":"? Defaults to true"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1701,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1701"}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":1146,"name":"ExitOptions.exit"}},{"id":1092,"name":"exitCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit code, defaults to 0"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1699,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1699"}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":1145,"name":"ExitOptions.exitCode"}},{"id":1090,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit with given status message"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1692,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1692"}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","id":1143,"name":"ExitOptions.statusMessage"}},{"id":1094,"name":"storage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1543,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1543"}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","id":1088,"name":"InitOptions.storage"}},{"id":1091,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Amount of time, in seconds, to wait for all event handlers to finish before exiting the process."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"30"}]}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1697,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1697"}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":1144,"name":"ExitOptions.timeoutSecs"}}],"groups":[{"title":"Properties","children":[1093,1092,1090,1094,1091]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1546,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1546"}],"extendedTypes":[{"type":"reference","id":1142,"name":"ExitOptions"},{"type":"reference","id":1087,"name":"InitOptions"}],"permalink":"/sdk/js/reference/next/interface/MainOptions","previousId":297,"nextId":1136},{"id":1136,"name":"MetamorphOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1138,"name":"build","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Tag or number of the target actor build to metamorph into (e.g. "},{"kind":"code","text":"`beta`"},{"kind":"text","text":" or "},{"kind":"code","text":"`1.2.345`"},{"kind":"text","text":").\\nIf not provided, the run uses build tag or number from the default actor run configuration (typically "},{"kind":"code","text":"`latest`"},{"kind":"text","text":")."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1679,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1679"}],"type":{"type":"intrinsic","name":"string"}},{"id":1137,"name":"contentType","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Content type for the "},{"kind":"code","text":"`input`"},{"kind":"text","text":". If not specified,\\n"},{"kind":"code","text":"`input`"},{"kind":"text","text":" is expected to be an object that will be stringified to JSON and content type set to\\n"},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":". If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, then "},{"kind":"code","text":"`input`"},{"kind":"text","text":" must be a\\n"},{"kind":"code","text":"`String`"},{"kind":"text","text":" or "},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1673,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1673"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1138,1137]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1666,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1666"}],"permalink":"/sdk/js/reference/next/interface/MetamorphOptions","previousId":1089,"nextId":1147},{"id":1147,"name":"OpenStorageOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1148,"name":"forceCloud","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the cloud storage is used even if the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":"\\nenvironment variable is set. This way it is possible to combine local and cloud storage."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1710,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1710"}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[1148]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1704,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1704"}],"permalink":"/sdk/js/reference/next/interface/OpenStorageOptions","previousId":1136,"nextId":1393},{"id":1393,"name":"ProxyConfigurationOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1398,"name":"apifyProxyCountry","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Same option as "},{"kind":"code","text":"`countryCode`"},{"kind":"text","text":" which can be used to\\nconfigurate the proxy by UI input schema. You should use the "},{"kind":"code","text":"`countryCode`"},{"kind":"text","text":" option in your crawler code."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":56,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L56"}],"type":{"type":"intrinsic","name":"string"}},{"id":1397,"name":"apifyProxyGroups","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Same option as "},{"kind":"code","text":"`groups`"},{"kind":"text","text":" which can be used to\\nconfigurate the proxy by UI input schema. You should use the "},{"kind":"code","text":"`groups`"},{"kind":"text","text":" option in your crawler code."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":50,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L50"}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":1396,"name":"countryCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set and relevant proxies are available in your Apify account, all proxied requests will\\nuse IP addresses that are geolocated to the specified country. For example "},{"kind":"code","text":"`GB`"},{"kind":"text","text":" for IPs\\nfrom Great Britain. Note that online services often have their own rules for handling\\ngeolocation and thus the country selection is a best attempt at geolocation, rather than\\na guaranteed hit. This parameter is optional, by default, each proxied request is assigned\\nan IP address from a random country. The country code needs to be a two letter ISO country code. See the\\n[full list of available country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).\\nThis parameter is optional, by default, the proxy uses all available proxy servers from all countries.\\non the Apify cloud, or when using the [Apify CLI](https://github.com/apify/apify-cli)."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":44,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L44"}],"type":{"type":"intrinsic","name":"string"}},{"id":1395,"name":"groups","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of proxy groups to be used by the [Apify Proxy](https://docs.apify.com/proxy).\\nIf not provided, the proxy will select the groups automatically."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":31,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L31"}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":1400,"name":"newUrlFunction","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Custom function that allows you to generate the new proxy URL dynamically. It gets the "},{"kind":"code","text":"`sessionId`"},{"kind":"text","text":" as a parameter\\nand should always return stringified proxy URL. Can be asynchronous.\\nThis function is used to generate the URL when "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newUrl"},{"kind":"text","text":" or "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newProxyInfo"},{"kind":"text","text":" is called."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":16,"character":4}],"type":{"type":"reference","name":"ProxyConfigurationFunction","qualifiedName":"ProxyConfigurationFunction","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreProxyConfigurationOptions.newUrlFunction"}},{"id":1394,"name":"password","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User\'s password for the proxy. By default, it is taken from the "},{"kind":"code","text":"`APIFY_PROXY_PASSWORD`"},{"kind":"text","text":"\\nenvironment variable, which is automatically set by the system when running the actors."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":25,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L25"}],"type":{"type":"intrinsic","name":"string"}},{"id":1399,"name":"proxyUrls","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of custom proxy URLs to be rotated.\\nCustom proxies are not compatible with Apify Proxy and an attempt to use both\\nconfiguration options will cause an error to be thrown on initialize."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":10,"character":4}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}},"inheritedFrom":{"type":"reference","name":"CoreProxyConfigurationOptions.proxyUrls"}}],"groups":[{"title":"Properties","children":[1398,1397,1396,1395,1400,1394,1399]}],"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":20,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L20"}],"extendedTypes":[{"type":"reference","name":"ProxyConfigurationOptions","qualifiedName":"ProxyConfigurationOptions","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/ProxyConfigurationOptions","previousId":1147,"nextId":1401},{"id":1401,"name":"ProxyInfo","kind":256,"kindString":"Interface","flags":{},"comment":{"summary":[{"kind":"text","text":"The main purpose of the ProxyInfo object is to provide information\\nabout the current proxy connection used by the crawler for the request.\\nOutside of crawlers, you can get this object by calling "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newProxyInfo"},{"kind":"text","text":".\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n\\nconst proxyConfiguration = await Actor.createProxyConfiguration({\\n groups: [\'GROUP1\', \'GROUP2\'] // List of Apify Proxy groups\\n countryCode: \'US\',\\n});\\n\\n// Getting proxyInfo object by calling class method directly\\nconst proxyInfo = proxyConfiguration.newProxyInfo();\\n\\n// In crawler\\nconst crawler = new CheerioCrawler({\\n // ...\\n proxyConfiguration,\\n requestHandler({ proxyInfo }) {\\n // Getting used proxy URL\\n const proxyUrl = proxyInfo.url;\\n\\n // Getting ID of used Session\\n const sessionIdentifier = proxyInfo.sessionId;\\n }\\n})\\n\\n```"}]},"children":[{"id":1403,"name":"countryCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set and relevant proxies are available in your Apify account, all proxied requests will\\nuse IP addresses that are geolocated to the specified country. For example "},{"kind":"code","text":"`GB`"},{"kind":"text","text":" for IPs\\nfrom Great Britain. Note that online services often have their own rules for handling\\ngeolocation and thus the country selection is a best attempt at geolocation, rather than\\na guaranteed hit. This parameter is optional, by default, each proxied request is assigned\\nan IP address from a random country. The country code needs to be a two letter ISO country code. See the\\n[full list of available country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).\\nThis parameter is optional, by default, the proxy uses all available proxy servers from all countries."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":108,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L108"}],"type":{"type":"intrinsic","name":"string"}},{"id":1402,"name":"groups","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"An array of proxy groups to be used by the [Apify Proxy](https://docs.apify.com/proxy).\\nIf not provided, the proxy will select the groups automatically."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":96,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L96"}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":1408,"name":"hostname","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Hostname of your proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":68,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.hostname"}},{"id":1404,"name":"password","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"User\'s password for the proxy. By default, it is taken from the "},{"kind":"code","text":"`APIFY_PROXY_PASSWORD`"},{"kind":"text","text":"\\nenvironment variable, which is automatically set by the system when running the actors\\non the Apify cloud, or when using the [Apify CLI](https://github.com/apify/apify-cli)."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":115,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L115"}],"type":{"type":"intrinsic","name":"string"},"overwrites":{"type":"reference","name":"CoreProxyInfo.password"}},{"id":1409,"name":"port","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Proxy port."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":72,"character":4}],"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.port"}},{"id":1405,"name":"sessionId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The identifier of used "},{"kind":"inline-tag","tag":"@apilink","text":"Session"},{"kind":"text","text":", if used."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":52,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.sessionId"}},{"id":1406,"name":"url","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The URL of the proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":56,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.url"}},{"id":1407,"name":"username","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Username for the proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":60,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.username"}}],"groups":[{"title":"Properties","children":[1403,1402,1408,1404,1409,1405,1406,1407]}],"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":91,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L91"}],"extendedTypes":[{"type":"reference","name":"ProxyInfo","qualifiedName":"ProxyInfo","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/ProxyInfo","previousId":1393,"nextId":208},{"id":208,"name":"QueueOperationInfo","kind":256,"kindString":"Interface","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A helper class that is used to report results from various\\n"},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" functions as well as "},{"kind":"inline-tag","tag":"@apilink","text":"enqueueLinks"},{"kind":"text","text":"."}]},"children":[{"id":211,"name":"requestId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The ID of the added request"}]},"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":13,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":210,"name":"wasAlreadyHandled","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Indicates if request was already marked as handled."}]},"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":11,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":209,"name":"wasAlreadyPresent","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Indicates if request was already present in the queue."}]},"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":9,"character":4}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[211,210,209]}],"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":7,"character":17}],"permalink":"/sdk/js/reference/next/interface/QueueOperationInfo","previousId":1401,"nextId":1140},{"id":1140,"name":"RebootOptions","kind":256,"kindString":"Interface","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1685,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1685"}],"permalink":"/sdk/js/reference/next/interface/RebootOptions","previousId":208,"nextId":230},{"id":230,"name":"RecordOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":231,"name":"contentType","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a custom MIME content type of the record."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":372,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[231]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":368,"character":17}],"permalink":"/sdk/js/reference/next/interface/RecordOptions","previousId":1140,"nextId":212},{"id":212,"name":"RequestQueueOperationOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":213,"name":"forefront","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":":\\n - while adding the request to the queue: the request will be added to the foremost position in the queue.\\n - while reclaiming the request: the request will be placed to the beginning of the queue, so that it\'s returned\\n in the next call to "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.fetchNextRequest"},{"kind":"text","text":".\\nBy default, it\'s put to the end of the queue."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":226,"character":4}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[213]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":217,"character":17}],"permalink":"/sdk/js/reference/next/interface/RequestQueueOperationOptions","previousId":230,"nextId":214},{"id":214,"name":"RequestQueueOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"comment":{"summary":[],"blockTags":[{"tag":"@deprecated","content":[{"kind":"text","text":"Use "},{"kind":"inline-tag","tag":"@apilink","text":"RequestProviderOptions"},{"kind":"text","text":" instead."}]}]},"children":[{"id":217,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":196,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.client"}},{"id":215,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":194,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.id"}},{"id":216,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":195,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.name"}},{"id":218,"name":"proxyConfiguration","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Used to pass the proxy configuration for the "},{"kind":"code","text":"`requestsFromUrl`"},{"kind":"text","text":" objects.\\nTakes advantage of the internal address rotation and authentication process.\\nIf undefined, the "},{"kind":"code","text":"`requestsFromUrl`"},{"kind":"text","text":" requests will be made without proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":202,"character":4}],"type":{"type":"reference","name":"ProxyConfiguration","qualifiedName":"ProxyConfiguration","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.proxyConfiguration"}}],"groups":[{"title":"Properties","children":[217,215,216,218]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":207,"character":17}],"extendedTypes":[{"type":"reference","name":"RequestProviderOptions","qualifiedName":"RequestProviderOptions","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/RequestQueueOptions","previousId":212,"nextId":1131},{"id":1131,"name":"WebhookOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1132,"name":"eventTypes","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Array of event types, which you can set for actor run, see\\nthe [actor run events](https://docs.apify.com/webhooks/events#actor-run) in the Apify doc."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1640,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1640"}],"type":{"type":"typeOperator","operator":"readonly","target":{"type":"array","elementType":{"type":"reference","name":"WebhookEventType","qualifiedName":"WebhookEventType","package":"apify-client"}}}},{"id":1135,"name":"idempotencyKey","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Idempotency key enables you to ensure that a webhook will not be added multiple times in case of\\nan actor restart or other situation that would cause the "},{"kind":"code","text":"`addWebhook()`"},{"kind":"text","text":" function to be called again.\\nWe suggest using the actor run ID as the idempotency key. You can get the run ID by calling\\n"},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getEnv"},{"kind":"text","text":" function."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1663,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1663"}],"type":{"type":"intrinsic","name":"string"}},{"id":1134,"name":"payloadTemplate","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Payload template is a JSON-like string that describes the structure of the webhook POST request payload.\\nIt uses JSON syntax, extended with a double curly braces syntax for injecting variables "},{"kind":"code","text":"`{{variable}}`"},{"kind":"text","text":".\\nThose variables are resolved at the time of the webhook\'s dispatch, and a list of available variables with their descriptions\\nis available in the [Apify webhook documentation](https://docs.apify.com/webhooks).\\nIf "},{"kind":"code","text":"`payloadTemplate`"},{"kind":"text","text":" is omitted, the default payload template is used\\n([view docs](https://docs.apify.com/webhooks/actions#payload-template))."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1655,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1655"}],"type":{"type":"intrinsic","name":"string"}},{"id":1133,"name":"requestUrl","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"URL which will be requested using HTTP POST request, when actor run will reach the set event type."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1645,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1645"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1132,1135,1134,1133]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1635,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1635"}],"permalink":"/sdk/js/reference/next/interface/WebhookOptions","previousId":214,"nextId":1106},{"id":1106,"name":"UserFunc","kind":4194304,"kindString":"Type alias","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1609,"character":12,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1609"}],"typeParameters":[{"id":1109,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reflection","declaration":{"id":1107,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1609,"character":36,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1609"}],"signatures":[{"id":1108,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","typeArguments":[{"type":"reference","id":1109,"name":"T"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/types"}}]}},"permalink":"/sdk/js/reference/next#UserFunc","previousId":1131,"nextId":234},{"id":234,"name":"log","kind":32,"kindString":"Variable","flags":{"isExternal":true,"isConst":true},"sources":[{"fileName":"node_modules/@apify/log/index.d.ts","line":8,"character":14}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"},"permalink":"/sdk/js/reference/next#log","previousId":1106}],"groups":[{"title":"Classes","children":[830,750,1237,1,1514,235,313,457,602,1467,1410,122],"categories":[{"title":"CATEGORY","children":[830,750,1237,1514,235,313,457,602,1467]},{"title":"Result Stores","children":[1]},{"title":"Scaling","children":[1410]},{"title":"Sources","children":[122]}]},{"title":"Enumerations","children":[305]},{"title":"Interfaces","children":[1127,1149,820,1095,1110,1119,1178,92,114,73,82,97,110,103,1142,1087,219,232,226,297,1089,1136,1147,1393,1401,208,1140,230,212,214,1131]},{"title":"Type Aliases","children":[1106]},{"title":"Variables","children":[234]}],"sources":[{"fileName":"packages/apify/src/index.ts","line":1,"character":0,"url":"https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/index.ts#L1"}],"permalink":"/sdk/js/reference/next"},"urlSlug":"."}],"packageName":"apify","packageVersion":"3.1.12"}]')}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1093],{457:e=>{e.exports=JSON.parse('[{"entryPoints":[{"index":true,"label":"Index","reflection":{"id":0,"name":"apify","kind":1,"kindString":"Project","flags":{},"originalName":"","children":[{"id":305,"name":"LogLevel","kind":8,"kindString":"Enumeration","flags":{"isExternal":true},"children":[{"id":311,"name":"DEBUG","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":7,"character":4}],"type":{"type":"literal","value":5}},{"id":307,"name":"ERROR","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":3,"character":4}],"type":{"type":"literal","value":1}},{"id":310,"name":"INFO","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":6,"character":4}],"type":{"type":"literal","value":4}},{"id":306,"name":"OFF","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":2,"character":4}],"type":{"type":"literal","value":0}},{"id":312,"name":"PERF","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":8,"character":4}],"type":{"type":"literal","value":6}},{"id":308,"name":"SOFT_FAIL","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":4,"character":4}],"type":{"type":"literal","value":2}},{"id":309,"name":"WARNING","kind":16,"kindString":"Enumeration Member","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":5,"character":4}],"type":{"type":"literal","value":3}}],"groups":[{"title":"Enumeration Members","children":[311,307,310,306,312,308,309]}],"sources":[{"fileName":"node_modules/@apify/log/log_consts.d.ts","line":1,"character":20}],"permalink":"/sdk/js/reference/next/enum/LogLevel","previousId":122,"nextId":1127},{"id":830,"name":"Actor","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"code","text":"`Actor`"},{"kind":"text","text":" class serves as an alternative approach to the static helpers exported from the package. It allows to pass configuration\\nthat will be used on the instance methods. Environment variables will have precedence over this configuration.\\nSee "},{"kind":"inline-tag","tag":"@apilink","text":"Configuration"},{"kind":"text","text":" for details about what can be configured and what are the default values."}]},"children":[{"id":953,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":82,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L82"}],"signatures":[{"id":954,"name":"new Actor","kind":16384,"kindString":"Constructor signature","flags":{},"typeParameter":[{"id":955,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":956,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"},"defaultValue":"{}"}],"type":{"type":"reference","id":830,"typeArguments":[{"type":"reference","id":955,"name":"Data"}],"name":"Actor"}}]},{"id":960,"name":"initialized","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Whether the actor instance was initialized. This is set by calling "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.init"},{"kind":"text","text":"."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":74,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L74"}],"type":{"type":"intrinsic","name":"boolean"},"defaultValue":"false"},{"id":947,"name":"apifyClient","kind":262144,"kindString":"Accessor","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1503,"character":15,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1503"}],"getSignature":{"id":948,"name":"apifyClient","kind":524288,"kindString":"Get signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Default "},{"kind":"inline-tag","tag":"@apilink","text":"ApifyClient"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","id":750,"name":"ApifyClient","qualifiedName":"ApifyClient","package":"apify-client"}}},{"id":949,"name":"config","kind":262144,"kindString":"Accessor","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1508,"character":15,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1508"}],"getSignature":{"id":950,"name":"config","kind":524288,"kindString":"Get signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Default "},{"kind":"inline-tag","tag":"@apilink","text":"Configuration"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","id":1237,"name":"Configuration"}}},{"id":1046,"name":"getInputOrThrow","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":760,"character":10,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L760"}],"signatures":[{"id":1047,"name":"getInputOrThrow","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets the actor input value just like the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getInput"},{"kind":"text","text":" method,\\nbut throws if it is not found."}]},"typeParameter":[{"id":1048,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"Buffer","qualifiedName":"global.Buffer","package":"@types/node"}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1048,"name":"T"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":1071,"name":"useState","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":963,"character":10,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L963"}],"signatures":[{"id":1072,"name":"useState","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Easily create and manage state values. All state values are automatically persisted.\\n\\nValues can be modified by simply using the assignment operator."}]},"typeParameter":[{"id":1073,"name":"State","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":1074,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The name of the store to use."}]},"type":{"type":"intrinsic","name":"string"}},{"id":1075,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"If the store does not yet have a value in it, the value will be initialized with the "},{"kind":"code","text":"`defaultValue`"},{"kind":"text","text":" you provide."}]},"type":{"type":"reference","id":1073,"name":"State"},"defaultValue":"..."},{"id":1076,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional object parameter where a custom "},{"kind":"code","text":"`keyValueStoreName`"},{"kind":"text","text":" and "},{"kind":"code","text":"`config`"},{"kind":"text","text":" can be passed in."}]},"type":{"type":"reference","name":"UseStateOptions","qualifiedName":"UseStateOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1073,"name":"State"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":883,"name":"abort","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1184,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1184"}],"signatures":[{"id":884,"name":"abort","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Aborts given actor run on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable).\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nFor more information about actors, read the\\n[documentation](https://docs.apify.com/actor).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.abort(runId);\\n```"}]},"parameters":[{"id":885,"name":"runId","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}},{"id":886,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1127,"name":"AbortOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":895,"name":"addWebhook","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1225,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1225"}],"signatures":[{"id":896,"name":"addWebhook","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed.\\nFor more information about Apify actor webhooks, please see the [documentation](https://docs.apify.com/webhooks).\\n\\nNote that webhooks are only supported for actors running on the Apify platform.\\nIn local environment, the function will print a warning and have no effect."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The return value is the Webhook object.\\nFor more information, see the [Get webhook](https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook) API endpoint."}]}]},"parameters":[{"id":897,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1131,"name":"WebhookOptions"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"Webhook","qualifiedName":"Webhook","package":"apify-client"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":868,"name":"call","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1110,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1110"}],"signatures":[{"id":869,"name":"call","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs an actor on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable).\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nIf you want to run an actor task rather than an actor, please use the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.callTask"},{"kind":"text","text":" function instead.\\n\\nFor more information about actors, read the [documentation](https://docs.apify.com/actor).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.call(\'apify/hello-world\', { myInput: 123 });\\n```"}]},"parameters":[{"id":870,"name":"actorId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Allowed formats are "},{"kind":"code","text":"`username/actor-name`"},{"kind":"text","text":", "},{"kind":"code","text":"`userId/actor-name`"},{"kind":"text","text":" or actor ID."}]},"type":{"type":"intrinsic","name":"string"}},{"id":871,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input for the actor. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Otherwise the "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" parameter must be provided."}]},"type":{"type":"intrinsic","name":"unknown"}},{"id":872,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1110,"name":"CallOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":873,"name":"callTask","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1139,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1139"}],"signatures":[{"id":874,"name":"callTask","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs an actor task on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable).\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nNote that an actor task is a saved input configuration and options for an actor.\\nIf you want to run an actor directly rather than an actor task, please use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"Actor.call"},{"kind":"text","text":" function instead.\\n\\nFor more information about actor tasks, read the [documentation](https://docs.apify.com/tasks).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.callTask(\'bob/some-task\');\\n```"}]},"parameters":[{"id":875,"name":"taskId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Allowed formats are "},{"kind":"code","text":"`username/task-name`"},{"kind":"text","text":", "},{"kind":"code","text":"`userId/task-name`"},{"kind":"text","text":" or task ID."}]},"type":{"type":"intrinsic","name":"string"}},{"id":876,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input overrides for the actor task. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Provided input will be merged with actor task input."}]},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}},{"id":877,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1119,"name":"CallTaskOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":935,"name":"createProxyConfiguration","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1467,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1467"}],"signatures":[{"id":936,"name":"createProxyConfiguration","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Creates a proxy configuration and returns a promise resolving to an instance\\nof the "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration"},{"kind":"text","text":" class that is already initialized.\\n\\nConfigures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking\\nyour crawlers based on IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures\\nthem to use the selected proxies for all connections.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration"},{"kind":"text","text":" class.\\n\\n"},{"kind":"code","text":"```javascript\\n\\n// Returns initialized proxy configuration class\\nconst proxyConfiguration = await Actor.createProxyConfiguration({\\n groups: [\'GROUP1\', \'GROUP2\'] // List of Apify proxy groups\\n countryCode: \'US\'\\n});\\n\\nconst crawler = new CheerioCrawler({\\n // ...\\n proxyConfiguration,\\n requestHandler({ proxyInfo }) {\\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\\n }\\n})\\n\\n```"},{"kind":"text","text":"\\n\\nFor compatibility with existing Actor Input UI (Input Schema), this function\\nreturns "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":" when the following object is passed as "},{"kind":"code","text":"`proxyConfigurationOptions`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```\\n{ useApifyProxy: false }\\n```"}]},"parameters":[{"id":937,"name":"proxyConfigurationOptions","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intersection","types":[{"type":"reference","id":1393,"name":"ProxyConfigurationOptions"},{"type":"reflection","declaration":{"id":938,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"children":[{"id":939,"name":"useApifyProxy","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1468,"character":65,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1468"}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[939]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1468,"character":63,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1468"}]}}]},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","id":1410,"name":"ProxyConfiguration"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":846,"name":"exit","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1066,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1066"}],"signatures":[{"id":847,"name":"exit","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gracefully exits the actor run with the provided status message and exit code."}]},"parameters":[{"id":848,"name":"messageOrOptions","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"First parameter accepts either a string (a terminal status message) or an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","id":1142,"name":"ExitOptions"}]}},{"id":849,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Second parameter accepts an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"reference","id":1142,"name":"ExitOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":850,"name":"fail","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1075,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1075"}],"signatures":[{"id":851,"name":"fail","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Calls "},{"kind":"code","text":"`Actor.exit()`"},{"kind":"text","text":" with "},{"kind":"code","text":"`options.exitCode`"},{"kind":"text","text":" set to "},{"kind":"code","text":"`1`"},{"kind":"text","text":"."}]},"parameters":[{"id":852,"name":"messageOrOptions","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"First parameter accepts either a string (a terminal status message) or an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","id":1142,"name":"ExitOptions"}]}},{"id":853,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Second parameter accepts an "},{"kind":"code","text":"`ExitOptions`"},{"kind":"text","text":" object."}]},"type":{"type":"reference","id":1142,"name":"ExitOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":940,"name":"getEnv","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1480,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1480"}],"signatures":[{"id":941,"name":"getEnv","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a new "},{"kind":"inline-tag","tag":"@apilink","text":"ApifyEnv"},{"kind":"text","text":" object which contains information parsed from all the Apify environment variables.\\n\\nFor the list of the Apify environment variables, see\\n[Actor documentation](https://docs.apify.com/actor/run#environment-variables).\\nIf some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null."}]},"type":{"type":"reference","id":1095,"name":"ApifyEnv"}}]},{"id":921,"name":"getInput","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1382,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1382"}],"signatures":[{"id":922,"name":"getInput","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets the actor input value from the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue | `keyValueStore.getValue(\'INPUT\')`"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nconst input = await Actor.getInput();\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst store = await Actor.openKeyValueStore();\\nawait store.getValue(\'INPUT\');\\n```"},{"kind":"text","text":"\\n\\nNote that the "},{"kind":"code","text":"`getInput()`"},{"kind":"text","text":" function does not cache the value read from the key-value store.\\nIf you need to use the input multiple times in your actor,\\nit is far more efficient to read it once and store it locally.\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openKeyValueStore"},{"kind":"text","text":" and "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":"\\n if the record is missing."}]}]},"typeParameter":[{"id":923,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"Buffer","qualifiedName":"global.Buffer","package":"@types/node"}]}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":923,"name":"T"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":924,"name":"getInputOrThrow","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1390,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1390"}],"signatures":[{"id":925,"name":"getInputOrThrow","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets the actor input value just like the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getInput"},{"kind":"text","text":" method,\\nbut throws if it is not found."}]},"typeParameter":[{"id":926,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"Buffer","qualifiedName":"global.Buffer","package":"@types/node"}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":926,"name":"T"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":911,"name":"getValue","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1317,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1317"}],"signatures":[{"id":912,"name":"getValue","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets a value from the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nconst value = await Actor.getValue(\'my-key\');\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst store = await Actor.openKeyValueStore();\\nconst value = await store.getValue(\'my-key\');\\n```"},{"kind":"text","text":"\\n\\nTo store the value to the default key-value store, you can use the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.setValue"},{"kind":"text","text":" function.\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openKeyValueStore"},{"kind":"text","text":"\\nand "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":"\\n if the record is missing."}]}]},"typeParameter":[{"id":913,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"parameters":[{"id":914,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Unique record key."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":913,"name":"T"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":843,"name":"init","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1057,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1057"}],"signatures":[{"id":844,"name":"init","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":845,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1087,"name":"InitOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":945,"name":"isAtHome","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1498,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1498"}],"signatures":[{"id":946,"name":"isAtHome","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" when code is running on Apify platform and "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise (for example locally)."}]},"type":{"type":"intrinsic","name":"boolean"}}]},{"id":838,"name":"main","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1053,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1053"}],"signatures":[{"id":839,"name":"main","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs the main user function that performs the job of the actor\\nand terminates the process when the user function finishes.\\n\\n**The "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":" function is optional** and is provided merely for your convenience.\\nIt is mainly useful when you\'re running your code as an actor on the [Apify platform](https://apify.com/actors).\\nHowever, if you want to use Apify SDK tools directly inside your existing projects, e.g.\\nrunning in an [Express](https://expressjs.com/) server, on\\n[Google Cloud functions](https://cloud.google.com/functions)\\nor [AWS Lambda](https://aws.amazon.com/lambda/), it\'s better to avoid\\nit since the function terminates the main process when it finishes!\\n\\nThe "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":" function performs the following actions:\\n\\n- When running on the Apify platform (i.e. "},{"kind":"code","text":"`APIFY_IS_AT_HOME`"},{"kind":"text","text":" environment variable is set),\\n it sets up a connection to listen for platform events.\\n For example, to get a notification about an imminent migration to another server.\\n See "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.events"},{"kind":"text","text":" for details.\\n- It checks that either "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" or "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" environment variable\\n is defined. If not, the functions sets "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" to "},{"kind":"code","text":"`./apify_storage`"},{"kind":"text","text":"\\n inside the current working directory. This is to simplify running code examples.\\n- It invokes the user function passed as the "},{"kind":"code","text":"`userFunc`"},{"kind":"text","text":" parameter.\\n- If the user function returned a promise, waits for it to resolve.\\n- If the user function throws an exception or some other error is encountered,\\n prints error details to console so that they are stored to the log.\\n- Exits the Node.js process, with zero exit code on success and non-zero on errors.\\n\\nThe user function can be synchronous:\\n\\n"},{"kind":"code","text":"```javascript\\nawait Actor.main(() => {\\n // My synchronous function that returns immediately\\n console.log(\'Hello world from actor!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nIf the user function returns a promise, it is considered asynchronous:\\n"},{"kind":"code","text":"```javascript\\nimport { gotScraping } from \'got-scraping\';\\n\\nawait Actor.main(() => {\\n // My asynchronous function that returns a promise\\n return gotScraping(\'http://www.example.com\').then((html) => {\\n console.log(html);\\n });\\n});\\n```"},{"kind":"text","text":"\\n\\nTo simplify your code, you can take advantage of the "},{"kind":"code","text":"`async`"},{"kind":"text","text":"/"},{"kind":"code","text":"`await`"},{"kind":"text","text":" keywords:\\n\\n"},{"kind":"code","text":"```javascript\\nimport { gotScraping } from \'got-scraping\';\\n\\nawait Actor.main(async () => {\\n // My asynchronous function\\n const html = await gotScraping(\'http://www.example.com\');\\n console.log(html);\\n});\\n```"}]},"typeParameter":[{"id":840,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":841,"name":"userFunc","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"User function to be executed. If it returns a promise,\\nthe promise will be awaited. The user function is called with no arguments."}]},"type":{"type":"reference","id":1106,"typeArguments":[{"type":"reference","id":840,"name":"T"}],"name":"UserFunc"}},{"id":842,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1089,"name":"MainOptions"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":840,"name":"T"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":887,"name":"metamorph","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1201,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1201"}],"signatures":[{"id":888,"name":"metamorph","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Transforms this actor run to an actor run of a given actor. The system stops the current container and starts\\nthe new container instead. All the default storages are preserved and the new input is stored under the "},{"kind":"code","text":"`INPUT-METAMORPH-1`"},{"kind":"text","text":" key\\nin the same default key-value store."}]},"parameters":[{"id":889,"name":"targetActorId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Either "},{"kind":"code","text":"`username/actor-name`"},{"kind":"text","text":" or actor ID of an actor to which we want to metamorph."}]},"type":{"type":"intrinsic","name":"string"}},{"id":890,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input for the actor. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Otherwise, the "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" parameter must be provided."}]},"type":{"type":"intrinsic","name":"unknown"}},{"id":891,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1136,"name":"MetamorphOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":942,"name":"newClient","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1491,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1491"}],"signatures":[{"id":943,"name":"newClient","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a new instance of the Apify API client. The "},{"kind":"code","text":"`ApifyClient`"},{"kind":"text","text":" class is provided\\nby the [apify-client](https://www.npmjs.com/package/apify-client)\\nNPM package, and it is automatically configured using the "},{"kind":"code","text":"`APIFY_API_BASE_URL`"},{"kind":"text","text":", and "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":"\\nenvironment variables. You can override the token via the available options. That\'s useful\\nif you want to use the client as a different Apify user than the SDK internals are using."}]},"parameters":[{"id":944,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":820,"name":"ApifyClientOptions","qualifiedName":"ApifyClientOptions","package":"apify-client"},"defaultValue":"{}"}],"type":{"type":"reference","id":750,"name":"ApifyClient","qualifiedName":"ApifyClient","package":"apify-client"}}]},{"id":861,"name":"off","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1083,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1083"}],"signatures":[{"id":862,"name":"off","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":863,"name":"event","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":864,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reflection","declaration":{"id":865,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1083,"character":48,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1083"}],"signatures":[{"id":866,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":867,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":854,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1079,"character":11,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1079"}],"signatures":[{"id":855,"name":"on","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":856,"name":"event","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":857,"name":"listener","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reflection","declaration":{"id":858,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1079,"character":46,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1079"}],"signatures":[{"id":859,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"parameters":[{"id":860,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":906,"name":"openDataset","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1284,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1284"}],"signatures":[{"id":907,"name":"openDataset","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Opens a dataset and returns a promise resolving to an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class.\\n\\nDatasets are used to store structured data where each object stored has the same attributes,\\nsuch as online store products or real estate offers.\\nThe actual data is stored either on the local filesystem or in the cloud.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class."}]},"typeParameter":[{"id":908,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":909,"name":"datasetIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the dataset to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default dataset associated with the actor run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":910,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1147,"name":"OpenStorageOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1,"typeArguments":[{"type":"reference","id":908,"name":"Data"}],"name":"Dataset","qualifiedName":"Dataset","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":927,"name":"openKeyValueStore","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1408,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1408"}],"signatures":[{"id":928,"name":"openKeyValueStore","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Opens a key-value store and returns a promise resolving to an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" class.\\n\\nKey-value stores are used to store records or files, along with their MIME content type.\\nThe records are stored and retrieved using a unique key.\\nThe actual data is stored either on a local filesystem or in the Apify cloud.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" class."}]},"parameters":[{"id":929,"name":"storeIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the key-value store to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default key-value store associated with the actor run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":930,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1147,"name":"OpenStorageOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1514,"name":"KeyValueStore"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":931,"name":"openRequestQueue","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1428,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1428"}],"signatures":[{"id":932,"name":"openRequestQueue","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Opens a request queue and returns a promise resolving to an instance\\nof the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" class.\\n\\n"},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud.\\nThe queue is used for deep crawling of websites, where you start with several URLs and then\\nrecursively follow links to other pages. The data structure supports both breadth-first\\nand depth-first crawling orders.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" class."}]},"parameters":[{"id":933,"name":"queueIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the request queue to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default request queue associated with the actor run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":934,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1147,"name":"OpenStorageOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":122,"name":"RequestQueue","qualifiedName":"RequestQueue","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":902,"name":"pushData","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1266,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1266"}],"signatures":[{"id":903,"name":"pushData","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Stores an object or an array of objects to the default "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" of the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.pushData"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nawait Actor.pushData({ myValue: 123 });\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst dataset = await Actor.openDataset();\\nawait dataset.pushData({ myValue: 123 });\\n```"},{"kind":"text","text":"\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openDataset"},{"kind":"text","text":" and "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.pushData"},{"kind":"text","text":"\\n\\n**IMPORTANT**: Make sure to use the "},{"kind":"code","text":"`await`"},{"kind":"text","text":" keyword when calling "},{"kind":"code","text":"`pushData()`"},{"kind":"text","text":",\\notherwise the actor process might finish before the data are stored!"}]},"typeParameter":[{"id":904,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":905,"name":"item","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Object or array of objects containing data to be stored in the default dataset.\\nThe objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB."}]},"type":{"type":"union","types":[{"type":"reference","id":904,"name":"Data"},{"type":"array","elementType":{"type":"reference","id":904,"name":"Data"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":892,"name":"reboot","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1210,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1210"}],"signatures":[{"id":893,"name":"reboot","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Internally reboots this actor run. The system stops the current container and starts\\na new container with the same run id.\\nThis can be used to get the Actor out of irrecoverable error state and continue where it left off."}]},"parameters":[{"id":894,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1140,"name":"RebootOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":898,"name":"setStatusMessage","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1239,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1239"}],"signatures":[{"id":899,"name":"setStatusMessage","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Sets the status message for the current actor run."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"The return value is the Run object. When run locally, this method returns empty object ("},{"kind":"code","text":"`{}`"},{"kind":"text","text":").\\nFor more information, see the [Actor Runs](https://docs.apify.com/api/v2#/reference/actor-runs/) API endpoints."}]}]},"parameters":[{"id":900,"name":"statusMessage","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"The status message to set."}]},"type":{"type":"intrinsic","name":"string"}},{"id":901,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","name":"SetStatusMessageOptions","qualifiedName":"SetStatusMessageOptions","package":"@crawlee/types"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":915,"name":"setValue","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1351,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1351"}],"signatures":[{"id":916,"name":"setValue","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Stores or deletes a value in the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current actor run.\\n\\nThis is just a convenient shortcut for "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.setValue"},{"kind":"text","text":".\\nFor example, calling the following code:\\n"},{"kind":"code","text":"```javascript\\nawait Actor.setValue(\'OUTPUT\', { foo: \\"bar\\" });\\n```"},{"kind":"text","text":"\\n\\nis equivalent to:\\n"},{"kind":"code","text":"```javascript\\nconst store = await Actor.openKeyValueStore();\\nawait store.setValue(\'OUTPUT\', { foo: \\"bar\\" });\\n```"},{"kind":"text","text":"\\n\\nTo get a value from the default key-value store, you can use the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getValue"},{"kind":"text","text":" function.\\n\\nFor more information, see "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.openKeyValueStore"},{"kind":"text","text":"\\nand "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":"."}]},"typeParameter":[{"id":917,"name":"T","kind":131072,"kindString":"Type parameter","flags":{}}],"parameters":[{"id":918,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Unique record key."}]},"type":{"type":"intrinsic","name":"string"}},{"id":919,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Record data, which can be one of the following values:\\n - If "},{"kind":"code","text":"`null`"},{"kind":"text","text":", the record in the key-value store is deleted.\\n - If no "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" can be any JavaScript object, and it will be stringified to JSON.\\n - If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is set, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is taken as is, and it must be a "},{"kind":"code","text":"`String`"},{"kind":"text","text":" or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html).\\n For any other value an error will be thrown."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":917,"name":"T"}]}},{"id":920,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":230,"name":"RecordOptions","qualifiedName":"RecordOptions","package":"@crawlee/core"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":878,"name":"start","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1166,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1166"}],"signatures":[{"id":879,"name":"start","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Runs an actor on the Apify platform using the current user account (determined by the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable),\\nunlike "},{"kind":"code","text":"`Actor.call`"},{"kind":"text","text":", this method just starts the run without waiting for finish.\\n\\nThe result of the function is an "},{"kind":"inline-tag","tag":"@apilink","text":"ActorRun"},{"kind":"text","text":" object that contains details about the actor run.\\n\\nFor more information about actors, read the\\n[documentation](https://docs.apify.com/actor).\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst run = await Actor.start(\'apify/hello-world\', { myInput: 123 });\\n```"}]},"parameters":[{"id":880,"name":"actorId","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"Allowed formats are "},{"kind":"code","text":"`username/actor-name`"},{"kind":"text","text":", "},{"kind":"code","text":"`userId/actor-name`"},{"kind":"text","text":" or actor ID."}]},"type":{"type":"intrinsic","name":"string"}},{"id":881,"name":"input","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Input for the actor. If it is an object, it will be stringified to\\n JSON and its content type set to "},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":".\\n Otherwise the "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" parameter must be provided."}]},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}},{"id":882,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1110,"name":"CallOptions"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1149,"name":"ActorRun","qualifiedName":"ActorRun","package":"apify-client"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":832,"name":"useState","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":981,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L981"}],"signatures":[{"id":833,"name":"useState","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Easily create and manage state values. All state values are automatically persisted.\\n\\nValues can be modified by simply using the assignment operator."}]},"typeParameter":[{"id":834,"name":"State","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":835,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The name of the store to use."}]},"type":{"type":"intrinsic","name":"string"}},{"id":836,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{},"comment":{"summary":[{"kind":"text","text":"If the store does not yet have a value in it, the value will be initialized with the "},{"kind":"code","text":"`defaultValue`"},{"kind":"text","text":" you provide."}]},"type":{"type":"reference","id":834,"name":"State"},"defaultValue":"..."},{"id":837,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional object parameter where a custom "},{"kind":"code","text":"`keyValueStoreName`"},{"kind":"text","text":" and "},{"kind":"code","text":"`config`"},{"kind":"text","text":" can be passed in."}]},"type":{"type":"reference","name":"UseStateOptions","qualifiedName":"UseStateOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":834,"name":"State"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]}],"groups":[{"title":"Constructors","children":[953]},{"title":"Properties","children":[960]},{"title":"Accessors","children":[947,949]},{"title":"Methods","children":[1046,1071,883,895,868,873,935,846,850,940,921,924,911,843,945,838,887,942,861,854,906,927,931,902,892,898,915,878,832]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":49,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L49"}],"typeParameters":[{"id":1086,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"permalink":"/sdk/js/reference/next/class/Actor","nextId":750},{"id":750,"name":"ApifyClient","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"ApifyClient is the official library to access [Apify API](https://docs.apify.com/api/v2) from your\\nJavaScript applications. It runs both in Node.js and browser."}]},"children":[{"id":751,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":37,"character":4}],"signatures":[{"id":752,"name":"new ApifyClient","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":753,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":820,"name":"ApifyClientOptions","qualifiedName":"ApifyClientOptions","package":"apify-client"}}],"type":{"type":"reference","id":750,"name":"ApifyClient","qualifiedName":"ApifyClient","package":"apify-client"}}]},{"id":754,"name":"baseUrl","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":32,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":758,"name":"httpClient","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":36,"character":4}],"type":{"type":"reference","name":"HttpClient","qualifiedName":"HttpClient","package":"apify-client"}},{"id":757,"name":"logger","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":35,"character":4}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}},{"id":756,"name":"stats","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":34,"character":4}],"type":{"type":"reference","name":"Statistics","qualifiedName":"Statistics","package":"apify-client"}},{"id":755,"name":"token","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":33,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":762,"name":"actor","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":46,"character":4}],"signatures":[{"id":763,"name":"actor","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actors/actor-object"}]},"parameters":[{"id":764,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ActorClient","qualifiedName":"ActorClient","package":"apify-client"}}]},{"id":760,"name":"actors","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":42,"character":4}],"signatures":[{"id":761,"name":"actors","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actors/actor-collection"}]},"type":{"type":"reference","name":"ActorCollectionClient","qualifiedName":"ActorCollectionClient","package":"apify-client"}}]},{"id":765,"name":"build","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":50,"character":4}],"signatures":[{"id":766,"name":"build","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-builds/build-object"}]},"parameters":[{"id":767,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"BuildClient","qualifiedName":"BuildClient","package":"apify-client"}}]},{"id":770,"name":"dataset","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":58,"character":4}],"signatures":[{"id":771,"name":"dataset","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/datasets/dataset"}]},"typeParameter":[{"id":772,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"},"default":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]},{"type":"intrinsic","name":"unknown"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"parameters":[{"id":773,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":772,"name":"Data","qualifiedName":"Data","package":"apify-client"}],"name":"DatasetClient","qualifiedName":"DatasetClient","package":"apify-client"}}]},{"id":768,"name":"datasets","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":54,"character":4}],"signatures":[{"id":769,"name":"datasets","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/datasets/dataset-collection"}]},"type":{"type":"reference","name":"DatasetCollectionClient","qualifiedName":"DatasetCollectionClient","package":"apify-client"}}]},{"id":776,"name":"keyValueStore","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":66,"character":4}],"signatures":[{"id":777,"name":"keyValueStore","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/key-value-stores/store-object"}]},"parameters":[{"id":778,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"KeyValueStoreClient","qualifiedName":"KeyValueStoreClient","package":"apify-client"}}]},{"id":774,"name":"keyValueStores","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":62,"character":4}],"signatures":[{"id":775,"name":"keyValueStores","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection"}]},"type":{"type":"reference","name":"KeyValueStoreCollectionClient","qualifiedName":"KeyValueStoreCollectionClient","package":"apify-client"}}]},{"id":779,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":70,"character":4}],"signatures":[{"id":780,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/logs"}]},"parameters":[{"id":781,"name":"buildOrRunId","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"LogClient","qualifiedName":"LogClient","package":"apify-client"}}]},{"id":784,"name":"requestQueue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":78,"character":4}],"signatures":[{"id":785,"name":"requestQueue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/request-queues/queue"}]},"parameters":[{"id":786,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":787,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"RequestQueueUserOptions","qualifiedName":"RequestQueueUserOptions","package":"apify-client"}}],"type":{"type":"reference","name":"RequestQueueClient","qualifiedName":"RequestQueueClient","package":"apify-client"}}]},{"id":782,"name":"requestQueues","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":74,"character":4}],"signatures":[{"id":783,"name":"requestQueues","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/request-queues/queue-collection"}]},"type":{"type":"reference","name":"RequestQueueCollectionClient","qualifiedName":"RequestQueueCollectionClient","package":"apify-client"}}]},{"id":788,"name":"run","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":82,"character":4}],"signatures":[{"id":789,"name":"run","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages"}]},"parameters":[{"id":790,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"RunClient","qualifiedName":"RunClient","package":"apify-client"}}]},{"id":798,"name":"schedule","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":98,"character":4}],"signatures":[{"id":799,"name":"schedule","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/schedules/schedule-object"}]},"parameters":[{"id":800,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"ScheduleClient","qualifiedName":"ScheduleClient","package":"apify-client"}}]},{"id":796,"name":"schedules","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":94,"character":4}],"signatures":[{"id":797,"name":"schedules","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/schedules/schedules-collection"}]},"type":{"type":"reference","name":"ScheduleCollectionClient","qualifiedName":"ScheduleCollectionClient","package":"apify-client"}}]},{"id":816,"name":"setStatusMessage","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":123,"character":4}],"signatures":[{"id":817,"name":"setStatusMessage","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":818,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":819,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"SetStatusMessageOptions","qualifiedName":"SetStatusMessageOptions","package":"@crawlee/types"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":814,"name":"store","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":122,"character":4}],"signatures":[{"id":815,"name":"store","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2/#/reference/store"}]},"type":{"type":"reference","name":"StoreCollectionClient","qualifiedName":"StoreCollectionClient","package":"apify-client"}}]},{"id":793,"name":"task","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":90,"character":4}],"signatures":[{"id":794,"name":"task","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-tasks/task-object"}]},"parameters":[{"id":795,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"TaskClient","qualifiedName":"TaskClient","package":"apify-client"}}]},{"id":791,"name":"tasks","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":86,"character":4}],"signatures":[{"id":792,"name":"tasks","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection"}]},"type":{"type":"reference","name":"TaskCollectionClient","qualifiedName":"TaskCollectionClient","package":"apify-client"}}]},{"id":801,"name":"user","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":102,"character":4}],"signatures":[{"id":802,"name":"user","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/users"}]},"parameters":[{"id":803,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"UserClient","qualifiedName":"UserClient","package":"apify-client"}}]},{"id":806,"name":"webhook","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":110,"character":4}],"signatures":[{"id":807,"name":"webhook","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhooks/webhook-object"}]},"parameters":[{"id":808,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"WebhookClient","qualifiedName":"WebhookClient","package":"apify-client"}}]},{"id":811,"name":"webhookDispatch","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":118,"character":4}],"signatures":[{"id":812,"name":"webhookDispatch","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object"}]},"parameters":[{"id":813,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","name":"WebhookDispatchClient","qualifiedName":"WebhookDispatchClient","package":"apify-client"}}]},{"id":809,"name":"webhookDispatches","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":114,"character":4}],"signatures":[{"id":810,"name":"webhookDispatches","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhook-dispatches"}]},"type":{"type":"reference","name":"WebhookDispatchCollectionClient","qualifiedName":"WebhookDispatchCollectionClient","package":"apify-client"}}]},{"id":804,"name":"webhooks","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":106,"character":4}],"signatures":[{"id":805,"name":"webhooks","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection"}]},"type":{"type":"reference","name":"WebhookCollectionClient","qualifiedName":"WebhookCollectionClient","package":"apify-client"}}]}],"groups":[{"title":"Constructors","children":[751]},{"title":"Properties","children":[754,758,757,756,755]},{"title":"Methods","children":[762,760,765,770,768,776,774,779,784,782,788,798,796,816,814,793,791,801,806,811,809,804]}],"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":31,"character":21}],"permalink":"/sdk/js/reference/next/class/ApifyClient","previousId":830,"nextId":1237},{"id":1237,"name":"Configuration","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"code","text":"`Configuration`"},{"kind":"text","text":" is a value object holding the SDK configuration. We can use it in two ways:\\n\\n1. When using "},{"kind":"code","text":"`Actor`"},{"kind":"text","text":" class, we can get the instance configuration via "},{"kind":"code","text":"`sdk.config`"},{"kind":"text","text":"\\n\\n "},{"kind":"code","text":"```javascript\\n import { Actor } from \'apify\';\\n import { BasicCrawler } from \'crawlee\';\\n\\n const sdk = new Actor({ token: \'123\' });\\n console.log(sdk.config.get(\'token\')); // \'123\'\\n\\n const crawler = new BasicCrawler({\\n // ... crawler options\\n }, sdk.config);\\n ```"},{"kind":"text","text":"\\n\\n2. To get the global configuration (singleton instance). It will respect the environment variables.\\n\\n "},{"kind":"code","text":"```javascript\\n import { BasicCrawler, Configuration } from \'crawlee\';\\n\\n // Get the global configuration\\n const config = Configuration.getGlobalConfig();\\n // Set the \'persistStateIntervalMillis\' option\\n // of global configuration to 30 seconds\\n config.set(\'persistStateIntervalMillis\', 30_000);\\n\\n // No need to pass the configuration to the crawler,\\n // as it\'s using the global configuration by default\\n const crawler = new BasicCrawler();\\n ```"},{"kind":"text","text":"\\n\\n## Supported Configuration Options\\n\\nKey | Environment Variable | Default Value\\n---|---|---\\n"},{"kind":"code","text":"`memoryMbytes`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_MEMORY_MBYTES`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`headless`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_HEADLESS`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`persistStateIntervalMillis`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PERSIST_STATE_INTERVAL_MILLIS`"},{"kind":"text","text":" | "},{"kind":"code","text":"`60e3`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`token`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`isAtHome`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_IS_AT_HOME`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`defaultDatasetId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_DEFAULT_DATASET_ID`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'default\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`defaultKeyValueStoreId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_DEFAULT_KEY_VALUE_STORE_ID`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'default\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`defaultRequestQueueId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_DEFAULT_REQUEST_QUEUE_ID`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'default\'`"},{"kind":"text","text":"\\n\\n## Advanced Configuration Options\\n\\nKey | Environment Variable | Default Value\\n---|---|---\\n"},{"kind":"code","text":"`actorEventsWsUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_EVENTS_WEBSOCKET_URL`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`actorId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`actorRunId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_RUN_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`actorTaskId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_TASK_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`apiBaseUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_API_BASE_URL`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'https://api.apify.com\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`containerPort`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_WEB_SERVER_PORT`"},{"kind":"text","text":" | "},{"kind":"code","text":"`4321`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`containerUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_WEB_SERVER_URL`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'http://localhost:4321\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`inputKey`"},{"kind":"text","text":" | "},{"kind":"code","text":"`ACTOR_INPUT_KEY`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'INPUT\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`metamorphAfterSleepMillis`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_METAMORPH_AFTER_SLEEP_MILLIS`"},{"kind":"text","text":" | "},{"kind":"code","text":"`300e3`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`proxyHostname`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_HOSTNAME`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'proxy.apify.com\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`proxyPassword`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_PASSWORD`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`proxyPort`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_PORT`"},{"kind":"text","text":" | "},{"kind":"code","text":"`8000`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`proxyStatusUrl`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_PROXY_STATUS_URL`"},{"kind":"text","text":" | "},{"kind":"code","text":"`\'http://proxy.apify.com\'`"},{"kind":"text","text":"\\n"},{"kind":"code","text":"`userId`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_USER_ID`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`xvfb`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_XVFB`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`chromeExecutablePath`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_CHROME_EXECUTABLE_PATH`"},{"kind":"text","text":" | -\\n"},{"kind":"code","text":"`defaultBrowserPath`"},{"kind":"text","text":" | "},{"kind":"code","text":"`APIFY_DEFAULT_BROWSER_PATH`"},{"kind":"text","text":" | -"}]},"children":[{"id":1315,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":226,"character":4}],"signatures":[{"id":1316,"name":"new Configuration","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates new "},{"kind":"code","text":"`Configuration`"},{"kind":"text","text":" instance with provided options. Env vars will have precedence over those."}]},"parameters":[{"id":1317,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"}}],"type":{"type":"reference","id":1237,"name":"Configuration"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.constructor"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.constructor"}},{"id":1372,"name":"storageManagers","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":222,"character":13}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"Constructor","qualifiedName":"Constructor","package":"@crawlee/core"},{"type":"reference","typeArguments":[{"type":"reference","name":"IStorage","qualifiedName":"IStorage","package":"@crawlee/core"}],"name":"StorageManager","qualifiedName":"StorageManager","package":"@crawlee/core"}],"name":"Map","qualifiedName":"Map","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.storageManagers"}},{"id":1238,"name":"globalConfig","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":100,"character":20,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L100"}],"type":{"type":"reference","id":1237,"name":"Configuration"},"overwrites":{"type":"reference","name":"CoreConfiguration.globalConfig"}},{"id":1318,"name":"get","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":179,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L179"}],"signatures":[{"id":1319,"name":"get","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"typeParameter":[{"id":1320,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"typeOperator","operator":"keyof","target":{"type":"reference","id":1178,"name":"ConfigurationOptions"}}},{"id":1342,"name":"U","kind":131072,"kindString":"Type parameter","flags":{},"type":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"},{"type":"intrinsic","name":"boolean"},{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},{"type":"reflection","declaration":{"id":1321,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":551,"character":4}],"signatures":[{"id":1322,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string representation of an object."}]},"parameters":[{"id":1323,"name":"radix","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a radix for converting numeric values to strings. This value is only used for numbers."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1324,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":557,"character":4}],"signatures":[{"id":1325,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string representing a number in fixed-point notation."}]},"parameters":[{"id":1326,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of digits after the decimal point. Must be in the range 0 - 20, inclusive."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1327,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":563,"character":4}],"signatures":[{"id":1328,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string containing a number represented in exponential notation."}]},"parameters":[{"id":1329,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of digits after the decimal point. Must be in the range 0 - 20, inclusive."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1330,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":569,"character":4}],"signatures":[{"id":1331,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits."}]},"parameters":[{"id":1332,"name":"precision","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of significant digits. Must be in the range 1 - 21, inclusive."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1333,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":572,"character":4}],"signatures":[{"id":1334,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns the primitive value of the specified object."}]},"type":{"type":"intrinsic","name":"number"}}]}},{"type":"reflection","declaration":{"id":1335,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":4499,"character":4},{"fileName":"website/node_modules/typescript/lib/lib.es2020.number.d.ts","line":27,"character":4}],"signatures":[{"id":1336,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Converts a number to a string by using the current or specified locale."}]},"parameters":[{"id":1337,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]}},{"id":1338,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An object that contains one or more properties that specify comparison options."}]},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}},{"id":1339,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Converts a number to a string by using the current or specified locale."}]},"parameters":[{"id":1340,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used."}]},"type":{"type":"reference","name":"LocalesArgument","qualifiedName":"Intl.LocalesArgument","package":"typescript"}},{"id":1341,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An object that contains one or more properties that specify comparison options."}]},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}}]}}]}}],"parameters":[{"id":1343,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1320,"name":"T"}},{"id":1344,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"reference","id":1342,"name":"U"}}],"type":{"type":"reference","id":1342,"name":"U"},"overwrites":{"type":"reference","name":"CoreConfiguration.get"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.get"}},{"id":1379,"name":"getEventManager","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":254,"character":4}],"signatures":[{"id":1380,"name":"getEventManager","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}},{"id":1345,"name":"set","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":186,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L186"}],"signatures":[{"id":1346,"name":"set","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"parameters":[{"id":1347,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"typeOperator","operator":"keyof","target":{"type":"reference","id":1178,"name":"ConfigurationOptions"}}},{"id":1348,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"overwrites":{"type":"reference","name":"CoreConfiguration.set"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.set"}},{"id":1387,"name":"useEventManager","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":262,"character":4}],"signatures":[{"id":1388,"name":"useEventManager","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1389,"name":"events","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useEventManager"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useEventManager"}},{"id":1384,"name":"useStorageClient","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":260,"character":4}],"signatures":[{"id":1385,"name":"useStorageClient","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1386,"name":"client","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}},{"id":1313,"name":"getEventManager","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":274,"character":11}],"signatures":[{"id":1314,"name":"getEventManager","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets default "},{"kind":"inline-tag","tag":"@apilink","text":"EventManager"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getEventManager"}},{"id":1299,"name":"getGlobalConfig","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":193,"character":20,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L193"}],"signatures":[{"id":1300,"name":"getGlobalConfig","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"type":{"type":"reference","id":1237,"name":"Configuration"},"overwrites":{"type":"reference","name":"CoreConfiguration.getGlobalConfig"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.getGlobalConfig"}},{"id":1311,"name":"getStorageClient","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":270,"character":11}],"signatures":[{"id":1312,"name":"getStorageClient","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets default "},{"kind":"inline-tag","tag":"@apilink","text":"StorageClient"},{"kind":"text","text":" instance."}]},"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getStorageClient"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.getStorageClient"}},{"id":1301,"name":"resetGlobalState","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":206,"character":20,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L206"}],"signatures":[{"id":1302,"name":"resetGlobalState","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Resets global configuration instance. The default instance holds configuration based on env vars,\\nif we want to change them, we need to first reset the global state. Used mainly for testing purposes."}]},"type":{"type":"intrinsic","name":"void"},"overwrites":{"type":"reference","name":"CoreConfiguration.resetGlobalState"}}],"overwrites":{"type":"reference","name":"CoreConfiguration.resetGlobalState"}},{"id":1304,"name":"set","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":243,"character":11}],"signatures":[{"id":1305,"name":"set","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Sets value for given option. Only affects the global "},{"kind":"code","text":"`Configuration`"},{"kind":"text","text":" instance, the value will not be propagated down to the env var.\\nTo reset a value, we can omit the "},{"kind":"code","text":"`value`"},{"kind":"text","text":" argument or pass "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":" there."}]},"parameters":[{"id":1306,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"typeOperator","operator":"keyof","target":{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"}}},{"id":1307,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.set"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.set"}},{"id":1308,"name":"useStorageClient","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":261,"character":11}],"signatures":[{"id":1309,"name":"useStorageClient","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1310,"name":"client","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}}],"inheritedFrom":{"type":"reference","name":"CoreConfiguration.useStorageClient"}}],"groups":[{"title":"Constructors","children":[1315]},{"title":"Properties","children":[1372,1238]},{"title":"Methods","children":[1318,1379,1345,1387,1384,1313,1299,1311,1301,1304,1308]}],"sources":[{"fileName":"packages/apify/src/configuration.ts","line":98,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L98"}],"extendedTypes":[{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/Configuration","previousId":750,"nextId":1},{"id":1,"name":"Dataset","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The "},{"kind":"code","text":"`Dataset`"},{"kind":"text","text":" class represents a store for structured data where each object stored has the same attributes,\\nsuch as online store products or real estate offers. You can imagine it as a table,\\nwhere each object is a row and its attributes are columns.\\nDataset is an append-only storage - you can only add new records to it but you cannot modify or remove existing records.\\nTypically it is used to store crawling results.\\n\\nDo not instantiate this class directly, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.open"},{"kind":"text","text":" function instead.\\n\\n"},{"kind":"code","text":"`Dataset`"},{"kind":"text","text":" stores its data either on local disk or in the Apify cloud,\\ndepending on whether the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" or "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variables are set.\\n\\nIf the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" environment variable is set, the data is stored in\\nthe local directory in the following files:\\n"},{"kind":"code","text":"```\\n{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\\n```"},{"kind":"text","text":"\\nNote that "},{"kind":"code","text":"`{DATASET_ID}`"},{"kind":"text","text":" is the name or ID of the dataset. The default dataset has ID: "},{"kind":"code","text":"`default`"},{"kind":"text","text":",\\nunless you override it by setting the "},{"kind":"code","text":"`APIFY_DEFAULT_DATASET_ID`"},{"kind":"text","text":" environment variable.\\nEach dataset item is stored as a separate JSON file, where "},{"kind":"code","text":"`{INDEX}`"},{"kind":"text","text":" is a zero-based index of the item in the dataset.\\n\\nIf the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable is set but "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" not, the data is stored in the\\n[Apify Dataset](https://docs.apify.com/storage/dataset)\\ncloud storage. Note that you can force usage of the cloud storage also by passing the "},{"kind":"code","text":"`forceCloud`"},{"kind":"text","text":"\\noption to "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset.open"},{"kind":"text","text":" function,\\neven if the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" variable is set.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n// Write a single row to the default dataset\\nawait Dataset.pushData({ col1: 123, col2: \'val2\' });\\n\\n// Open a named dataset\\nconst dataset = await Dataset.open(\'some-name\');\\n\\n// Write a single row\\nawait dataset.pushData({ foo: \'bar\' });\\n\\n// Write multiple rows\\nawait dataset.pushData([\\n { foo: \'bar2\', col2: \'val2\' },\\n { col3: 123 },\\n]);\\n\\n// Export the entirety of the dataset to one file in the key-value store\\nawait dataset.exportToCSV(\'MY-DATA\');\\n```"}]},"children":[{"id":31,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":144,"character":4}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetClient","qualifiedName":"DatasetClient","package":"@crawlee/types"}},{"id":28,"name":"config","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":141,"character":13}],"type":{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"}},{"id":29,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":142,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":32,"name":"log","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":145,"character":4}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}},{"id":30,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":143,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":70,"name":"drop","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":289,"character":4}],"signatures":[{"id":71,"name":"drop","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the dataset either from the Apify cloud storage or from the local directory,\\ndepending on the mode of operation."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":39,"name":"exportTo","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":186,"character":4}],"signatures":[{"id":40,"name":"exportTo","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save the entirety of the dataset\'s contents into one file within a key-value store."}]},"parameters":[{"id":41,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":42,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the dataset and target KVS name."}]},"type":{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"}},{"id":43,"name":"contentType","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Only JSON and CSV are supported currently, defaults to JSON."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":48,"name":"exportToCSV","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":200,"character":4}],"signatures":[{"id":49,"name":"exportToCSV","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one CSV file within a key-value store."}]},"parameters":[{"id":50,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":51,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the target KVS name."}]},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"},{"type":"literal","value":"fromDataset"}],"name":"Omit","qualifiedName":"Omit","package":"typescript"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":44,"name":"exportToJSON","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":193,"character":4}],"signatures":[{"id":45,"name":"exportToJSON","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one JSON file within a key-value store."}]},"parameters":[{"id":46,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":47,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the target KVS name."}]},"type":{"type":"reference","typeArguments":[{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"},{"type":"literal","value":"fromDataset"}],"name":"Omit","qualifiedName":"Omit","package":"typescript"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":54,"name":"forEach","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":258,"character":4}],"signatures":[{"id":55,"name":"forEach","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Iterates over dataset items, yielding each in turn to an "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function.\\nEach invocation of "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" is called with two arguments: "},{"kind":"code","text":"`(item, index)`"},{"kind":"text","text":".\\n\\nIf the "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function returns a Promise then it is awaited before the next call.\\nIf it throws an error, the iteration is aborted and the "},{"kind":"code","text":"`forEach`"},{"kind":"text","text":" function throws the error.\\n\\n**Example usage**\\n"},{"kind":"code","text":"```javascript\\nconst dataset = await Dataset.open(\'my-results\');\\nawait dataset.forEach(async (item, index) => {\\n console.log(`Item at ${index}: ${JSON.stringify(item)}`);\\n});\\n```"}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0"}]}]},"parameters":[{"id":56,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A function that is called for every item in the dataset."}]},"type":{"type":"reference","id":92,"typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetConsumer","qualifiedName":"DatasetConsumer","package":"@crawlee/core"}},{"id":57,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`forEach()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":82,"name":"DatasetIteratorOptions","qualifiedName":"DatasetIteratorOptions","package":"@crawlee/core"}},{"id":58,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies the initial index number passed to the "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":36,"name":"getData","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":178,"character":4}],"signatures":[{"id":37,"name":"getData","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns "},{"kind":"inline-tag","tag":"@apilink","text":"DatasetContent"},{"kind":"text","text":" object holding the items in the dataset based on the provided parameters."}]},"parameters":[{"id":38,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":73,"name":"DatasetDataOptions","qualifiedName":"DatasetDataOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":114,"typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetContent","qualifiedName":"DatasetContent","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":52,"name":"getInfo","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":237,"character":4}],"signatures":[{"id":53,"name":"getInfo","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an object containing general information about the dataset.\\n\\nThe function returns the same object as the Apify API Client\'s\\n[getDataset](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-datasets-getDataset)\\nfunction, which in turn calls the\\n[Get dataset](https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset)\\nAPI endpoint.\\n\\n**Example:**\\n"},{"kind":"code","text":"```\\n{\\n id: \\"WkzbQMuFYuamGv3YF\\",\\n name: \\"my-dataset\\",\\n userId: \\"wRsJZtadYvn4mBZmm\\",\\n createdAt: new Date(\\"2015-12-12T07:34:14.202Z\\"),\\n modifiedAt: new Date(\\"2015-12-13T08:36:13.202Z\\"),\\n accessedAt: new Date(\\"2015-12-14T08:36:13.202Z\\"),\\n itemCount: 14,\\n}\\n```"}]},"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"DatasetInfo","qualifiedName":"DatasetInfo","package":"@crawlee/types"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":59,"name":"map","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":268,"character":4}],"signatures":[{"id":60,"name":"map","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Produces a new array of values by mapping each value in list through a transformation function "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":".\\nEach invocation of "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" is called with two arguments: "},{"kind":"code","text":"`(element, index)`"},{"kind":"text","text":".\\n\\nIf "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" then it\'s awaited before a next call."}]},"typeParameter":[{"id":61,"name":"R","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"parameters":[{"id":62,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":97,"typeArguments":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"},{"type":"reference","id":61,"name":"R","qualifiedName":"R","package":"@crawlee/core"}],"name":"DatasetMapper","qualifiedName":"DatasetMapper","package":"@crawlee/core"}},{"id":63,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`map()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":82,"name":"DatasetIteratorOptions","qualifiedName":"DatasetIteratorOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"reference","id":61,"name":"R","qualifiedName":"R","package":"@crawlee/core"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":33,"name":"pushData","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":174,"character":4}],"signatures":[{"id":34,"name":"pushData","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Stores an object or an array of objects to the dataset.\\nThe function returns a promise that resolves when the operation finishes.\\nIt has no result, but throws on invalid args or other errors.\\n\\n**IMPORTANT**: Make sure to use the "},{"kind":"code","text":"`await`"},{"kind":"text","text":" keyword when calling "},{"kind":"code","text":"`pushData()`"},{"kind":"text","text":",\\notherwise the crawler process might finish before the data is stored!\\n\\nThe size of the data is limited by the receiving API and therefore "},{"kind":"code","text":"`pushData()`"},{"kind":"text","text":" will only\\nallow objects whose JSON representation is smaller than 9MB. When an array is passed,\\nnone of the included objects\\nmay be larger than 9MB, but the array itself may be of any size.\\n\\nThe function internally\\nchunks the array into separate items and pushes them sequentially.\\nThe chunking process is stable (keeps order of data), but it does not provide a transaction\\nsafety mechanism. Therefore, in the event of an uploading error (after several automatic retries),\\nthe function\'s Promise will reject and the dataset will be left in a state where some of\\nthe items have already been saved to the dataset while other items from the source array were not.\\nTo overcome this limitation, the developer may, for example, read the last item saved in the dataset\\nand re-attempt the save of the data from this item onwards to prevent duplicates."}]},"parameters":[{"id":35,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Object or array of objects containing data to be stored in the default dataset.\\n The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB."}]},"type":{"type":"union","types":[{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"},{"type":"array","elementType":{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":64,"name":"reduce","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":284,"character":4}],"signatures":[{"id":65,"name":"reduce","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Reduces a list of values down to a single value.\\n\\nMemo is the initial state of the reduction, and each successive step of it should be returned by "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":".\\nThe "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" is passed three arguments: the "},{"kind":"code","text":"`memo`"},{"kind":"text","text":", then the "},{"kind":"code","text":"`value`"},{"kind":"text","text":" and "},{"kind":"code","text":"`index`"},{"kind":"text","text":" of the iteration.\\n\\nIf no "},{"kind":"code","text":"`memo`"},{"kind":"text","text":" is passed to the initial invocation of reduce, the "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" is not invoked on the first element of the list.\\nThe first element is instead passed as the memo in the invocation of the "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" on the next element in the list.\\n\\nIf "},{"kind":"code","text":"`iteratee()`"},{"kind":"text","text":" returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" then it\'s awaited before a next call."}]},"typeParameter":[{"id":66,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"parameters":[{"id":67,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":103,"typeArguments":[{"type":"reference","id":66,"name":"T","qualifiedName":"T","package":"@crawlee/core"},{"type":"reference","name":"Data","qualifiedName":"Dataset.Data","package":"@crawlee/core"}],"name":"DatasetReducer","qualifiedName":"DatasetReducer","package":"@crawlee/core"}},{"id":68,"name":"memo","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Initial state of the reduction."}]},"type":{"type":"reference","id":66,"name":"T","qualifiedName":"T","package":"@crawlee/core"}},{"id":69,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`reduce()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":82,"name":"DatasetIteratorOptions","qualifiedName":"DatasetIteratorOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":66,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":6,"name":"exportToCSV","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":214,"character":11}],"signatures":[{"id":7,"name":"exportToCSV","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one CSV file within a key-value store."}]},"parameters":[{"id":8,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":9,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the dataset and target KVS name."}]},"type":{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":2,"name":"exportToJSON","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":207,"character":11}],"signatures":[{"id":3,"name":"exportToJSON","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Save entire default dataset\'s contents into one JSON file within a key-value store."}]},"parameters":[{"id":4,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the value to save the data in."}]},"type":{"type":"intrinsic","name":"string"}},{"id":5,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An optional options object where you can provide the dataset and target KVS name."}]},"type":{"type":"reference","name":"ExportOptions","qualifiedName":"ExportOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":19,"name":"getData","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":333,"character":11}],"signatures":[{"id":20,"name":"getData","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns "},{"kind":"inline-tag","tag":"@apilink","text":"DatasetContent"},{"kind":"text","text":" object holding the items in the dataset based on the provided parameters."}]},"typeParameter":[{"id":21,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":22,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":73,"name":"DatasetDataOptions","qualifiedName":"DatasetDataOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":114,"typeArguments":[{"type":"reference","id":21,"name":"Data","qualifiedName":"Data","package":"@crawlee/core"}],"name":"DatasetContent","qualifiedName":"DatasetContent","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":10,"name":"open","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":304,"character":11}],"signatures":[{"id":11,"name":"open","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Opens a dataset and returns a promise resolving to an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class.\\n\\nDatasets are used to store structured data where each object stored has the same attributes,\\nsuch as online store products or real estate offers.\\nThe actual data is stored either on the local filesystem or in the cloud.\\n\\nFor more details and code examples, see the "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" class."}]},"typeParameter":[{"id":12,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":13,"name":"datasetIdOrName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"ID or name of the dataset to be opened. If "},{"kind":"code","text":"`null`"},{"kind":"text","text":" or "},{"kind":"code","text":"`undefined`"},{"kind":"text","text":",\\n the function returns the default dataset associated with the crawler run."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":14,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Storage manager options."}]},"type":{"type":"reference","name":"StorageManagerOptions","qualifiedName":"StorageManagerOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1,"typeArguments":[{"type":"reference","id":12,"name":"Data","qualifiedName":"Data","package":"@crawlee/core"}],"name":"Dataset","qualifiedName":"Dataset","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]}],"groups":[{"title":"Properties","children":[31,28,29,32,30]},{"title":"Methods","children":[70,39,48,44,54,36,52,59,33,64,6,2,19,10]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":140,"character":21}],"typeParameters":[{"id":72,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"permalink":"/sdk/js/reference/next/class/Dataset","previousId":1237,"nextId":1514},{"id":1514,"name":"KeyValueStore","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"children":[{"id":1548,"name":"config","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":71,"character":13}],"type":{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.config"}},{"id":1549,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":72,"character":13}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.id"}},{"id":1550,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":73,"character":13}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.name"}},{"id":1570,"name":"drop","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":196,"character":4}],"signatures":[{"id":1571,"name":"drop","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the key-value store either from the Apify cloud storage or from the local directory,\\ndepending on the mode of operation."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.drop"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.drop"}},{"id":1574,"name":"forEachKey","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":220,"character":4}],"signatures":[{"id":1575,"name":"forEachKey","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Iterates over key-value store keys, yielding each in turn to an "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function.\\nEach invocation of "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" is called with three arguments: "},{"kind":"code","text":"`(key, index, info)`"},{"kind":"text","text":", where "},{"kind":"code","text":"`key`"},{"kind":"text","text":"\\nis the record key, "},{"kind":"code","text":"`index`"},{"kind":"text","text":" is a zero-based index of the key in the current iteration\\n(regardless of "},{"kind":"code","text":"`options.exclusiveStartKey`"},{"kind":"text","text":") and "},{"kind":"code","text":"`info`"},{"kind":"text","text":" is an object that contains a single property "},{"kind":"code","text":"`size`"},{"kind":"text","text":"\\nindicating size of the record in bytes.\\n\\nIf the "},{"kind":"code","text":"`iteratee`"},{"kind":"text","text":" function returns a Promise then it is awaited before the next call.\\nIf it throws an error, the iteration is aborted and the "},{"kind":"code","text":"`forEachKey`"},{"kind":"text","text":" function throws the error.\\n\\n**Example usage**\\n"},{"kind":"code","text":"```javascript\\nconst keyValueStore = await KeyValueStore.open();\\nawait keyValueStore.forEachKey(async (key, index, info) => {\\n console.log(`Key at ${index}: ${key} has size ${info.size}`);\\n});\\n```"}]},"parameters":[{"id":1576,"name":"iteratee","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A function that is called for every key in the key-value store."}]},"type":{"type":"reference","id":219,"name":"KeyConsumer","qualifiedName":"KeyConsumer","package":"@crawlee/core"}},{"id":1577,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All "},{"kind":"code","text":"`forEachKey()`"},{"kind":"text","text":" parameters."}]},"type":{"type":"reference","id":232,"name":"KeyValueStoreIteratorOptions","qualifiedName":"KeyValueStoreIteratorOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.forEachKey"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.forEachKey"}},{"id":1559,"name":"getAutoSavedValue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":146,"character":4}],"signatures":[{"id":1560,"name":"getAutoSavedValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"typeParameter":[{"id":1561,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":1562,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":1563,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":1561,"name":"T","qualifiedName":"T","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1561,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}},{"id":1545,"name":"getPublicUrl","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/key_value_store.ts","line":12,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/key_value_store.ts#L12"}],"signatures":[{"id":1546,"name":"getPublicUrl","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a URL for the given key that may be used to publicly\\naccess the value in the remote key-value store."}]},"parameters":[{"id":1547,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"string"}}]},{"id":1551,"name":"getValue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":112,"character":4},{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":145,"character":4}],"signatures":[{"id":1552,"name":"getValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets a value from the key-value store.\\n\\nThe function returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that resolves to the record value,\\nwhose JavaScript type depends on the MIME content type of the record.\\nRecords with the "},{"kind":"code","text":"`application/json`"},{"kind":"text","text":"\\ncontent type are automatically parsed and returned as a JavaScript object.\\nSimilarly, records with "},{"kind":"code","text":"`text/plain`"},{"kind":"text","text":" content types are returned as a string.\\nFor all other content types, the value is returned as a raw\\n["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html) instance.\\n\\nIf the record does not exist, the function resolves to "},{"kind":"code","text":"`null`"},{"kind":"text","text":".\\n\\nTo save or delete a value in the key-value store, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.setValue"},{"kind":"text","text":" function.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open();\\nconst buffer = await store.getValue(\'screenshot1.png\');\\n```"}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record."}]}]},"typeParameter":[{"id":1553,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"default":{"type":"intrinsic","name":"unknown"}}],"parameters":[{"id":1554,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Unique key of the record. It can be at most 256 characters long and only consist\\n of the following characters: "},{"kind":"code","text":"`a`"},{"kind":"text","text":"-"},{"kind":"code","text":"`z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A`"},{"kind":"text","text":"-"},{"kind":"code","text":"`Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`0`"},{"kind":"text","text":"-"},{"kind":"code","text":"`9`"},{"kind":"text","text":" and "},{"kind":"code","text":"`!-_.\'()`"}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":1553,"name":"T","qualifiedName":"T","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getValue"}},{"id":1555,"name":"getValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets a value from the key-value store.\\n\\nThe function returns a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that resolves to the record value,\\nwhose JavaScript type depends on the MIME content type of the record.\\nRecords with the "},{"kind":"code","text":"`application/json`"},{"kind":"text","text":"\\ncontent type are automatically parsed and returned as a JavaScript object.\\nSimilarly, records with "},{"kind":"code","text":"`text/plain`"},{"kind":"text","text":" content types are returned as a string.\\nFor all other content types, the value is returned as a raw\\n["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html) instance.\\n\\nIf the record does not exist, the function resolves to "},{"kind":"code","text":"`null`"},{"kind":"text","text":".\\n\\nTo save or delete a value in the key-value store, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.setValue"},{"kind":"text","text":" function.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open();\\nconst buffer = await store.getValue(\'screenshot1.png\');\\n```"}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns a promise that resolves to an object, string\\n or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), depending\\n on the MIME content type of the record, or the default value if the key is missing from the store."}]}]},"typeParameter":[{"id":1556,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"default":{"type":"intrinsic","name":"unknown"}}],"parameters":[{"id":1557,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Unique key of the record. It can be at most 256 characters long and only consist\\n of the following characters: "},{"kind":"code","text":"`a`"},{"kind":"text","text":"-"},{"kind":"code","text":"`z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A`"},{"kind":"text","text":"-"},{"kind":"code","text":"`Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`0`"},{"kind":"text","text":"-"},{"kind":"code","text":"`9`"},{"kind":"text","text":" and "},{"kind":"code","text":"`!-_.\'()`"}]},"type":{"type":"intrinsic","name":"string"}},{"id":1558,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Fallback that will be returned if no value if present in the storage."}]},"type":{"type":"reference","id":1556,"name":"T","qualifiedName":"T","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1556,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getValue"}},{"id":1564,"name":"setValue","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":191,"character":4}],"signatures":[{"id":1565,"name":"setValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Saves or deletes a record in the key-value store.\\nThe function returns a promise that resolves once the record has been saved or deleted.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open();\\nawait store.setValue(\'OUTPUT\', { foo: \'bar\' });\\n```"},{"kind":"text","text":"\\n\\nBeware that the key can be at most 256 characters long and only contain the following characters: "},{"kind":"code","text":"`a-zA-Z0-9!-_.\'()`"},{"kind":"text","text":"\\n\\nBy default, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is converted to JSON and stored with the\\n"},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":" MIME content type.\\nTo store the value with another content type, pass it in the options as follows:\\n"},{"kind":"code","text":"```javascript\\nconst store = await KeyValueStore.open(\'my-text-store\');\\nawait store.setValue(\'RESULTS\', \'my text data\', { contentType: \'text/plain\' });\\n```"},{"kind":"text","text":"\\nIf you set custom content type, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" must be either a string or\\n["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html), otherwise an error will be thrown.\\n\\nIf "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is "},{"kind":"code","text":"`null`"},{"kind":"text","text":", the record is deleted instead. Note that the "},{"kind":"code","text":"`setValue()`"},{"kind":"text","text":" function succeeds\\nregardless whether the record existed or not.\\n\\nTo retrieve a value from the key-value store, use the\\n"},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore.getValue"},{"kind":"text","text":" function.\\n\\n**IMPORTANT:** Always make sure to use the "},{"kind":"code","text":"`await`"},{"kind":"text","text":" keyword when calling "},{"kind":"code","text":"`setValue()`"},{"kind":"text","text":",\\notherwise the crawler process might finish before the value is stored!"}]},"typeParameter":[{"id":1566,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"parameters":[{"id":1567,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Unique key of the record. It can be at most 256 characters long and only consist\\n of the following characters: "},{"kind":"code","text":"`a`"},{"kind":"text","text":"-"},{"kind":"code","text":"`z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A`"},{"kind":"text","text":"-"},{"kind":"code","text":"`Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`0`"},{"kind":"text","text":"-"},{"kind":"code","text":"`9`"},{"kind":"text","text":" and "},{"kind":"code","text":"`!-_.\'()`"}]},"type":{"type":"intrinsic","name":"string"}},{"id":1568,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Record data, which can be one of the following values:\\n - If "},{"kind":"code","text":"`null`"},{"kind":"text","text":", the record in the key-value store is deleted.\\n - If no "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" can be any JavaScript object and it will be stringified to JSON.\\n - If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is set, "},{"kind":"code","text":"`value`"},{"kind":"text","text":" is taken as is and it must be a "},{"kind":"code","text":"`String`"},{"kind":"text","text":" or ["},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"](https://nodejs.org/api/buffer.html).\\n For any other value an error will be thrown."}]},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","id":1566,"name":"T","qualifiedName":"T","package":"@crawlee/core"}]}},{"id":1569,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Record options."}]},"type":{"type":"reference","id":230,"name":"RecordOptions","qualifiedName":"RecordOptions","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.setValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.setValue"}},{"id":1527,"name":"getAutoSavedValue","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":295,"character":11}],"signatures":[{"id":1528,"name":"getAutoSavedValue","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"typeParameter":[{"id":1529,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":1530,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":1531,"name":"defaultValue","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","id":1529,"name":"T","qualifiedName":"T","package":"@crawlee/core"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1529,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}}],"inheritedFrom":{"type":"reference","name":"CoreKeyValueStore.getAutoSavedValue"}},{"id":1515,"name":"open","kind":2048,"kindString":"Method","flags":{"isStatic":true},"sources":[{"fileName":"packages/apify/src/key_value_store.ts","line":19,"character":26,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/key_value_store.ts#L19"}],"signatures":[{"id":1516,"name":"open","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[],"blockTags":[{"tag":"@inheritDoc","content":[]}]},"parameters":[{"id":1517,"name":"storeIdOrName","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1518,"name":"options","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"StorageManagerOptions","qualifiedName":"StorageManagerOptions","package":"@crawlee/core"},"defaultValue":"{}"}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1514,"name":"KeyValueStore"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"CoreKeyValueStore.open"}}],"overwrites":{"type":"reference","name":"CoreKeyValueStore.open"}}],"groups":[{"title":"Properties","children":[1548,1549,1550]},{"title":"Methods","children":[1570,1574,1559,1545,1551,1564,1527,1515]}],"sources":[{"fileName":"packages/apify/src/key_value_store.ts","line":7,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/key_value_store.ts#L7"}],"extendedTypes":[{"type":"reference","name":"KeyValueStore","qualifiedName":"KeyValueStore","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/KeyValueStore","previousId":1,"nextId":235},{"id":235,"name":"Log","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The log instance enables level aware logging of messages and we advise\\nto use it instead of "},{"kind":"code","text":"`console.log()`"},{"kind":"text","text":" and its aliases in most development\\nscenarios.\\n\\nA very useful use case for "},{"kind":"code","text":"`log`"},{"kind":"text","text":" is using "},{"kind":"code","text":"`log.debug`"},{"kind":"text","text":" liberally throughout\\nthe codebase to get useful logging messages only when appropriate log level is set\\nand keeping the console tidy in production environments.\\n\\nThe available logging levels are, in this order: "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":", "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":", "},{"kind":"code","text":"`WARNING`"},{"kind":"text","text":", "},{"kind":"code","text":"`ERROR`"},{"kind":"text","text":", "},{"kind":"code","text":"`OFF`"},{"kind":"text","text":"\\nand can be referenced from the "},{"kind":"code","text":"`log.LEVELS`"},{"kind":"text","text":" constant, such as "},{"kind":"code","text":"`log.LEVELS.ERROR`"},{"kind":"text","text":".\\n\\nTo log messages to the system console, use the "},{"kind":"code","text":"`log.level(message)`"},{"kind":"text","text":" invocation,\\nsuch as "},{"kind":"code","text":"`log.debug(\'this is a debug message\')`"},{"kind":"text","text":".\\n\\nTo prevent writing of messages above a certain log level to the console, simply\\nset the appropriate level. The default log level is "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":", which means that\\n"},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":" messages will not be printed, unless enabled.\\n\\n**Example:**\\n"},{"kind":"code","text":"```js\\nimport log from \'@apify/log\';\\n\\n// importing from the Apify SDK or Crawlee is also supported:\\n// import { log } from \'apify\';\\n// import { log } from \'crawlee\';\\n\\nlog.info(\'Information message\', { someData: 123 }); // prints message\\nlog.debug(\'Debug message\', { debugData: \'hello\' }); // doesn\'t print anything\\n\\nlog.setLevel(log.LEVELS.DEBUG);\\nlog.debug(\'Debug message\'); // prints message\\n\\nlog.setLevel(log.LEVELS.ERROR);\\nlog.debug(\'Debug message\'); // doesn\'t print anything\\nlog.info(\'Info message\'); // doesn\'t print anything\\nlog.error(\'Error message\', { errorDetails: \'This is bad!\' }); // prints message\\n\\ntry {\\n throw new Error(\'Not good!\');\\n} catch (e) {\\n log.exception(e, \'Exception occurred\', { errorDetails: \'This is really bad!\' }); // prints message\\n}\\n\\nlog.setOptions({ prefix: \'My actor\' });\\nlog.info(\'I am running!\'); // prints \\"My actor: I am running\\"\\n\\nconst childLog = log.child({ prefix: \'Crawler\' });\\nlog.info(\'I am crawling!\'); // prints \\"My actor:Crawler: I am crawling\\"\\n```"},{"kind":"text","text":"\\n\\nAnother very useful way of setting the log level is by setting the "},{"kind":"code","text":"`APIFY_LOG_LEVEL`"},{"kind":"text","text":"\\nenvironment variable, such as "},{"kind":"code","text":"`APIFY_LOG_LEVEL=DEBUG`"},{"kind":"text","text":". This way, no code changes\\nare necessary to turn on your debug messages and start debugging right away.\\n\\nTo add timestamps to your logs, you can override the default logger settings:\\n"},{"kind":"code","text":"```js\\nlog.setOptions({\\n logger: new log.LoggerText({ skipTime: false }),\\n});\\n```"},{"kind":"text","text":"\\nYou can customize your logging further by extending or replacing the default\\nlogger instances with your own implementations."}]},"children":[{"id":236,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":98,"character":4}],"signatures":[{"id":237,"name":"new Log","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":238,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Partial","qualifiedName":"Partial","package":"typescript"}}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}}]},{"id":239,"name":"LEVELS","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Map of available log levels that\'s useful for easy setting of appropriate log levels.\\nEach log level is represented internally by a number. Eg. "},{"kind":"code","text":"`log.LEVELS.DEBUG === 5`"},{"kind":"text","text":"."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":95,"character":13}],"type":{"type":"query","queryType":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}}},{"id":259,"name":"child","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":130,"character":4}],"signatures":[{"id":260,"name":"child","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a new instance of logger that inherits settings from a parent logger."}]},"parameters":[{"id":261,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Partial","qualifiedName":"Partial","package":"typescript"}}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"}}]},{"id":283,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":157,"character":4}],"signatures":[{"id":284,"name":"debug","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs a "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":" message. By default, it will not be written to the console. To see "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":"\\nmessages in the console, set the log level to "},{"kind":"code","text":"`DEBUG`"},{"kind":"text","text":" either using the "},{"kind":"code","text":"`log.setLevel(log.LEVELS.DEBUG)`"},{"kind":"text","text":"\\nmethod or using the environment variable "},{"kind":"code","text":"`APIFY_LOG_LEVEL=DEBUG`"},{"kind":"text","text":". Data are stringified and appended\\nto the message."}]},"parameters":[{"id":285,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":286,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":294,"name":"deprecated","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":166,"character":4}],"signatures":[{"id":295,"name":"deprecated","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs given message only once as WARNING. It\'s used to warn user that some feature he is using has been deprecated."}]},"parameters":[{"id":296,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":262,"name":"error","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":135,"character":4}],"signatures":[{"id":263,"name":"error","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs an "},{"kind":"code","text":"`ERROR`"},{"kind":"text","text":" message. Use this method to log error messages that are not directly connected\\nto an exception. For logging exceptions, use the "},{"kind":"code","text":"`log.exception`"},{"kind":"text","text":" method."}]},"parameters":[{"id":264,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":265,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":266,"name":"exception","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":140,"character":4}],"signatures":[{"id":267,"name":"exception","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs an "},{"kind":"code","text":"`ERROR`"},{"kind":"text","text":" level message with a nicely formatted exception. Note that the exception is the first parameter\\nhere and an additional message is only optional."}]},"parameters":[{"id":268,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":269,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":270,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":243,"name":"getLevel","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":106,"character":4}],"signatures":[{"id":244,"name":"getLevel","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently selected logging level. This is useful for checking whether a message\\nwill actually be printed to the console before one actually performs a resource intensive operation\\nto construct the message, such as querying a DB for some metadata that need to be added. If the log\\nlevel is not high enough at the moment, it doesn\'t make sense to execute the query."}]},"type":{"type":"intrinsic","name":"number"}}]},{"id":257,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":126,"character":4}],"signatures":[{"id":258,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the logger configuration."}]},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Required","qualifiedName":"Required","package":"typescript"}}]},{"id":279,"name":"info","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":150,"character":4}],"signatures":[{"id":280,"name":"info","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs an "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":" message. "},{"kind":"code","text":"`INFO`"},{"kind":"text","text":" is the default log level so info messages will be always logged,\\nunless the log level is changed. Data are stringified and appended to the message."}]},"parameters":[{"id":281,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":282,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":248,"name":"internal","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":118,"character":4}],"signatures":[{"id":249,"name":"internal","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":250,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":251,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":252,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":253,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":287,"name":"perf","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":158,"character":4}],"signatures":[{"id":288,"name":"perf","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":289,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":290,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":245,"name":"setLevel","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":117,"character":4}],"signatures":[{"id":246,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Sets the log level to the given value, preventing messages from less important log levels\\nfrom being printed to the console. Use in conjunction with the "},{"kind":"code","text":"`log.LEVELS`"},{"kind":"text","text":" constants such as\\n\\n"},{"kind":"code","text":"```\\nlog.setLevel(log.LEVELS.DEBUG);\\n```"},{"kind":"text","text":"\\n\\nDefault log level is INFO."}]},"parameters":[{"id":247,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":254,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":122,"character":4}],"signatures":[{"id":255,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Configures logger."}]},"parameters":[{"id":256,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"reference","id":297,"name":"LoggerOptions","qualifiedName":"LoggerOptions","package":"@apify/log"}],"name":"Partial","qualifiedName":"Partial","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":271,"name":"softFail","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":141,"character":4}],"signatures":[{"id":272,"name":"softFail","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":273,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":274,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":275,"name":"warning","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":145,"character":4}],"signatures":[{"id":276,"name":"warning","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs a "},{"kind":"code","text":"`WARNING`"},{"kind":"text","text":" level message. Data are stringified and appended to the message."}]},"parameters":[{"id":277,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":278,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"AdditionalData","qualifiedName":"AdditionalData","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":291,"name":"warningOnce","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":162,"character":4}],"signatures":[{"id":292,"name":"warningOnce","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Logs a "},{"kind":"code","text":"`WARNING`"},{"kind":"text","text":" level message only once."}]},"parameters":[{"id":293,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"}}]}],"groups":[{"title":"Constructors","children":[236]},{"title":"Properties","children":[239]},{"title":"Methods","children":[259,283,294,262,266,243,257,279,248,287,245,254,271,275,291]}],"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":90,"character":21}],"permalink":"/sdk/js/reference/next/class/Log","previousId":1514,"nextId":313},{"id":313,"name":"Logger","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"This is an abstract class that should\\nbe extended by custom logger classes.\\n\\nthis._log() method must be implemented by them."}]},"children":[{"id":354,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":13,"character":4}],"signatures":[{"id":355,"name":"new Logger","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":356,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"overwrites":{"type":"reference","name":"EventEmitter.constructor"}}],"overwrites":{"type":"reference","name":"EventEmitter.constructor"}},{"id":351,"name":"captureRejectionSymbol","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Value: "},{"kind":"code","text":"`Symbol.for(\'nodejs.rejection\')`"},{"kind":"text","text":"\\n\\nSee how to write a custom "},{"kind":"code","text":"`rejection handler`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":402,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":351,"name":"captureRejectionSymbol","qualifiedName":"EventEmitter.captureRejectionSymbol","package":"@types/node"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.captureRejectionSymbol"}},{"id":352,"name":"captureRejections","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\\n\\nChange the default "},{"kind":"code","text":"`captureRejections`"},{"kind":"text","text":" option on all new "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" objects."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":409,"character":15}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"EventEmitter.captureRejections"}},{"id":353,"name":"defaultMaxListeners","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default, a maximum of "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners can be registered for any single\\nevent. This limit can be changed for individual "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances\\nusing the "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" method. To change the default\\nfor _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":"property can be used. If this value is not a positive number, a "},{"kind":"code","text":"`RangeError`"},{"kind":"text","text":"is thrown.\\n\\nTake caution when setting the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":" because the\\nchange affects _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, including those created before\\nthe change is made. However, calling "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" still has\\nprecedence over "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":".\\n\\nThis is not a hard limit. The "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance will allow\\nmore listeners to be added but will output a trace warning to stderr indicating\\nthat a \\"possible EventEmitter memory leak\\" has been detected. For any single"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", the "},{"kind":"code","text":"`emitter.getMaxListeners()`"},{"kind":"text","text":" and "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":"methods can be used to\\ntemporarily avoid this warning:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.setMaxListeners(emitter.getMaxListeners() + 1);\\nemitter.once(\'event\', () => {\\n // do stuff\\n emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));\\n});\\n```"},{"kind":"text","text":"\\n\\nThe "},{"kind":"code","text":"`--trace-warnings`"},{"kind":"text","text":" command-line flag can be used to display the\\nstack trace for such warnings.\\n\\nThe emitted warning can be inspected with "},{"kind":"code","text":"`process.on(\'warning\')`"},{"kind":"text","text":" and will\\nhave the additional "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":", "},{"kind":"code","text":"`type`"},{"kind":"text","text":", and "},{"kind":"code","text":"`count`"},{"kind":"text","text":" properties, referring to\\nthe event emitter instance, the event\'s name and the number of attached\\nlisteners, respectively.\\nIts "},{"kind":"code","text":"`name`"},{"kind":"text","text":" property is set to "},{"kind":"code","text":"`\'MaxListenersExceededWarning\'`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.11.2"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":446,"character":15}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.defaultMaxListeners"}},{"id":350,"name":"errorMonitor","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"This symbol shall be used to install a listener for only monitoring "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":"events. Listeners installed using this symbol are called before the regular"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listeners are called.\\n\\nInstalling a listener using this symbol does not change the behavior once an"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is emitted. Therefore, the process will still crash if no\\nregular "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listener is installed."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.17.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":395,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":350,"name":"errorMonitor","qualifiedName":"EventEmitter.errorMonitor","package":"@types/node"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.errorMonitor"}},{"id":379,"name":"[captureRejectionSymbol]","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":112,"character":8}],"signatures":[{"id":380,"name":"[captureRejectionSymbol]","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":381,"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":382,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":383,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventEmitter.__@captureRejectionSymbol@599"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.__@captureRejectionSymbol@599"}},{"id":367,"name":"_log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":17,"character":4}],"signatures":[{"id":368,"name":"_log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":369,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":370,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":371,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":372,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}},{"id":373,"name":"opts","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":363,"name":"_outputWithConsole","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":16,"character":4}],"signatures":[{"id":364,"name":"_outputWithConsole","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":365,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":366,"name":"line","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":384,"name":"addListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":16}],"signatures":[{"id":385,"name":"addListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.on(eventName, listener)`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":386,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":387,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":388,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":66}],"signatures":[{"id":389,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":390,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.addListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.addListener"}},{"id":433,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":772,"character":16}],"signatures":[{"id":434,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Synchronously calls each of the listeners registered for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", in the order they were registered, passing the supplied arguments\\nto each.\\n\\nReturns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the event had listeners, "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEmitter = new EventEmitter();\\n\\n// First listener\\nmyEmitter.on(\'event\', function firstListener() {\\n console.log(\'Helloooo! first listener\');\\n});\\n// Second listener\\nmyEmitter.on(\'event\', function secondListener(arg1, arg2) {\\n console.log(`event with parameters ${arg1}, ${arg2} in second listener`);\\n});\\n// Third listener\\nmyEmitter.on(\'event\', function thirdListener(...args) {\\n const parameters = args.join(\', \');\\n console.log(`event with parameters ${parameters} in third listener`);\\n});\\n\\nconsole.log(myEmitter.listeners(\'event\'));\\n\\nmyEmitter.emit(\'event\', 1, 2, 3, 4, 5);\\n\\n// Prints:\\n// [\\n// [Function: firstListener],\\n// [Function: secondListener],\\n// [Function: thirdListener]\\n// ]\\n// Helloooo! first listener\\n// event with parameters 1, 2 in second listener\\n// event with parameters 1, 2, 3, 4, 5 in third listener\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":435,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":436,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"EventEmitter.emit"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.emit"}},{"id":455,"name":"eventNames","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":835,"character":16}],"signatures":[{"id":456,"name":"eventNames","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an array listing the events for which the emitter has registered\\nlisteners. The values in the array are strings or "},{"kind":"code","text":"`Symbol`"},{"kind":"text","text":"s.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\n\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => {});\\nmyEE.on(\'bar\', () => {});\\n\\nconst sym = Symbol(\'symbol\');\\nmyEE.on(sym, () => {});\\n\\nconsole.log(myEE.eventNames());\\n// Prints: [ \'foo\', \'bar\', Symbol(symbol) ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},"inheritedFrom":{"type":"reference","name":"EventEmitter.eventNames"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.eventNames"}},{"id":425,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":687,"character":16}],"signatures":[{"id":426,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the current max listener value for the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" which is either\\nset by "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" or defaults to "},{"kind":"inline-tag","tag":"@link","text":"defaultMaxListeners","target":353},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v1.0.0"}]}]},"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}},{"id":361,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":15,"character":4}],"signatures":[{"id":362,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}]},{"id":437,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":781,"character":16}],"signatures":[{"id":438,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of listeners listening for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\nIf "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" is provided, it will return how many times the listener is found\\nin the list of the listeners of the event."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v3.2.0"}]}]},"parameters":[{"id":439,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":440,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The event handler function"}]},"type":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}},{"id":427,"name":"listeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":700,"character":16}],"signatures":[{"id":428,"name":"listeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\nconsole.log(util.inspect(server.listeners(\'connection\')));\\n// Prints: [ [Function] ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":429,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.listeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.listeners"}},{"id":374,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":18,"character":4}],"signatures":[{"id":375,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":376,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":377,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":378,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":412,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":16}],"signatures":[{"id":413,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.removeListener()`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v10.0.0"}]}]},"parameters":[{"id":414,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":415,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":416,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":58}],"signatures":[{"id":417,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":418,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.off"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.off"}},{"id":391,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":16}],"signatures":[{"id":392,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the end of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => console.log(\'a\'));\\nmyEE.prependListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.101"}]}]},"parameters":[{"id":393,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":394,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":395,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":57}],"signatures":[{"id":396,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":397,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}},{"id":398,"name":"once","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":16}],"signatures":[{"id":399,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". The\\nnext time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this listener is removed and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.once(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependOnceListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.once(\'foo\', () => console.log(\'a\'));\\nmyEE.prependOnceListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.0"}]}]},"parameters":[{"id":400,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":401,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":402,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":59}],"signatures":[{"id":403,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":404,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}},{"id":441,"name":"prependListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":16}],"signatures":[{"id":442,"name":"prependListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the _beginning_ of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependListener(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":443,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":444,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":445,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":70}],"signatures":[{"id":446,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":447,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.prependListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.prependListener"}},{"id":448,"name":"prependOnceListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":16}],"signatures":[{"id":449,"name":"prependOnceListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" to the _beginning_ of the listeners array. The next time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this\\nlistener is removed, and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependOnceListener(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":450,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":451,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":452,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":74}],"signatures":[{"id":453,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":454,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.prependOnceListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.prependOnceListener"}},{"id":430,"name":"rawListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":731,"character":16}],"signatures":[{"id":431,"name":"rawListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":",\\nincluding any wrappers (such as those created by "},{"kind":"code","text":"`.once()`"},{"kind":"text","text":").\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.once(\'log\', () => console.log(\'log once\'));\\n\\n// Returns a new Array with a function `onceWrapper` which has a property\\n// `listener` which contains the original listener bound above\\nconst listeners = emitter.rawListeners(\'log\');\\nconst logFnWrapper = listeners[0];\\n\\n// Logs \\"log once\\" to the console and does not unbind the `once` event\\nlogFnWrapper.listener();\\n\\n// Logs \\"log once\\" to the console and removes the listener\\nlogFnWrapper();\\n\\nemitter.on(\'log\', () => console.log(\'log persistently\'));\\n// Will return a new Array with a single function bound by `.on()` above\\nconst newListeners = emitter.rawListeners(\'log\');\\n\\n// Logs \\"log persistently\\" twice\\nnewListeners[0]();\\nemitter.emit(\'log\');\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v9.4.0"}]}]},"parameters":[{"id":432,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.rawListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.rawListeners"}},{"id":419,"name":"removeAllListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":671,"character":16}],"signatures":[{"id":420,"name":"removeAllListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes all listeners, or those of the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nIt is bad practice to remove listeners added elsewhere in the code,\\nparticularly when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance was created by some other\\ncomponent or module (e.g. sockets or file streams).\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":421,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.removeAllListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.removeAllListeners"}},{"id":405,"name":"removeListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":16}],"signatures":[{"id":406,"name":"removeListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the specified "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" from the listener array for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nconst callback = (stream) => {\\n console.log(\'someone connected!\');\\n};\\nserver.on(\'connection\', callback);\\n// ...\\nserver.removeListener(\'connection\', callback);\\n```"},{"kind":"text","text":"\\n\\n"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove, at most, one instance of a listener from the\\nlistener array. If any single listener has been added multiple times to the\\nlistener array for the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", then "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" must be\\ncalled multiple times to remove each instance.\\n\\nOnce an event is emitted, all listeners attached to it at the\\ntime of emitting are called in order. This implies that any"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" or "},{"kind":"code","text":"`removeAllListeners()`"},{"kind":"text","text":" calls _after_ emitting and _before_ the last listener finishes execution\\nwill not remove them from"},{"kind":"code","text":"`emit()`"},{"kind":"text","text":" in progress. Subsequent events behave as expected.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nclass MyEmitter extends EventEmitter {}\\nconst myEmitter = new MyEmitter();\\n\\nconst callbackA = () => {\\n console.log(\'A\');\\n myEmitter.removeListener(\'event\', callbackB);\\n};\\n\\nconst callbackB = () => {\\n console.log(\'B\');\\n};\\n\\nmyEmitter.on(\'event\', callbackA);\\n\\nmyEmitter.on(\'event\', callbackB);\\n\\n// callbackA removes listener callbackB but it will still be called.\\n// Internal listener array at time of emit [callbackA, callbackB]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n// B\\n\\n// callbackB is now removed.\\n// Internal listener array [callbackA]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n```"},{"kind":"text","text":"\\n\\nBecause listeners are managed using an internal array, calling this will\\nchange the position indices of any listener registered _after_ the listener\\nbeing removed. This will not impact the order in which listeners are called,\\nbut it means that any copies of the listener array as returned by\\nthe "},{"kind":"code","text":"`emitter.listeners()`"},{"kind":"text","text":" method will need to be recreated.\\n\\nWhen a single function has been added as a handler multiple times for a single\\nevent (as in the example below), "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove the most\\nrecently added instance. In the example the "},{"kind":"code","text":"`once(\'ping\')`"},{"kind":"text","text":"listener is removed:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst ee = new EventEmitter();\\n\\nfunction pong() {\\n console.log(\'pong\');\\n}\\n\\nee.on(\'ping\', pong);\\nee.once(\'ping\', pong);\\nee.removeListener(\'ping\', pong);\\n\\nee.emit(\'ping\');\\nee.emit(\'ping\');\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":407,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":408,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":409,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":69}],"signatures":[{"id":410,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":411,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.removeListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.removeListener"}},{"id":422,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":681,"character":16}],"signatures":[{"id":423,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s will print a warning if more than "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners are\\nadded for a particular event. This is a useful default that helps finding\\nmemory leaks. The "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":" method allows the limit to be\\nmodified for this specific "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance. The value can be set to"},{"kind":"code","text":"`Infinity`"},{"kind":"text","text":" (or "},{"kind":"code","text":"`0`"},{"kind":"text","text":") to indicate an unlimited number of listeners.\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.5"}]}]},"parameters":[{"id":424,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}},{"id":358,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":14,"character":4}],"signatures":[{"id":359,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":360,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]},{"id":343,"name":"addAbortListener","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":15}],"signatures":[{"id":344,"name":"addAbortListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Listens once to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on the provided "},{"kind":"code","text":"`signal`"},{"kind":"text","text":".\\n\\nListening to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on abort signals is unsafe and may\\nlead to resource leaks since another third party with the signal can\\ncall "},{"kind":"code","text":"`e.stopImmediatePropagation()`"},{"kind":"text","text":". Unfortunately Node.js cannot change\\nthis since it would violate the web standard. Additionally, the original\\nAPI makes it easy to forget to remove listeners.\\n\\nThis API allows safely using "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":"s in Node.js APIs by solving these\\ntwo issues by listening to the event such that "},{"kind":"code","text":"`stopImmediatePropagation`"},{"kind":"text","text":" does\\nnot prevent the listener from running.\\n\\nReturns a disposable so that it may be unsubscribed from more easily.\\n\\n"},{"kind":"code","text":"```js\\nimport { addAbortListener } from \'node:events\';\\n\\nfunction example(signal) {\\n let disposable;\\n try {\\n signal.addEventListener(\'abort\', (e) => e.stopImmediatePropagation());\\n disposable = addAbortListener(signal, (e) => {\\n // Do something when signal is aborted.\\n });\\n } finally {\\n disposable?.[Symbol.dispose]();\\n }\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v20.5.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"Disposable that removes the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" listener."}]}],"modifierTags":["@experimental"]},"parameters":[{"id":345,"name":"signal","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"AbortSignal","qualifiedName":"AbortSignal","package":"typescript"}},{"id":346,"name":"resource","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":347,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":63}],"signatures":[{"id":348,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":349,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Event","qualifiedName":"Event","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","name":"Disposable","qualifiedName":"Disposable","package":"@types/node"},"inheritedFrom":{"type":"reference","name":"EventEmitter.addAbortListener"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.addAbortListener"}},{"id":332,"name":"getEventListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":308,"character":15}],"signatures":[{"id":333,"name":"getEventListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.listeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the event listeners for the\\nevent target. This is useful for debugging and diagnostic purposes.\\n\\n"},{"kind":"code","text":"```js\\nimport { getEventListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n const listener = () => console.log(\'Events are fun\');\\n ee.on(\'foo\', listener);\\n console.log(getEventListeners(ee, \'foo\')); // [ [Function: listener] ]\\n}\\n{\\n const et = new EventTarget();\\n const listener = () => console.log(\'Events are fun\');\\n et.addEventListener(\'foo\', listener);\\n console.log(getEventListeners(et, \'foo\')); // [ [Function: listener] ]\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.2.0, v14.17.0"}]}]},"parameters":[{"id":334,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}},{"id":335,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","name":"EventEmitter.getEventListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.getEventListeners"}},{"id":336,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":337,"character":15}],"signatures":[{"id":337,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently set max amount of listeners.\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.getMaxListeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the max event listeners for the\\nevent target. If the number of event handlers on a single EventTarget exceeds\\nthe max set, the EventTarget will print a warning.\\n\\n"},{"kind":"code","text":"```js\\nimport { getMaxListeners, setMaxListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n console.log(getMaxListeners(ee)); // 10\\n setMaxListeners(11, ee);\\n console.log(getMaxListeners(ee)); // 11\\n}\\n{\\n const et = new EventTarget();\\n console.log(getMaxListeners(et)); // 10\\n setMaxListeners(11, et);\\n console.log(getMaxListeners(et)); // 11\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v19.9.0"}]}]},"parameters":[{"id":338,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.getMaxListeners"}},{"id":328,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":280,"character":15}],"signatures":[{"id":329,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A class method that returns the number of listeners for the given "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"registered on the given "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, listenerCount } from \'node:events\';\\n\\nconst myEmitter = new EventEmitter();\\nmyEmitter.on(\'event\', () => {});\\nmyEmitter.on(\'event\', () => {});\\nconsole.log(listenerCount(myEmitter, \'event\'));\\n// Prints: 2\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.9.12"}]},{"tag":"@deprecated","content":[{"kind":"text","text":"Since v3.2.0 - Use "},{"kind":"code","text":"`listenerCount`"},{"kind":"text","text":" instead."}]}]},"parameters":[{"id":330,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The emitter to query"}]},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":331,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The event name"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.listenerCount"}},{"id":323,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":258,"character":15}],"signatures":[{"id":324,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\n// Emit later on\\nprocess.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n});\\n\\nfor await (const event of on(ee, \'foo\')) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n}\\n// Unreachable here\\n```"},{"kind":"text","text":"\\n\\nReturns an "},{"kind":"code","text":"`AsyncIterator`"},{"kind":"text","text":" that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events. It will throw\\nif the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":". It removes all listeners when\\nexiting the loop. The "},{"kind":"code","text":"`value`"},{"kind":"text","text":" returned by each iteration is an array\\ncomposed of the emitted event arguments.\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting on events:\\n\\n"},{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ac = new AbortController();\\n\\n(async () => {\\n const ee = new EventEmitter();\\n\\n // Emit later on\\n process.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n });\\n\\n for await (const event of on(ee, \'foo\', { signal: ac.signal })) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n }\\n // Unreachable here\\n})();\\n\\nprocess.nextTick(() => ac.abort());\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.16.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events emitted by the "},{"kind":"code","text":"`emitter`"}]}]},"parameters":[{"id":325,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":326,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"intrinsic","name":"string"}},{"id":327,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"AsyncIterableIterator","qualifiedName":"AsyncIterableIterator","package":"typescript"},"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.on"}},{"id":314,"name":"once","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":193,"character":15},{"fileName":"node_modules/@types/node/events.d.ts","line":198,"character":15}],"signatures":[{"id":315,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that is fulfilled when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits the given\\nevent or that is rejected if the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" while waiting.\\nThe "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" will resolve with an array of all the arguments emitted to the\\ngiven event.\\n\\nThis method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event\\nsemantics and does not listen to the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event.\\n\\n"},{"kind":"code","text":"```js\\nimport { once, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\nprocess.nextTick(() => {\\n ee.emit(\'myevent\', 42);\\n});\\n\\nconst [value] = await once(ee, \'myevent\');\\nconsole.log(value);\\n\\nconst err = new Error(\'kaboom\');\\nprocess.nextTick(() => {\\n ee.emit(\'error\', err);\\n});\\n\\ntry {\\n await once(ee, \'myevent\');\\n} catch (err) {\\n console.error(\'error happened\', err);\\n}\\n```"},{"kind":"text","text":"\\n\\nThe special handling of the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is only used when "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":"is used to wait for another event. If "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":" is used to wait for the\\n\'"},{"kind":"code","text":"`error\'`"},{"kind":"text","text":" event itself, then it is treated as any other kind of event without\\nspecial handling:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\n\\nonce(ee, \'error\')\\n .then(([err]) => console.log(\'ok\', err.message))\\n .catch((err) => console.error(\'error\', err.message));\\n\\nee.emit(\'error\', new Error(\'boom\'));\\n\\n// Prints: ok boom\\n```"},{"kind":"text","text":"\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting for the event:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\nconst ac = new AbortController();\\n\\nasync function foo(emitter, event, signal) {\\n try {\\n await once(emitter, event, { signal });\\n console.log(\'event emitted!\');\\n } catch (error) {\\n if (error.name === \'AbortError\') {\\n console.error(\'Waiting for the event was canceled!\');\\n } else {\\n console.error(\'There was an error\', error.message);\\n }\\n }\\n}\\n\\nfoo(ee, \'foo\', ac.signal);\\nac.abort(); // Abort waiting for the event\\nee.emit(\'foo\'); // Prints: Waiting for the event was canceled!\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v11.13.0, v10.16.0"}]}]},"parameters":[{"id":316,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_NodeEventTarget","qualifiedName":"_NodeEventTarget","package":"@types/node"}},{"id":317,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":318,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}},{"id":319,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":320,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"}},{"id":321,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":322,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.once"}},{"id":339,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":352,"character":15}],"signatures":[{"id":340,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { setMaxListeners, EventEmitter } from \'node:events\';\\n\\nconst target = new EventTarget();\\nconst emitter = new EventEmitter();\\n\\nsetMaxListeners(5, target, emitter);\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.4.0"}]}]},"parameters":[{"id":341,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A non-negative number. The maximum number of listeners per "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":" event."}]},"type":{"type":"intrinsic","name":"number"}},{"id":342,"name":"eventTargets","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}}],"inheritedFrom":{"type":"reference","name":"EventEmitter.setMaxListeners"}}],"groups":[{"title":"Constructors","children":[354]},{"title":"Properties","children":[351,352,353,350]},{"title":"Methods","children":[379,367,363,384,433,455,425,361,437,427,374,412,391,398,441,448,430,419,405,422,358,343,332,336,328,323,314,339]}],"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":11,"character":21}],"extendedTypes":[{"type":"reference","name":"EventEmitter","qualifiedName":"EventEmitter","package":"@types/node"}],"extendedBy":[{"type":"reference","id":457,"name":"LoggerJson"},{"type":"reference","id":602,"name":"LoggerText"}],"permalink":"/sdk/js/reference/next/class/Logger","previousId":235,"nextId":457},{"id":457,"name":"LoggerJson","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"This is an abstract class that should\\nbe extended by custom logger classes.\\n\\nthis._log() method must be implemented by them."}]},"children":[{"id":498,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_json.d.ts","line":5,"character":4}],"signatures":[{"id":499,"name":"new LoggerJson","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":500,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"id":501,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"overwrites":{"type":"reference","id":355,"name":"Logger.constructor"}}],"overwrites":{"type":"reference","id":354,"name":"Logger.constructor"}},{"id":495,"name":"captureRejectionSymbol","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Value: "},{"kind":"code","text":"`Symbol.for(\'nodejs.rejection\')`"},{"kind":"text","text":"\\n\\nSee how to write a custom "},{"kind":"code","text":"`rejection handler`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":402,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":351,"name":"captureRejectionSymbol","qualifiedName":"EventEmitter.captureRejectionSymbol","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":351,"name":"Logger.captureRejectionSymbol"}},{"id":496,"name":"captureRejections","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\\n\\nChange the default "},{"kind":"code","text":"`captureRejections`"},{"kind":"text","text":" option on all new "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" objects."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":409,"character":15}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":352,"name":"Logger.captureRejections"}},{"id":497,"name":"defaultMaxListeners","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default, a maximum of "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners can be registered for any single\\nevent. This limit can be changed for individual "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances\\nusing the "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" method. To change the default\\nfor _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":"property can be used. If this value is not a positive number, a "},{"kind":"code","text":"`RangeError`"},{"kind":"text","text":"is thrown.\\n\\nTake caution when setting the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":" because the\\nchange affects _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, including those created before\\nthe change is made. However, calling "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" still has\\nprecedence over "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":".\\n\\nThis is not a hard limit. The "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance will allow\\nmore listeners to be added but will output a trace warning to stderr indicating\\nthat a \\"possible EventEmitter memory leak\\" has been detected. For any single"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", the "},{"kind":"code","text":"`emitter.getMaxListeners()`"},{"kind":"text","text":" and "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":"methods can be used to\\ntemporarily avoid this warning:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.setMaxListeners(emitter.getMaxListeners() + 1);\\nemitter.once(\'event\', () => {\\n // do stuff\\n emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));\\n});\\n```"},{"kind":"text","text":"\\n\\nThe "},{"kind":"code","text":"`--trace-warnings`"},{"kind":"text","text":" command-line flag can be used to display the\\nstack trace for such warnings.\\n\\nThe emitted warning can be inspected with "},{"kind":"code","text":"`process.on(\'warning\')`"},{"kind":"text","text":" and will\\nhave the additional "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":", "},{"kind":"code","text":"`type`"},{"kind":"text","text":", and "},{"kind":"code","text":"`count`"},{"kind":"text","text":" properties, referring to\\nthe event emitter instance, the event\'s name and the number of attached\\nlisteners, respectively.\\nIts "},{"kind":"code","text":"`name`"},{"kind":"text","text":" property is set to "},{"kind":"code","text":"`\'MaxListenersExceededWarning\'`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.11.2"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":446,"character":15}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":353,"name":"Logger.defaultMaxListeners"}},{"id":494,"name":"errorMonitor","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"This symbol shall be used to install a listener for only monitoring "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":"events. Listeners installed using this symbol are called before the regular"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listeners are called.\\n\\nInstalling a listener using this symbol does not change the behavior once an"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is emitted. Therefore, the process will still crash if no\\nregular "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listener is installed."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.17.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":395,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":350,"name":"errorMonitor","qualifiedName":"EventEmitter.errorMonitor","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":350,"name":"Logger.errorMonitor"}},{"id":524,"name":"[captureRejectionSymbol]","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":112,"character":8}],"signatures":[{"id":525,"name":"[captureRejectionSymbol]","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":526,"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":527,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":528,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":380,"name":"Logger.[captureRejectionSymbol]"}}],"inheritedFrom":{"type":"reference","id":379,"name":"Logger.[captureRejectionSymbol]"}},{"id":502,"name":"_log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_json.d.ts","line":6,"character":4}],"signatures":[{"id":503,"name":"_log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":504,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":505,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":506,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":507,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}},{"id":508,"name":"opts","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"},"overwrites":{"type":"reference","id":368,"name":"Logger._log"}}],"overwrites":{"type":"reference","id":367,"name":"Logger._log"}},{"id":515,"name":"_outputWithConsole","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":16,"character":4}],"signatures":[{"id":516,"name":"_outputWithConsole","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":517,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":518,"name":"line","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":364,"name":"Logger._outputWithConsole"}}],"inheritedFrom":{"type":"reference","id":363,"name":"Logger._outputWithConsole"}},{"id":529,"name":"addListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":16}],"signatures":[{"id":530,"name":"addListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.on(eventName, listener)`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":531,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":532,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":533,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":66}],"signatures":[{"id":534,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":535,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":385,"name":"Logger.addListener"}}],"inheritedFrom":{"type":"reference","id":384,"name":"Logger.addListener"}},{"id":578,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":772,"character":16}],"signatures":[{"id":579,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Synchronously calls each of the listeners registered for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", in the order they were registered, passing the supplied arguments\\nto each.\\n\\nReturns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the event had listeners, "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEmitter = new EventEmitter();\\n\\n// First listener\\nmyEmitter.on(\'event\', function firstListener() {\\n console.log(\'Helloooo! first listener\');\\n});\\n// Second listener\\nmyEmitter.on(\'event\', function secondListener(arg1, arg2) {\\n console.log(`event with parameters ${arg1}, ${arg2} in second listener`);\\n});\\n// Third listener\\nmyEmitter.on(\'event\', function thirdListener(...args) {\\n const parameters = args.join(\', \');\\n console.log(`event with parameters ${parameters} in third listener`);\\n});\\n\\nconsole.log(myEmitter.listeners(\'event\'));\\n\\nmyEmitter.emit(\'event\', 1, 2, 3, 4, 5);\\n\\n// Prints:\\n// [\\n// [Function: firstListener],\\n// [Function: secondListener],\\n// [Function: thirdListener]\\n// ]\\n// Helloooo! first listener\\n// event with parameters 1, 2 in second listener\\n// event with parameters 1, 2, 3, 4, 5 in third listener\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":580,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":581,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":434,"name":"Logger.emit"}}],"inheritedFrom":{"type":"reference","id":433,"name":"Logger.emit"}},{"id":600,"name":"eventNames","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":835,"character":16}],"signatures":[{"id":601,"name":"eventNames","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an array listing the events for which the emitter has registered\\nlisteners. The values in the array are strings or "},{"kind":"code","text":"`Symbol`"},{"kind":"text","text":"s.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\n\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => {});\\nmyEE.on(\'bar\', () => {});\\n\\nconst sym = Symbol(\'symbol\');\\nmyEE.on(sym, () => {});\\n\\nconsole.log(myEE.eventNames());\\n// Prints: [ \'foo\', \'bar\', Symbol(symbol) ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},"inheritedFrom":{"type":"reference","id":456,"name":"Logger.eventNames"}}],"inheritedFrom":{"type":"reference","id":455,"name":"Logger.eventNames"}},{"id":570,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":687,"character":16}],"signatures":[{"id":571,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the current max listener value for the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" which is either\\nset by "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" or defaults to "},{"kind":"inline-tag","tag":"@link","text":"defaultMaxListeners","target":497},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v1.0.0"}]}]},"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":426,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":425,"name":"Logger.getMaxListeners"}},{"id":513,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":15,"character":4}],"signatures":[{"id":514,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"},"inheritedFrom":{"type":"reference","id":362,"name":"Logger.getOptions"}}],"inheritedFrom":{"type":"reference","id":361,"name":"Logger.getOptions"}},{"id":582,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":781,"character":16}],"signatures":[{"id":583,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of listeners listening for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\nIf "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" is provided, it will return how many times the listener is found\\nin the list of the listeners of the event."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v3.2.0"}]}]},"parameters":[{"id":584,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":585,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The event handler function"}]},"type":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":438,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":437,"name":"Logger.listenerCount"}},{"id":572,"name":"listeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":700,"character":16}],"signatures":[{"id":573,"name":"listeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\nconsole.log(util.inspect(server.listeners(\'connection\')));\\n// Prints: [ [Function] ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":574,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":428,"name":"Logger.listeners"}}],"inheritedFrom":{"type":"reference","id":427,"name":"Logger.listeners"}},{"id":519,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":18,"character":4}],"signatures":[{"id":520,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":521,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":522,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":523,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":375,"name":"Logger.log"}}],"inheritedFrom":{"type":"reference","id":374,"name":"Logger.log"}},{"id":557,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":16}],"signatures":[{"id":558,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.removeListener()`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v10.0.0"}]}]},"parameters":[{"id":559,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":560,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":561,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":58}],"signatures":[{"id":562,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":563,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":413,"name":"Logger.off"}}],"inheritedFrom":{"type":"reference","id":412,"name":"Logger.off"}},{"id":536,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":16}],"signatures":[{"id":537,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the end of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => console.log(\'a\'));\\nmyEE.prependListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.101"}]}]},"parameters":[{"id":538,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":539,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":540,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":57}],"signatures":[{"id":541,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":542,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":392,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":391,"name":"Logger.on"}},{"id":543,"name":"once","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":16}],"signatures":[{"id":544,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". The\\nnext time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this listener is removed and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.once(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependOnceListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.once(\'foo\', () => console.log(\'a\'));\\nmyEE.prependOnceListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.0"}]}]},"parameters":[{"id":545,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":546,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":547,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":59}],"signatures":[{"id":548,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":549,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":399,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":398,"name":"Logger.once"}},{"id":586,"name":"prependListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":16}],"signatures":[{"id":587,"name":"prependListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the _beginning_ of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependListener(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":588,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":589,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":590,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":70}],"signatures":[{"id":591,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":592,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":442,"name":"Logger.prependListener"}}],"inheritedFrom":{"type":"reference","id":441,"name":"Logger.prependListener"}},{"id":593,"name":"prependOnceListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":16}],"signatures":[{"id":594,"name":"prependOnceListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" to the _beginning_ of the listeners array. The next time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this\\nlistener is removed, and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependOnceListener(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":595,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":596,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":597,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":74}],"signatures":[{"id":598,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":599,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":449,"name":"Logger.prependOnceListener"}}],"inheritedFrom":{"type":"reference","id":448,"name":"Logger.prependOnceListener"}},{"id":575,"name":"rawListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":731,"character":16}],"signatures":[{"id":576,"name":"rawListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":",\\nincluding any wrappers (such as those created by "},{"kind":"code","text":"`.once()`"},{"kind":"text","text":").\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.once(\'log\', () => console.log(\'log once\'));\\n\\n// Returns a new Array with a function `onceWrapper` which has a property\\n// `listener` which contains the original listener bound above\\nconst listeners = emitter.rawListeners(\'log\');\\nconst logFnWrapper = listeners[0];\\n\\n// Logs \\"log once\\" to the console and does not unbind the `once` event\\nlogFnWrapper.listener();\\n\\n// Logs \\"log once\\" to the console and removes the listener\\nlogFnWrapper();\\n\\nemitter.on(\'log\', () => console.log(\'log persistently\'));\\n// Will return a new Array with a single function bound by `.on()` above\\nconst newListeners = emitter.rawListeners(\'log\');\\n\\n// Logs \\"log persistently\\" twice\\nnewListeners[0]();\\nemitter.emit(\'log\');\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v9.4.0"}]}]},"parameters":[{"id":577,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":431,"name":"Logger.rawListeners"}}],"inheritedFrom":{"type":"reference","id":430,"name":"Logger.rawListeners"}},{"id":564,"name":"removeAllListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":671,"character":16}],"signatures":[{"id":565,"name":"removeAllListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes all listeners, or those of the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nIt is bad practice to remove listeners added elsewhere in the code,\\nparticularly when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance was created by some other\\ncomponent or module (e.g. sockets or file streams).\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":566,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":420,"name":"Logger.removeAllListeners"}}],"inheritedFrom":{"type":"reference","id":419,"name":"Logger.removeAllListeners"}},{"id":550,"name":"removeListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":16}],"signatures":[{"id":551,"name":"removeListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the specified "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" from the listener array for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nconst callback = (stream) => {\\n console.log(\'someone connected!\');\\n};\\nserver.on(\'connection\', callback);\\n// ...\\nserver.removeListener(\'connection\', callback);\\n```"},{"kind":"text","text":"\\n\\n"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove, at most, one instance of a listener from the\\nlistener array. If any single listener has been added multiple times to the\\nlistener array for the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", then "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" must be\\ncalled multiple times to remove each instance.\\n\\nOnce an event is emitted, all listeners attached to it at the\\ntime of emitting are called in order. This implies that any"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" or "},{"kind":"code","text":"`removeAllListeners()`"},{"kind":"text","text":" calls _after_ emitting and _before_ the last listener finishes execution\\nwill not remove them from"},{"kind":"code","text":"`emit()`"},{"kind":"text","text":" in progress. Subsequent events behave as expected.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nclass MyEmitter extends EventEmitter {}\\nconst myEmitter = new MyEmitter();\\n\\nconst callbackA = () => {\\n console.log(\'A\');\\n myEmitter.removeListener(\'event\', callbackB);\\n};\\n\\nconst callbackB = () => {\\n console.log(\'B\');\\n};\\n\\nmyEmitter.on(\'event\', callbackA);\\n\\nmyEmitter.on(\'event\', callbackB);\\n\\n// callbackA removes listener callbackB but it will still be called.\\n// Internal listener array at time of emit [callbackA, callbackB]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n// B\\n\\n// callbackB is now removed.\\n// Internal listener array [callbackA]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n```"},{"kind":"text","text":"\\n\\nBecause listeners are managed using an internal array, calling this will\\nchange the position indices of any listener registered _after_ the listener\\nbeing removed. This will not impact the order in which listeners are called,\\nbut it means that any copies of the listener array as returned by\\nthe "},{"kind":"code","text":"`emitter.listeners()`"},{"kind":"text","text":" method will need to be recreated.\\n\\nWhen a single function has been added as a handler multiple times for a single\\nevent (as in the example below), "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove the most\\nrecently added instance. In the example the "},{"kind":"code","text":"`once(\'ping\')`"},{"kind":"text","text":"listener is removed:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst ee = new EventEmitter();\\n\\nfunction pong() {\\n console.log(\'pong\');\\n}\\n\\nee.on(\'ping\', pong);\\nee.once(\'ping\', pong);\\nee.removeListener(\'ping\', pong);\\n\\nee.emit(\'ping\');\\nee.emit(\'ping\');\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":552,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":553,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":554,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":69}],"signatures":[{"id":555,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":556,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":406,"name":"Logger.removeListener"}}],"inheritedFrom":{"type":"reference","id":405,"name":"Logger.removeListener"}},{"id":567,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":681,"character":16}],"signatures":[{"id":568,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s will print a warning if more than "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners are\\nadded for a particular event. This is a useful default that helps finding\\nmemory leaks. The "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":" method allows the limit to be\\nmodified for this specific "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance. The value can be set to"},{"kind":"code","text":"`Infinity`"},{"kind":"text","text":" (or "},{"kind":"code","text":"`0`"},{"kind":"text","text":") to indicate an unlimited number of listeners.\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.5"}]}]},"parameters":[{"id":569,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","id":457,"name":"LoggerJson","qualifiedName":"LoggerJson","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":423,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":422,"name":"Logger.setMaxListeners"}},{"id":510,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":14,"character":4}],"signatures":[{"id":511,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":512,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":359,"name":"Logger.setOptions"}}],"inheritedFrom":{"type":"reference","id":358,"name":"Logger.setOptions"}},{"id":487,"name":"addAbortListener","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":15}],"signatures":[{"id":488,"name":"addAbortListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Listens once to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on the provided "},{"kind":"code","text":"`signal`"},{"kind":"text","text":".\\n\\nListening to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on abort signals is unsafe and may\\nlead to resource leaks since another third party with the signal can\\ncall "},{"kind":"code","text":"`e.stopImmediatePropagation()`"},{"kind":"text","text":". Unfortunately Node.js cannot change\\nthis since it would violate the web standard. Additionally, the original\\nAPI makes it easy to forget to remove listeners.\\n\\nThis API allows safely using "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":"s in Node.js APIs by solving these\\ntwo issues by listening to the event such that "},{"kind":"code","text":"`stopImmediatePropagation`"},{"kind":"text","text":" does\\nnot prevent the listener from running.\\n\\nReturns a disposable so that it may be unsubscribed from more easily.\\n\\n"},{"kind":"code","text":"```js\\nimport { addAbortListener } from \'node:events\';\\n\\nfunction example(signal) {\\n let disposable;\\n try {\\n signal.addEventListener(\'abort\', (e) => e.stopImmediatePropagation());\\n disposable = addAbortListener(signal, (e) => {\\n // Do something when signal is aborted.\\n });\\n } finally {\\n disposable?.[Symbol.dispose]();\\n }\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v20.5.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"Disposable that removes the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" listener."}]}],"modifierTags":["@experimental"]},"parameters":[{"id":489,"name":"signal","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"AbortSignal","qualifiedName":"AbortSignal","package":"typescript"}},{"id":490,"name":"resource","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":491,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":63}],"signatures":[{"id":492,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":493,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Event","qualifiedName":"Event","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","name":"Disposable","qualifiedName":"Disposable","package":"@types/node"},"inheritedFrom":{"type":"reference","id":344,"name":"Logger.addAbortListener"}}],"inheritedFrom":{"type":"reference","id":343,"name":"Logger.addAbortListener"}},{"id":476,"name":"getEventListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":308,"character":15}],"signatures":[{"id":477,"name":"getEventListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.listeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the event listeners for the\\nevent target. This is useful for debugging and diagnostic purposes.\\n\\n"},{"kind":"code","text":"```js\\nimport { getEventListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n const listener = () => console.log(\'Events are fun\');\\n ee.on(\'foo\', listener);\\n console.log(getEventListeners(ee, \'foo\')); // [ [Function: listener] ]\\n}\\n{\\n const et = new EventTarget();\\n const listener = () => console.log(\'Events are fun\');\\n et.addEventListener(\'foo\', listener);\\n console.log(getEventListeners(et, \'foo\')); // [ [Function: listener] ]\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.2.0, v14.17.0"}]}]},"parameters":[{"id":478,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}},{"id":479,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":333,"name":"Logger.getEventListeners"}}],"inheritedFrom":{"type":"reference","id":332,"name":"Logger.getEventListeners"}},{"id":480,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":337,"character":15}],"signatures":[{"id":481,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently set max amount of listeners.\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.getMaxListeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the max event listeners for the\\nevent target. If the number of event handlers on a single EventTarget exceeds\\nthe max set, the EventTarget will print a warning.\\n\\n"},{"kind":"code","text":"```js\\nimport { getMaxListeners, setMaxListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n console.log(getMaxListeners(ee)); // 10\\n setMaxListeners(11, ee);\\n console.log(getMaxListeners(ee)); // 11\\n}\\n{\\n const et = new EventTarget();\\n console.log(getMaxListeners(et)); // 10\\n setMaxListeners(11, et);\\n console.log(getMaxListeners(et)); // 11\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v19.9.0"}]}]},"parameters":[{"id":482,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":337,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":336,"name":"Logger.getMaxListeners"}},{"id":472,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":280,"character":15}],"signatures":[{"id":473,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A class method that returns the number of listeners for the given "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"registered on the given "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, listenerCount } from \'node:events\';\\n\\nconst myEmitter = new EventEmitter();\\nmyEmitter.on(\'event\', () => {});\\nmyEmitter.on(\'event\', () => {});\\nconsole.log(listenerCount(myEmitter, \'event\'));\\n// Prints: 2\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.9.12"}]},{"tag":"@deprecated","content":[{"kind":"text","text":"Since v3.2.0 - Use "},{"kind":"code","text":"`listenerCount`"},{"kind":"text","text":" instead."}]}]},"parameters":[{"id":474,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The emitter to query"}]},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":475,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The event name"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":329,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":328,"name":"Logger.listenerCount"}},{"id":467,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":258,"character":15}],"signatures":[{"id":468,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\n// Emit later on\\nprocess.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n});\\n\\nfor await (const event of on(ee, \'foo\')) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n}\\n// Unreachable here\\n```"},{"kind":"text","text":"\\n\\nReturns an "},{"kind":"code","text":"`AsyncIterator`"},{"kind":"text","text":" that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events. It will throw\\nif the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":". It removes all listeners when\\nexiting the loop. The "},{"kind":"code","text":"`value`"},{"kind":"text","text":" returned by each iteration is an array\\ncomposed of the emitted event arguments.\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting on events:\\n\\n"},{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ac = new AbortController();\\n\\n(async () => {\\n const ee = new EventEmitter();\\n\\n // Emit later on\\n process.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n });\\n\\n for await (const event of on(ee, \'foo\', { signal: ac.signal })) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n }\\n // Unreachable here\\n})();\\n\\nprocess.nextTick(() => ac.abort());\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.16.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events emitted by the "},{"kind":"code","text":"`emitter`"}]}]},"parameters":[{"id":469,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":470,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"intrinsic","name":"string"}},{"id":471,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"AsyncIterableIterator","qualifiedName":"AsyncIterableIterator","package":"typescript"},"inheritedFrom":{"type":"reference","id":324,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":323,"name":"Logger.on"}},{"id":458,"name":"once","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":193,"character":15},{"fileName":"node_modules/@types/node/events.d.ts","line":198,"character":15}],"signatures":[{"id":459,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that is fulfilled when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits the given\\nevent or that is rejected if the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" while waiting.\\nThe "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" will resolve with an array of all the arguments emitted to the\\ngiven event.\\n\\nThis method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event\\nsemantics and does not listen to the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event.\\n\\n"},{"kind":"code","text":"```js\\nimport { once, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\nprocess.nextTick(() => {\\n ee.emit(\'myevent\', 42);\\n});\\n\\nconst [value] = await once(ee, \'myevent\');\\nconsole.log(value);\\n\\nconst err = new Error(\'kaboom\');\\nprocess.nextTick(() => {\\n ee.emit(\'error\', err);\\n});\\n\\ntry {\\n await once(ee, \'myevent\');\\n} catch (err) {\\n console.error(\'error happened\', err);\\n}\\n```"},{"kind":"text","text":"\\n\\nThe special handling of the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is only used when "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":"is used to wait for another event. If "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":" is used to wait for the\\n\'"},{"kind":"code","text":"`error\'`"},{"kind":"text","text":" event itself, then it is treated as any other kind of event without\\nspecial handling:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\n\\nonce(ee, \'error\')\\n .then(([err]) => console.log(\'ok\', err.message))\\n .catch((err) => console.error(\'error\', err.message));\\n\\nee.emit(\'error\', new Error(\'boom\'));\\n\\n// Prints: ok boom\\n```"},{"kind":"text","text":"\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting for the event:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\nconst ac = new AbortController();\\n\\nasync function foo(emitter, event, signal) {\\n try {\\n await once(emitter, event, { signal });\\n console.log(\'event emitted!\');\\n } catch (error) {\\n if (error.name === \'AbortError\') {\\n console.error(\'Waiting for the event was canceled!\');\\n } else {\\n console.error(\'There was an error\', error.message);\\n }\\n }\\n}\\n\\nfoo(ee, \'foo\', ac.signal);\\nac.abort(); // Abort waiting for the event\\nee.emit(\'foo\'); // Prints: Waiting for the event was canceled!\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v11.13.0, v10.16.0"}]}]},"parameters":[{"id":460,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_NodeEventTarget","qualifiedName":"_NodeEventTarget","package":"@types/node"}},{"id":461,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":462,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":315,"name":"Logger.once"}},{"id":463,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":464,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"}},{"id":465,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":466,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":319,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":314,"name":"Logger.once"}},{"id":483,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":352,"character":15}],"signatures":[{"id":484,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { setMaxListeners, EventEmitter } from \'node:events\';\\n\\nconst target = new EventTarget();\\nconst emitter = new EventEmitter();\\n\\nsetMaxListeners(5, target, emitter);\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.4.0"}]}]},"parameters":[{"id":485,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A non-negative number. The maximum number of listeners per "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":" event."}]},"type":{"type":"intrinsic","name":"number"}},{"id":486,"name":"eventTargets","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":340,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":339,"name":"Logger.setMaxListeners"}}],"groups":[{"title":"Constructors","children":[498]},{"title":"Properties","children":[495,496,497,494]},{"title":"Methods","children":[524,502,515,529,578,600,570,513,582,572,519,557,536,543,586,593,575,564,550,567,510,487,476,480,472,467,458,483]}],"sources":[{"fileName":"node_modules/@apify/log/logger_json.d.ts","line":4,"character":21}],"extendedTypes":[{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"}],"permalink":"/sdk/js/reference/next/class/LoggerJson","previousId":313,"nextId":602},{"id":602,"name":"LoggerText","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"This is an abstract class that should\\nbe extended by custom logger classes.\\n\\nthis._log() method must be implemented by them."}]},"children":[{"id":643,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":9,"character":4}],"signatures":[{"id":644,"name":"new LoggerText","kind":16384,"kindString":"Constructor signature","flags":{"isExternal":true},"parameters":[{"id":645,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"id":646,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true}}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"overwrites":{"type":"reference","id":355,"name":"Logger.constructor"}}],"overwrites":{"type":"reference","id":354,"name":"Logger.constructor"}},{"id":640,"name":"captureRejectionSymbol","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"Value: "},{"kind":"code","text":"`Symbol.for(\'nodejs.rejection\')`"},{"kind":"text","text":"\\n\\nSee how to write a custom "},{"kind":"code","text":"`rejection handler`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":402,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":351,"name":"captureRejectionSymbol","qualifiedName":"EventEmitter.captureRejectionSymbol","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":351,"name":"Logger.captureRejectionSymbol"}},{"id":641,"name":"captureRejections","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\\n\\nChange the default "},{"kind":"code","text":"`captureRejections`"},{"kind":"text","text":" option on all new "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" objects."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.4.0, v12.16.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":409,"character":15}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":352,"name":"Logger.captureRejections"}},{"id":642,"name":"defaultMaxListeners","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default, a maximum of "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners can be registered for any single\\nevent. This limit can be changed for individual "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances\\nusing the "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" method. To change the default\\nfor _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":"property can be used. If this value is not a positive number, a "},{"kind":"code","text":"`RangeError`"},{"kind":"text","text":"is thrown.\\n\\nTake caution when setting the "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":" because the\\nchange affects _all_"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instances, including those created before\\nthe change is made. However, calling "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" still has\\nprecedence over "},{"kind":"code","text":"`events.defaultMaxListeners`"},{"kind":"text","text":".\\n\\nThis is not a hard limit. The "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance will allow\\nmore listeners to be added but will output a trace warning to stderr indicating\\nthat a \\"possible EventEmitter memory leak\\" has been detected. For any single"},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", the "},{"kind":"code","text":"`emitter.getMaxListeners()`"},{"kind":"text","text":" and "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":"methods can be used to\\ntemporarily avoid this warning:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.setMaxListeners(emitter.getMaxListeners() + 1);\\nemitter.once(\'event\', () => {\\n // do stuff\\n emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));\\n});\\n```"},{"kind":"text","text":"\\n\\nThe "},{"kind":"code","text":"`--trace-warnings`"},{"kind":"text","text":" command-line flag can be used to display the\\nstack trace for such warnings.\\n\\nThe emitted warning can be inspected with "},{"kind":"code","text":"`process.on(\'warning\')`"},{"kind":"text","text":" and will\\nhave the additional "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":", "},{"kind":"code","text":"`type`"},{"kind":"text","text":", and "},{"kind":"code","text":"`count`"},{"kind":"text","text":" properties, referring to\\nthe event emitter instance, the event\'s name and the number of attached\\nlisteners, respectively.\\nIts "},{"kind":"code","text":"`name`"},{"kind":"text","text":" property is set to "},{"kind":"code","text":"`\'MaxListenersExceededWarning\'`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.11.2"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":446,"character":15}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":353,"name":"Logger.defaultMaxListeners"}},{"id":639,"name":"errorMonitor","kind":1024,"kindString":"Property","flags":{"isStatic":true,"isExternal":true,"isReadonly":true},"comment":{"summary":[{"kind":"text","text":"This symbol shall be used to install a listener for only monitoring "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":"events. Listeners installed using this symbol are called before the regular"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listeners are called.\\n\\nInstalling a listener using this symbol does not change the behavior once an"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is emitted. Therefore, the process will still crash if no\\nregular "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" listener is installed."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.17.0"}]}]},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":395,"character":24}],"type":{"type":"query","queryType":{"type":"reference","id":350,"name":"errorMonitor","qualifiedName":"EventEmitter.errorMonitor","package":"@types/node"}},"inheritedFrom":{"type":"reference","id":350,"name":"Logger.errorMonitor"}},{"id":672,"name":"[captureRejectionSymbol]","kind":2048,"kindString":"Method","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":112,"character":8}],"signatures":[{"id":673,"name":"[captureRejectionSymbol]","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":674,"name":"error","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Error","qualifiedName":"Error","package":"typescript"}},{"id":675,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":676,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":380,"name":"Logger.[captureRejectionSymbol]"}}],"inheritedFrom":{"type":"reference","id":379,"name":"Logger.[captureRejectionSymbol]"}},{"id":647,"name":"_log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":10,"character":4}],"signatures":[{"id":648,"name":"_log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":649,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":650,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":651,"name":"data","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"any"}},{"id":652,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}},{"id":653,"name":"opts","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"},"overwrites":{"type":"reference","id":368,"name":"Logger._log"}}],"overwrites":{"type":"reference","id":367,"name":"Logger._log"}},{"id":663,"name":"_outputWithConsole","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":16,"character":4}],"signatures":[{"id":664,"name":"_outputWithConsole","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":665,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":666,"name":"line","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":364,"name":"Logger._outputWithConsole"}}],"inheritedFrom":{"type":"reference","id":363,"name":"Logger._outputWithConsole"}},{"id":654,"name":"_parseException","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":11,"character":4}],"signatures":[{"id":655,"name":"_parseException","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":656,"name":"exception","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Exception","qualifiedName":"Exception","package":"@apify/log"}}],"type":{"type":"intrinsic","name":"string"}}]},{"id":677,"name":"addListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":16}],"signatures":[{"id":678,"name":"addListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.on(eventName, listener)`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":679,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":680,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":681,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":510,"character":66}],"signatures":[{"id":682,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":683,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":385,"name":"Logger.addListener"}}],"inheritedFrom":{"type":"reference","id":384,"name":"Logger.addListener"}},{"id":726,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":772,"character":16}],"signatures":[{"id":727,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Synchronously calls each of the listeners registered for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", in the order they were registered, passing the supplied arguments\\nto each.\\n\\nReturns "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the event had listeners, "},{"kind":"code","text":"`false`"},{"kind":"text","text":" otherwise.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEmitter = new EventEmitter();\\n\\n// First listener\\nmyEmitter.on(\'event\', function firstListener() {\\n console.log(\'Helloooo! first listener\');\\n});\\n// Second listener\\nmyEmitter.on(\'event\', function secondListener(arg1, arg2) {\\n console.log(`event with parameters ${arg1}, ${arg2} in second listener`);\\n});\\n// Third listener\\nmyEmitter.on(\'event\', function thirdListener(...args) {\\n const parameters = args.join(\', \');\\n console.log(`event with parameters ${parameters} in third listener`);\\n});\\n\\nconsole.log(myEmitter.listeners(\'event\'));\\n\\nmyEmitter.emit(\'event\', 1, 2, 3, 4, 5);\\n\\n// Prints:\\n// [\\n// [Function: firstListener],\\n// [Function: secondListener],\\n// [Function: thirdListener]\\n// ]\\n// Helloooo! first listener\\n// event with parameters 1, 2 in second listener\\n// event with parameters 1, 2, 3, 4, 5 in third listener\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":728,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":729,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":434,"name":"Logger.emit"}}],"inheritedFrom":{"type":"reference","id":433,"name":"Logger.emit"}},{"id":748,"name":"eventNames","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":835,"character":16}],"signatures":[{"id":749,"name":"eventNames","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an array listing the events for which the emitter has registered\\nlisteners. The values in the array are strings or "},{"kind":"code","text":"`Symbol`"},{"kind":"text","text":"s.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\n\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => {});\\nmyEE.on(\'bar\', () => {});\\n\\nconst sym = Symbol(\'symbol\');\\nmyEE.on(sym, () => {});\\n\\nconsole.log(myEE.eventNames());\\n// Prints: [ \'foo\', \'bar\', Symbol(symbol) ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},"inheritedFrom":{"type":"reference","id":456,"name":"Logger.eventNames"}}],"inheritedFrom":{"type":"reference","id":455,"name":"Logger.eventNames"}},{"id":718,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":687,"character":16}],"signatures":[{"id":719,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the current max listener value for the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" which is either\\nset by "},{"kind":"code","text":"`emitter.setMaxListeners(n)`"},{"kind":"text","text":" or defaults to "},{"kind":"inline-tag","tag":"@link","text":"defaultMaxListeners","target":642},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v1.0.0"}]}]},"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":426,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":425,"name":"Logger.getMaxListeners"}},{"id":661,"name":"getOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":15,"character":4}],"signatures":[{"id":662,"name":"getOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"},"inheritedFrom":{"type":"reference","id":362,"name":"Logger.getOptions"}}],"inheritedFrom":{"type":"reference","id":361,"name":"Logger.getOptions"}},{"id":730,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":781,"character":16}],"signatures":[{"id":731,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of listeners listening for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\nIf "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" is provided, it will return how many times the listener is found\\nin the list of the listeners of the event."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v3.2.0"}]}]},"parameters":[{"id":732,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":733,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The event handler function"}]},"type":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":438,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":437,"name":"Logger.listenerCount"}},{"id":720,"name":"listeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":700,"character":16}],"signatures":[{"id":721,"name":"listeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\nconsole.log(util.inspect(server.listeners(\'connection\')));\\n// Prints: [ [Function] ]\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":722,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":428,"name":"Logger.listeners"}}],"inheritedFrom":{"type":"reference","id":427,"name":"Logger.listeners"}},{"id":667,"name":"log","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":18,"character":4}],"signatures":[{"id":668,"name":"log","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":669,"name":"level","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"}},{"id":670,"name":"message","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":671,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":375,"name":"Logger.log"}}],"inheritedFrom":{"type":"reference","id":374,"name":"Logger.log"}},{"id":705,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":16}],"signatures":[{"id":706,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Alias for "},{"kind":"code","text":"`emitter.removeListener()`"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v10.0.0"}]}]},"parameters":[{"id":707,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":708,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":709,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":660,"character":58}],"signatures":[{"id":710,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":711,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":413,"name":"Logger.off"}}],"inheritedFrom":{"type":"reference","id":412,"name":"Logger.off"}},{"id":684,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":16}],"signatures":[{"id":685,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the end of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.on(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.on(\'foo\', () => console.log(\'a\'));\\nmyEE.prependListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.101"}]}]},"parameters":[{"id":686,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":687,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":688,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":542,"character":57}],"signatures":[{"id":689,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":690,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":392,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":391,"name":"Logger.on"}},{"id":691,"name":"once","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":16}],"signatures":[{"id":692,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". The\\nnext time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this listener is removed and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.once(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained.\\n\\nBy default, event listeners are invoked in the order they are added. The"},{"kind":"code","text":"`emitter.prependOnceListener()`"},{"kind":"text","text":" method can be used as an alternative to add the\\nevent listener to the beginning of the listeners array.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst myEE = new EventEmitter();\\nmyEE.once(\'foo\', () => console.log(\'a\'));\\nmyEE.prependOnceListener(\'foo\', () => console.log(\'b\'));\\nmyEE.emit(\'foo\');\\n// Prints:\\n// b\\n// a\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.0"}]}]},"parameters":[{"id":693,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":694,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":695,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":572,"character":59}],"signatures":[{"id":696,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":697,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":399,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":398,"name":"Logger.once"}},{"id":734,"name":"prependListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":16}],"signatures":[{"id":735,"name":"prependListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function to the _beginning_ of the listeners array for the\\nevent named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":". No checks are made to see if the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" has\\nalready been added. Multiple calls passing the same combination of "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"and "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" will result in the "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" being added, and called, multiple\\ntimes.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependListener(\'connection\', (stream) => {\\n console.log(\'someone connected!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":736,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":737,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":738,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":799,"character":70}],"signatures":[{"id":739,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":740,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":442,"name":"Logger.prependListener"}}],"inheritedFrom":{"type":"reference","id":441,"name":"Logger.prependListener"}},{"id":741,"name":"prependOnceListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":16}],"signatures":[{"id":742,"name":"prependOnceListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Adds a **one-time**"},{"kind":"code","text":"`listener`"},{"kind":"text","text":" function for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" to the _beginning_ of the listeners array. The next time "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" is triggered, this\\nlistener is removed, and then invoked.\\n\\n"},{"kind":"code","text":"```js\\nserver.prependOnceListener(\'connection\', (stream) => {\\n console.log(\'Ah, we have our first user!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v6.0.0"}]}]},"parameters":[{"id":743,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":744,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The callback function"}]},"type":{"type":"reflection","declaration":{"id":745,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":815,"character":74}],"signatures":[{"id":746,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":747,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":449,"name":"Logger.prependOnceListener"}}],"inheritedFrom":{"type":"reference","id":448,"name":"Logger.prependOnceListener"}},{"id":723,"name":"rawListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":731,"character":16}],"signatures":[{"id":724,"name":"rawListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":",\\nincluding any wrappers (such as those created by "},{"kind":"code","text":"`.once()`"},{"kind":"text","text":").\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst emitter = new EventEmitter();\\nemitter.once(\'log\', () => console.log(\'log once\'));\\n\\n// Returns a new Array with a function `onceWrapper` which has a property\\n// `listener` which contains the original listener bound above\\nconst listeners = emitter.rawListeners(\'log\');\\nconst logFnWrapper = listeners[0];\\n\\n// Logs \\"log once\\" to the console and does not unbind the `once` event\\nlogFnWrapper.listener();\\n\\n// Logs \\"log once\\" to the console and removes the listener\\nlogFnWrapper();\\n\\nemitter.on(\'log\', () => console.log(\'log persistently\'));\\n// Will return a new Array with a single function bound by `.on()` above\\nconst newListeners = emitter.rawListeners(\'log\');\\n\\n// Logs \\"log persistently\\" twice\\nnewListeners[0]();\\nemitter.emit(\'log\');\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v9.4.0"}]}]},"parameters":[{"id":725,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":431,"name":"Logger.rawListeners"}}],"inheritedFrom":{"type":"reference","id":430,"name":"Logger.rawListeners"}},{"id":712,"name":"removeAllListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":671,"character":16}],"signatures":[{"id":713,"name":"removeAllListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes all listeners, or those of the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nIt is bad practice to remove listeners added elsewhere in the code,\\nparticularly when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance was created by some other\\ncomponent or module (e.g. sockets or file streams).\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":714,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":420,"name":"Logger.removeAllListeners"}}],"inheritedFrom":{"type":"reference","id":419,"name":"Logger.removeAllListeners"}},{"id":698,"name":"removeListener","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":16}],"signatures":[{"id":699,"name":"removeListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the specified "},{"kind":"code","text":"`listener`"},{"kind":"text","text":" from the listener array for the event named"},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nconst callback = (stream) => {\\n console.log(\'someone connected!\');\\n};\\nserver.on(\'connection\', callback);\\n// ...\\nserver.removeListener(\'connection\', callback);\\n```"},{"kind":"text","text":"\\n\\n"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove, at most, one instance of a listener from the\\nlistener array. If any single listener has been added multiple times to the\\nlistener array for the specified "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":", then "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" must be\\ncalled multiple times to remove each instance.\\n\\nOnce an event is emitted, all listeners attached to it at the\\ntime of emitting are called in order. This implies that any"},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" or "},{"kind":"code","text":"`removeAllListeners()`"},{"kind":"text","text":" calls _after_ emitting and _before_ the last listener finishes execution\\nwill not remove them from"},{"kind":"code","text":"`emit()`"},{"kind":"text","text":" in progress. Subsequent events behave as expected.\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nclass MyEmitter extends EventEmitter {}\\nconst myEmitter = new MyEmitter();\\n\\nconst callbackA = () => {\\n console.log(\'A\');\\n myEmitter.removeListener(\'event\', callbackB);\\n};\\n\\nconst callbackB = () => {\\n console.log(\'B\');\\n};\\n\\nmyEmitter.on(\'event\', callbackA);\\n\\nmyEmitter.on(\'event\', callbackB);\\n\\n// callbackA removes listener callbackB but it will still be called.\\n// Internal listener array at time of emit [callbackA, callbackB]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n// B\\n\\n// callbackB is now removed.\\n// Internal listener array [callbackA]\\nmyEmitter.emit(\'event\');\\n// Prints:\\n// A\\n```"},{"kind":"text","text":"\\n\\nBecause listeners are managed using an internal array, calling this will\\nchange the position indices of any listener registered _after_ the listener\\nbeing removed. This will not impact the order in which listeners are called,\\nbut it means that any copies of the listener array as returned by\\nthe "},{"kind":"code","text":"`emitter.listeners()`"},{"kind":"text","text":" method will need to be recreated.\\n\\nWhen a single function has been added as a handler multiple times for a single\\nevent (as in the example below), "},{"kind":"code","text":"`removeListener()`"},{"kind":"text","text":" will remove the most\\nrecently added instance. In the example the "},{"kind":"code","text":"`once(\'ping\')`"},{"kind":"text","text":"listener is removed:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter } from \'node:events\';\\nconst ee = new EventEmitter();\\n\\nfunction pong() {\\n console.log(\'pong\');\\n}\\n\\nee.on(\'ping\', pong);\\nee.once(\'ping\', pong);\\nee.removeListener(\'ping\', pong);\\n\\nee.emit(\'ping\');\\nee.emit(\'ping\');\\n```"},{"kind":"text","text":"\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.1.26"}]}]},"parameters":[{"id":700,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":701,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":702,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":655,"character":69}],"signatures":[{"id":703,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":704,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":406,"name":"Logger.removeListener"}}],"inheritedFrom":{"type":"reference","id":405,"name":"Logger.removeListener"}},{"id":715,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":681,"character":16}],"signatures":[{"id":716,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"By default "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s will print a warning if more than "},{"kind":"code","text":"`10`"},{"kind":"text","text":" listeners are\\nadded for a particular event. This is a useful default that helps finding\\nmemory leaks. The "},{"kind":"code","text":"`emitter.setMaxListeners()`"},{"kind":"text","text":" method allows the limit to be\\nmodified for this specific "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" instance. The value can be set to"},{"kind":"code","text":"`Infinity`"},{"kind":"text","text":" (or "},{"kind":"code","text":"`0`"},{"kind":"text","text":") to indicate an unlimited number of listeners.\\n\\nReturns a reference to the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":", so that calls can be chained."}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.3.5"}]}]},"parameters":[{"id":717,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","id":602,"name":"LoggerText","qualifiedName":"LoggerText","package":"@apify/log"},"inheritedFrom":{"type":"reference","id":423,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":422,"name":"Logger.setMaxListeners"}},{"id":658,"name":"setOptions","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@apify/log/logger.d.ts","line":14,"character":4}],"signatures":[{"id":659,"name":"setOptions","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":660,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"any"}],"name":"Record","qualifiedName":"Record","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":359,"name":"Logger.setOptions"}}],"inheritedFrom":{"type":"reference","id":358,"name":"Logger.setOptions"}},{"id":632,"name":"addAbortListener","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":15}],"signatures":[{"id":633,"name":"addAbortListener","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Listens once to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on the provided "},{"kind":"code","text":"`signal`"},{"kind":"text","text":".\\n\\nListening to the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" event on abort signals is unsafe and may\\nlead to resource leaks since another third party with the signal can\\ncall "},{"kind":"code","text":"`e.stopImmediatePropagation()`"},{"kind":"text","text":". Unfortunately Node.js cannot change\\nthis since it would violate the web standard. Additionally, the original\\nAPI makes it easy to forget to remove listeners.\\n\\nThis API allows safely using "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":"s in Node.js APIs by solving these\\ntwo issues by listening to the event such that "},{"kind":"code","text":"`stopImmediatePropagation`"},{"kind":"text","text":" does\\nnot prevent the listener from running.\\n\\nReturns a disposable so that it may be unsubscribed from more easily.\\n\\n"},{"kind":"code","text":"```js\\nimport { addAbortListener } from \'node:events\';\\n\\nfunction example(signal) {\\n let disposable;\\n try {\\n signal.addEventListener(\'abort\', (e) => e.stopImmediatePropagation());\\n disposable = addAbortListener(signal, (e) => {\\n // Do something when signal is aborted.\\n });\\n } finally {\\n disposable?.[Symbol.dispose]();\\n }\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v20.5.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"Disposable that removes the "},{"kind":"code","text":"`abort`"},{"kind":"text","text":" listener."}]}],"modifierTags":["@experimental"]},"parameters":[{"id":634,"name":"signal","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"AbortSignal","qualifiedName":"AbortSignal","package":"typescript"}},{"id":635,"name":"resource","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":636,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":387,"character":63}],"signatures":[{"id":637,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":638,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Event","qualifiedName":"Event","package":"typescript"}}],"type":{"type":"intrinsic","name":"void"}}]}}}],"type":{"type":"reference","name":"Disposable","qualifiedName":"Disposable","package":"@types/node"},"inheritedFrom":{"type":"reference","id":344,"name":"Logger.addAbortListener"}}],"inheritedFrom":{"type":"reference","id":343,"name":"Logger.addAbortListener"}},{"id":621,"name":"getEventListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":308,"character":15}],"signatures":[{"id":622,"name":"getEventListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a copy of the array of listeners for the event named "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":".\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.listeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the event listeners for the\\nevent target. This is useful for debugging and diagnostic purposes.\\n\\n"},{"kind":"code","text":"```js\\nimport { getEventListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n const listener = () => console.log(\'Events are fun\');\\n ee.on(\'foo\', listener);\\n console.log(getEventListeners(ee, \'foo\')); // [ [Function: listener] ]\\n}\\n{\\n const et = new EventTarget();\\n const listener = () => console.log(\'Events are fun\');\\n et.addEventListener(\'foo\', listener);\\n console.log(getEventListeners(et, \'foo\')); // [ [Function: listener] ]\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.2.0, v14.17.0"}]}]},"parameters":[{"id":623,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}},{"id":624,"name":"name","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"array","elementType":{"type":"reference","name":"Function","qualifiedName":"Function","package":"typescript"}},"inheritedFrom":{"type":"reference","id":333,"name":"Logger.getEventListeners"}}],"inheritedFrom":{"type":"reference","id":332,"name":"Logger.getEventListeners"}},{"id":625,"name":"getMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":337,"character":15}],"signatures":[{"id":626,"name":"getMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the currently set max amount of listeners.\\n\\nFor "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":"s this behaves exactly the same as calling "},{"kind":"code","text":"`.getMaxListeners`"},{"kind":"text","text":" on\\nthe emitter.\\n\\nFor "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":"s this is the only way to get the max event listeners for the\\nevent target. If the number of event handlers on a single EventTarget exceeds\\nthe max set, the EventTarget will print a warning.\\n\\n"},{"kind":"code","text":"```js\\nimport { getMaxListeners, setMaxListeners, EventEmitter } from \'node:events\';\\n\\n{\\n const ee = new EventEmitter();\\n console.log(getMaxListeners(ee)); // 10\\n setMaxListeners(11, ee);\\n console.log(getMaxListeners(ee)); // 11\\n}\\n{\\n const et = new EventTarget();\\n console.log(getMaxListeners(et)); // 10\\n setMaxListeners(11, et);\\n console.log(getMaxListeners(et)); // 11\\n}\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v19.9.0"}]}]},"parameters":[{"id":627,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":337,"name":"Logger.getMaxListeners"}}],"inheritedFrom":{"type":"reference","id":336,"name":"Logger.getMaxListeners"}},{"id":617,"name":"listenerCount","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":280,"character":15}],"signatures":[{"id":618,"name":"listenerCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A class method that returns the number of listeners for the given "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":"registered on the given "},{"kind":"code","text":"`emitter`"},{"kind":"text","text":".\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, listenerCount } from \'node:events\';\\n\\nconst myEmitter = new EventEmitter();\\nmyEmitter.on(\'event\', () => {});\\nmyEmitter.on(\'event\', () => {});\\nconsole.log(listenerCount(myEmitter, \'event\'));\\n// Prints: 2\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v0.9.12"}]},{"tag":"@deprecated","content":[{"kind":"text","text":"Since v3.2.0 - Use "},{"kind":"code","text":"`listenerCount`"},{"kind":"text","text":" instead."}]}]},"parameters":[{"id":619,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The emitter to query"}]},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":620,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The event name"}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":329,"name":"Logger.listenerCount"}}],"inheritedFrom":{"type":"reference","id":328,"name":"Logger.listenerCount"}},{"id":612,"name":"on","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":258,"character":15}],"signatures":[{"id":613,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\n// Emit later on\\nprocess.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n});\\n\\nfor await (const event of on(ee, \'foo\')) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n}\\n// Unreachable here\\n```"},{"kind":"text","text":"\\n\\nReturns an "},{"kind":"code","text":"`AsyncIterator`"},{"kind":"text","text":" that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events. It will throw\\nif the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":". It removes all listeners when\\nexiting the loop. The "},{"kind":"code","text":"`value`"},{"kind":"text","text":" returned by each iteration is an array\\ncomposed of the emitted event arguments.\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting on events:\\n\\n"},{"kind":"code","text":"```js\\nimport { on, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ac = new AbortController();\\n\\n(async () => {\\n const ee = new EventEmitter();\\n\\n // Emit later on\\n process.nextTick(() => {\\n ee.emit(\'foo\', \'bar\');\\n ee.emit(\'foo\', 42);\\n });\\n\\n for await (const event of on(ee, \'foo\', { signal: ac.signal })) {\\n // The execution of this inner block is synchronous and it\\n // processes one event at a time (even with await). Do not use\\n // if concurrent execution is required.\\n console.log(event); // prints [\'bar\'] [42]\\n }\\n // Unreachable here\\n})();\\n\\nprocess.nextTick(() => ac.abort());\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v13.6.0, v12.16.0"}]},{"tag":"@returns","content":[{"kind":"text","text":"that iterates "},{"kind":"code","text":"`eventName`"},{"kind":"text","text":" events emitted by the "},{"kind":"code","text":"`emitter`"}]}]},"parameters":[{"id":614,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}},{"id":615,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The name of the event being listened for"}]},"type":{"type":"intrinsic","name":"string"}},{"id":616,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"any"}],"name":"AsyncIterableIterator","qualifiedName":"AsyncIterableIterator","package":"typescript"},"inheritedFrom":{"type":"reference","id":324,"name":"Logger.on"}}],"inheritedFrom":{"type":"reference","id":323,"name":"Logger.on"}},{"id":603,"name":"once","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":193,"character":15},{"fileName":"node_modules/@types/node/events.d.ts","line":198,"character":15}],"signatures":[{"id":604,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Creates a "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" that is fulfilled when the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits the given\\nevent or that is rejected if the "},{"kind":"code","text":"`EventEmitter`"},{"kind":"text","text":" emits "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" while waiting.\\nThe "},{"kind":"code","text":"`Promise`"},{"kind":"text","text":" will resolve with an array of all the arguments emitted to the\\ngiven event.\\n\\nThis method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special"},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event\\nsemantics and does not listen to the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event.\\n\\n"},{"kind":"code","text":"```js\\nimport { once, EventEmitter } from \'node:events\';\\nimport process from \'node:process\';\\n\\nconst ee = new EventEmitter();\\n\\nprocess.nextTick(() => {\\n ee.emit(\'myevent\', 42);\\n});\\n\\nconst [value] = await once(ee, \'myevent\');\\nconsole.log(value);\\n\\nconst err = new Error(\'kaboom\');\\nprocess.nextTick(() => {\\n ee.emit(\'error\', err);\\n});\\n\\ntry {\\n await once(ee, \'myevent\');\\n} catch (err) {\\n console.error(\'error happened\', err);\\n}\\n```"},{"kind":"text","text":"\\n\\nThe special handling of the "},{"kind":"code","text":"`\'error\'`"},{"kind":"text","text":" event is only used when "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":"is used to wait for another event. If "},{"kind":"code","text":"`events.once()`"},{"kind":"text","text":" is used to wait for the\\n\'"},{"kind":"code","text":"`error\'`"},{"kind":"text","text":" event itself, then it is treated as any other kind of event without\\nspecial handling:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\n\\nonce(ee, \'error\')\\n .then(([err]) => console.log(\'ok\', err.message))\\n .catch((err) => console.error(\'error\', err.message));\\n\\nee.emit(\'error\', new Error(\'boom\'));\\n\\n// Prints: ok boom\\n```"},{"kind":"text","text":"\\n\\nAn "},{"kind":"code","text":"`AbortSignal`"},{"kind":"text","text":" can be used to cancel waiting for the event:\\n\\n"},{"kind":"code","text":"```js\\nimport { EventEmitter, once } from \'node:events\';\\n\\nconst ee = new EventEmitter();\\nconst ac = new AbortController();\\n\\nasync function foo(emitter, event, signal) {\\n try {\\n await once(emitter, event, { signal });\\n console.log(\'event emitted!\');\\n } catch (error) {\\n if (error.name === \'AbortError\') {\\n console.error(\'Waiting for the event was canceled!\');\\n } else {\\n console.error(\'There was an error\', error.message);\\n }\\n }\\n}\\n\\nfoo(ee, \'foo\', ac.signal);\\nac.abort(); // Abort waiting for the event\\nee.emit(\'foo\'); // Prints: Waiting for the event was canceled!\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v11.13.0, v10.16.0"}]}]},"parameters":[{"id":605,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_NodeEventTarget","qualifiedName":"_NodeEventTarget","package":"@types/node"}},{"id":606,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"symbol"}]}},{"id":607,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":315,"name":"Logger.once"}},{"id":608,"name":"once","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":609,"name":"emitter","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"}},{"id":610,"name":"eventName","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"string"}},{"id":611,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"StaticEventEmitterOptions","qualifiedName":"StaticEventEmitterOptions","package":"@types/node"}}],"type":{"type":"reference","typeArguments":[{"type":"array","elementType":{"type":"intrinsic","name":"any"}}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","id":319,"name":"Logger.once"}}],"inheritedFrom":{"type":"reference","id":314,"name":"Logger.once"}},{"id":628,"name":"setMaxListeners","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@types/node/events.d.ts","line":352,"character":15}],"signatures":[{"id":629,"name":"setMaxListeners","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"code","text":"```js\\nimport { setMaxListeners, EventEmitter } from \'node:events\';\\n\\nconst target = new EventTarget();\\nconst emitter = new EventEmitter();\\n\\nsetMaxListeners(5, target, emitter);\\n```"}],"blockTags":[{"tag":"@since","content":[{"kind":"text","text":"v15.4.0"}]}]},"parameters":[{"id":630,"name":"n","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"A non-negative number. The maximum number of listeners per "},{"kind":"code","text":"`EventTarget`"},{"kind":"text","text":" event."}]},"type":{"type":"intrinsic","name":"number"}},{"id":631,"name":"eventTargets","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"union","types":[{"type":"reference","name":"_DOMEventTarget","qualifiedName":"_DOMEventTarget","package":"@types/node"},{"type":"reference","name":"EventEmitter","qualifiedName":"global.NodeJS.EventEmitter","package":"@types/node"}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","id":340,"name":"Logger.setMaxListeners"}}],"inheritedFrom":{"type":"reference","id":339,"name":"Logger.setMaxListeners"}}],"groups":[{"title":"Constructors","children":[643]},{"title":"Properties","children":[640,641,642,639]},{"title":"Methods","children":[672,647,663,654,677,726,748,718,661,730,720,667,705,684,691,734,741,723,712,698,715,658,632,621,625,617,612,603,628]}],"sources":[{"fileName":"node_modules/@apify/log/logger_text.d.ts","line":8,"character":21}],"extendedTypes":[{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"}],"permalink":"/sdk/js/reference/next/class/LoggerText","previousId":457,"nextId":1467},{"id":1467,"name":"PlatformEventManager","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"text","text":"Gets an instance of a Node.js\'\\n[EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)\\nclass that emits various events from the SDK or the Apify platform.\\nThe event emitter is initialized by calling the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.main"},{"kind":"text","text":" function.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\nActor.on(\'cpuInfo\', (data) => {\\n if (data.isCpuOverloaded) console.log(\'Oh no, the CPU is overloaded!\');\\n});\\n```"},{"kind":"text","text":"\\n\\nThe following events are emitted:\\n\\n- "},{"kind":"code","text":"`cpuInfo`"},{"kind":"text","text":": "},{"kind":"code","text":"`{ \\"isCpuOverloaded\\": Boolean }`"},{"kind":"text","text":"\\n The event is emitted approximately every second\\n and it indicates whether the actor is using the maximum of available CPU resources.\\n If that\'s the case, the actor should not add more workload.\\n For example, this event is used by the "},{"kind":"inline-tag","tag":"@apilink","text":"AutoscaledPool"},{"kind":"text","text":" class.\\n- "},{"kind":"code","text":"`migrating`"},{"kind":"text","text":": "},{"kind":"code","text":"`void`"},{"kind":"text","text":"\\n Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon.\\n You can use it to persist the state of the actor and gracefully stop your in-progress tasks,\\n so that they are not interrupted by the migration.\\n For example, this is used by the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestList"},{"kind":"text","text":" class.\\n- "},{"kind":"code","text":"`aborting`"},{"kind":"text","text":": "},{"kind":"code","text":"`void`"},{"kind":"text","text":"\\n When a user aborts an actor run on the Apify platform, they can choose to abort gracefully to allow\\n the actor some time before getting killed. This graceful abort emits the "},{"kind":"code","text":"`aborting`"},{"kind":"text","text":" event which the SDK\\n uses to gracefully stop running crawls and you can use it to do your own cleanup as well.\\n- "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":": "},{"kind":"code","text":"`{ \\"isMigrating\\": Boolean }`"},{"kind":"text","text":"\\n Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is time to persist\\n their state, in order to avoid repeating all work when the actor restarts.\\n This event is automatically emitted together with the "},{"kind":"code","text":"`migrating`"},{"kind":"text","text":" event,\\n in which case the "},{"kind":"code","text":"`isMigrating`"},{"kind":"text","text":" flag is set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":". Otherwise the flag is "},{"kind":"code","text":"`false`"},{"kind":"text","text":".\\n Note that the "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":" event is provided merely for user convenience,\\n you can achieve the same effect using "},{"kind":"code","text":"`setInterval()`"},{"kind":"text","text":" and listening for the "},{"kind":"code","text":"`migrating`"},{"kind":"text","text":" event."}]},"children":[{"id":1468,"name":"constructor","kind":512,"kindString":"Constructor","flags":{},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":49,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L49"}],"signatures":[{"id":1469,"name":"new PlatformEventManager","kind":16384,"kindString":"Constructor signature","flags":{},"parameters":[{"id":1470,"name":"config","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","id":1237,"name":"Configuration"},"defaultValue":"..."}],"type":{"type":"reference","id":1467,"name":"PlatformEventManager"},"overwrites":{"type":"reference","name":"EventManager.constructor"}}],"overwrites":{"type":"reference","name":"EventManager.constructor"}},{"id":1472,"name":"config","kind":1024,"kindString":"Property","flags":{"isReadonly":true},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":49,"character":34,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L49"}],"type":{"type":"reference","id":1237,"name":"Configuration"},"defaultValue":"...","inheritedFrom":{"type":"reference","name":"EventManager.config"}},{"id":1478,"name":"close","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":111,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L111"}],"signatures":[{"id":1479,"name":"close","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Closes websocket providing events from Actor infrastructure and also stops sending internal events\\nof Apify package such as "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":".\\nThis is automatically called at the end of "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":"."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"EventManager.close"}}],"overwrites":{"type":"reference","name":"EventManager.close"}},{"id":1498,"name":"emit","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":35,"character":4}],"signatures":[{"id":1499,"name":"emit","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1500,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":1501,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"unknown"}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventManager.emit"}}],"inheritedFrom":{"type":"reference","name":"EventManager.emit"}},{"id":1473,"name":"init","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":57,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L57"}],"signatures":[{"id":1474,"name":"init","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Initializes "},{"kind":"code","text":"`Actor.events`"},{"kind":"text","text":" event emitter by creating a connection to a websocket that provides them.\\nThis is an internal function that is automatically called by "},{"kind":"code","text":"`Actor.main()`"},{"kind":"text","text":"."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"EventManager.init"}}],"overwrites":{"type":"reference","name":"EventManager.init"}},{"id":1502,"name":"isInitialized","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":36,"character":4}],"signatures":[{"id":1503,"name":"isInitialized","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"EventManager.isInitialized"}}],"inheritedFrom":{"type":"reference","name":"EventManager.isInitialized"}},{"id":1491,"name":"off","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":34,"character":4}],"signatures":[{"id":1492,"name":"off","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1493,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":1494,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reflection","declaration":{"id":1495,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":34,"character":41}],"signatures":[{"id":1496,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1497,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventManager.off"}}],"inheritedFrom":{"type":"reference","name":"EventManager.off"}},{"id":1484,"name":"on","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":33,"character":4}],"signatures":[{"id":1485,"name":"on","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1486,"name":"event","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"EventTypeName","qualifiedName":"EventTypeName","package":"@crawlee/core"}},{"id":1487,"name":"listener","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reflection","declaration":{"id":1488,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/events/event_manager.d.ts","line":33,"character":39}],"signatures":[{"id":1489,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1490,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"array","elementType":{"type":"intrinsic","name":"any"}}}],"type":{"type":"intrinsic","name":"any"}}]}}}],"type":{"type":"intrinsic","name":"void"},"inheritedFrom":{"type":"reference","name":"EventManager.on"}}],"inheritedFrom":{"type":"reference","name":"EventManager.on"}}],"groups":[{"title":"Constructors","children":[1468]},{"title":"Properties","children":[1472]},{"title":"Methods","children":[1478,1498,1473,1502,1491,1484]}],"sources":[{"fileName":"packages/apify/src/platform_event_manager.ts","line":45,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L45"}],"extendedTypes":[{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/PlatformEventManager","previousId":602,"nextId":1410},{"id":1410,"name":"ProxyConfiguration","kind":128,"kindString":"Class","flags":{},"comment":{"summary":[{"kind":"text","text":"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking\\nyour crawlers based on IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures\\nthem to use the selected proxies for all connections. You can get information about the currently used proxy by inspecting\\nthe "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyInfo"},{"kind":"text","text":" property in your crawler\'s page function. There, you can inspect the proxy\'s URL and other attributes.\\n\\nThe proxy servers are managed by [Apify Proxy](https://docs.apify.com/proxy). To be able to use Apify Proxy,\\nyou need an Apify account and access to the selected proxies. If you provide no configuration option,\\nthe proxies will be managed automatically using a smart algorithm.\\n\\nIf you want to use your own proxies, use the "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfigurationOptions.proxyUrls"},{"kind":"text","text":" option. Your list of proxy URLs will\\nbe rotated by the configuration if this option is provided.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n\\nconst proxyConfiguration = await Actor.createProxyConfiguration({\\n groups: [\'GROUP1\', \'GROUP2\'] // List of Apify Proxy groups\\n countryCode: \'US\',\\n});\\n\\nconst crawler = new CheerioCrawler({\\n // ...\\n proxyConfiguration,\\n requestHandler({ proxyInfo }) {\\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\\n }\\n})\\n\\n```"}]},"children":[{"id":1421,"name":"config","kind":1024,"kindString":"Property","flags":{"isReadonly":true},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":162,"character":66,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L162"}],"type":{"type":"reference","id":1237,"name":"Configuration"},"defaultValue":"..."},{"id":1448,"name":"isManInTheMiddle","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":103,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreProxyConfiguration.isManInTheMiddle"}},{"id":1422,"name":"initialize","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":215,"character":10,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L215"}],"signatures":[{"id":1423,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups\\nif Apify Proxy configuration is used.\\nAlso checks if country has access to Apify Proxy groups if the country code is provided.\\n\\nYou should use the "},{"kind":"inline-tag","tag":"@apilink","text":"createProxyConfiguration"},{"kind":"text","text":" function to create a pre-initialized\\n"},{"kind":"code","text":"`ProxyConfiguration`"},{"kind":"text","text":" instance instead of calling this manually."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"}}]},{"id":1424,"name":"newProxyInfo","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":239,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L239"}],"signatures":[{"id":1425,"name":"newProxyInfo","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"This function creates a new "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyInfo"},{"kind":"text","text":" info object.\\nIt is used by CheerioCrawler and PuppeteerCrawler to generate proxy URLs and also to allow the user to inspect\\nthe currently used proxy via the requestHandler parameter "},{"kind":"code","text":"`proxyInfo`"},{"kind":"text","text":".\\nUse it if you want to work with a rich representation of a proxy URL.\\nIf you need the URL string only, use "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newUrl"},{"kind":"text","text":"."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Represents information about used proxy and its configuration."}]}]},"parameters":[{"id":1426,"name":"sessionId","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Represents the identifier of user "},{"kind":"inline-tag","tag":"@apilink","text":"Session"},{"kind":"text","text":" that can be managed by the "},{"kind":"inline-tag","tag":"@apilink","text":"SessionPool"},{"kind":"text","text":" or\\n you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.\\n When the provided sessionId is a number, it\'s converted to a string. Property sessionId of\\n "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyInfo"},{"kind":"text","text":" is always returned as a type string.\\n\\n All the HTTP requests going through the proxy with the same session identifier\\n will use the same target proxy server (i.e. the same IP address).\\n The identifier must not be longer than 50 characters and include only the following: "},{"kind":"code","text":"`0-9`"},{"kind":"text","text":", "},{"kind":"code","text":"`a-z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A-Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\".\\"`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\"_\\"`"},{"kind":"text","text":" and "},{"kind":"code","text":"`\\"~\\"`"},{"kind":"text","text":"."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":1401,"name":"ProxyInfo"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newProxyInfo"}}],"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newProxyInfo"}},{"id":1427,"name":"newUrl","kind":2048,"kindString":"Method","flags":{},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":270,"character":19,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L270"}],"signatures":[{"id":1428,"name":"newUrl","kind":4096,"kindString":"Call signature","flags":{},"comment":{"summary":[{"kind":"text","text":"Returns a new proxy URL based on provided configuration options and the "},{"kind":"code","text":"`sessionId`"},{"kind":"text","text":" parameter."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"A string with a proxy URL, including authentication credentials and port number.\\n For example, "},{"kind":"code","text":"`http://bob:password123@proxy.example.com:8000`"}]}]},"parameters":[{"id":1429,"name":"sessionId","kind":32768,"kindString":"Parameter","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Represents the identifier of user "},{"kind":"inline-tag","tag":"@apilink","text":"Session"},{"kind":"text","text":" that can be managed by the "},{"kind":"inline-tag","tag":"@apilink","text":"SessionPool"},{"kind":"text","text":" or\\n you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.\\n When the provided sessionId is a number, it\'s converted to a string.\\n\\n All the HTTP requests going through the proxy with the same session identifier\\n will use the same target proxy server (i.e. the same IP address).\\n The identifier must not be longer than 50 characters and include only the following: "},{"kind":"code","text":"`0-9`"},{"kind":"text","text":", "},{"kind":"code","text":"`a-z`"},{"kind":"text","text":", "},{"kind":"code","text":"`A-Z`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\".\\"`"},{"kind":"text","text":", "},{"kind":"code","text":"`\\"_\\"`"},{"kind":"text","text":" and "},{"kind":"code","text":"`\\"~\\"`"},{"kind":"text","text":"."}]},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newUrl"}}],"overwrites":{"type":"reference","name":"CoreProxyConfiguration.newUrl"}}],"groups":[{"title":"Properties","children":[1421,1448]},{"title":"Methods","children":[1422,1424,1427]}],"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":151,"character":13,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L151"}],"extendedTypes":[{"type":"reference","name":"ProxyConfiguration","qualifiedName":"ProxyConfiguration","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/ProxyConfiguration","previousId":1467,"nextId":122},{"id":122,"name":"RequestQueue","kind":128,"kindString":"Class","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Represents a queue of URLs to crawl, which is used for deep crawling of websites\\nwhere you start with several URLs and then recursively\\nfollow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.\\n\\nEach URL is represented using an instance of the "},{"kind":"inline-tag","tag":"@apilink","text":"Request"},{"kind":"text","text":" class.\\nThe queue can only contain unique URLs. More precisely, it can only contain "},{"kind":"inline-tag","tag":"@apilink","text":"Request"},{"kind":"text","text":" instances\\nwith distinct "},{"kind":"code","text":"`uniqueKey`"},{"kind":"text","text":" properties. By default, "},{"kind":"code","text":"`uniqueKey`"},{"kind":"text","text":" is generated from the URL, but it can also be overridden.\\nTo add a single URL multiple times to the queue,\\ncorresponding "},{"kind":"inline-tag","tag":"@apilink","text":"Request"},{"kind":"text","text":" objects will need to have different "},{"kind":"code","text":"`uniqueKey`"},{"kind":"text","text":" properties.\\n\\nDo not instantiate this class directly, use the "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.open"},{"kind":"text","text":" function instead.\\n\\n"},{"kind":"code","text":"`RequestQueue`"},{"kind":"text","text":" is used by "},{"kind":"inline-tag","tag":"@apilink","text":"BasicCrawler"},{"kind":"text","text":", "},{"kind":"inline-tag","tag":"@apilink","text":"CheerioCrawler"},{"kind":"text","text":", "},{"kind":"inline-tag","tag":"@apilink","text":"PuppeteerCrawler"},{"kind":"text","text":"\\nand "},{"kind":"inline-tag","tag":"@apilink","text":"PlaywrightCrawler"},{"kind":"text","text":" as a source of URLs to crawl.\\nUnlike "},{"kind":"inline-tag","tag":"@apilink","text":"RequestList"},{"kind":"text","text":", "},{"kind":"code","text":"`RequestQueue`"},{"kind":"text","text":" supports dynamic adding and removing of requests.\\nOn the other hand, the queue is not optimized for operations that add or remove a large number of URLs in a batch.\\n\\n"},{"kind":"code","text":"`RequestQueue`"},{"kind":"text","text":" stores its data either on local disk or in the Apify Cloud,\\ndepending on whether the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" or "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable is set.\\n\\nIf the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" environment variable is set, the queue data is stored in\\nthat directory in an SQLite database file.\\n\\nIf the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable is set but "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" is not, the data is stored in the\\n[Apify Request Queue](https://docs.apify.com/storage/request-queue)\\ncloud storage. Note that you can force usage of the cloud storage also by passing the "},{"kind":"code","text":"`forceCloud`"},{"kind":"text","text":"\\noption to "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.open"},{"kind":"text","text":" function,\\neven if the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":" variable is set.\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n// Open the default request queue associated with the crawler run\\nconst queue = await RequestQueue.open();\\n\\n// Open a named request queue\\nconst queueWithName = await RequestQueue.open(\'some-name\');\\n\\n// Enqueue few requests\\nawait queue.addRequest({ url: \'http://example.com/aaa\' });\\nawait queue.addRequest({ url: \'http://example.com/bbb\' });\\nawait queue.addRequest({ url: \'http://example.com/foo/bar\' }, { forefront: true });\\n```"}]},"children":[{"id":172,"name":"assumedHandledCount","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":21,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.assumedHandledCount"}},{"id":171,"name":"assumedTotalCount","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":20,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.assumedTotalCount"}},{"id":166,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":15,"character":4}],"type":{"type":"reference","name":"RequestQueueClient","qualifiedName":"RequestQueueClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"RequestProvider.client"}},{"id":165,"name":"clientKey","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":14,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProvider.clientKey"}},{"id":161,"name":"config","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isReadonly":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":10,"character":13}],"type":{"type":"reference","name":"Configuration","qualifiedName":"Configuration","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"RequestProvider.config"}},{"id":162,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":11,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProvider.id"}},{"id":169,"name":"internalTimeoutMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":18,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.internalTimeoutMillis"}},{"id":168,"name":"log","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":17,"character":4}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"},"inheritedFrom":{"type":"reference","name":"RequestProvider.log"}},{"id":163,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":12,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProvider.name"}},{"id":170,"name":"requestLockSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":19,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.requestLockSecs"}},{"id":164,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":13,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"RequestProvider.timeoutSecs"}},{"id":144,"name":"addRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":91,"character":4}],"signatures":[{"id":145,"name":"addRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":146,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"requestLike","isOptional":false,"element":{"type":"reference","name":"Source","qualifiedName":"Source","package":"@crawlee/core"}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","id":212,"name":"RequestQueueOperationOptions","qualifiedName":"RequestQueueOperationOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"RequestQueueOperationInfo","qualifiedName":"RequestQueueOperationInfo","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.addRequest"}}],"overwrites":{"type":"reference","name":"RequestProvider.addRequest"}},{"id":147,"name":"addRequests","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":92,"character":4}],"signatures":[{"id":148,"name":"addRequests","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":149,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"requestsLike","isOptional":false,"element":{"type":"array","elementType":{"type":"reference","name":"Source","qualifiedName":"Source","package":"@crawlee/core"}}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","id":212,"name":"RequestQueueOperationOptions","qualifiedName":"RequestQueueOperationOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"BatchAddRequestsResult","qualifiedName":"BatchAddRequestsResult","package":"@crawlee/types"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.addRequests"}}],"overwrites":{"type":"reference","name":"RequestProvider.addRequests"}},{"id":150,"name":"addRequestsBatched","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":93,"character":4}],"signatures":[{"id":151,"name":"addRequestsBatched","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":152,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"requests","isOptional":false,"element":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"reference","name":"Source","qualifiedName":"Source","package":"@crawlee/core"}]}}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","name":"AddRequestsBatchedOptions","qualifiedName":"AddRequestsBatchedOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","name":"AddRequestsBatchedResult","qualifiedName":"AddRequestsBatchedResult","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.addRequestsBatched"}}],"overwrites":{"type":"reference","name":"RequestProvider.addRequestsBatched"}},{"id":194,"name":"drop","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":120,"character":4}],"signatures":[{"id":195,"name":"drop","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Removes the queue either from the Apify Cloud storage or from the local database,\\ndepending on the mode of operation."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.drop"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.drop"}},{"id":132,"name":"fetchNextRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":76,"character":4}],"signatures":[{"id":133,"name":"fetchNextRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns a next request in the queue to be processed, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":" if there are no more pending requests.\\n\\nOnce you successfully finish processing of the request, you need to call\\n"},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.markRequestHandled"},{"kind":"text","text":"\\nto mark the request as handled in the queue. If there was some error in processing the request,\\ncall "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.reclaimRequest"},{"kind":"text","text":" instead,\\nso that the queue will give the request to some other consumer in another call to the "},{"kind":"code","text":"`fetchNextRequest`"},{"kind":"text","text":" function.\\n\\nNote that the "},{"kind":"code","text":"`null`"},{"kind":"text","text":" return value doesn\'t mean the queue processing finished,\\nit means there are currently no pending requests.\\nTo check whether all requests in queue were finished,\\nuse "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.isFinished"},{"kind":"text","text":" instead."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns the request object or "},{"kind":"code","text":"`null`"},{"kind":"text","text":" if there are no more pending requests."}]}]},"typeParameter":[{"id":134,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","typeArguments":[{"type":"reference","id":134,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.fetchNextRequest"}}],"overwrites":{"type":"reference","name":"RequestProvider.fetchNextRequest"}},{"id":198,"name":"getInfo","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":155,"character":4}],"signatures":[{"id":199,"name":"getInfo","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns an object containing general information about the request queue.\\n\\nThe function returns the same object as the Apify API Client\'s\\n[getQueue](https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues)\\nfunction, which in turn calls the\\n[Get request queue](https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue)\\nAPI endpoint.\\n\\n**Example:**\\n"},{"kind":"code","text":"```\\n{\\n id: \\"WkzbQMuFYuamGv3YF\\",\\n name: \\"my-queue\\",\\n userId: \\"wRsJZtadYvn4mBZmm\\",\\n createdAt: new Date(\\"2015-12-12T07:34:14.202Z\\"),\\n modifiedAt: new Date(\\"2015-12-13T08:36:13.202Z\\"),\\n accessedAt: new Date(\\"2015-12-14T08:36:13.202Z\\"),\\n totalRequestCount: 25,\\n handledRequestCount: 5,\\n pendingRequestCount: 20,\\n}\\n```"}]},"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reference","name":"RequestQueueInfo","qualifiedName":"RequestQueueInfo","package":"@crawlee/types"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.getInfo"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.getInfo"}},{"id":180,"name":"getRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":76,"character":4}],"signatures":[{"id":181,"name":"getRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Gets the request from the queue specified by ID."}],"blockTags":[{"tag":"@returns","content":[{"kind":"text","text":"Returns the request object, or "},{"kind":"code","text":"`null`"},{"kind":"text","text":" if it was not found."}]}]},"typeParameter":[{"id":182,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"default":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}}],"parameters":[{"id":183,"name":"id","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"ID of the request."}]},"type":{"type":"intrinsic","name":"string"}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","typeArguments":[{"type":"reference","id":182,"name":"T","qualifiedName":"T","package":"@crawlee/core"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.getRequest"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.getRequest"}},{"id":196,"name":"handledCount","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":130,"character":4}],"signatures":[{"id":197,"name":"handledCount","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Returns the number of handled requests.\\n\\nThis function is just a convenient shortcut for:\\n\\n"},{"kind":"code","text":"```javascript\\nconst { handledRequestCount } = await queue.getInfo();\\n```"}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"number"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.handledCount"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.handledCount"}},{"id":184,"name":"isEmpty","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":99,"character":4}],"signatures":[{"id":185,"name":"isEmpty","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Resolves to "},{"kind":"code","text":"`true`"},{"kind":"text","text":" if the next call to "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.fetchNextRequest"},{"kind":"text","text":"\\nwould return "},{"kind":"code","text":"`null`"},{"kind":"text","text":", otherwise it resolves to "},{"kind":"code","text":"`false`"},{"kind":"text","text":".\\nNote that even if the queue is empty, there might be some pending requests currently being processed.\\nIf you need to ensure that there is no activity in the queue, use "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.isFinished"},{"kind":"text","text":"."}]},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"inheritedFrom":{"type":"reference","name":"RequestProvider.isEmpty"}}],"inheritedFrom":{"type":"reference","name":"RequestProvider.isEmpty"}},{"id":142,"name":"isFinished","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":90,"character":4}],"signatures":[{"id":143,"name":"isFinished","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"boolean"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.isFinished"}}],"overwrites":{"type":"reference","name":"RequestProvider.isFinished"}},{"id":153,"name":"markRequestHandled","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":94,"character":4}],"signatures":[{"id":154,"name":"markRequestHandled","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":155,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"request","isOptional":false,"element":{"type":"reference","typeArguments":[{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"RequestQueueOperationInfo","qualifiedName":"RequestQueueOperationInfo","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.markRequestHandled"}}],"overwrites":{"type":"reference","name":"RequestProvider.markRequestHandled"}},{"id":156,"name":"reclaimRequest","kind":2048,"kindString":"Method","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":95,"character":4}],"signatures":[{"id":157,"name":"reclaimRequest","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":158,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"request","isOptional":false,"element":{"type":"reference","typeArguments":[{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"}],"name":"Request","qualifiedName":"Request","package":"@crawlee/core"}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","id":212,"name":"RequestQueueOperationOptions","qualifiedName":"RequestQueueOperationOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"RequestQueueOperationInfo","qualifiedName":"RequestQueueOperationInfo","package":"@crawlee/core"}]}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.reclaimRequest"}}],"overwrites":{"type":"reference","name":"RequestProvider.reclaimRequest"}},{"id":123,"name":"open","kind":2048,"kindString":"Method","flags":{"isStatic":true,"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":97,"character":11}],"signatures":[{"id":124,"name":"open","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":125,"name":"args","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isRest":true},"type":{"type":"tuple","elements":[{"type":"named-tuple-member","name":"queueIdOrName","isOptional":true,"element":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"type":"named-tuple-member","name":"options","isOptional":true,"element":{"type":"reference","name":"StorageManagerOptions","qualifiedName":"StorageManagerOptions","package":"@crawlee/core"}}]}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":122,"name":"RequestQueue","qualifiedName":"RequestQueue","package":"@crawlee/core"}],"name":"Promise","qualifiedName":"Promise","package":"typescript"},"overwrites":{"type":"reference","name":"RequestProvider.open"}}],"overwrites":{"type":"reference","name":"RequestProvider.open"}}],"groups":[{"title":"Properties","children":[172,171,166,165,161,162,169,168,163,170,164]},{"title":"Methods","children":[144,147,150,194,132,198,180,196,184,142,153,156,123]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_queue.d.ts","line":52,"character":21}],"extendedTypes":[{"type":"reference","name":"RequestProvider","qualifiedName":"RequestProvider","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/class/RequestQueue","previousId":1410,"nextId":305},{"id":1127,"name":"AbortOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1130,"name":"gracefully","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/run.d.ts","line":80,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"RunAbortOptions.gracefully"}},{"id":1129,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit with given status message"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1632,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1632"}],"type":{"type":"intrinsic","name":"string"}},{"id":1128,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User API token that is used to run the actor. By default, it is taken from the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1629,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1629"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1130,1129,1128]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1625,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1625"}],"extendedTypes":[{"type":"reference","name":"RunAbortOptions","qualifiedName":"RunAbortOptions","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/AbortOptions","previousId":305,"nextId":1149},{"id":1149,"name":"ActorRun","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":1161,"name":"actId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":172,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.actId"}},{"id":1162,"name":"actorTaskId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":173,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.actorTaskId"}},{"id":1167,"name":"buildId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":178,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.buildId"}},{"id":1168,"name":"buildNumber","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":179,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.buildNumber"}},{"id":1155,"name":"containerUrl","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":191,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":1170,"name":"defaultDatasetId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":181,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.defaultDatasetId"}},{"id":1169,"name":"defaultKeyValueStoreId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":180,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.defaultKeyValueStoreId"}},{"id":1171,"name":"defaultRequestQueueId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":182,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.defaultRequestQueueId"}},{"id":1154,"name":"exitCode","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":190,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":1164,"name":"finishedAt","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":175,"character":4}],"type":{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.finishedAt"}},{"id":1157,"name":"gitBranchName","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":193,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":1160,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":171,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.id"}},{"id":1156,"name":"isContainerServerReady","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":192,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":1166,"name":"meta","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":177,"character":4}],"type":{"type":"reference","name":"ActorRunMeta","qualifiedName":"ActorRunMeta","package":"apify-client"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.meta"}},{"id":1153,"name":"options","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":189,"character":4}],"type":{"type":"reference","name":"ActorRunOptions","qualifiedName":"ActorRunOptions","package":"apify-client"}},{"id":1163,"name":"startedAt","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":174,"character":4}],"type":{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.startedAt"}},{"id":1152,"name":"stats","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":188,"character":4}],"type":{"type":"reference","name":"ActorRunStats","qualifiedName":"ActorRunStats","package":"apify-client"}},{"id":1165,"name":"status","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":176,"character":4}],"type":{"type":"union","types":[{"type":"literal","value":"READY"},{"type":"literal","value":"RUNNING"},{"type":"literal","value":"SUCCEEDED"},{"type":"literal","value":"FAILED"},{"type":"literal","value":"ABORTING"},{"type":"literal","value":"ABORTED"},{"type":"literal","value":"TIMING-OUT"},{"type":"literal","value":"TIMED-OUT"}]},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.status"}},{"id":1151,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":187,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":1158,"name":"usage","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":194,"character":4}],"type":{"type":"reference","name":"ActorRunUsage","qualifiedName":"ActorRunUsage","package":"apify-client"}},{"id":1172,"name":"usageTotalUsd","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":183,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorRunListItem.usageTotalUsd"}},{"id":1159,"name":"usageUsd","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":195,"character":4}],"type":{"type":"reference","name":"ActorRunUsage","qualifiedName":"ActorRunUsage","package":"apify-client"}},{"id":1150,"name":"userId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":186,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1161,1162,1167,1168,1155,1170,1169,1171,1154,1164,1157,1160,1156,1166,1153,1163,1152,1165,1151,1158,1172,1159,1150]}],"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":185,"character":17}],"extendedTypes":[{"type":"reference","name":"ActorRunListItem","qualifiedName":"ActorRunListItem","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/ActorRun","previousId":1127,"nextId":820},{"id":820,"name":"ApifyClientOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":821,"name":"baseUrl","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"https://api.apify.com"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":127,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":822,"name":"maxRetries","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"8"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":129,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":823,"name":"minDelayBetweenRetriesMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"500"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":131,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":824,"name":"requestInterceptors","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"[]"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":133,"character":4}],"type":{"type":"array","elementType":{"type":"union","types":[{"type":"intrinsic","name":"undefined"},{"type":"reflection","declaration":{"id":825,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/apify-client/node_modules/axios/index.d.ts","line":133,"character":27}],"signatures":[{"id":826,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":827,"name":"value","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"type":{"type":"reference","name":"ApifyRequestConfig","qualifiedName":"ApifyRequestConfig","package":"apify-client"}}],"type":{"type":"intrinsic","name":"unknown"}}]}}]}}},{"id":828,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"360"}]}]},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":135,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":829,"name":"token","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":136,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[821,822,823,824,828,829]}],"sources":[{"fileName":"node_modules/apify-client/dist/apify_client.d.ts","line":125,"character":17}],"permalink":"/sdk/js/reference/next/interface/ApifyClientOptions","previousId":1149,"nextId":1095},{"id":1095,"name":"ApifyEnv","kind":256,"kindString":"Interface","flags":{},"comment":{"summary":[{"kind":"text","text":"Parsed representation of the Apify environment variables.\\nThis object is returned by the "},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getEnv"},{"kind":"text","text":" function."}]},"children":[{"id":1096,"name":"actorId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the actor (ACTOR_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1556,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1556"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1097,"name":"actorRunId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the actor run (ACTOR_RUN_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1561,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1561"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1098,"name":"actorTaskId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the actor task (ACTOR_TASK_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1566,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1566"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1104,"name":"defaultDatasetId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the dataset where input and output data of this\\nactor is stored (ACTOR_DEFAULT_DATASET_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1600,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1600"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1103,"name":"defaultKeyValueStoreId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the key-value store where input and output data of this\\nactor is stored (ACTOR_DEFAULT_KEY_VALUE_STORE_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1594,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1594"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1105,"name":"memoryMbytes","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Amount of memory allocated for the actor,\\nin megabytes (ACTOR_MEMORY_MBYTES)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1606,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1606"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"number"}]}},{"id":1101,"name":"startedAt","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Date when the actor was started (ACTOR_STARTED_AT)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1583,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1583"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"}]}},{"id":1102,"name":"timeoutAt","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Date when the actor will time out (ACTOR_TIMEOUT_AT)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1588,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1588"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"reference","name":"Date","qualifiedName":"Date","package":"typescript"}]}},{"id":1100,"name":"token","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Authentication token representing privileges given to the actor run,\\nit can be passed to various Apify APIs (APIFY_TOKEN)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1578,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1578"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":1099,"name":"userId","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"ID of the user who started the actor - note that it might be\\ndifferent than the owner ofthe actor (APIFY_USER_ID)"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1572,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1572"}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}}],"groups":[{"title":"Properties","children":[1096,1097,1098,1104,1103,1105,1101,1102,1100,1099]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1552,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1552"}],"permalink":"/sdk/js/reference/next/interface/ApifyEnv","previousId":820,"nextId":1110},{"id":1110,"name":"CallOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1113,"name":"build","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Tag or number of the actor build to run (e.g. "},{"kind":"code","text":"`beta`"},{"kind":"text","text":" or "},{"kind":"code","text":"`1.2.345`"},{"kind":"text","text":").\\nIf not provided, the run uses build tag or number from the default actor run configuration (typically "},{"kind":"code","text":"`latest`"},{"kind":"text","text":")."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":129,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.build"}},{"id":1114,"name":"contentType","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Content type for the "},{"kind":"code","text":"`input`"},{"kind":"text","text":". If not specified,\\n"},{"kind":"code","text":"`input`"},{"kind":"text","text":" is expected to be an object that will be stringified to JSON and content type set to\\n"},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":". If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, then "},{"kind":"code","text":"`input`"},{"kind":"text","text":" must be a\\n"},{"kind":"code","text":"`String`"},{"kind":"text","text":" or "},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":136,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.contentType"}},{"id":1118,"name":"maxItems","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies maximum number of items that the actor run should return.\\nThis is used by pay per result actors to limit the maximum number of results that will be charged to customer.\\nValue can be accessed in actor run using "},{"kind":"code","text":"`ACTOR_MAX_PAID_DATASET_ITEMS`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":165,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.maxItems"}},{"id":1115,"name":"memory","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Memory in megabytes which will be allocated for the new actor run.\\nIf not provided, the run uses memory of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":141,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.memory"}},{"id":1116,"name":"timeout","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Timeout for the actor run in seconds. Zero value means there is no timeout.\\nIf not provided, the run uses timeout of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":146,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.timeout"}},{"id":1111,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User API token that is used to run the actor. By default, it is taken from the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1615,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1615"}],"type":{"type":"intrinsic","name":"string"}},{"id":1112,"name":"waitSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":168,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.waitSecs"}},{"id":1117,"name":"webhooks","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies optional webhooks associated with the actor run, which can be used\\nto receive a notification e.g. when the actor finished or failed, see\\n[ad hook webhooks documentation](https://docs.apify.com/webhooks/ad-hoc-webhooks) for detailed description."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":159,"character":4}],"type":{"type":"typeOperator","operator":"readonly","target":{"type":"array","elementType":{"type":"reference","name":"WebhookUpdateData","qualifiedName":"WebhookUpdateData","package":"apify-client"}}},"inheritedFrom":{"type":"reference","name":"ActorCallOptions.webhooks"}}],"groups":[{"title":"Properties","children":[1113,1114,1118,1115,1116,1111,1112,1117]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1611,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1611"}],"extendedTypes":[{"type":"reference","name":"ActorCallOptions","qualifiedName":"ActorCallOptions","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/CallOptions","previousId":1095,"nextId":1119},{"id":1119,"name":"CallTaskOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1122,"name":"build","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Tag or number of the actor build to run (e.g. "},{"kind":"code","text":"`beta`"},{"kind":"text","text":" or "},{"kind":"code","text":"`1.2.345`"},{"kind":"text","text":").\\nIf not provided, the run uses build tag or number from the default actor run configuration (typically "},{"kind":"code","text":"`latest`"},{"kind":"text","text":")."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":129,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.build"}},{"id":1126,"name":"maxItems","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies maximum number of items that the actor run should return.\\nThis is used by pay per result actors to limit the maximum number of results that will be charged to customer.\\nValue can be accessed in actor run using "},{"kind":"code","text":"`ACTOR_MAX_PAID_DATASET_ITEMS`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":165,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.maxItems"}},{"id":1123,"name":"memory","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Memory in megabytes which will be allocated for the new actor run.\\nIf not provided, the run uses memory of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":141,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.memory"}},{"id":1124,"name":"timeout","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Timeout for the actor run in seconds. Zero value means there is no timeout.\\nIf not provided, the run uses timeout of the default actor run configuration."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":146,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.timeout"}},{"id":1120,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User API token that is used to run the actor. By default, it is taken from the "},{"kind":"code","text":"`APIFY_TOKEN`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1622,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1622"}],"type":{"type":"intrinsic","name":"string"}},{"id":1121,"name":"waitSecs","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/task.d.ts","line":86,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.waitSecs"}},{"id":1125,"name":"webhooks","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies optional webhooks associated with the actor run, which can be used\\nto receive a notification e.g. when the actor finished or failed, see\\n[ad hook webhooks documentation](https://docs.apify.com/webhooks/ad-hoc-webhooks) for detailed description."}]},"sources":[{"fileName":"node_modules/apify-client/dist/resource_clients/actor.d.ts","line":159,"character":4}],"type":{"type":"typeOperator","operator":"readonly","target":{"type":"array","elementType":{"type":"reference","name":"WebhookUpdateData","qualifiedName":"WebhookUpdateData","package":"apify-client"}}},"inheritedFrom":{"type":"reference","name":"TaskCallOptions.webhooks"}}],"groups":[{"title":"Properties","children":[1122,1126,1123,1124,1120,1121,1125]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1618,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1618"}],"extendedTypes":[{"type":"reference","name":"TaskCallOptions","qualifiedName":"TaskCallOptions","package":"apify-client"}],"permalink":"/sdk/js/reference/next/interface/CallTaskOptions","previousId":1110,"nextId":1178},{"id":1178,"name":"ConfigurationOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1180,"name":"actorEventsWsUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":12,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L12"}],"type":{"type":"intrinsic","name":"string"}},{"id":1182,"name":"actorId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":14,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L14"}],"type":{"type":"intrinsic","name":"string"}},{"id":1183,"name":"actorRunId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":15,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L15"}],"type":{"type":"intrinsic","name":"string"}},{"id":1184,"name":"actorTaskId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":16,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L16"}],"type":{"type":"intrinsic","name":"string"}},{"id":1185,"name":"apiBaseUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":17,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L17"}],"type":{"type":"intrinsic","name":"string"}},{"id":1204,"name":"availableMemoryRatio","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the ratio, defining the amount of system memory that could be used by the "},{"kind":"inline-tag","tag":"@apilink","text":"AutoscaledPool"},{"kind":"text","text":".\\nWhen the memory usage is more than the provided ratio, the memory is considered overloaded.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_AVAILABLE_MEMORY_RATIO`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0.25"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":67,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.availableMemoryRatio"}},{"id":1211,"name":"chromeExecutablePath","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines a path to Chrome executable.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_CHROME_EXECUTABLE_PATH`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":114,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.chromeExecutablePath"}},{"id":1186,"name":"containerPort","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":18,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L18"}],"type":{"type":"intrinsic","name":"number"}},{"id":1187,"name":"containerUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":19,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L19"}],"type":{"type":"intrinsic","name":"string"}},{"id":1212,"name":"defaultBrowserPath","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines a path to default browser executable.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_BROWSER_PATH`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":120,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultBrowserPath"}},{"id":1199,"name":"defaultDatasetId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Default dataset id.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_DATASET_ID`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'default\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":32,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultDatasetId"}},{"id":1201,"name":"defaultKeyValueStoreId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Default key-value store id.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_KEY_VALUE_STORE_ID`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'default\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":46,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultKeyValueStoreId"}},{"id":1202,"name":"defaultRequestQueueId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Default request queue id.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DEFAULT_REQUEST_QUEUE_ID`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'default\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":53,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.defaultRequestQueueId"}},{"id":1213,"name":"disableBrowserSandbox","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether to disable browser sandbox by adding "},{"kind":"code","text":"`--no-sandbox`"},{"kind":"text","text":" flag to "},{"kind":"code","text":"`launchOptions`"},{"kind":"text","text":".\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_DISABLE_BROWSER_SANDBOX`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":126,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.disableBrowserSandbox"}},{"id":1197,"name":"eventManager","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the Event Manager to be used."}],"blockTags":[{"tag":"@default","content":[{"kind":"inline-tag","tag":"@apilink","text":"EventManager"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":20,"character":4}],"type":{"type":"reference","name":"EventManager","qualifiedName":"EventManager","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.eventManager"}},{"id":1209,"name":"headless","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether web browsers launched by Crawlee will run in the headless mode.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_HEADLESS`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"true"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":101,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.headless"}},{"id":1208,"name":"inputKey","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the default input key, i.e. the key that is used to get the crawler input value\\nfrom the default "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" associated with the current crawler run.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_INPUT_KEY`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'INPUT\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":94,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.inputKey"}},{"id":1195,"name":"inputSecretsPrivateKeyFile","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":27,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L27"}],"type":{"type":"intrinsic","name":"string"}},{"id":1194,"name":"inputSecretsPrivateKeyPassphrase","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":26,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L26"}],"type":{"type":"intrinsic","name":"string"}},{"id":1192,"name":"isAtHome","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":24,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L24"}],"type":{"type":"intrinsic","name":"boolean"}},{"id":1214,"name":"logLevel","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the log level to the given value.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_LOG_LEVEL`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"\'INFO\'"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":133,"character":4}],"type":{"type":"union","types":[{"type":"reference","id":305,"name":"LogLevel","qualifiedName":"LogLevel","package":"@apify/log"},{"type":"reflection","declaration":{"id":1215,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":551,"character":4}],"signatures":[{"id":1216,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1217,"name":"radix","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1218,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":557,"character":4}],"signatures":[{"id":1219,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1220,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1221,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":563,"character":4}],"signatures":[{"id":1222,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1223,"name":"fractionDigits","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1224,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":569,"character":4}],"signatures":[{"id":1225,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1226,"name":"precision","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"intrinsic","name":"string"}}]}},{"type":"reflection","declaration":{"id":1227,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":572,"character":4}],"signatures":[{"id":1228,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"type":{"type":"intrinsic","name":"number"}}]}},{"type":"reflection","declaration":{"id":1229,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"sources":[{"fileName":"website/node_modules/typescript/lib/lib.es5.d.ts","line":4499,"character":4},{"fileName":"website/node_modules/typescript/lib/lib.es2020.number.d.ts","line":27,"character":4}],"signatures":[{"id":1230,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1231,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"array","elementType":{"type":"intrinsic","name":"string"}}]}},{"id":1232,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}},{"id":1233,"name":"__type","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":1234,"name":"locales","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"LocalesArgument","qualifiedName":"Intl.LocalesArgument","package":"typescript"}},{"id":1235,"name":"options","kind":32768,"kindString":"Parameter","flags":{"isExternal":true,"isOptional":true},"type":{"type":"reference","name":"NumberFormatOptions","qualifiedName":"Intl.NumberFormatOptions","package":"typescript"}}],"type":{"type":"intrinsic","name":"string"}}]}}]},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.logLevel"}},{"id":1203,"name":"maxUsedCpuRatio","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the ratio, defining the maximum CPU usage.\\nWhen the CPU usage is higher than the provided ratio, the CPU is considered overloaded."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0.95"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":59,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.maxUsedCpuRatio"}},{"id":1205,"name":"memoryMbytes","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the amount of system memory in megabytes to be used by the "},{"kind":"inline-tag","tag":"@apilink","text":"AutoscaledPool"},{"kind":"text","text":".\\nBy default, the maximum memory is set to one quarter of total system memory.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_MEMORY_MBYTES`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":74,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.memoryMbytes"}},{"id":1179,"name":"metamorphAfterSleepMillis","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":11,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L11"}],"type":{"type":"intrinsic","name":"number"}},{"id":1206,"name":"persistStateIntervalMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the interval of emitting the "},{"kind":"code","text":"`persistState`"},{"kind":"text","text":" event.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_PERSIST_STATE_INTERVAL_MILLIS`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"60_000"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":81,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.persistStateIntervalMillis"}},{"id":1236,"name":"persistStorage","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether the storage client used should persist the data it stores.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_PERSIST_STORAGE`"},{"kind":"text","text":" environment variable."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":139,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.persistStorage"}},{"id":1188,"name":"proxyHostname","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":20,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L20"}],"type":{"type":"intrinsic","name":"string"}},{"id":1189,"name":"proxyPassword","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":21,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L21"}],"type":{"type":"intrinsic","name":"string"}},{"id":1190,"name":"proxyPort","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":22,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L22"}],"type":{"type":"intrinsic","name":"number"}},{"id":1191,"name":"proxyStatusUrl","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":23,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L23"}],"type":{"type":"intrinsic","name":"string"}},{"id":1200,"name":"purgeOnStart","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether to purge the default storage folders before starting the crawler run.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_PURGE_ON_START`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"true"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":39,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.purgeOnStart"}},{"id":1196,"name":"storageClient","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines storage client to be used."}],"blockTags":[{"tag":"@default","content":[{"kind":"inline-tag","tag":"@apilink","text":"MemoryStorage"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":15,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.storageClient"}},{"id":1198,"name":"storageClientOptions","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Could be used to adjust the storage client behavior\\ne.g. "},{"kind":"inline-tag","tag":"@apilink","text":"MemoryStorageOptions"},{"kind":"text","text":" could be used to adjust the "},{"kind":"inline-tag","tag":"@apilink","text":"MemoryStorage"},{"kind":"text","text":" behavior."}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":25,"character":4}],"type":{"type":"reference","name":"Dictionary","qualifiedName":"Dictionary","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.storageClientOptions"}},{"id":1207,"name":"systemInfoIntervalMillis","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines the interval of emitting the "},{"kind":"code","text":"`systemInfo`"},{"kind":"text","text":" event."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"60_000"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":86,"character":4}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.systemInfoIntervalMillis"}},{"id":1181,"name":"token","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":13,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L13"}],"type":{"type":"intrinsic","name":"string"}},{"id":1193,"name":"userId","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/configuration.ts","line":25,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L25"}],"type":{"type":"intrinsic","name":"string"}},{"id":1210,"name":"xvfb","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Defines whether to run X virtual framebuffer on the web browsers launched by Crawlee.\\n\\nAlternative to "},{"kind":"code","text":"`CRAWLEE_XVFB`"},{"kind":"text","text":" environment variable."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/configuration.d.ts","line":108,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"CoreConfigurationOptions.xvfb"}}],"groups":[{"title":"Properties","children":[1180,1182,1183,1184,1185,1204,1211,1186,1187,1212,1199,1201,1202,1213,1197,1209,1208,1195,1194,1192,1214,1203,1205,1179,1206,1236,1188,1189,1190,1191,1200,1196,1198,1207,1181,1193,1210]}],"sources":[{"fileName":"packages/apify/src/configuration.ts","line":10,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L10"}],"extendedTypes":[{"type":"reference","name":"ConfigurationOptions","qualifiedName":"ConfigurationOptions","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/ConfigurationOptions","previousId":1119,"nextId":92},{"id":92,"name":"DatasetConsumer","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":338,"character":17}],"typeParameters":[{"id":93,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"signatures":[{"id":94,"name":"DatasetConsumer","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":95,"name":"item","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry being processed."}]},"type":{"type":"reference","id":93,"name":"Data","qualifiedName":"DatasetConsumer.Data","package":"@crawlee/core"}},{"id":96,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/DatasetConsumer","previousId":1178,"nextId":114},{"id":114,"name":"DatasetContent","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":116,"name":"count","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Count of dataset entries returned in this set."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":376,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":120,"name":"desc","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Should the results be in descending order."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":384,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":119,"name":"items","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Dataset entries based on chosen format parameter."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":382,"character":4}],"type":{"type":"array","elementType":{"type":"reference","id":121,"name":"Data","qualifiedName":"DatasetContent.Data","package":"@crawlee/core"}}},{"id":118,"name":"limit","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Maximum number of dataset entries requested."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":380,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":117,"name":"offset","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of the first returned entry in the dataset."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":378,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":115,"name":"total","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Total count of entries in the dataset."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":374,"character":4}],"type":{"type":"intrinsic","name":"number"}}],"groups":[{"title":"Properties","children":[116,120,119,118,117,115]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":372,"character":17}],"typeParameters":[{"id":121,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"permalink":"/sdk/js/reference/next/interface/DatasetContent","previousId":92,"nextId":73},{"id":73,"name":"DatasetDataOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":79,"name":"clean","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the function returns only non-empty items and skips hidden fields (i.e. fields starting with "},{"kind":"code","text":"`#`"},{"kind":"text","text":" character).\\nNote that the "},{"kind":"code","text":"`clean`"},{"kind":"text","text":" parameter is a shortcut for "},{"kind":"code","text":"`skipHidden: true`"},{"kind":"text","text":" and "},{"kind":"code","text":"`skipEmpty: true`"},{"kind":"text","text":" options."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":55,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":76,"name":"desc","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the objects are sorted by "},{"kind":"code","text":"`createdAt`"},{"kind":"text","text":" in descending order.\\nOtherwise they are sorted in ascending order."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":40,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":77,"name":"fields","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of field names that will be included in the result. If omitted, all fields are included in the results."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":44,"character":4}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":75,"name":"limit","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Maximum number of array elements to return."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"250000"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":34,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":74,"name":"offset","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Number of array elements that should be skipped at the start."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"0"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":29,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":81,"name":"skipEmpty","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the function doesn\'t return empty items.\\nNote that in this case the returned number of items might be lower than limit parameter and pagination must be done using the "},{"kind":"code","text":"`limit`"},{"kind":"text","text":" value."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":66,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":80,"name":"skipHidden","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the function doesn\'t return hidden fields (fields starting with \\"#\\" character)."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":60,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":78,"name":"unwind","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a name of the field in the result objects that will be used to unwind the resulting objects.\\nBy default, the results are returned as they are."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":49,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[79,76,77,75,74,81,80,78]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":24,"character":17}],"permalink":"/sdk/js/reference/next/interface/DatasetDataOptions","previousId":114,"nextId":82},{"id":82,"name":"DatasetIteratorOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":89,"name":"desc","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the objects are sorted by "},{"kind":"code","text":"`createdAt`"},{"kind":"text","text":" in descending order.\\nOtherwise they are sorted in ascending order."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":40,"character":4}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","name":"Omit.desc"}},{"id":90,"name":"fields","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of field names that will be included in the result. If omitted, all fields are included in the results."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":44,"character":4}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}},"inheritedFrom":{"type":"reference","name":"Omit.fields"}},{"id":91,"name":"unwind","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a name of the field in the result objects that will be used to unwind the resulting objects.\\nBy default, the results are returned as they are."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":49,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"Omit.unwind"}}],"groups":[{"title":"Properties","children":[89,90,91]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":68,"character":17}],"extendedTypes":[{"type":"reference","typeArguments":[{"type":"reference","id":73,"name":"DatasetDataOptions","qualifiedName":"DatasetDataOptions","package":"@crawlee/core"},{"type":"union","types":[{"type":"literal","value":"offset"},{"type":"literal","value":"limit"},{"type":"literal","value":"clean"},{"type":"literal","value":"skipHidden"},{"type":"literal","value":"skipEmpty"}]}],"name":"Omit","qualifiedName":"Omit","package":"typescript"}],"permalink":"/sdk/js/reference/next/interface/DatasetIteratorOptions","previousId":73,"nextId":97},{"id":97,"name":"DatasetMapper","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":348,"character":17}],"typeParameters":[{"id":98,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}},{"id":99,"name":"R","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"signatures":[{"id":100,"name":"DatasetMapper","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"User-function used in the "},{"kind":"code","text":"`Dataset.map()`"},{"kind":"text","text":" API."}]},"parameters":[{"id":101,"name":"item","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry being processed."}]},"type":{"type":"reference","id":98,"name":"Data","qualifiedName":"DatasetMapper.Data","package":"@crawlee/core"}},{"id":102,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":99,"name":"R","qualifiedName":"DatasetMapper.R","package":"@crawlee/core"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/DatasetMapper","previousId":82,"nextId":110},{"id":110,"name":"DatasetOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":113,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":370,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}},{"id":111,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":368,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":112,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":369,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[113,111,112]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":367,"character":17}],"permalink":"/sdk/js/reference/next/interface/DatasetOptions","previousId":97,"nextId":103},{"id":103,"name":"DatasetReducer","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/dataset.d.ts","line":359,"character":17}],"typeParameters":[{"id":104,"name":"T","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}},{"id":105,"name":"Data","kind":131072,"kindString":"Type parameter","flags":{"isExternal":true}}],"signatures":[{"id":106,"name":"DatasetReducer","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":107,"name":"memo","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Previous state of the reduction."}]},"type":{"type":"reference","id":104,"name":"T","qualifiedName":"DatasetReducer.T","package":"@crawlee/core"}},{"id":108,"name":"item","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry being processed."}]},"type":{"type":"reference","id":105,"name":"Data","qualifiedName":"DatasetReducer.Data","package":"@crawlee/core"}},{"id":109,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of current "},{"kind":"inline-tag","tag":"@apilink","text":"Dataset"},{"kind":"text","text":" entry."}]},"type":{"type":"intrinsic","name":"number"}}],"type":{"type":"reference","typeArguments":[{"type":"reference","id":104,"name":"T","qualifiedName":"DatasetReducer.T","package":"@crawlee/core"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/DatasetReducer","previousId":110,"nextId":1142},{"id":1142,"name":"ExitOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1146,"name":"exit","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Call "},{"kind":"code","text":"`process.exit()`"},{"kind":"text","text":"? Defaults to true"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1701,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1701"}],"type":{"type":"intrinsic","name":"boolean"}},{"id":1145,"name":"exitCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit code, defaults to 0"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1699,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1699"}],"type":{"type":"intrinsic","name":"number"}},{"id":1143,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit with given status message"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1692,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1692"}],"type":{"type":"intrinsic","name":"string"}},{"id":1144,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Amount of time, in seconds, to wait for all event handlers to finish before exiting the process."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"30"}]}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1697,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1697"}],"type":{"type":"intrinsic","name":"number"}}],"groups":[{"title":"Properties","children":[1146,1145,1143,1144]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1690,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1690"}],"extendedBy":[{"type":"reference","id":1089,"name":"MainOptions"}],"permalink":"/sdk/js/reference/next/interface/ExitOptions","previousId":103,"nextId":1087},{"id":1087,"name":"InitOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1088,"name":"storage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1543,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1543"}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}}],"groups":[{"title":"Properties","children":[1088]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1542,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1542"}],"extendedBy":[{"type":"reference","id":1089,"name":"MainOptions"}],"permalink":"/sdk/js/reference/next/interface/InitOptions","previousId":1142,"nextId":219},{"id":219,"name":"KeyConsumer","kind":256,"kindString":"Interface","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":352,"character":17}],"signatures":[{"id":220,"name":"KeyConsumer","kind":4096,"kindString":"Call signature","flags":{"isExternal":true},"parameters":[{"id":221,"name":"key","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Current "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" key being processed."}]},"type":{"type":"intrinsic","name":"string"}},{"id":222,"name":"index","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Position of the current key in "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":"."}]},"type":{"type":"intrinsic","name":"number"}},{"id":223,"name":"info","kind":32768,"kindString":"Parameter","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Information about the current "},{"kind":"inline-tag","tag":"@apilink","text":"KeyValueStore"},{"kind":"text","text":" entry."}]},"type":{"type":"reflection","declaration":{"id":224,"name":"__type","kind":65536,"kindString":"Type literal","flags":{"isExternal":true},"children":[{"id":225,"name":"size","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Size of the value associated with the current key in bytes."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":360,"character":8}],"type":{"type":"intrinsic","name":"number"}}],"groups":[{"title":"Properties","children":[225]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":359,"character":39}]}}}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"void"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/core"}}],"permalink":"/sdk/js/reference/next/interface/KeyConsumer","previousId":1087,"nextId":232},{"id":232,"name":"KeyValueStoreIteratorOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":233,"name":"exclusiveStartKey","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"All keys up to this one (including) are skipped from the result."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":378,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[233]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":374,"character":17}],"permalink":"/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions","previousId":219,"nextId":226},{"id":226,"name":"KeyValueStoreOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":229,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":366,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"}},{"id":227,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":364,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":228,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":365,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[229,227,228]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":363,"character":17}],"permalink":"/sdk/js/reference/next/interface/KeyValueStoreOptions","previousId":232,"nextId":297},{"id":297,"name":"LoggerOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":304,"name":"data","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Additional data to be added to each log line."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":23,"character":4}],"type":{"type":"reference","typeArguments":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"unknown"}],"name":"Record","qualifiedName":"Record","package":"typescript"}},{"id":298,"name":"level","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Sets the log level to the given value, preventing messages from less important log levels\\nfrom being printed to the console. Use in conjunction with the "},{"kind":"code","text":"`log.LEVELS`"},{"kind":"text","text":" constants."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":8,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":303,"name":"logger","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable\\nstrings. Optionally you can use "},{"kind":"code","text":"`log.LoggerJson`"},{"kind":"text","text":" that formats each log line as a JSON."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":21,"character":4}],"type":{"type":"reference","id":313,"name":"Logger","qualifiedName":"Logger","package":"@apify/log"}},{"id":299,"name":"maxDepth","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Max depth of data object that will be logged. Anything deeper than the limit will be stripped off."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":10,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":300,"name":"maxStringLength","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Max length of the string to be logged. Longer strings will be truncated."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":12,"character":4}],"type":{"type":"intrinsic","name":"number"}},{"id":301,"name":"prefix","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Prefix to be prepended the each logged line."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":14,"character":4}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}},{"id":302,"name":"suffix","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Suffix that will be appended the each logged line."}]},"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":16,"character":4}],"type":{"type":"union","types":[{"type":"literal","value":null},{"type":"intrinsic","name":"string"}]}}],"groups":[{"title":"Properties","children":[304,298,303,299,300,301,302]}],"sources":[{"fileName":"node_modules/@apify/log/log.d.ts","line":3,"character":17}],"permalink":"/sdk/js/reference/next/interface/LoggerOptions","previousId":226,"nextId":1089},{"id":1089,"name":"MainOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1093,"name":"exit","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Call "},{"kind":"code","text":"`process.exit()`"},{"kind":"text","text":"? Defaults to true"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1701,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1701"}],"type":{"type":"intrinsic","name":"boolean"},"inheritedFrom":{"type":"reference","id":1146,"name":"ExitOptions.exit"}},{"id":1092,"name":"exitCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit code, defaults to 0"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1699,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1699"}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":1145,"name":"ExitOptions.exitCode"}},{"id":1090,"name":"statusMessage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Exit with given status message"}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1692,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1692"}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","id":1143,"name":"ExitOptions.statusMessage"}},{"id":1094,"name":"storage","kind":1024,"kindString":"Property","flags":{"isOptional":true},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1543,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1543"}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","id":1088,"name":"InitOptions.storage"}},{"id":1091,"name":"timeoutSecs","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Amount of time, in seconds, to wait for all event handlers to finish before exiting the process."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"30"}]}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1697,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1697"}],"type":{"type":"intrinsic","name":"number"},"inheritedFrom":{"type":"reference","id":1144,"name":"ExitOptions.timeoutSecs"}}],"groups":[{"title":"Properties","children":[1093,1092,1090,1094,1091]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1546,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1546"}],"extendedTypes":[{"type":"reference","id":1142,"name":"ExitOptions"},{"type":"reference","id":1087,"name":"InitOptions"}],"permalink":"/sdk/js/reference/next/interface/MainOptions","previousId":297,"nextId":1136},{"id":1136,"name":"MetamorphOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1138,"name":"build","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Tag or number of the target actor build to metamorph into (e.g. "},{"kind":"code","text":"`beta`"},{"kind":"text","text":" or "},{"kind":"code","text":"`1.2.345`"},{"kind":"text","text":").\\nIf not provided, the run uses build tag or number from the default actor run configuration (typically "},{"kind":"code","text":"`latest`"},{"kind":"text","text":")."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1679,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1679"}],"type":{"type":"intrinsic","name":"string"}},{"id":1137,"name":"contentType","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Content type for the "},{"kind":"code","text":"`input`"},{"kind":"text","text":". If not specified,\\n"},{"kind":"code","text":"`input`"},{"kind":"text","text":" is expected to be an object that will be stringified to JSON and content type set to\\n"},{"kind":"code","text":"`application/json; charset=utf-8`"},{"kind":"text","text":". If "},{"kind":"code","text":"`options.contentType`"},{"kind":"text","text":" is specified, then "},{"kind":"code","text":"`input`"},{"kind":"text","text":" must be a\\n"},{"kind":"code","text":"`String`"},{"kind":"text","text":" or "},{"kind":"code","text":"`Buffer`"},{"kind":"text","text":"."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1673,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1673"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1138,1137]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1666,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1666"}],"permalink":"/sdk/js/reference/next/interface/MetamorphOptions","previousId":1089,"nextId":1147},{"id":1147,"name":"OpenStorageOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1148,"name":"forceCloud","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":" then the cloud storage is used even if the "},{"kind":"code","text":"`APIFY_LOCAL_STORAGE_DIR`"},{"kind":"text","text":"\\nenvironment variable is set. This way it is possible to combine local and cloud storage."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1710,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1710"}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[1148]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1704,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1704"}],"permalink":"/sdk/js/reference/next/interface/OpenStorageOptions","previousId":1136,"nextId":1393},{"id":1393,"name":"ProxyConfigurationOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1398,"name":"apifyProxyCountry","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Same option as "},{"kind":"code","text":"`countryCode`"},{"kind":"text","text":" which can be used to\\nconfigurate the proxy by UI input schema. You should use the "},{"kind":"code","text":"`countryCode`"},{"kind":"text","text":" option in your crawler code."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":56,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L56"}],"type":{"type":"intrinsic","name":"string"}},{"id":1397,"name":"apifyProxyGroups","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Same option as "},{"kind":"code","text":"`groups`"},{"kind":"text","text":" which can be used to\\nconfigurate the proxy by UI input schema. You should use the "},{"kind":"code","text":"`groups`"},{"kind":"text","text":" option in your crawler code."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":50,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L50"}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":1396,"name":"countryCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set and relevant proxies are available in your Apify account, all proxied requests will\\nuse IP addresses that are geolocated to the specified country. For example "},{"kind":"code","text":"`GB`"},{"kind":"text","text":" for IPs\\nfrom Great Britain. Note that online services often have their own rules for handling\\ngeolocation and thus the country selection is a best attempt at geolocation, rather than\\na guaranteed hit. This parameter is optional, by default, each proxied request is assigned\\nan IP address from a random country. The country code needs to be a two letter ISO country code. See the\\n[full list of available country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).\\nThis parameter is optional, by default, the proxy uses all available proxy servers from all countries.\\non the Apify cloud, or when using the [Apify CLI](https://github.com/apify/apify-cli)."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":44,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L44"}],"type":{"type":"intrinsic","name":"string"}},{"id":1395,"name":"groups","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of proxy groups to be used by the [Apify Proxy](https://docs.apify.com/proxy).\\nIf not provided, the proxy will select the groups automatically."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":31,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L31"}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":1400,"name":"newUrlFunction","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Custom function that allows you to generate the new proxy URL dynamically. It gets the "},{"kind":"code","text":"`sessionId`"},{"kind":"text","text":" as a parameter\\nand should always return stringified proxy URL. Can be asynchronous.\\nThis function is used to generate the URL when "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newUrl"},{"kind":"text","text":" or "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newProxyInfo"},{"kind":"text","text":" is called."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":16,"character":4}],"type":{"type":"reference","name":"ProxyConfigurationFunction","qualifiedName":"ProxyConfigurationFunction","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"CoreProxyConfigurationOptions.newUrlFunction"}},{"id":1394,"name":"password","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"User\'s password for the proxy. By default, it is taken from the "},{"kind":"code","text":"`APIFY_PROXY_PASSWORD`"},{"kind":"text","text":"\\nenvironment variable, which is automatically set by the system when running the actors."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":25,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L25"}],"type":{"type":"intrinsic","name":"string"}},{"id":1399,"name":"proxyUrls","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"An array of custom proxy URLs to be rotated.\\nCustom proxies are not compatible with Apify Proxy and an attempt to use both\\nconfiguration options will cause an error to be thrown on initialize."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":10,"character":4}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}},"inheritedFrom":{"type":"reference","name":"CoreProxyConfigurationOptions.proxyUrls"}}],"groups":[{"title":"Properties","children":[1398,1397,1396,1395,1400,1394,1399]}],"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":20,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L20"}],"extendedTypes":[{"type":"reference","name":"ProxyConfigurationOptions","qualifiedName":"ProxyConfigurationOptions","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/ProxyConfigurationOptions","previousId":1147,"nextId":1401},{"id":1401,"name":"ProxyInfo","kind":256,"kindString":"Interface","flags":{},"comment":{"summary":[{"kind":"text","text":"The main purpose of the ProxyInfo object is to provide information\\nabout the current proxy connection used by the crawler for the request.\\nOutside of crawlers, you can get this object by calling "},{"kind":"inline-tag","tag":"@apilink","text":"ProxyConfiguration.newProxyInfo"},{"kind":"text","text":".\\n\\n**Example usage:**\\n\\n"},{"kind":"code","text":"```javascript\\n\\nconst proxyConfiguration = await Actor.createProxyConfiguration({\\n groups: [\'GROUP1\', \'GROUP2\'] // List of Apify Proxy groups\\n countryCode: \'US\',\\n});\\n\\n// Getting proxyInfo object by calling class method directly\\nconst proxyInfo = proxyConfiguration.newProxyInfo();\\n\\n// In crawler\\nconst crawler = new CheerioCrawler({\\n // ...\\n proxyConfiguration,\\n requestHandler({ proxyInfo }) {\\n // Getting used proxy URL\\n const proxyUrl = proxyInfo.url;\\n\\n // Getting ID of used Session\\n const sessionIdentifier = proxyInfo.sessionId;\\n }\\n})\\n\\n```"}]},"children":[{"id":1403,"name":"countryCode","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set and relevant proxies are available in your Apify account, all proxied requests will\\nuse IP addresses that are geolocated to the specified country. For example "},{"kind":"code","text":"`GB`"},{"kind":"text","text":" for IPs\\nfrom Great Britain. Note that online services often have their own rules for handling\\ngeolocation and thus the country selection is a best attempt at geolocation, rather than\\na guaranteed hit. This parameter is optional, by default, each proxied request is assigned\\nan IP address from a random country. The country code needs to be a two letter ISO country code. See the\\n[full list of available country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).\\nThis parameter is optional, by default, the proxy uses all available proxy servers from all countries."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":108,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L108"}],"type":{"type":"intrinsic","name":"string"}},{"id":1402,"name":"groups","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"An array of proxy groups to be used by the [Apify Proxy](https://docs.apify.com/proxy).\\nIf not provided, the proxy will select the groups automatically."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":96,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L96"}],"type":{"type":"array","elementType":{"type":"intrinsic","name":"string"}}},{"id":1408,"name":"hostname","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Hostname of your proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":68,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.hostname"}},{"id":1404,"name":"password","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"User\'s password for the proxy. By default, it is taken from the "},{"kind":"code","text":"`APIFY_PROXY_PASSWORD`"},{"kind":"text","text":"\\nenvironment variable, which is automatically set by the system when running the actors\\non the Apify cloud, or when using the [Apify CLI](https://github.com/apify/apify-cli)."}]},"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":115,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L115"}],"type":{"type":"intrinsic","name":"string"},"overwrites":{"type":"reference","name":"CoreProxyInfo.password"}},{"id":1409,"name":"port","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Proxy port."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":72,"character":4}],"type":{"type":"union","types":[{"type":"intrinsic","name":"string"},{"type":"intrinsic","name":"number"}]},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.port"}},{"id":1405,"name":"sessionId","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"The identifier of used "},{"kind":"inline-tag","tag":"@apilink","text":"Session"},{"kind":"text","text":", if used."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":52,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.sessionId"}},{"id":1406,"name":"url","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The URL of the proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":56,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.url"}},{"id":1407,"name":"username","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Username for the proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/proxy_configuration.d.ts","line":60,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"CoreProxyInfo.username"}}],"groups":[{"title":"Properties","children":[1403,1402,1408,1404,1409,1405,1406,1407]}],"sources":[{"fileName":"packages/apify/src/proxy_configuration.ts","line":91,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L91"}],"extendedTypes":[{"type":"reference","name":"ProxyInfo","qualifiedName":"ProxyInfo","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/ProxyInfo","previousId":1393,"nextId":208},{"id":208,"name":"QueueOperationInfo","kind":256,"kindString":"Interface","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"A helper class that is used to report results from various\\n"},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue"},{"kind":"text","text":" functions as well as "},{"kind":"inline-tag","tag":"@apilink","text":"enqueueLinks"},{"kind":"text","text":"."}]},"children":[{"id":211,"name":"requestId","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"The ID of the added request"}]},"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":13,"character":4}],"type":{"type":"intrinsic","name":"string"}},{"id":210,"name":"wasAlreadyHandled","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Indicates if request was already marked as handled."}]},"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":11,"character":4}],"type":{"type":"intrinsic","name":"boolean"}},{"id":209,"name":"wasAlreadyPresent","kind":1024,"kindString":"Property","flags":{"isExternal":true},"comment":{"summary":[{"kind":"text","text":"Indicates if request was already present in the queue."}]},"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":9,"character":4}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[211,210,209]}],"sources":[{"fileName":"node_modules/@crawlee/types/storages.d.ts","line":7,"character":17}],"permalink":"/sdk/js/reference/next/interface/QueueOperationInfo","previousId":1401,"nextId":1140},{"id":1140,"name":"RebootOptions","kind":256,"kindString":"Interface","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1685,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1685"}],"permalink":"/sdk/js/reference/next/interface/RebootOptions","previousId":208,"nextId":230},{"id":230,"name":"RecordOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":231,"name":"contentType","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Specifies a custom MIME content type of the record."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":372,"character":4}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[231]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/key_value_store.d.ts","line":368,"character":17}],"permalink":"/sdk/js/reference/next/interface/RecordOptions","previousId":1140,"nextId":212},{"id":212,"name":"RequestQueueOperationOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"children":[{"id":213,"name":"forefront","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"If set to "},{"kind":"code","text":"`true`"},{"kind":"text","text":":\\n - while adding the request to the queue: the request will be added to the foremost position in the queue.\\n - while reclaiming the request: the request will be placed to the beginning of the queue, so that it\'s returned\\n in the next call to "},{"kind":"inline-tag","tag":"@apilink","text":"RequestQueue.fetchNextRequest"},{"kind":"text","text":".\\nBy default, it\'s put to the end of the queue."}],"blockTags":[{"tag":"@default","content":[{"kind":"text","text":"false"}]}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":226,"character":4}],"type":{"type":"intrinsic","name":"boolean"}}],"groups":[{"title":"Properties","children":[213]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":217,"character":17}],"permalink":"/sdk/js/reference/next/interface/RequestQueueOperationOptions","previousId":230,"nextId":214},{"id":214,"name":"RequestQueueOptions","kind":256,"kindString":"Interface","flags":{"isExternal":true},"comment":{"summary":[],"blockTags":[{"tag":"@deprecated","content":[{"kind":"text","text":"Use "},{"kind":"inline-tag","tag":"@apilink","text":"RequestProviderOptions"},{"kind":"text","text":" instead."}]}]},"children":[{"id":217,"name":"client","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":196,"character":4}],"type":{"type":"reference","name":"StorageClient","qualifiedName":"StorageClient","package":"@crawlee/types"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.client"}},{"id":215,"name":"id","kind":1024,"kindString":"Property","flags":{"isExternal":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":194,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.id"}},{"id":216,"name":"name","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":195,"character":4}],"type":{"type":"intrinsic","name":"string"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.name"}},{"id":218,"name":"proxyConfiguration","kind":1024,"kindString":"Property","flags":{"isExternal":true,"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Used to pass the proxy configuration for the "},{"kind":"code","text":"`requestsFromUrl`"},{"kind":"text","text":" objects.\\nTakes advantage of the internal address rotation and authentication process.\\nIf undefined, the "},{"kind":"code","text":"`requestsFromUrl`"},{"kind":"text","text":" requests will be made without proxy."}]},"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":202,"character":4}],"type":{"type":"reference","name":"ProxyConfiguration","qualifiedName":"ProxyConfiguration","package":"@crawlee/core"},"inheritedFrom":{"type":"reference","name":"RequestProviderOptions.proxyConfiguration"}}],"groups":[{"title":"Properties","children":[217,215,216,218]}],"sources":[{"fileName":"node_modules/@crawlee/core/storages/request_provider.d.ts","line":207,"character":17}],"extendedTypes":[{"type":"reference","name":"RequestProviderOptions","qualifiedName":"RequestProviderOptions","package":"@crawlee/core"}],"permalink":"/sdk/js/reference/next/interface/RequestQueueOptions","previousId":212,"nextId":1131},{"id":1131,"name":"WebhookOptions","kind":256,"kindString":"Interface","flags":{},"children":[{"id":1132,"name":"eventTypes","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"Array of event types, which you can set for actor run, see\\nthe [actor run events](https://docs.apify.com/webhooks/events#actor-run) in the Apify doc."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1640,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1640"}],"type":{"type":"typeOperator","operator":"readonly","target":{"type":"array","elementType":{"type":"reference","name":"WebhookEventType","qualifiedName":"WebhookEventType","package":"apify-client"}}}},{"id":1135,"name":"idempotencyKey","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Idempotency key enables you to ensure that a webhook will not be added multiple times in case of\\nan actor restart or other situation that would cause the "},{"kind":"code","text":"`addWebhook()`"},{"kind":"text","text":" function to be called again.\\nWe suggest using the actor run ID as the idempotency key. You can get the run ID by calling\\n"},{"kind":"inline-tag","tag":"@apilink","text":"Actor.getEnv"},{"kind":"text","text":" function."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1663,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1663"}],"type":{"type":"intrinsic","name":"string"}},{"id":1134,"name":"payloadTemplate","kind":1024,"kindString":"Property","flags":{"isOptional":true},"comment":{"summary":[{"kind":"text","text":"Payload template is a JSON-like string that describes the structure of the webhook POST request payload.\\nIt uses JSON syntax, extended with a double curly braces syntax for injecting variables "},{"kind":"code","text":"`{{variable}}`"},{"kind":"text","text":".\\nThose variables are resolved at the time of the webhook\'s dispatch, and a list of available variables with their descriptions\\nis available in the [Apify webhook documentation](https://docs.apify.com/webhooks).\\nIf "},{"kind":"code","text":"`payloadTemplate`"},{"kind":"text","text":" is omitted, the default payload template is used\\n([view docs](https://docs.apify.com/webhooks/actions#payload-template))."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1655,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1655"}],"type":{"type":"intrinsic","name":"string"}},{"id":1133,"name":"requestUrl","kind":1024,"kindString":"Property","flags":{},"comment":{"summary":[{"kind":"text","text":"URL which will be requested using HTTP POST request, when actor run will reach the set event type."}]},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1645,"character":4,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1645"}],"type":{"type":"intrinsic","name":"string"}}],"groups":[{"title":"Properties","children":[1132,1135,1134,1133]}],"sources":[{"fileName":"packages/apify/src/actor.ts","line":1635,"character":17,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1635"}],"permalink":"/sdk/js/reference/next/interface/WebhookOptions","previousId":214,"nextId":1106},{"id":1106,"name":"UserFunc","kind":4194304,"kindString":"Type alias","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1609,"character":12,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1609"}],"typeParameters":[{"id":1109,"name":"T","kind":131072,"kindString":"Type parameter","flags":{},"default":{"type":"intrinsic","name":"unknown"}}],"type":{"type":"reflection","declaration":{"id":1107,"name":"__type","kind":65536,"kindString":"Type literal","flags":{},"sources":[{"fileName":"packages/apify/src/actor.ts","line":1609,"character":36,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1609"}],"signatures":[{"id":1108,"name":"__type","kind":4096,"kindString":"Call signature","flags":{},"type":{"type":"reference","typeArguments":[{"type":"reference","id":1109,"name":"T"}],"name":"Awaitable","qualifiedName":"Awaitable","package":"@crawlee/types"}}]}},"permalink":"/sdk/js/reference/next#UserFunc","previousId":1131,"nextId":234},{"id":234,"name":"log","kind":32,"kindString":"Variable","flags":{"isExternal":true,"isConst":true},"sources":[{"fileName":"node_modules/@apify/log/index.d.ts","line":8,"character":14}],"type":{"type":"reference","id":235,"name":"Log","qualifiedName":"Log","package":"@apify/log"},"permalink":"/sdk/js/reference/next#log","previousId":1106}],"groups":[{"title":"Classes","children":[830,750,1237,1,1514,235,313,457,602,1467,1410,122],"categories":[{"title":"CATEGORY","children":[830,750,1237,1514,235,313,457,602,1467]},{"title":"Result Stores","children":[1]},{"title":"Scaling","children":[1410]},{"title":"Sources","children":[122]}]},{"title":"Enumerations","children":[305]},{"title":"Interfaces","children":[1127,1149,820,1095,1110,1119,1178,92,114,73,82,97,110,103,1142,1087,219,232,226,297,1089,1136,1147,1393,1401,208,1140,230,212,214,1131]},{"title":"Type Aliases","children":[1106]},{"title":"Variables","children":[234]}],"sources":[{"fileName":"packages/apify/src/index.ts","line":1,"character":0,"url":"https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/index.ts#L1"}],"permalink":"/sdk/js/reference/next"},"urlSlug":"."}],"packageName":"apify","packageVersion":"3.1.12"}]')}}]); \ No newline at end of file diff --git a/assets/js/5374a44b.2c9e6730.js b/assets/js/5374a44b.2c9e6730.js new file mode 100644 index 0000000000..2f01071826 --- /dev/null +++ b/assets/js/5374a44b.2c9e6730.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2631],{91670:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],s={id:"dataset-mapper",title:"DatasetMapper"},i=void 0,l={unversionedId:"typedefs/dataset-mapper",id:"version-2.3/typedefs/dataset-mapper",title:"DatasetMapper",description:"User-function used in the Dataset.map() API.",source:"@site/versioned_docs/version-2.3/typedefs/DatasetMapper.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-mapper",permalink:"/sdk/js/docs/2.3/typedefs/dataset-mapper",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetMapper.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"dataset-mapper",title:"DatasetMapper"},sidebar:"version-2.3/docs",previous:{title:"DatasetConsumer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-consumer"},next:{title:"DatasetReducer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-reducer"}},c={},d=[],u={toc:d},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetmapper"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.map()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=a,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[d]="string"==typeof e?e:a,p[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],s={id:"dataset-mapper",title:"DatasetMapper"},i=void 0,l={unversionedId:"typedefs/dataset-mapper",id:"version-2.3/typedefs/dataset-mapper",title:"DatasetMapper",description:"User-function used in the Dataset.map() API.",source:"@site/versioned_docs/version-2.3/typedefs/DatasetMapper.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-mapper",permalink:"/sdk/js/docs/2.3/typedefs/dataset-mapper",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetMapper.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"dataset-mapper",title:"DatasetMapper"},sidebar:"version-2.3/docs",previous:{title:"DatasetConsumer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-consumer"},next:{title:"DatasetReducer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-reducer"}},c={},d=[],u={toc:d},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetmapper"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.map()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=a,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[d]="string"==typeof e?e:a,p[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=r(87462),i=r(63366),a=(r(67294),r(3905)),s=["components"],l={id:"statistic-persisted-state",title:"StatisticPersistedState"},o=void 0,p={unversionedId:"typedefs/statistic-persisted-state",id:"version-2.3/typedefs/statistic-persisted-state",title:"StatisticPersistedState",description:"Format of the persisted stats",source:"@site/versioned_docs/version-2.3/typedefs/StatisticPersistedState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-persisted-state",permalink:"/sdk/js/docs/2.3/typedefs/statistic-persisted-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticPersistedState.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"statistic-persisted-state",title:"StatisticPersistedState"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"requestRetryHistogram",id:"requestretryhistogram",level:3},{value:"statsId",id:"statsid",level:3},{value:"requestAvgFailedDurationMillis",id:"requestavgfaileddurationmillis",level:3},{value:"requestAvgFinishedDurationMillis",id:"requestavgfinisheddurationmillis",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestTotalDurationMillis",id:"requesttotaldurationmillis",level:3},{value:"requestsTotal",id:"requeststotal",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"crawlerLastStartTimestamp",id:"crawlerlaststarttimestamp",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,r=(0,i.Z)(e,s);return(0,a.kt)(m,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticpersistedstate"}),(0,a.kt)("p",null,"Format of the persisted stats"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestretryhistogram"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statsid"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotaldurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requeststotal"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsTotal")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerlaststarttimestamp"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerLastStartTimestamp")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var n=r(67294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var o=n.createContext({}),p=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=i,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return r?n.createElement(k,s(s({ref:t},d),{},{components:r})):n.createElement(k,s({ref:t},d))}));function k(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,s=new Array(a);s[0]=m;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[u]="string"==typeof e?e:i,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=r(87462),i=r(63366),a=(r(67294),r(3905)),s=["components"],l={id:"statistic-persisted-state",title:"StatisticPersistedState"},o=void 0,p={unversionedId:"typedefs/statistic-persisted-state",id:"version-2.3/typedefs/statistic-persisted-state",title:"StatisticPersistedState",description:"Format of the persisted stats",source:"@site/versioned_docs/version-2.3/typedefs/StatisticPersistedState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-persisted-state",permalink:"/sdk/js/docs/2.3/typedefs/statistic-persisted-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticPersistedState.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"statistic-persisted-state",title:"StatisticPersistedState"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"requestRetryHistogram",id:"requestretryhistogram",level:3},{value:"statsId",id:"statsid",level:3},{value:"requestAvgFailedDurationMillis",id:"requestavgfaileddurationmillis",level:3},{value:"requestAvgFinishedDurationMillis",id:"requestavgfinisheddurationmillis",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestTotalDurationMillis",id:"requesttotaldurationmillis",level:3},{value:"requestsTotal",id:"requeststotal",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"crawlerLastStartTimestamp",id:"crawlerlaststarttimestamp",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,r=(0,i.Z)(e,s);return(0,a.kt)(m,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticpersistedstate"}),(0,a.kt)("p",null,"Format of the persisted stats"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestretryhistogram"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statsid"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestavgfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestAvgFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotaldurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requeststotal"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsTotal")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerlaststarttimestamp"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerLastStartTimestamp")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var n=r(67294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var o=n.createContext({}),p=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=i,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return r?n.createElement(k,s(s({ref:t},d),{},{components:r})):n.createElement(k,s({ref:t},d))}));function k(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,s=new Array(a);s[0]=m;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[u]="string"==typeof e?e:i,s[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"upgrading-to-v1",title:"Upgrading to v1"},p=void 0,s={unversionedId:"upgrading/upgrading-to-v1",id:"upgrading/upgrading-to-v1",title:"Upgrading to v1",description:"Summary",source:"@site/../docs/upgrading/upgrading_v1.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v1",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v1.md",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v1",title:"Upgrading to v1"},sidebar:"docs",previous:{title:"Upgrading",permalink:"/sdk/js/docs/next/upgrading"},next:{title:"Upgrading to v2",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v2"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"Map of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"autoscaledPool was moved under crawlingContext.crawler",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of PuppeteerPool with BrowserPool",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running BrowserPool",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of BrowserController",id:"introduction-of-browsercontroller",level:3},{value:"BrowserPool methods vs PuppeteerPool",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated PuppeteerCrawlerOptions",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of gotoFunction",id:"removal-of-gotofunction",level:3},{value:"launchPuppeteerOptions => launchContext",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of launchPuppeteerFunction",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},h="wrapper";function m(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),h=o,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return t?a.createElement(m,l(l({ref:n},u),{},{components:t})):a.createElement(m,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=h;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"upgrading-to-v1",title:"Upgrading to v1"},p=void 0,s={unversionedId:"upgrading/upgrading-to-v1",id:"upgrading/upgrading-to-v1",title:"Upgrading to v1",description:"Summary",source:"@site/../docs/upgrading/upgrading_v1.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v1",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v1.md",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v1",title:"Upgrading to v1"},sidebar:"docs",previous:{title:"Upgrading",permalink:"/sdk/js/docs/next/upgrading"},next:{title:"Upgrading to v2",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v2"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"Map of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"autoscaledPool was moved under crawlingContext.crawler",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of PuppeteerPool with BrowserPool",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running BrowserPool",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of BrowserController",id:"introduction-of-browsercontroller",level:3},{value:"BrowserPool methods vs PuppeteerPool",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated PuppeteerCrawlerOptions",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of gotoFunction",id:"removal-of-gotofunction",level:3},{value:"launchPuppeteerOptions => launchContext",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of launchPuppeteerFunction",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},h="wrapper";function m(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),h=o,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return t?a.createElement(m,l(l({ref:n},u),{},{components:t})):a.createElement(m,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=h;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>d,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),i=["components"],o={id_old:"version-1.3-handle-failed-request",title:"HandleFailedRequest",id:"handle-failed-request"},s=void 0,d={unversionedId:"typedefs/handle-failed-request",id:"version-1.3/typedefs/handle-failed-request",title:"HandleFailedRequest",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/HandleFailedRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequest.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-handle-failed-request",title:"HandleFailedRequest",id:"handle-failed-request"},sidebar:"version-1.3/docs",previous:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"},next:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request-input"}},p={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,l.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlefailedrequest"}),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/handle-failed-request-input",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"HandleFailedRequestInput"))," - Arguments passed to this callback.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=d(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||c[f]||l;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=f;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var d=2;d{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>d,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),i=["components"],o={id_old:"version-1.3-handle-failed-request",title:"HandleFailedRequest",id:"handle-failed-request"},s=void 0,d={unversionedId:"typedefs/handle-failed-request",id:"version-1.3/typedefs/handle-failed-request",title:"HandleFailedRequest",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/HandleFailedRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequest.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-handle-failed-request",title:"HandleFailedRequest",id:"handle-failed-request"},sidebar:"version-1.3/docs",previous:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"},next:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request-input"}},p={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,l.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlefailedrequest"}),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/handle-failed-request-input",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"HandleFailedRequestInput"))," - Arguments passed to this callback.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=d(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||c[f]||l;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=f;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var d=2;d{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var n=t(87462),o=t(63366),a=(t(67294),t(3905)),i=["components"],l={id:"browser-plugin",title:"BrowserPlugin"},p=void 0,c={unversionedId:"api/browser-plugin",id:"version-2.3/api/browser-plugin",title:"BrowserPlugin",description:"---",source:"@site/versioned_docs/version-2.3/api/BrowserPlugin.md",sourceDirName:"api",slug:"/api/browser-plugin",permalink:"/sdk/js/docs/2.3/api/browser-plugin",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BrowserPlugin.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"browser-plugin",title:"BrowserPlugin"}},s={},u=[{value:"new BrowserPlugin(launcher, context)",id:"new-browserpluginlauncher-context",level:2}],d={toc:u},m="wrapper";function f(e){var r=e.components,t=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserplugin"}),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"exports.browserplugin"}),(0,a.kt)("h2",{id:"new-browserpluginlauncher-context"},(0,a.kt)("inlineCode",{parentName:"h2"},"new BrowserPlugin(launcher, context)")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"launcher")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"*")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),c=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},s=function(e){var r=c(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(t),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return t?n.createElement(f,i(i({ref:r},s),{},{components:t})):n.createElement(f,i({ref:r},s))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=m;var l={};for(var p in r)hasOwnProperty.call(r,p)&&(l[p]=r[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var c=2;c{t.r(r),t.d(r,{assets:()=>s,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var n=t(87462),o=t(63366),a=(t(67294),t(3905)),i=["components"],l={id:"browser-plugin",title:"BrowserPlugin"},p=void 0,c={unversionedId:"api/browser-plugin",id:"version-2.3/api/browser-plugin",title:"BrowserPlugin",description:"---",source:"@site/versioned_docs/version-2.3/api/BrowserPlugin.md",sourceDirName:"api",slug:"/api/browser-plugin",permalink:"/sdk/js/docs/2.3/api/browser-plugin",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BrowserPlugin.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"browser-plugin",title:"BrowserPlugin"}},s={},u=[{value:"new BrowserPlugin(launcher, context)",id:"new-browserpluginlauncher-context",level:2}],d={toc:u},m="wrapper";function f(e){var r=e.components,t=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserplugin"}),(0,a.kt)("hr",null),(0,a.kt)("a",{name:"exports.browserplugin"}),(0,a.kt)("h2",{id:"new-browserpluginlauncher-context"},(0,a.kt)("inlineCode",{parentName:"h2"},"new BrowserPlugin(launcher, context)")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"launcher")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"*")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=n.createContext({}),c=function(e){var r=n.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},s=function(e){var r=c(e.components);return n.createElement(p.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(t),m=o,f=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return t?n.createElement(f,i(i({ref:r},s),{},{components:t})):n.createElement(f,i({ref:r},s))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=m;var l={};for(var p in r)hasOwnProperty.call(r,p)&&(l[p]=r[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id:"hook",title:"Hook"},p=void 0,s={unversionedId:"typedefs/hook",id:"version-2.3/typedefs/hook",title:"Hook",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/Hook.md",sourceDirName:"typedefs",slug:"/typedefs/hook",permalink:"/sdk/js/docs/2.3/typedefs/hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/Hook.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"hook",title:"Hook"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"hook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=o,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id:"hook",title:"Hook"},p=void 0,s={unversionedId:"typedefs/hook",id:"version-2.3/typedefs/hook",title:"Hook",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/Hook.md",sourceDirName:"typedefs",slug:"/typedefs/hook",permalink:"/sdk/js/docs/2.3/typedefs/hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/Hook.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"hook",title:"Hook"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"hook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=o,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var o=n(87462),s=n(63366),r=(n(67294),n(3905)),i=["components"],a={id_old:"version-2.3.0-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},l=void 0,p={unversionedId:"typedefs/session-pool-options",id:"version-2.3/typedefs/session-pool-options",title:"SessionPoolOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SessionPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-pool-options",permalink:"/sdk/js/docs/2.3/typedefs/session-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionPoolOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},sidebar:"version-2.3/docs",previous:{title:"SessionOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-options"},next:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/2.3/typedefs/snapshotter-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"maxPoolSize",id:"maxpoolsize",level:3},{value:"sessionOptions",id:"sessionoptions",level:3},{value:"persistStateKeyValueStoreId",id:"persiststatekeyvaluestoreid",level:3},{value:"persistStateKey",id:"persiststatekey",level:3},{value:"createSessionFunction",id:"createsessionfunction",level:3},{value:"forceCloud",id:"forcecloud",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,s.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"sessionpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"maxpoolsize"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxPoolSize")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Maximum size of the pool. Indicates how many sessions are rotated."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekeyvaluestoreid"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKeyValueStoreId")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Name or Id of ",(0,r.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," where is the ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool")," state stored."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekey"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ",(0,r.kt)("code",null," = ",'"',"\\",'"',"SESSION_POOL_STATE\\",'"','"')),(0,r.kt)("p",null,"Session pool persists it's state under this key in Key value store."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"createsessionfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"createSessionFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/create-session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CreateSession"))),(0,r.kt)("p",null,"Custom function that should return ",(0,r.kt)("inlineCode",{parentName:"p"},"Session")," instance. Any error thrown from this function will terminate the process. Function receives ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool"),"\ninstance as a parameter"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"forcecloud"},(0,r.kt)("inlineCode",{parentName:"h3"},"forceCloud")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = false")),(0,r.kt)("p",null,"If set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," then the function uses cloud storage usage even if the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible\nto combine local and cloud storage."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," If you use ",(0,r.kt)("inlineCode",{parentName:"p"},"forceCloud"),", it is recommended to also set the ",(0,r.kt)("inlineCode",{parentName:"p"},"persistStateKeyValueStoreId")," option, as otherwise the ",(0,r.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," will be\nunnamed!"),(0,r.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var o=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),u=p(n),m=s,f=u["".concat(l,".").concat(m)]||u[m]||c[m]||r;return n?o.createElement(f,i(i({ref:t},d),{},{components:n})):o.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,i=new Array(r);i[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[u]="string"==typeof e?e:s,i[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var o=n(87462),s=n(63366),r=(n(67294),n(3905)),i=["components"],a={id_old:"version-2.3.0-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},l=void 0,p={unversionedId:"typedefs/session-pool-options",id:"version-2.3/typedefs/session-pool-options",title:"SessionPoolOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SessionPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-pool-options",permalink:"/sdk/js/docs/2.3/typedefs/session-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionPoolOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},sidebar:"version-2.3/docs",previous:{title:"SessionOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-options"},next:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/2.3/typedefs/snapshotter-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"maxPoolSize",id:"maxpoolsize",level:3},{value:"sessionOptions",id:"sessionoptions",level:3},{value:"persistStateKeyValueStoreId",id:"persiststatekeyvaluestoreid",level:3},{value:"persistStateKey",id:"persiststatekey",level:3},{value:"createSessionFunction",id:"createsessionfunction",level:3},{value:"forceCloud",id:"forcecloud",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,s.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"sessionpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"maxpoolsize"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxPoolSize")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Maximum size of the pool. Indicates how many sessions are rotated."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekeyvaluestoreid"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKeyValueStoreId")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Name or Id of ",(0,r.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," where is the ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool")," state stored."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekey"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ",(0,r.kt)("code",null," = ",'"',"\\",'"',"SESSION_POOL_STATE\\",'"','"')),(0,r.kt)("p",null,"Session pool persists it's state under this key in Key value store."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"createsessionfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"createSessionFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/create-session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CreateSession"))),(0,r.kt)("p",null,"Custom function that should return ",(0,r.kt)("inlineCode",{parentName:"p"},"Session")," instance. Any error thrown from this function will terminate the process. Function receives ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool"),"\ninstance as a parameter"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"forcecloud"},(0,r.kt)("inlineCode",{parentName:"h3"},"forceCloud")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = false")),(0,r.kt)("p",null,"If set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," then the function uses cloud storage usage even if the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible\nto combine local and cloud storage."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," If you use ",(0,r.kt)("inlineCode",{parentName:"p"},"forceCloud"),", it is recommended to also set the ",(0,r.kt)("inlineCode",{parentName:"p"},"persistStateKeyValueStoreId")," option, as otherwise the ",(0,r.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," will be\nunnamed!"),(0,r.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var o=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),u=p(n),m=s,f=u["".concat(l,".").concat(m)]||u[m]||c[m]||r;return n?o.createElement(f,i(i({ref:t},d),{},{components:n})):o.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,i=new Array(r);i[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[u]="string"==typeof e?e:s,i[1]=a;for(var p=2;p{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>g,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var t=o(87462),s=o(63366),r=(o(67294),o(3905)),a=["components"],i={id_old:"version-1.3-session-management",title:"Session Management",id:"session-management"},l=void 0,u={unversionedId:"guides/session-management",id:"version-1.3/guides/session-management",title:"Session Management",description:"SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-1.3/guides/session_management.md",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/1.3/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/session_management.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-session-management",title:"Session Management",id:"session-management"},sidebar:"version-1.3/docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/1.3/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/1.3/guides/type-script-actor"}},p={},c=[],d={toc:c},m="wrapper";function g(e){var n=e.components,o=(0,s.Z)(e,a);return(0,r.kt)(m,(0,t.Z)({},d,o,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,r.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,r.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/puppeteer-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Apify.createProxyConfiguration();\n\nconst crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/cheerio-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/basic-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BasicCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await Apify.utils.requestAsBrowser(requestOptions);\n } catch (e) {\n if (e === "SomeNetworkError") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example solo usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(async () => {\n\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await Apify.openSessionPool(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,r.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}g.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>p,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),u=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},p=function(e){var n=u(e.components);return t.createElement(l.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=u(o),m=s,g=c["".concat(l,".").concat(m)]||c[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},p),{},{components:o})):t.createElement(g,a({ref:n},p))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[c]="string"==typeof e?e:s,a[1]=i;for(var u=2;u{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>l,default:()=>g,frontMatter:()=>i,metadata:()=>u,toc:()=>c});var t=o(87462),s=o(63366),r=(o(67294),o(3905)),a=["components"],i={id_old:"version-1.3-session-management",title:"Session Management",id:"session-management"},l=void 0,u={unversionedId:"guides/session-management",id:"version-1.3/guides/session-management",title:"Session Management",description:"SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-1.3/guides/session_management.md",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/1.3/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/session_management.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-session-management",title:"Session Management",id:"session-management"},sidebar:"version-1.3/docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/1.3/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/1.3/guides/type-script-actor"}},p={},c=[],d={toc:c},m="wrapper";function g(e){var n=e.components,o=(0,s.Z)(e,a);return(0,r.kt)(m,(0,t.Z)({},d,o,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,r.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,r.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/puppeteer-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Apify.createProxyConfiguration();\n\nconst crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/cheerio-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)("a",{parentName:"strong",href:"../api/basic-crawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BasicCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await Apify.utils.requestAsBrowser(requestOptions);\n } catch (e) {\n if (e === "SomeNetworkError") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example solo usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(async () => {\n\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await Apify.openSessionPool(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,r.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}g.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>p,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),u=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},p=function(e){var n=u(e.components);return t.createElement(l.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=u(o),m=s,g=c["".concat(l,".").concat(m)]||c[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},p),{},{components:o})):t.createElement(g,a({ref:n},p))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[c]="string"==typeof e?e:s,a[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),r=n(63366),a=(n(67294),n(3905)),l=["components"],i={id_old:"version-2.3.0-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},p=void 0,s={unversionedId:"typedefs/puppeteer-crawler-options",id:"version-2.3/typedefs/puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/playwright-launch-context"},next:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,a.kt)(h,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteercrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerHandlePage"))),(0,a.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,a.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer")," ",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,a.kt)("inlineCode",{parentName:"p"},"browserPool")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer"),"\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by\n",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The function must return a promise, which is then awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"navigationtimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,"Where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchcontext"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))),(0,a.kt)("p",null,"Options used by ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," to start new Puppeteer instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"browserpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs\nprovided and rotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n const { page } = crawlingContext;\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by the crawler and cannot be overridden. However, you can provide a custom implementation of\n",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Puppeteer crawler will initialize the ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"The configuration options for ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),s=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},h=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(n),h=r,k=c["".concat(p,".").concat(h)]||c[h]||d[h]||a;return n?o.createElement(k,l(l({ref:t},u),{},{components:n})):o.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),r=n(63366),a=(n(67294),n(3905)),l=["components"],i={id_old:"version-2.3.0-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},p=void 0,s={unversionedId:"typedefs/puppeteer-crawler-options",id:"version-2.3/typedefs/puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-crawler-options",title:"PuppeteerCrawlerOptions",id:"puppeteer-crawler-options"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/playwright-launch-context"},next:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,a.kt)(h,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteercrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerHandlePage"))),(0,a.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,a.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer")," ",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,a.kt)("inlineCode",{parentName:"p"},"browserPool")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,a.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Puppeteer"),"\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by\n",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The function must return a promise, which is then awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"navigationtimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PuppeteerCrawler,\n}\n")),(0,a.kt)("p",null,"Where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchcontext"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))),(0,a.kt)("p",null,"Options used by ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," to start new Puppeteer instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"browserpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs\nprovided and rotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n const { page } = crawlingContext;\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by the crawler and cannot be overridden. However, you can provide a custom implementation of\n",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Puppeteer crawler will initialize the ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"The configuration options for ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),s=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},h=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(n),h=r,k=c["".concat(p,".").concat(h)]||c[h]||d[h]||a;return n?o.createElement(k,l(l({ref:t},u),{},{components:n})):o.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>c,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],c={id_old:"version-1.3-abort-function",title:"AbortFunction",id:"abort-function"},p=void 0,s={unversionedId:"typedefs/abort-function",id:"version-1.3/typedefs/abort-function",title:"AbortFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/AbortFunction.md",sourceDirName:"typedefs",slug:"/typedefs/abort-function",permalink:"/sdk/js/docs/1.3/typedefs/abort-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AbortFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-abort-function",title:"AbortFunction",id:"abort-function"}},l={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"abortfunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(n),d=o,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:o,i[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>c,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],c={id_old:"version-1.3-abort-function",title:"AbortFunction",id:"abort-function"},p=void 0,s={unversionedId:"typedefs/abort-function",id:"version-1.3/typedefs/abort-function",title:"AbortFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/AbortFunction.md",sourceDirName:"typedefs",slug:"/typedefs/abort-function",permalink:"/sdk/js/docs/1.3/typedefs/abort-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AbortFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-abort-function",title:"AbortFunction",id:"abort-function"}},l={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"abortfunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(n),d=o,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:o,i[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-puppeteer-handle-page",title:"PuppeteerHandlePage",id:"puppeteer-handle-page"},i=void 0,s={unversionedId:"typedefs/puppeteer-handle-page",id:"version-1.3/typedefs/puppeteer-handle-page",title:"PuppeteerHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePage.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-handle-page",title:"PuppeteerHandlePage",id:"puppeteer-handle-page"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"},next:{title:"PuppeteerHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"}},d={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepage"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))," | ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,p.kt)("inlineCode",{parentName:"li"},"Object"))),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,m=u["".concat(i,".").concat(f)]||u[f]||c[f]||p;return r?n.createElement(m,o(o({ref:t},d),{},{components:r})):n.createElement(m,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-puppeteer-handle-page",title:"PuppeteerHandlePage",id:"puppeteer-handle-page"},i=void 0,s={unversionedId:"typedefs/puppeteer-handle-page",id:"version-1.3/typedefs/puppeteer-handle-page",title:"PuppeteerHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePage.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-handle-page",title:"PuppeteerHandlePage",id:"puppeteer-handle-page"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"},next:{title:"PuppeteerHandlePageInputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"}},d={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepage"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))," | ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,p.kt)("inlineCode",{parentName:"li"},"Object"))),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,m=u["".concat(i,".").concat(f)]||u[f]||c[f]||p;return r?n.createElement(m,o(o({ref:t},d),{},{components:r})):n.createElement(m,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{n.d(t,{Z:()=>i});var a=n(67294),r=n(34334);const l={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(87462),r=n(67294),l=n(34334),i=n(63735),o=n(38224),u=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,d=[],m=(0,i.o5)().blockElementScrollPositionUntilNextRender,p=function(e){var t=e.currentTarget,n=d.indexOf(t),a=s[n].value;a!==o&&(m(t),u(a))},b=function(e){var t,n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":var a,r=d.indexOf(e.currentTarget)+1;n=null!=(a=d[r])?a:d[0];break;case"ArrowLeft":var l,i=d.indexOf(e.currentTarget)-1;n=null!=(l=d[i])?l:d[d.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,i=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:p},i,{className:(0,l.Z)("tabs__item",c.tabItem,null==i?void 0:i.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,a=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var i=l.find((function(e){return e.props.value===a}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function m(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},r.createElement(s,(0,a.Z)({},e,t)),r.createElement(d,(0,a.Z)({},e,t)))}function p(e){var t=(0,u.Z)();return r.createElement(m,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>m});var a=n(67294),r=n(16550),l=n(34423),i=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,i=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:i});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function m(e){var t,n,r,l,i=e.defaultValue,u=e.queryString,m=void 0!==u&&u,p=e.groupId,b=c(e),g=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:b})})),h=g[0],y=g[1],I=d({queryString:m,groupId:p}),C=I[0],f=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:p}.groupId),n=(0,o.Nk)(t),r=n[0],l=n[1],[r,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),w=v[0],k=v[1],x=function(){var e=null!=C?C:w;return s({value:e,tabValues:b})?e:null}();return(0,a.useLayoutEffect)((function(){x&&y(x)}),[x]),{selectedValue:h,selectValue:(0,a.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),f(e),k(e)}),[f,k,b]),tabValues:b}}},68889:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(67294),r=n(88746),l=n(6141),i=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),u=o.version,c=o.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var s=u+"/";return"current"===u?s="next/":c&&(s=""),a.createElement(r.default,{to:"/api/"+s+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>i});var a=n(67294),r=n(88746),l="https://crawlee.dev",i=function(e){var t=e.to,n=e.children,i=e.version;return a.createElement(r.default,{href:l+"/api"+(i?"/"+i:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},96128:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>h,default:()=>k,frontMatter:()=>g,metadata:()=>y,toc:()=>C});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=n(65559),o=n(30433),u=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'all' will enqueue all links found\n // highlight-next-line\n strategy: 'all',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgZW5xdWV1ZUxpbmtzIH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcyh7XFxuICAgICAgICAgICAgLy8gU2V0dGluZyB0aGUgc3RyYXRlZ3kgdG8gJ2FsbCcgd2lsbCBlbnF1ZXVlIGFsbCBsaW5rcyBmb3VuZFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogJ2FsbCcsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbJ2h0dHBzOi8vYXBpZnkuY29tLyddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.a1IFpzCtFyz6kXkEkdwjYb-WWnJaRH4hJxbbzFMcYfg"},d={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-hostname'\n // strategy: 'same-hostname',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgaG9zdG5hbWVcXG4gICAgICAgICAgICAvLyBhcyByZXF1ZXN0LmxvYWRlZFVybCBvciByZXF1ZXN0LnVybFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogRW5xdWV1ZVN0cmF0ZWd5LlNhbWVIb3N0bmFtZSxcXG4gICAgICAgICAgICAvLyBBbHRlcm5hdGl2ZWx5LCB5b3UgY2FuIHBhc3MgaW4gdGhlIHN0cmluZyAnc2FtZS1ob3N0bmFtZSdcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtaG9zdG5hbWUnLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.yF2AJFRXorzWRuCXhRGjM8nWXBFT585D7nwOkBPAPf0"},m={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-subdomain'\n // strategy: 'same-subdomain',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw"};var p,b=["components"],g={id:"crawl-relative-links",title:"Crawl a website with relative links"},h=void 0,y={unversionedId:"examples/crawl-relative-links",id:"version-3.1/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"When crawling a website, you may encounter different types of links present that you may want to crawl.",source:"@site/versioned_docs/version-3.1/examples/crawl_relative_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_relative_links.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/examples/crawl-single-url"}},I={},C=[],f=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),v={toc:C},w="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,b);return(0,l.kt)(w,(0,a.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"When crawling a website, you may encounter different types of links present that you may want to crawl.\nTo facilitate the easy crawling of such links, we provide the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method on the crawler context, which will\nautomatically find links and add them to the crawler's ",(0,l.kt)(u.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"."),(0,l.kt)("p",null,"We provide 3 different strategies for crawling relative links:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#All",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"All"))," which will enqueue all links found, regardless of the domain they point to."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameHostname",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameHostname"))," which will enqueue all links found for the same hostname (regardless of any subdomains present)."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameSubdomain",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameSubdomain"))," which will enqueue all links found that have the same subdomain and hostname. This is the default strategy.")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For these examples, we are using the ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),", however\nthe same method is available for both the ",(0,l.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"\nand ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", and you use it\nthe exact same way.")),(0,l.kt)(i.Z,{groupId:"enqueue_strategy",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"all",label:"All Links",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"Any urls found will be matched by this strategy, even if they go off of the site you are currently crawling.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s)),(0,l.kt)(o.Z,{value:"same_hostname",label:"Same Hostname",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will match relative urls, urls that point to the same\nfull domain or urls that point to any subdomain of the provided domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example"),"\nor ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example")," will all be matched by this strategy.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d)),(0,l.kt)(o.Z,{value:"same-subdomain",label:"Same Subdomain",default:!0,mdxType:"TabItem"},(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This is the default strategy when calling ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", so you don't have to specify it.")),(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will only match relative urls or urls that point to the same\nfull domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example"),"\nwill all be matched by this strategy, while ",(0,l.kt)("inlineCode",{parentName:"p"},"https://other-subdomain.example.com")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"https://otherexample.com")," will not.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},m))))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),c=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=c(n),p=r,b=d["".concat(u,".").concat(p)]||d[p]||m[p]||l;return n?a.createElement(b,i(i({ref:t},s),{},{components:n})):a.createElement(b,i({ref:t},s))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=p;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[d]="string"==typeof e?e:r,i[1]=o;for(var c=2;c{n.d(t,{Z:()=>i});var a=n(67294),r=n(34334);const l={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(87462),r=n(67294),l=n(34334),i=n(63735),o=n(38224),u=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,d=[],m=(0,i.o5)().blockElementScrollPositionUntilNextRender,p=function(e){var t=e.currentTarget,n=d.indexOf(t),a=s[n].value;a!==o&&(m(t),u(a))},b=function(e){var t,n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":var a,r=d.indexOf(e.currentTarget)+1;n=null!=(a=d[r])?a:d[0];break;case"ArrowLeft":var l,i=d.indexOf(e.currentTarget)-1;n=null!=(l=d[i])?l:d[d.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,i=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:p},i,{className:(0,l.Z)("tabs__item",c.tabItem,null==i?void 0:i.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,a=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var i=l.find((function(e){return e.props.value===a}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function m(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},r.createElement(s,(0,a.Z)({},e,t)),r.createElement(d,(0,a.Z)({},e,t)))}function p(e){var t=(0,u.Z)();return r.createElement(m,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>m});var a=n(67294),r=n(16550),l=n(34423),i=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,i=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:i});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function m(e){var t,n,r,l,i=e.defaultValue,u=e.queryString,m=void 0!==u&&u,p=e.groupId,b=c(e),g=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:b})})),h=g[0],y=g[1],I=d({queryString:m,groupId:p}),C=I[0],f=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:p}.groupId),n=(0,o.Nk)(t),r=n[0],l=n[1],[r,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),w=v[0],k=v[1],x=function(){var e=null!=C?C:w;return s({value:e,tabValues:b})?e:null}();return(0,a.useLayoutEffect)((function(){x&&y(x)}),[x]),{selectedValue:h,selectValue:(0,a.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),f(e),k(e)}),[f,k,b]),tabValues:b}}},68889:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(67294),r=n(88746),l=n(6141),i=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),u=o.version,c=o.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var s=u+"/";return"current"===u?s="next/":c&&(s=""),a.createElement(r.default,{to:"/api/"+s+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>i});var a=n(67294),r=n(88746),l="https://crawlee.dev",i=function(e){var t=e.to,n=e.children,i=e.version;return a.createElement(r.default,{href:l+"/api"+(i?"/"+i:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},96128:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>h,default:()=>k,frontMatter:()=>g,metadata:()=>y,toc:()=>C});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=n(65559),o=n(30433),u=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'all' will enqueue all links found\n // highlight-next-line\n strategy: 'all',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgZW5xdWV1ZUxpbmtzIH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcyh7XFxuICAgICAgICAgICAgLy8gU2V0dGluZyB0aGUgc3RyYXRlZ3kgdG8gJ2FsbCcgd2lsbCBlbnF1ZXVlIGFsbCBsaW5rcyBmb3VuZFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogJ2FsbCcsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbJ2h0dHBzOi8vYXBpZnkuY29tLyddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.a1IFpzCtFyz6kXkEkdwjYb-WWnJaRH4hJxbbzFMcYfg"},d={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-hostname'\n // strategy: 'same-hostname',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgaG9zdG5hbWVcXG4gICAgICAgICAgICAvLyBhcyByZXF1ZXN0LmxvYWRlZFVybCBvciByZXF1ZXN0LnVybFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogRW5xdWV1ZVN0cmF0ZWd5LlNhbWVIb3N0bmFtZSxcXG4gICAgICAgICAgICAvLyBBbHRlcm5hdGl2ZWx5LCB5b3UgY2FuIHBhc3MgaW4gdGhlIHN0cmluZyAnc2FtZS1ob3N0bmFtZSdcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtaG9zdG5hbWUnLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.yF2AJFRXorzWRuCXhRGjM8nWXBFT585D7nwOkBPAPf0"},m={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-subdomain'\n // strategy: 'same-subdomain',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw"};var p,b=["components"],g={id:"crawl-relative-links",title:"Crawl a website with relative links"},h=void 0,y={unversionedId:"examples/crawl-relative-links",id:"version-3.1/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"When crawling a website, you may encounter different types of links present that you may want to crawl.",source:"@site/versioned_docs/version-3.1/examples/crawl_relative_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_relative_links.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/examples/crawl-single-url"}},I={},C=[],f=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),v={toc:C},w="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,b);return(0,l.kt)(w,(0,a.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"When crawling a website, you may encounter different types of links present that you may want to crawl.\nTo facilitate the easy crawling of such links, we provide the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method on the crawler context, which will\nautomatically find links and add them to the crawler's ",(0,l.kt)(u.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"."),(0,l.kt)("p",null,"We provide 3 different strategies for crawling relative links:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#All",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"All"))," which will enqueue all links found, regardless of the domain they point to."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameHostname",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameHostname"))," which will enqueue all links found for the same hostname (regardless of any subdomains present)."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameSubdomain",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameSubdomain"))," which will enqueue all links found that have the same subdomain and hostname. This is the default strategy.")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For these examples, we are using the ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),", however\nthe same method is available for both the ",(0,l.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"\nand ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", and you use it\nthe exact same way.")),(0,l.kt)(i.Z,{groupId:"enqueue_strategy",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"all",label:"All Links",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"Any urls found will be matched by this strategy, even if they go off of the site you are currently crawling.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s)),(0,l.kt)(o.Z,{value:"same_hostname",label:"Same Hostname",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will match relative urls, urls that point to the same\nfull domain or urls that point to any subdomain of the provided domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example"),"\nor ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example")," will all be matched by this strategy.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d)),(0,l.kt)(o.Z,{value:"same-subdomain",label:"Same Subdomain",default:!0,mdxType:"TabItem"},(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This is the default strategy when calling ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", so you don't have to specify it.")),(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will only match relative urls or urls that point to the same\nfull domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example"),"\nwill all be matched by this strategy, while ",(0,l.kt)("inlineCode",{parentName:"p"},"https://other-subdomain.example.com")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"https://otherexample.com")," will not.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},m))))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),c=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=c(n),p=r,b=d["".concat(u,".").concat(p)]||d[p]||m[p]||l;return n?a.createElement(b,i(i({ref:t},s),{},{components:n})):a.createElement(b,i({ref:t},s))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=p;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[d]="string"==typeof e?e:r,i[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=n(87462),a=n(63366),u=(n(67294),n(3905)),l=["components"],i={id:"request-queue",title:"RequestQueue"},s=void 0,o={unversionedId:"api/request-queue",id:"version-2.3/api/request-queue",title:"RequestQueue",description:"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links",source:"@site/versioned_docs/version-2.3/api/RequestQueue.md",sourceDirName:"api",slug:"/api/request-queue",permalink:"/sdk/js/docs/2.3/api/request-queue",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestQueue.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-queue",title:"RequestQueue"},sidebar:"version-2.3/docs",previous:{title:"RequestList",permalink:"/sdk/js/docs/2.3/api/request-list"},next:{title:"PseudoUrl",permalink:"/sdk/js/docs/2.3/api/pseudo-url"}},p={},d=[{value:"requestQueue.addRequest(requestLike, [options])",id:"requestqueueaddrequestrequestlike-options",level:2},{value:"requestQueue.getRequest(id)",id:"requestqueuegetrequestid",level:2},{value:"requestQueue.fetchNextRequest()",id:"requestqueuefetchnextrequest",level:2},{value:"requestQueue.markRequestHandled(request)",id:"requestqueuemarkrequesthandledrequest",level:2},{value:"requestQueue.reclaimRequest(request, [options])",id:"requestqueuereclaimrequestrequest-options",level:2},{value:"requestQueue.isEmpty()",id:"requestqueueisempty",level:2},{value:"requestQueue.isFinished()",id:"requestqueueisfinished",level:2},{value:"requestQueue._reset()",id:"requestqueue_reset",level:2},{value:"requestQueue.drop()",id:"requestqueuedrop",level:2},{value:"requestQueue.handledCount()",id:"requestqueuehandledcount",level:2},{value:"requestQueue.getInfo()",id:"requestqueuegetinfo",level:2}],m={toc:d},q="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,u.kt)(q,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,u.kt)("a",{name:"requestqueue"}),(0,u.kt)("p",null,"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links\nto other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,u.kt)("p",null,"Each URL is represented using an instance of the ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," class. The queue can only contain unique URLs. More precisely, it can\nonly contain ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," instances with distinct ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can\nalso be overridden. To add a single URL multiple times to the queue, corresponding ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different\n",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties."),(0,u.kt)("p",null,"Do not instantiate this class directly, use the ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function instead."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is used by ",(0,u.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,u.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,u.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and ",(0,u.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl. Unlike\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," supports dynamic adding and removing of requests. On the other hand, the queue is not optimized\nfor operations that add or remove a large number of URLs in a batch."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," stores its data either on local disk or in the Apify Cloud, depending on whether the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN"),"\nenvironment variable is set."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the queue data is stored in that directory in an SQLite database file."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," is not, the data is stored in the\n",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/request-queue",target:"_blank",rel:"noopener"},"Apify Request Queue")," cloud storage. Note that you can force usage of the cloud storage also by passing\nthe ",(0,u.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function, even if the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is\nset."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example usage:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst queue = await Apify.openRequestQueue();\n\n// Open a named request queue\nconst queueWithName = await Apify.openRequestQueue('some-name');\n\n// Enqueue few requests\nawait queue.addRequest({ url: 'http://example.com/aaa' });\nawait queue.addRequest({ url: 'http://example.com/bbb' });\nawait queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });\n")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"addrequest"}),(0,u.kt)("h2",{id:"requestqueueaddrequestrequestlike-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.addRequest(requestLike, [options])")),(0,u.kt)("p",null,"Adds a request to the queue."),(0,u.kt)("p",null,"If a request with the same ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property is already present in the queue, it will not be updated. You can find out whether this happened from\nthe resulting ",(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," object."),(0,u.kt)("p",null,"To add multiple requests to the queue by extracting links from a webpage, see the ",(0,u.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," helper function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"requestLike")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," | ",(0,u.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," object or vanilla\nobject with request data. Note that the function sets the ",(0,u.kt)("inlineCode",{parentName:"li"},"uniqueKey")," and ",(0,u.kt)("inlineCode",{parentName:"li"},"id")," fields to the passed Request."),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"Object"),(0,u.kt)("ul",{parentName:"li"},(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true"),", the request will be added to the foremost position in the queue.")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getrequest"}),(0,u.kt)("h2",{id:"requestqueuegetrequestid"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getRequest(id)")),(0,u.kt)("p",null,"Gets the request from the queue specified by ID."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"id")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"string")," - ID of the request.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if it was not found."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"fetchnextrequest"}),(0,u.kt)("h2",{id:"requestqueuefetchnextrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.fetchNextRequest()")),(0,u.kt)("p",null,"Returns a next request in the queue to be processed, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("p",null,"Once you successfully finish processing of the request, you need to call\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#markrequesthandled",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.markRequestHandled()"))," to mark the request as handled in the queue. If there was some error in\nprocessing the request, call ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#reclaimrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.reclaimRequest()"))," instead, so that the queue will give the request\nto some other consumer in another call to the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,"Note that the ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," return value doesn't mean the queue processing finished, it means there are currently no pending requests. To check whether all\nrequests in queue were finished, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()"))," instead."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"markrequesthandled"}),(0,u.kt)("h2",{id:"requestqueuemarkrequesthandledrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.markRequestHandled(request)")),(0,u.kt)("p",null,"Marks a request that was previously returned by the ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," function as handled\nafter successful processing. Handled requests will never again be returned by the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(QueueOperationInfo|null)>"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"reclaimrequest"}),(0,u.kt)("h2",{id:"requestqueuereclaimrequestrequest-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.reclaimRequest(request, [options])")),(0,u.kt)("p",null,"Reclaims a failed request back to the queue, so that it can be returned for processed later again by another call to\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". The request record in the queue is updated using the provided ",(0,u.kt)("inlineCode",{parentName:"p"},"request"),"\nparameter. For example, this lets you store the number of retries or error messages for the request."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"object")," - ",(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true")," then the request it placed to the beginning of the\nqueue, so that it's returned in the next call to ",(0,u.kt)("a",{parentName:"li",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". By default, it's put\nto the end of the queue.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(QueueOperationInfo|null)>"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isempty"}),(0,u.kt)("h2",{id:"requestqueueisempty"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isEmpty()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," would return ",(0,u.kt)("inlineCode",{parentName:"p"},"null"),", otherwise it\nresolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that\nthere is no activity in the queue, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()")),"."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isfinished"}),(0,u.kt)("h2",{id:"requestqueueisfinished"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isFinished()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left. Due to the nature of distributed storage used by the queue, the\nfunction might occasionally return a false negative, but it will never return a false positive."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"_reset"}),(0,u.kt)("h2",{id:"requestqueue_reset"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue._reset()")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Internal"),":"),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"drop"}),(0,u.kt)("h2",{id:"requestqueuedrop"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.drop()")),(0,u.kt)("p",null,"Removes the queue either from the Apify Cloud storage or from the local database, depending on the mode of operation."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"handledcount"}),(0,u.kt)("h2",{id:"requestqueuehandledcount"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.handledCount()")),(0,u.kt)("p",null,"Returns the number of handled requests."),(0,u.kt)("p",null,"This function is just a convenient shortcut for:"),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"const { handledRequestCount } = await queue.getInfo();\n")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getinfo"}),(0,u.kt)("h2",{id:"requestqueuegetinfo"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getInfo()")),(0,u.kt)("p",null,"Returns an object containing general information about the request queue."),(0,u.kt)("p",null,"The function returns the same object as the Apify API Client's ",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues",target:"_blank",rel:"noopener"},"getQueue"),"\nfunction, which in turn calls the ",(0,u.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue",target:"_blank",rel:"noopener"},"Get request queue")," API endpoint."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-queue",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n totalRequestCount: 25,\n handledRequestCount: 5,\n pendingRequestCount: 20,\n}\n')),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/request-queue-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},q=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,u=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=o(n),q=a,k=d["".concat(s,".").concat(q)]||d[q]||m[q]||u;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var u=n.length,l=new Array(u);l[0]=q;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,l[1]=i;for(var o=2;o{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>d});var r=n(87462),a=n(63366),u=(n(67294),n(3905)),l=["components"],i={id:"request-queue",title:"RequestQueue"},s=void 0,o={unversionedId:"api/request-queue",id:"version-2.3/api/request-queue",title:"RequestQueue",description:"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links",source:"@site/versioned_docs/version-2.3/api/RequestQueue.md",sourceDirName:"api",slug:"/api/request-queue",permalink:"/sdk/js/docs/2.3/api/request-queue",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestQueue.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-queue",title:"RequestQueue"},sidebar:"version-2.3/docs",previous:{title:"RequestList",permalink:"/sdk/js/docs/2.3/api/request-list"},next:{title:"PseudoUrl",permalink:"/sdk/js/docs/2.3/api/pseudo-url"}},p={},d=[{value:"requestQueue.addRequest(requestLike, [options])",id:"requestqueueaddrequestrequestlike-options",level:2},{value:"requestQueue.getRequest(id)",id:"requestqueuegetrequestid",level:2},{value:"requestQueue.fetchNextRequest()",id:"requestqueuefetchnextrequest",level:2},{value:"requestQueue.markRequestHandled(request)",id:"requestqueuemarkrequesthandledrequest",level:2},{value:"requestQueue.reclaimRequest(request, [options])",id:"requestqueuereclaimrequestrequest-options",level:2},{value:"requestQueue.isEmpty()",id:"requestqueueisempty",level:2},{value:"requestQueue.isFinished()",id:"requestqueueisfinished",level:2},{value:"requestQueue._reset()",id:"requestqueue_reset",level:2},{value:"requestQueue.drop()",id:"requestqueuedrop",level:2},{value:"requestQueue.handledCount()",id:"requestqueuehandledcount",level:2},{value:"requestQueue.getInfo()",id:"requestqueuegetinfo",level:2}],m={toc:d},q="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,u.kt)(q,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,u.kt)("a",{name:"requestqueue"}),(0,u.kt)("p",null,"Represents a queue of URLs to crawl, which is used for deep crawling of websites where you start with several URLs and then recursively follow links\nto other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,u.kt)("p",null,"Each URL is represented using an instance of the ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," class. The queue can only contain unique URLs. More precisely, it can\nonly contain ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," instances with distinct ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties. By default, ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," is generated from the URL, but it can\nalso be overridden. To add a single URL multiple times to the queue, corresponding ",(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," objects will need to have different\n",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," properties."),(0,u.kt)("p",null,"Do not instantiate this class directly, use the ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function instead."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is used by ",(0,u.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,u.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,u.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and ",(0,u.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," as a source of URLs to crawl. Unlike\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," supports dynamic adding and removing of requests. On the other hand, the queue is not optimized\nfor operations that add or remove a large number of URLs in a batch."),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"RequestQueue")," stores its data either on local disk or in the Apify Cloud, depending on whether the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN"),"\nenvironment variable is set."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the queue data is stored in that directory in an SQLite database file."),(0,u.kt)("p",null,"If the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," is not, the data is stored in the\n",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/request-queue",target:"_blank",rel:"noopener"},"Apify Request Queue")," cloud storage. Note that you can force usage of the cloud storage also by passing\nthe ",(0,u.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,u.kt)("a",{parentName:"p",href:"../api/apify#openrequestqueue",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Apify.openRequestQueue()"))," function, even if the ",(0,u.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is\nset."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example usage:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst queue = await Apify.openRequestQueue();\n\n// Open a named request queue\nconst queueWithName = await Apify.openRequestQueue('some-name');\n\n// Enqueue few requests\nawait queue.addRequest({ url: 'http://example.com/aaa' });\nawait queue.addRequest({ url: 'http://example.com/bbb' });\nawait queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });\n")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"addrequest"}),(0,u.kt)("h2",{id:"requestqueueaddrequestrequestlike-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.addRequest(requestLike, [options])")),(0,u.kt)("p",null,"Adds a request to the queue."),(0,u.kt)("p",null,"If a request with the same ",(0,u.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property is already present in the queue, it will not be updated. You can find out whether this happened from\nthe resulting ",(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," object."),(0,u.kt)("p",null,"To add multiple requests to the queue by extracting links from a webpage, see the ",(0,u.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," helper function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"requestLike")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," | ",(0,u.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))," object or vanilla\nobject with request data. Note that the function sets the ",(0,u.kt)("inlineCode",{parentName:"li"},"uniqueKey")," and ",(0,u.kt)("inlineCode",{parentName:"li"},"id")," fields to the passed Request."),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"Object"),(0,u.kt)("ul",{parentName:"li"},(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true"),", the request will be added to the foremost position in the queue.")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getrequest"}),(0,u.kt)("h2",{id:"requestqueuegetrequestid"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getRequest(id)")),(0,u.kt)("p",null,"Gets the request from the queue specified by ID."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"id")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"string")," - ID of the request.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if it was not found."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"fetchnextrequest"}),(0,u.kt)("h2",{id:"requestqueuefetchnextrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.fetchNextRequest()")),(0,u.kt)("p",null,"Returns a next request in the queue to be processed, or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("p",null,"Once you successfully finish processing of the request, you need to call\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#markrequesthandled",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.markRequestHandled()"))," to mark the request as handled in the queue. If there was some error in\nprocessing the request, call ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#reclaimrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.reclaimRequest()"))," instead, so that the queue will give the request\nto some other consumer in another call to the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,"Note that the ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," return value doesn't mean the queue processing finished, it means there are currently no pending requests. To check whether all\nrequests in queue were finished, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()"))," instead."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(Request|null)>"))," - Returns the request object or ",(0,u.kt)("inlineCode",{parentName:"p"},"null")," if there are no more pending requests."),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"markrequesthandled"}),(0,u.kt)("h2",{id:"requestqueuemarkrequesthandledrequest"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.markRequestHandled(request)")),(0,u.kt)("p",null,"Marks a request that was previously returned by the ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," function as handled\nafter successful processing. Handled requests will never again be returned by the ",(0,u.kt)("inlineCode",{parentName:"p"},"fetchNextRequest")," function."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request")))),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(QueueOperationInfo|null)>"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"reclaimrequest"}),(0,u.kt)("h2",{id:"requestqueuereclaimrequestrequest-options"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.reclaimRequest(request, [options])")),(0,u.kt)("p",null,"Reclaims a failed request back to the queue, so that it can be returned for processed later again by another call to\n",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". The request record in the queue is updated using the provided ",(0,u.kt)("inlineCode",{parentName:"p"},"request"),"\nparameter. For example, this lets you store the number of retries or error messages for the request."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,u.kt)("ul",null,(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,u.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Request"))),(0,u.kt)("li",{parentName:"ul"},(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"object")," - ",(0,u.kt)("strong",{parentName:"li"},(0,u.kt)("inlineCode",{parentName:"strong"},"[forefront]")),": ",(0,u.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,u.kt)("code",null," = false")," - If ",(0,u.kt)("inlineCode",{parentName:"li"},"true")," then the request it placed to the beginning of the\nqueue, so that it's returned in the next call to ",(0,u.kt)("a",{parentName:"li",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()")),". By default, it's put\nto the end of the queue.")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise<(QueueOperationInfo|null)>"))),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isempty"}),(0,u.kt)("h2",{id:"requestqueueisempty"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isEmpty()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if the next call to ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#fetchnextrequest",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.fetchNextRequest()"))," would return ",(0,u.kt)("inlineCode",{parentName:"p"},"null"),", otherwise it\nresolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"false"),". Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that\nthere is no activity in the queue, use ",(0,u.kt)("a",{parentName:"p",href:"../api/request-queue#isfinished",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"RequestQueue.isFinished()")),"."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"isfinished"}),(0,u.kt)("h2",{id:"requestqueueisfinished"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.isFinished()")),(0,u.kt)("p",null,"Resolves to ",(0,u.kt)("inlineCode",{parentName:"p"},"true")," if all requests were already handled and there are no more left. Due to the nature of distributed storage used by the queue, the\nfunction might occasionally return a false negative, but it will never return a false positive."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"_reset"}),(0,u.kt)("h2",{id:"requestqueue_reset"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue._reset()")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Internal"),":"),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"drop"}),(0,u.kt)("h2",{id:"requestqueuedrop"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.drop()")),(0,u.kt)("p",null,"Removes the queue either from the Apify Cloud storage or from the local database, depending on the mode of operation."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"handledcount"}),(0,u.kt)("h2",{id:"requestqueuehandledcount"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.handledCount()")),(0,u.kt)("p",null,"Returns the number of handled requests."),(0,u.kt)("p",null,"This function is just a convenient shortcut for:"),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre",className:"language-javascript"},"const { handledRequestCount } = await queue.getInfo();\n")),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("inlineCode",{parentName:"p"},"Promise")),(0,u.kt)("hr",null),(0,u.kt)("a",{name:"getinfo"}),(0,u.kt)("h2",{id:"requestqueuegetinfo"},(0,u.kt)("inlineCode",{parentName:"h2"},"requestQueue.getInfo()")),(0,u.kt)("p",null,"Returns an object containing general information about the request queue."),(0,u.kt)("p",null,"The function returns the same object as the Apify API Client's ",(0,u.kt)("a",{parentName:"p",href:"https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues",target:"_blank",rel:"noopener"},"getQueue"),"\nfunction, which in turn calls the ",(0,u.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue",target:"_blank",rel:"noopener"},"Get request queue")," API endpoint."),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Example:")),(0,u.kt)("pre",null,(0,u.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-queue",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n totalRequestCount: 25,\n handledRequestCount: 5,\n pendingRequestCount: 20,\n}\n')),(0,u.kt)("p",null,(0,u.kt)("strong",{parentName:"p"},"Returns"),":"),(0,u.kt)("p",null,(0,u.kt)("a",{parentName:"p",href:"../typedefs/request-queue-info",target:null,rel:null},(0,u.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,u.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},q=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,u=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=o(n),q=a,k=d["".concat(s,".").concat(q)]||d[q]||m[q]||u;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var u=n.length,l=new Array(u);l[0]=q;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,l[1]=i;for(var o=2;o{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>u,default:()=>b,frontMatter:()=>l,metadata:()=>s,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905));r(14563);const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Proxy connection is automatically established in the Crawler\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n async requestHandler({ page }) {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n});\n\nconsole.log('Running Puppeteer script...');\n\nawait crawler.run(['http://proxy.apify.com']);\n\nconsole.log('Puppeteer closed.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk"};var c,i=["components"],l={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},u=void 0,s={unversionedId:"examples/puppeteer-with-proxy",id:"examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.",source:"@site/../docs/examples/puppeteer_with_proxy.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/next/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_with_proxy.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/next/examples/puppeteer-recursive-crawl"},next:{title:"Upgrading",permalink:"/sdk/js/docs/next/upgrading"}},d={},y=[],m=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:y},x="wrapper";function b(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(x,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"."),(0,a.kt)("p",null,"To make it work, you'll need an Apify account with access to the proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your account from the SDK."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}b.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),s=l(r),y=o,m=s["".concat(i,".").concat(y)]||s[y]||d[y]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[s]="string"==typeof e?e:o,p[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>u,default:()=>x,frontMatter:()=>l,metadata:()=>s,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905));r(14563);const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Proxy connection is automatically established in the Crawler\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n async requestHandler({ page }) {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n});\n\nconsole.log('Running Puppeteer script...');\n\nawait crawler.run(['http://proxy.apify.com']);\n\nconsole.log('Puppeteer closed.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk"};var c,i=["components"],l={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},u=void 0,s={unversionedId:"examples/puppeteer-with-proxy",id:"examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.",source:"@site/../docs/examples/puppeteer_with_proxy.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/next/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_with_proxy.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/next/examples/puppeteer-recursive-crawl"},next:{title:"Upgrading",permalink:"/sdk/js/docs/next/upgrading"}},d={},y=[],m=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:y},g="wrapper";function x(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(g,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"."),(0,a.kt)("p",null,"To make it work, you'll need an Apify account with access to the proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your account from the SDK."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}x.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=c(e,["components","mdxType","originalType","parentName"]),s=l(r),y=o,m=s["".concat(i,".").concat(y)]||s[y]||d[y]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[s]="string"==typeof e?e:o,p[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>s});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id:"playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam"},l=void 0,c={unversionedId:"typedefs/playwright-handle-page-function-param",id:"version-2.3/typedefs/playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function-param",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunctionParam.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"},next:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:s},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrighthandlepagefunctionparam"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"page"},(0,o.kt)("inlineCode",{parentName:"h3"},"page")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Page")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"crawler"},(0,o.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),s=c(r),f=a,y=s["".concat(l,".").concat(f)]||s[f]||u[f]||o;return r?n.createElement(y,i(i({ref:t},d),{},{components:r})):n.createElement(y,i({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[s]="string"==typeof e?e:a,i[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>s});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=["components"],p={id:"playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam"},l=void 0,c={unversionedId:"typedefs/playwright-handle-page-function-param",id:"version-2.3/typedefs/playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function-param",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunctionParam.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-handle-page-function-param",title:"PlaywrightHandlePageFunctionParam"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"},next:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:s},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,o);return(0,i.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrighthandlepagefunctionparam"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"page"},(0,i.kt)("inlineCode",{parentName:"h3"},"page")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Page")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"crawler"},(0,i.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),s=c(r),f=a,y=s["".concat(l,".").concat(f)]||s[f]||u[f]||i;return r?n.createElement(y,o(o({ref:t},d),{},{components:r})):n.createElement(y,o({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=f;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[s]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],p={id_old:"version-1.3-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},i=void 0,s={unversionedId:"typedefs/cheerio-handle-page-inputs",id:"version-1.3/typedefs/cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CheerioHandlePageInputs.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page-inputs",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePageInputs.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},sidebar:"version-1.3/docs",previous:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page"},next:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"$",id:"",level:3},{value:"body",id:"body",level:3},{value:"json",id:"json",level:3},{value:"request",id:"request",level:3},{value:"contentType",id:"contenttype",level:3},{value:"response",id:"response",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(h,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepageinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:""},(0,o.kt)("inlineCode",{parentName:"h3"},"$")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"cheerio.Root")),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://cheerio.js.org/",target:"_blank",rel:"noopener"},"Cheerio")," object with parsed HTML."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"body"},(0,o.kt)("inlineCode",{parentName:"h3"},"body")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"The request body of the web page."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"json"},(0,o.kt)("inlineCode",{parentName:"h3"},"json")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"The parsed object from JSON string if the response contains the content type application/json."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"contenttype"},(0,o.kt)("inlineCode",{parentName:"h3"},"contentType")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Parsed ",(0,o.kt)("inlineCode",{parentName:"p"},"Content-Type header: { type, encoding }"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"response"},(0,o.kt)("inlineCode",{parentName:"h3"},"response")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"IncomingMessage")),(0,o.kt)("p",null,"An instance of Node's ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"http.IncomingMessage")," object,"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,o.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"crawler"},(0,o.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=s(n),h=a,k=c["".concat(i,".").concat(h)]||c[h]||u[h]||o;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=h;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[c]="string"==typeof e?e:a,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],p={id_old:"version-1.3-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},i=void 0,s={unversionedId:"typedefs/cheerio-handle-page-inputs",id:"version-1.3/typedefs/cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CheerioHandlePageInputs.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page-inputs",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePageInputs.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-cheerio-handle-page-inputs",title:"CheerioHandlePageInputs",id:"cheerio-handle-page-inputs"},sidebar:"version-1.3/docs",previous:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page"},next:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"$",id:"",level:3},{value:"body",id:"body",level:3},{value:"json",id:"json",level:3},{value:"request",id:"request",level:3},{value:"contentType",id:"contenttype",level:3},{value:"response",id:"response",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],u={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(h,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepageinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:""},(0,o.kt)("inlineCode",{parentName:"h3"},"$")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"cheerio.Root")),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"https://cheerio.js.org/",target:"_blank",rel:"noopener"},"Cheerio")," object with parsed HTML."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"body"},(0,o.kt)("inlineCode",{parentName:"h3"},"body")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,o.kt)("p",null,"The request body of the web page."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"json"},(0,o.kt)("inlineCode",{parentName:"h3"},"json")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"The parsed object from JSON string if the response contains the content type application/json."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"contenttype"},(0,o.kt)("inlineCode",{parentName:"h3"},"contentType")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Object")),(0,o.kt)("p",null,"Parsed ",(0,o.kt)("inlineCode",{parentName:"p"},"Content-Type header: { type, encoding }"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"response"},(0,o.kt)("inlineCode",{parentName:"h3"},"response")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"IncomingMessage")),(0,o.kt)("p",null,"An instance of Node's ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/http.html#http_class_http_incomingmessage",target:"_blank",rel:"noopener"},"http.IncomingMessage")," object,"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,o.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"crawler"},(0,o.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=s(n),h=a,k=c["".concat(i,".").concat(h)]||c[h]||u[h]||o;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=h;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[c]="string"==typeof e?e:a,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>m});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-apify",title:"Apify",id:"apify"},p=void 0,s={unversionedId:"api/apify",id:"version-1.3/api/apify",title:"Apify",description:"The following section describes all functions and properties provided by the apify package, except individual classes and namespaces that have their",source:"@site/versioned_docs/version-1.3/api/Apify.md",sourceDirName:"api",slug:"/api/apify",permalink:"/sdk/js/docs/1.3/api/apify",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Apify.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-apify",title:"Apify",id:"apify"},sidebar:"version-1.3/docs",previous:{title:"Use stealth mode",permalink:"/sdk/js/docs/1.3/examples/use-stealth-mode"},next:{title:"Configuration",permalink:"/sdk/js/docs/1.3/api/configuration"}},u={},m=[{value:"Apify Class",id:"apify-class",level:2},{value:"Apify.addWebhook(options)",id:"apifyaddwebhookoptions",level:2},{value:"Apify.call(actId, [input], [options])",id:"apifycallactid-input-options",level:2},{value:"Apify.callTask(taskId, [input], [options])",id:"apifycalltasktaskid-input-options",level:2},{value:"Apify.createProxyConfiguration([proxyConfigurationOptions])",id:"apifycreateproxyconfigurationproxyconfigurationoptions",level:2},{value:"Apify.events",id:"apifyevents",level:2},{value:"Apify.getEnv()",id:"apifygetenv",level:2},{value:"Apify.getInput()",id:"apifygetinput",level:2},{value:"Apify.getMemoryInfo()",id:"apifygetmemoryinfo",level:2},{value:"Apify.getValue(key)",id:"apifygetvaluekey",level:2},{value:"Apify.isAtHome()",id:"apifyisathome",level:2},{value:"Apify.launchPlaywright([launchContext])",id:"apifylaunchplaywrightlaunchcontext",level:2},{value:"Apify.launchPuppeteer([launchContext])",id:"apifylaunchpuppeteerlaunchcontext",level:2},{value:"Apify.main(userFunc)",id:"apifymainuserfunc",level:2},{value:"Apify.metamorph(targetActorId, [input], [options])",id:"apifymetamorphtargetactorid-input-options",level:2},{value:"Apify.newClient([options])",id:"apifynewclientoptions",level:2},{value:"Apify.openDataset([datasetIdOrName], [options])",id:"apifyopendatasetdatasetidorname-options",level:2},{value:"Apify.openKeyValueStore([storeIdOrName], [options])",id:"apifyopenkeyvaluestorestoreidorname-options",level:2},{value:"Apify.openRequestList(listName, sources, [options])",id:"apifyopenrequestlistlistname-sources-options",level:2},{value:"Apify.openRequestQueue([queueIdOrName], [options])",id:"apifyopenrequestqueuequeueidorname-options",level:2},{value:"Apify.openSessionPool(sessionPoolOptions)",id:"apifyopensessionpoolsessionpooloptions",level:2},{value:"Apify.pushData(item)",id:"apifypushdataitem",level:2},{value:"Apify.setValue(key, value, [options])",id:"apifysetvaluekey-value-options",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,i.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"apify"}),(0,i.kt)("p",null,"The following section describes all functions and properties provided by the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify")," package, except individual classes and namespaces that have their\nseparate, detailed, documentation pages accessible from the left sidebar. To learn how Apify SDK works, we suggest following the\n",(0,i.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started")," tutorial."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Important:")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The following functions: ",(0,i.kt)("inlineCode",{parentName:"p"},"addWebhook"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"call"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"newClient")," invoke features of the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," and\nrequire your scripts to be authenticated. See the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#logging-into-apify-platform-from-apify-sdk",target:null,rel:null},"authentication guide")," for\ninstructions.")),(0,i.kt)("h2",{id:"apify-class"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify")," Class"),(0,i.kt)("p",null,"As opposed to those helper functions, there is an alternative approach using ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," class (a named export). It has mostly the same API, but the\nmethods on ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," instance will use the configuration provided in the constructor. Environment variables will have precedence over this\nconfiguration."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n\n// the token will be passed to the `call` method automatically\nconst run = await sdk.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Another example shows how the default dataset name can be changed:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ defaultDatasetId: 'custom-name' });\nawait sdk.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify'); // use default export to get the helper functions\n\nconst dataset = await Apify.openDataset('custom-name');\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," for details about what can be configured and what are the default values."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addwebhook"}),(0,i.kt)("h2",{id:"apifyaddwebhookoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.addWebhook(options)")),(0,i.kt)("p",null,"Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed. For more information\nabout Apify actor webhooks, please see the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,"Note that webhooks are only supported for actors running on the Apify platform. In local environment, the function will print a warning and have no\neffect."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"eventTypes")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/event-types",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"EventTypes"))," - Array of event types, which you can set for actor run, see the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/events#actor-run",target:"_blank",rel:"noopener"},"actor run events")," in the Apify doc."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestUrl")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - URL which will be requested using HTTP POST request, when actor run will reach the set event type."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[payloadTemplate]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Payload template is a JSON-like string that describes the structure of the webhook POST request payload.\nIt uses JSON syntax, extended with a double curly braces syntax for injecting variables ",(0,i.kt)("inlineCode",{parentName:"li"},"{{variable}}"),". Those variables are resolved at the\ntime of the webhook's dispatch, and a list of available variables with their descriptions is available in the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"Apify webhook documentation"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"payloadTemplate")," is omitted, the default payload template is used\n(",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/actions#payload-template",target:"_blank",rel:"noopener"},"view docs"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[idempotencyKey]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Idempotency key enables you to ensure that a webhook will not be added multiple times in case of an actor\nrestart or other situation that would cause the ",(0,i.kt)("inlineCode",{parentName:"li"},"addWebhook()")," function to be called again. We suggest using the actor run ID as the\nidempotency key. You can get the run ID by calling ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#getenv",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/webhook-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(WebhookRun|undefined)>"))," - The return value is the Webhook object. For more information, see the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook",target:"_blank",rel:"noopener"},"Get webhook")," API endpoint."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"call"}),(0,i.kt)("h2",{id:"apifycallactid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.call(actId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the actor to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run fails, the function throws the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"If you want to run an actor task rather than an actor, please use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.callTask()"))," function instead."),(0,i.kt)("p",null,"For more information about actors, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"call()")," function invokes the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Run actor")," and several other\nAPI endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"actId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/actor-name")," or actor ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor run. If not provided, the run uses memory of\nthe default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor run to finish, in seconds. If the limit is reached, the returned promise is\nresolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[fetchOutput]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"false")," then the function does not fetch output of the actor."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[disableBodyParser]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function will not attempt to parse the actor's output and will\nreturn it in a raw ",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"calltask"}),(0,i.kt)("h2",{id:"apifycalltasktaskid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.callTask(taskId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor task on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the task to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run failed, the function fails with ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"Note that an actor task is a saved input configuration and options for an actor. If you want to run an actor directly rather than an actor task,\nplease use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function instead."),(0,i.kt)("p",null,"For more information about actor tasks, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/tasks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.callTask('bob/some-task');\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask()")," function calls the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actor-tasks/run-collection/run-task",target:"_blank",rel:"noopener"},"Run task")," and several\nother API endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"taskId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/task-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/task-name")," or task ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input overrides for the actor task. If it is an object, it will be stringified to JSON and its content type\nset to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Provided input will be merged with actor task input."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor task run. If not provided, the run uses memory\nof the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor task run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor task run to finish, in seconds. If the limit is reached, the returned promise\nis resolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor task to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"createproxyconfiguration"}),(0,i.kt)("h2",{id:"apifycreateproxyconfigurationproxyconfigurationoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.createProxyConfiguration([proxyConfigurationOptions])")),(0,i.kt)("p",null,"Creates a proxy configuration and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that is\nalready initialized."),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\n// Returns initialized proxy configuration class\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify proxy groups\n countryCode: 'US'\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("p",null,"For compatibility with existing Actor Input UI (Input Schema), this function returns ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," when the following object is passed as\n",(0,i.kt)("inlineCode",{parentName:"p"},"proxyConfigurationOptions"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{ useApifyProxy: false }\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[proxyConfigurationOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(ProxyConfiguration|undefined)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"events"}),(0,i.kt)("h2",{id:"apifyevents"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.events")),(0,i.kt)("p",null,"Gets an instance of a Node.js' ",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/events.html#events_class_eventemitter",target:"_blank",rel:"noopener"},"EventEmitter")," class that emits various events from the\nSDK or the Apify platform. The event emitter is initialized by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.events.on('cpuInfo', data => {\n if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');\n});\n")),(0,i.kt)("p",null,"The following events are emitted:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"cpuInfo"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isCpuOverloaded": Boolean }')," The event is emitted approximately every second and it indicates whether the actor is using the\nmaximum of available CPU resources. If that's the case, the actor should not add more workload. For example, this event is used by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"migrating"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"void")," Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon. You can use it to\npersist the state of the actor and gracefully stop your in-progress tasks, so that they are not interrupted by the migration. For example, this is\nused by the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"persistState"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isMigrating": Boolean }')," Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is\ntime to persist their state, in order to avoid repeating all work when the actor restarts. This event is automatically emitted together with the\n",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event, in which case the ",(0,i.kt)("inlineCode",{parentName:"li"},"isMigrating")," flag is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),". Otherwise the flag is ",(0,i.kt)("inlineCode",{parentName:"li"},"false"),". Note that the ",(0,i.kt)("inlineCode",{parentName:"li"},"persistState")," event is\nprovided merely for user convenience, you can achieve the same effect using ",(0,i.kt)("inlineCode",{parentName:"li"},"setInterval()")," and listening for the ",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getenv"}),(0,i.kt)("h2",{id:"apifygetenv"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getEnv()")),(0,i.kt)("p",null,"Returns a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))," object which contains information parsed from all the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables."),(0,i.kt)("p",null,"For the list of the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables, see ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#environment-variables",target:"_blank",rel:"noopener"},"Actor documentation"),". If some of\nthe variables are not defined or are invalid, the corresponding value in the resulting object will be null."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getinput"}),(0,i.kt)("h2",{id:"apifygetinput"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getInput()")),(0,i.kt)("p",null,"Gets the actor input value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"keyValueStore.getValue('INPUT')")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.getValue('INPUT');\n")),(0,i.kt)("p",null,"Note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"getInput()")," function does not cache the value read from the key-value store. If you need to use the input multiple times in your actor,\nit is far more efficient to read it once and store it locally."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getmemoryinfo"}),(0,i.kt)("h2",{id:"apifygetmemoryinfo"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getMemoryInfo()")),(0,i.kt)("p",null,"Returns memory statistics of the process and the system, see ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"MemoryInfo")),"."),(0,i.kt)("p",null,"If the process runs inside of Docker, the ",(0,i.kt)("inlineCode",{parentName:"p"},"getMemoryInfo")," gets container memory limits, otherwise it gets system memory limits."),(0,i.kt)("p",null,"Beware that the function is quite inefficient because it spawns a new process. Therefore you shouldn't call it too often, like more than once per\nsecond."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getvalue"}),(0,i.kt)("h2",{id:"apifygetvaluekey"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getValue(key)")),(0,i.kt)("p",null,"Gets a value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const value = await Apify.getValue('my-key');\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst value = await store.getValue('my-key');\n")),(0,i.kt)("p",null,"To store the value to the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isathome"}),(0,i.kt)("h2",{id:"apifyisathome"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.isAtHome()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," when code is running on Apify platform and ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," otherwise (for example locally)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchplaywright"}),(0,i.kt)("h2",{id:"apifylaunchplaywrightlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPlaywright([launchContext])")),(0,i.kt)("p",null,"Launches headless browsers using Playwright pre-configured to work within the Apify platform. The function has the same return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"browserType.launch()"),". See ",(0,i.kt)("a",{href:"https://playwright.dev/docs/api/class-browsertype",target:"_blank"}," Playwright documentation")," for more\ndetails."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPlaywright()")," function alters the following Playwright options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"launchOptions")," in a proper format. The proxy URL must define a port number and have one\nof the following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPlaywright")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/playwright",target:"_blank",rel:"noopener"},"Playwright")," NPM package installed in your project. When running\non the Apify Platform, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-*")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," - Optional settings passed to ",(0,i.kt)("inlineCode",{parentName:"li"},"browserType.launch()"),". In\naddition to ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions",target:"_blank",rel:"noopener"},"Playwright's options")," the object may\ncontain our own ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," that enable additional features.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchpuppeteer"}),(0,i.kt)("h2",{id:"apifylaunchpuppeteerlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPuppeteer([launchContext])")),(0,i.kt)("p",null,"Launches headless Chrome using Puppeteer pre-configured to work within the Apify platform. The function has the same argument and the return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"puppeteer.launch()"),". See ",(0,i.kt)("a",{href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions",target:"_blank"}," Puppeteer\ndocumentation")," for more details."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPuppeteer()")," function alters the following Puppeteer options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"args")," as ",(0,i.kt)("inlineCode",{parentName:"li"},"--proxy-server=XXX"),". The proxy URL must define a port number and have one of\nthe following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPuppeteer")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/puppeteer",target:"_blank",rel:"noopener"},"puppeteer")," NPM package installed in your project. When running on\nthe Apify cloud, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-chrome")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,"For an example of usage, see the ",(0,i.kt)("a",{parentName:"p",href:"../examples/synchronous-run",target:null,rel:null},"Synchronous run Example")," or the\n",(0,i.kt)("a",{parentName:"p",href:"../examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer proxy Example")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLauncher")," parameters are passed via an\nlaunchContext object. If you want to pass custom ",(0,i.kt)("inlineCode",{parentName:"li"},"puppeteer.launch(options)")," options you can use the ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLaunchContext.launchOptions"),"\nproperty.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"main"}),(0,i.kt)("h2",{id:"apifymainuserfunc"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.main(userFunc)")),(0,i.kt)("p",null,"Runs the main user function that performs the job of the actor and terminates the process when the user function finishes."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"The ",(0,i.kt)("inlineCode",{parentName:"strong"},"Apify.main()")," function is optional")," and is provided merely for your convenience. It is mainly useful when you're running your code as an actor\non the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),". However, if you want to use Apify SDK tools directly inside your existing projects, e.g. running in\nan ",(0,i.kt)("a",{parentName:"p",href:"https://expressjs.com/",target:"_blank",rel:"noopener"},"Express")," server, on ",(0,i.kt)("a",{parentName:"p",href:"https://cloud.google.com/functions",target:"_blank",rel:"noopener"},"Google Cloud functions")," or\n",(0,i.kt)("a",{parentName:"p",href:"https://aws.amazon.com/lambda/",target:"_blank",rel:"noopener"},"AWS Lambda"),", it's better to avoid it since the function terminates the main process when it finishes!"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.main()")," function performs the following actions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"When running on the Apify platform (i.e. ",(0,i.kt)("code",null,"APIFY_IS_AT_HOME")," environment variable is set), it sets up a connection to listen for\nplatform events. For example, to get a notification about an imminent migration to another server. See ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events"))," for\ndetails."),(0,i.kt)("li",{parentName:"ul"},"It checks that either ",(0,i.kt)("code",null,"APIFY_TOKEN")," or ",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," environment variable is defined. If not, the functions sets",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," to ",(0,i.kt)("code",null,"./apify_storage")," inside the current working directory. This is to simplify running code examples."),(0,i.kt)("li",{parentName:"ul"},"It invokes the user function passed as the ",(0,i.kt)("code",null,"userFunc")," parameter."),(0,i.kt)("li",{parentName:"ul"},"If the user function returned a promise, waits for it to resolve."),(0,i.kt)("li",{parentName:"ul"},"If the user function throws an exception or some other error is encountered, prints error details to console so that they are stored to the log."),(0,i.kt)("li",{parentName:"ul"},"Exits the Node.js process, with zero exit code on success and non-zero on errors.")),(0,i.kt)("p",null,"The user function can be synchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(() => {\n // My synchronous function that returns immediately\n console.log('Hello world from actor!');\n});\n")),(0,i.kt)("p",null,"If the user function returns a promise, it is considered asynchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const { requestAsBrowser } = require('some-request-library');\n\nApify.main(() => {\n // My asynchronous function that returns a promise\n return request('http://www.example.com').then(html => {\n console.log(html);\n });\n});\n")),(0,i.kt)("p",null,"To simplify your code, you can take advantage of the ",(0,i.kt)("inlineCode",{parentName:"p"},"async"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = require('some-request-library');\n\nApify.main(async () => {\n // My asynchronous function\n const html = await request('http://www.example.com');\n console.log(html);\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"userFunc")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/user-func",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"UserFunc"))," - User function to be executed. If it returns a promise, the promise will be awaited. The user\nfunction is called with no arguments.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"metamorph"}),(0,i.kt)("h2",{id:"apifymetamorphtargetactorid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.metamorph(targetActorId, [input], [options])")),(0,i.kt)("p",null,"Transforms this actor run to an actor run of a given actor. The system stops the current container and starts the new container instead. All the\ndefault storages are preserved and the new input is stored under the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT-METAMORPH-1")," key in the same default key-value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"targetActorId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Either ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name")," or actor ID of an actor to which we want to metamorph."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the target actor build to metamorph into (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses\nbuild tag or number from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),").")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newclient"}),(0,i.kt)("h2",{id:"apifynewclientoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.newClient([options])")),(0,i.kt)("p",null,"Returns a new instance of the Apify API client. The ",(0,i.kt)("inlineCode",{parentName:"p"},"ApifyClient")," class is provided by the"),(0,i.kt)("a",{href:"https://www.npmjs.com/package/apify-client",target:"_blank"},"apify-client")," NPM package, and it is automatically configured using the `APIFY_API_BASE_URL`, and `APIFY_TOKEN` environment variables. You can override the token via the available options. That's useful if you want to use the client as a different Apify user than the SDK internals are using.",(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string"))))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opendataset"}),(0,i.kt)("h2",{id:"apifyopendatasetdatasetidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openDataset([datasetIdOrName], [options])")),(0,i.kt)("p",null,"Opens a dataset and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. The\nactual data is stored either on the local filesystem or in the cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[datasetIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the dataset to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default dataset\nassociated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openkeyvaluestore"}),(0,i.kt)("h2",{id:"apifyopenkeyvaluestorestoreidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openKeyValueStore([storeIdOrName], [options])")),(0,i.kt)("p",null,"Opens a key-value store and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,"Key-value stores are used to store records or files, along with their MIME content type. The records are stored and retrieved using a unique key. The\nactual data is stored either on a local filesystem or in the Apify cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[storeIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the key-value store to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default\nkey-value store associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestlist"}),(0,i.kt)("h2",{id:"apifyopenrequestlistlistname-sources-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestList(listName, sources, [options])")),(0,i.kt)("p",null,"Opens a request list and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that is already initialized."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," represents a list of URLs to crawl, which is always stored in memory. To enable picking up where left off after a\nprocess restart, the request list sources are persisted to the key-value store at initialization of the list. Then, while crawling, a small state\nobject is regularly persisted to keep track of the crawling status."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sources = ['https://www.example.com', 'https://www.google.com', 'https://www.bing.com'];\n\nconst requestList = await Apify.openRequestList('my-name', sources);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"listName")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," - Name of the request list to be opened. Setting a name enables the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to be persisted in the\nkey-value store. This is useful in case of a restart or migration. Since ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is only stored in memory, a restart or migration wipes it\nclean. Setting a name will enable the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to survive those situations and continue where it left off."),(0,i.kt)("p",{parentName:"li"},"The name will be used as a prefix in key-value store, producing keys such as ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_STATE")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_SOURCES"),"."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),", the list will not be persisted and will only be stored in memory. Process restart will then cause the list to be crawled again from the\nbeginning. We suggest always using a name.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"sources")),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|string)>"))," - An array of sources of URLs for the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," initializes. This is a measure to\nprevent memory leaks in situations when millions of sources are added."))),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," to download the\nsource URLs from a given remote location. The URLs will be parsed from the received response. In this case you can limit the URLs using ",(0,i.kt)("inlineCode",{parentName:"p"},"regex"),"\nparameter containing regular expression pattern for URLs to be included."),(0,i.kt)("p",null,"For details, see the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - The ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," options. Note that the\n",(0,i.kt)("inlineCode",{parentName:"li"},"listName")," parameter supersedes the ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persiststatekey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistStateKey"))," and\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey"))," options and the ",(0,i.kt)("inlineCode",{parentName:"li"},"sources")," parameter supersedes the\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," option.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestqueue"}),(0,i.kt)("h2",{id:"apifyopenrequestqueuequeueidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestQueue([queueIdOrName], [options])")),(0,i.kt)("p",null,"Opens a request queue and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud. The queue is\nused for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports\nboth breadth-first and depth-first crawling orders."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[queueIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the request queue to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default request\nqueue associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opensessionpool"}),(0,i.kt)("h2",{id:"apifyopensessionpoolsessionpooloptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openSessionPool(sessionPoolOptions)")),(0,i.kt)("p",null,"Opens a SessionPool and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that is already initialized."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionPoolOptions")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"pushdata"}),(0,i.kt)("h2",{id:"apifypushdataitem"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.pushData(item)")),(0,i.kt)("p",null,"Stores an object or an array of objects to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," of the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset();\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,i.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data are stored!"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object or array of objects containing data to be stored in the default dataset. The objects must be serializable to JSON\nand the JSON representation of each object must be smaller than 9MB.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"setvalue"}),(0,i.kt)("h2",{id:"apifysetvaluekey-value-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.setValue(key, value, [options])")),(0,i.kt)("p",null,"Stores or deletes a value in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"To get a value from the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," - Record data, which can be one of the following values:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,i.kt)("li",{parentName:"ul"},"If no ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(n),k=r,c=m["".concat(p,".").concat(k)]||m[k]||d[k]||i;return n?a.createElement(c,o(o({ref:t},u),{},{components:n})):a.createElement(c,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:r,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>m});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-apify",title:"Apify",id:"apify"},p=void 0,s={unversionedId:"api/apify",id:"version-1.3/api/apify",title:"Apify",description:"The following section describes all functions and properties provided by the apify package, except individual classes and namespaces that have their",source:"@site/versioned_docs/version-1.3/api/Apify.md",sourceDirName:"api",slug:"/api/apify",permalink:"/sdk/js/docs/1.3/api/apify",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Apify.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-apify",title:"Apify",id:"apify"},sidebar:"version-1.3/docs",previous:{title:"Use stealth mode",permalink:"/sdk/js/docs/1.3/examples/use-stealth-mode"},next:{title:"Configuration",permalink:"/sdk/js/docs/1.3/api/configuration"}},u={},m=[{value:"Apify Class",id:"apify-class",level:2},{value:"Apify.addWebhook(options)",id:"apifyaddwebhookoptions",level:2},{value:"Apify.call(actId, [input], [options])",id:"apifycallactid-input-options",level:2},{value:"Apify.callTask(taskId, [input], [options])",id:"apifycalltasktaskid-input-options",level:2},{value:"Apify.createProxyConfiguration([proxyConfigurationOptions])",id:"apifycreateproxyconfigurationproxyconfigurationoptions",level:2},{value:"Apify.events",id:"apifyevents",level:2},{value:"Apify.getEnv()",id:"apifygetenv",level:2},{value:"Apify.getInput()",id:"apifygetinput",level:2},{value:"Apify.getMemoryInfo()",id:"apifygetmemoryinfo",level:2},{value:"Apify.getValue(key)",id:"apifygetvaluekey",level:2},{value:"Apify.isAtHome()",id:"apifyisathome",level:2},{value:"Apify.launchPlaywright([launchContext])",id:"apifylaunchplaywrightlaunchcontext",level:2},{value:"Apify.launchPuppeteer([launchContext])",id:"apifylaunchpuppeteerlaunchcontext",level:2},{value:"Apify.main(userFunc)",id:"apifymainuserfunc",level:2},{value:"Apify.metamorph(targetActorId, [input], [options])",id:"apifymetamorphtargetactorid-input-options",level:2},{value:"Apify.newClient([options])",id:"apifynewclientoptions",level:2},{value:"Apify.openDataset([datasetIdOrName], [options])",id:"apifyopendatasetdatasetidorname-options",level:2},{value:"Apify.openKeyValueStore([storeIdOrName], [options])",id:"apifyopenkeyvaluestorestoreidorname-options",level:2},{value:"Apify.openRequestList(listName, sources, [options])",id:"apifyopenrequestlistlistname-sources-options",level:2},{value:"Apify.openRequestQueue([queueIdOrName], [options])",id:"apifyopenrequestqueuequeueidorname-options",level:2},{value:"Apify.openSessionPool(sessionPoolOptions)",id:"apifyopensessionpoolsessionpooloptions",level:2},{value:"Apify.pushData(item)",id:"apifypushdataitem",level:2},{value:"Apify.setValue(key, value, [options])",id:"apifysetvaluekey-value-options",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,i.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"apify"}),(0,i.kt)("p",null,"The following section describes all functions and properties provided by the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify")," package, except individual classes and namespaces that have their\nseparate, detailed, documentation pages accessible from the left sidebar. To learn how Apify SDK works, we suggest following the\n",(0,i.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started")," tutorial."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Important:")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The following functions: ",(0,i.kt)("inlineCode",{parentName:"p"},"addWebhook"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"call"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"newClient")," invoke features of the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," and\nrequire your scripts to be authenticated. See the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#logging-into-apify-platform-from-apify-sdk",target:null,rel:null},"authentication guide")," for\ninstructions.")),(0,i.kt)("h2",{id:"apify-class"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify")," Class"),(0,i.kt)("p",null,"As opposed to those helper functions, there is an alternative approach using ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," class (a named export). It has mostly the same API, but the\nmethods on ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," instance will use the configuration provided in the constructor. Environment variables will have precedence over this\nconfiguration."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n\n// the token will be passed to the `call` method automatically\nconst run = await sdk.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Another example shows how the default dataset name can be changed:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ defaultDatasetId: 'custom-name' });\nawait sdk.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify'); // use default export to get the helper functions\n\nconst dataset = await Apify.openDataset('custom-name');\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," for details about what can be configured and what are the default values."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addwebhook"}),(0,i.kt)("h2",{id:"apifyaddwebhookoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.addWebhook(options)")),(0,i.kt)("p",null,"Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed. For more information\nabout Apify actor webhooks, please see the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,"Note that webhooks are only supported for actors running on the Apify platform. In local environment, the function will print a warning and have no\neffect."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"eventTypes")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/event-types",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"EventTypes"))," - Array of event types, which you can set for actor run, see the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/events#actor-run",target:"_blank",rel:"noopener"},"actor run events")," in the Apify doc."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestUrl")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - URL which will be requested using HTTP POST request, when actor run will reach the set event type."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[payloadTemplate]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Payload template is a JSON-like string that describes the structure of the webhook POST request payload.\nIt uses JSON syntax, extended with a double curly braces syntax for injecting variables ",(0,i.kt)("inlineCode",{parentName:"li"},"{{variable}}"),". Those variables are resolved at the\ntime of the webhook's dispatch, and a list of available variables with their descriptions is available in the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"Apify webhook documentation"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"payloadTemplate")," is omitted, the default payload template is used\n(",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/actions#payload-template",target:"_blank",rel:"noopener"},"view docs"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[idempotencyKey]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Idempotency key enables you to ensure that a webhook will not be added multiple times in case of an actor\nrestart or other situation that would cause the ",(0,i.kt)("inlineCode",{parentName:"li"},"addWebhook()")," function to be called again. We suggest using the actor run ID as the\nidempotency key. You can get the run ID by calling ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#getenv",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/webhook-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(WebhookRun|undefined)>"))," - The return value is the Webhook object. For more information, see the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook",target:"_blank",rel:"noopener"},"Get webhook")," API endpoint."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"call"}),(0,i.kt)("h2",{id:"apifycallactid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.call(actId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the actor to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run fails, the function throws the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"If you want to run an actor task rather than an actor, please use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.callTask()"))," function instead."),(0,i.kt)("p",null,"For more information about actors, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"call()")," function invokes the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Run actor")," and several other\nAPI endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"actId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/actor-name")," or actor ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor run. If not provided, the run uses memory of\nthe default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor run to finish, in seconds. If the limit is reached, the returned promise is\nresolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[fetchOutput]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"false")," then the function does not fetch output of the actor."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[disableBodyParser]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function will not attempt to parse the actor's output and will\nreturn it in a raw ",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"calltask"}),(0,i.kt)("h2",{id:"apifycalltasktaskid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.callTask(taskId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor task on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the task to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run failed, the function fails with ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"Note that an actor task is a saved input configuration and options for an actor. If you want to run an actor directly rather than an actor task,\nplease use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function instead."),(0,i.kt)("p",null,"For more information about actor tasks, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/tasks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.callTask('bob/some-task');\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask()")," function calls the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actor-tasks/run-collection/run-task",target:"_blank",rel:"noopener"},"Run task")," and several\nother API endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"taskId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/task-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/task-name")," or task ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input overrides for the actor task. If it is an object, it will be stringified to JSON and its content type\nset to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Provided input will be merged with actor task input."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor task run. If not provided, the run uses memory\nof the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor task run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor task run to finish, in seconds. If the limit is reached, the returned promise\nis resolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor task to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"createproxyconfiguration"}),(0,i.kt)("h2",{id:"apifycreateproxyconfigurationproxyconfigurationoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.createProxyConfiguration([proxyConfigurationOptions])")),(0,i.kt)("p",null,"Creates a proxy configuration and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that is\nalready initialized."),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\n// Returns initialized proxy configuration class\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify proxy groups\n countryCode: 'US'\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("p",null,"For compatibility with existing Actor Input UI (Input Schema), this function returns ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," when the following object is passed as\n",(0,i.kt)("inlineCode",{parentName:"p"},"proxyConfigurationOptions"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{ useApifyProxy: false }\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[proxyConfigurationOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(ProxyConfiguration|undefined)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"events"}),(0,i.kt)("h2",{id:"apifyevents"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.events")),(0,i.kt)("p",null,"Gets an instance of a Node.js' ",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/events.html#events_class_eventemitter",target:"_blank",rel:"noopener"},"EventEmitter")," class that emits various events from the\nSDK or the Apify platform. The event emitter is initialized by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.events.on('cpuInfo', data => {\n if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');\n});\n")),(0,i.kt)("p",null,"The following events are emitted:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"cpuInfo"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isCpuOverloaded": Boolean }')," The event is emitted approximately every second and it indicates whether the actor is using the\nmaximum of available CPU resources. If that's the case, the actor should not add more workload. For example, this event is used by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"migrating"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"void")," Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon. You can use it to\npersist the state of the actor and gracefully stop your in-progress tasks, so that they are not interrupted by the migration. For example, this is\nused by the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"persistState"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isMigrating": Boolean }')," Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is\ntime to persist their state, in order to avoid repeating all work when the actor restarts. This event is automatically emitted together with the\n",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event, in which case the ",(0,i.kt)("inlineCode",{parentName:"li"},"isMigrating")," flag is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),". Otherwise the flag is ",(0,i.kt)("inlineCode",{parentName:"li"},"false"),". Note that the ",(0,i.kt)("inlineCode",{parentName:"li"},"persistState")," event is\nprovided merely for user convenience, you can achieve the same effect using ",(0,i.kt)("inlineCode",{parentName:"li"},"setInterval()")," and listening for the ",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getenv"}),(0,i.kt)("h2",{id:"apifygetenv"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getEnv()")),(0,i.kt)("p",null,"Returns a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))," object which contains information parsed from all the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables."),(0,i.kt)("p",null,"For the list of the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables, see ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#environment-variables",target:"_blank",rel:"noopener"},"Actor documentation"),". If some of\nthe variables are not defined or are invalid, the corresponding value in the resulting object will be null."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getinput"}),(0,i.kt)("h2",{id:"apifygetinput"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getInput()")),(0,i.kt)("p",null,"Gets the actor input value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"keyValueStore.getValue('INPUT')")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.getValue('INPUT');\n")),(0,i.kt)("p",null,"Note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"getInput()")," function does not cache the value read from the key-value store. If you need to use the input multiple times in your actor,\nit is far more efficient to read it once and store it locally."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getmemoryinfo"}),(0,i.kt)("h2",{id:"apifygetmemoryinfo"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getMemoryInfo()")),(0,i.kt)("p",null,"Returns memory statistics of the process and the system, see ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"MemoryInfo")),"."),(0,i.kt)("p",null,"If the process runs inside of Docker, the ",(0,i.kt)("inlineCode",{parentName:"p"},"getMemoryInfo")," gets container memory limits, otherwise it gets system memory limits."),(0,i.kt)("p",null,"Beware that the function is quite inefficient because it spawns a new process. Therefore you shouldn't call it too often, like more than once per\nsecond."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getvalue"}),(0,i.kt)("h2",{id:"apifygetvaluekey"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getValue(key)")),(0,i.kt)("p",null,"Gets a value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const value = await Apify.getValue('my-key');\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst value = await store.getValue('my-key');\n")),(0,i.kt)("p",null,"To store the value to the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isathome"}),(0,i.kt)("h2",{id:"apifyisathome"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.isAtHome()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," when code is running on Apify platform and ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," otherwise (for example locally)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchplaywright"}),(0,i.kt)("h2",{id:"apifylaunchplaywrightlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPlaywright([launchContext])")),(0,i.kt)("p",null,"Launches headless browsers using Playwright pre-configured to work within the Apify platform. The function has the same return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"browserType.launch()"),". See ",(0,i.kt)("a",{href:"https://playwright.dev/docs/api/class-browsertype",target:"_blank"}," Playwright documentation")," for more\ndetails."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPlaywright()")," function alters the following Playwright options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"launchOptions")," in a proper format. The proxy URL must define a port number and have one\nof the following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPlaywright")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/playwright",target:"_blank",rel:"noopener"},"Playwright")," NPM package installed in your project. When running\non the Apify Platform, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-*")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," - Optional settings passed to ",(0,i.kt)("inlineCode",{parentName:"li"},"browserType.launch()"),". In\naddition to ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions",target:"_blank",rel:"noopener"},"Playwright's options")," the object may\ncontain our own ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," that enable additional features.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchpuppeteer"}),(0,i.kt)("h2",{id:"apifylaunchpuppeteerlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPuppeteer([launchContext])")),(0,i.kt)("p",null,"Launches headless Chrome using Puppeteer pre-configured to work within the Apify platform. The function has the same argument and the return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"puppeteer.launch()"),". See ",(0,i.kt)("a",{href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions",target:"_blank"}," Puppeteer\ndocumentation")," for more details."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPuppeteer()")," function alters the following Puppeteer options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"args")," as ",(0,i.kt)("inlineCode",{parentName:"li"},"--proxy-server=XXX"),". The proxy URL must define a port number and have one of\nthe following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPuppeteer")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/puppeteer",target:"_blank",rel:"noopener"},"puppeteer")," NPM package installed in your project. When running on\nthe Apify cloud, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-chrome")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,"For an example of usage, see the ",(0,i.kt)("a",{parentName:"p",href:"../examples/synchronous-run",target:null,rel:null},"Synchronous run Example")," or the\n",(0,i.kt)("a",{parentName:"p",href:"../examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer proxy Example")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLauncher")," parameters are passed via an\nlaunchContext object. If you want to pass custom ",(0,i.kt)("inlineCode",{parentName:"li"},"puppeteer.launch(options)")," options you can use the ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLaunchContext.launchOptions"),"\nproperty.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"main"}),(0,i.kt)("h2",{id:"apifymainuserfunc"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.main(userFunc)")),(0,i.kt)("p",null,"Runs the main user function that performs the job of the actor and terminates the process when the user function finishes."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"The ",(0,i.kt)("inlineCode",{parentName:"strong"},"Apify.main()")," function is optional")," and is provided merely for your convenience. It is mainly useful when you're running your code as an actor\non the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),". However, if you want to use Apify SDK tools directly inside your existing projects, e.g. running in\nan ",(0,i.kt)("a",{parentName:"p",href:"https://expressjs.com/",target:"_blank",rel:"noopener"},"Express")," server, on ",(0,i.kt)("a",{parentName:"p",href:"https://cloud.google.com/functions",target:"_blank",rel:"noopener"},"Google Cloud functions")," or\n",(0,i.kt)("a",{parentName:"p",href:"https://aws.amazon.com/lambda/",target:"_blank",rel:"noopener"},"AWS Lambda"),", it's better to avoid it since the function terminates the main process when it finishes!"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.main()")," function performs the following actions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"When running on the Apify platform (i.e. ",(0,i.kt)("code",null,"APIFY_IS_AT_HOME")," environment variable is set), it sets up a connection to listen for\nplatform events. For example, to get a notification about an imminent migration to another server. See ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events"))," for\ndetails."),(0,i.kt)("li",{parentName:"ul"},"It checks that either ",(0,i.kt)("code",null,"APIFY_TOKEN")," or ",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," environment variable is defined. If not, the functions sets",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," to ",(0,i.kt)("code",null,"./apify_storage")," inside the current working directory. This is to simplify running code examples."),(0,i.kt)("li",{parentName:"ul"},"It invokes the user function passed as the ",(0,i.kt)("code",null,"userFunc")," parameter."),(0,i.kt)("li",{parentName:"ul"},"If the user function returned a promise, waits for it to resolve."),(0,i.kt)("li",{parentName:"ul"},"If the user function throws an exception or some other error is encountered, prints error details to console so that they are stored to the log."),(0,i.kt)("li",{parentName:"ul"},"Exits the Node.js process, with zero exit code on success and non-zero on errors.")),(0,i.kt)("p",null,"The user function can be synchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(() => {\n // My synchronous function that returns immediately\n console.log('Hello world from actor!');\n});\n")),(0,i.kt)("p",null,"If the user function returns a promise, it is considered asynchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const { requestAsBrowser } = require('some-request-library');\n\nApify.main(() => {\n // My asynchronous function that returns a promise\n return request('http://www.example.com').then(html => {\n console.log(html);\n });\n});\n")),(0,i.kt)("p",null,"To simplify your code, you can take advantage of the ",(0,i.kt)("inlineCode",{parentName:"p"},"async"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = require('some-request-library');\n\nApify.main(async () => {\n // My asynchronous function\n const html = await request('http://www.example.com');\n console.log(html);\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"userFunc")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/user-func",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"UserFunc"))," - User function to be executed. If it returns a promise, the promise will be awaited. The user\nfunction is called with no arguments.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"metamorph"}),(0,i.kt)("h2",{id:"apifymetamorphtargetactorid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.metamorph(targetActorId, [input], [options])")),(0,i.kt)("p",null,"Transforms this actor run to an actor run of a given actor. The system stops the current container and starts the new container instead. All the\ndefault storages are preserved and the new input is stored under the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT-METAMORPH-1")," key in the same default key-value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"targetActorId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Either ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name")," or actor ID of an actor to which we want to metamorph."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the target actor build to metamorph into (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses\nbuild tag or number from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),").")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newclient"}),(0,i.kt)("h2",{id:"apifynewclientoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.newClient([options])")),(0,i.kt)("p",null,"Returns a new instance of the Apify API client. The ",(0,i.kt)("inlineCode",{parentName:"p"},"ApifyClient")," class is provided by the"),(0,i.kt)("a",{href:"https://www.npmjs.com/package/apify-client",target:"_blank"},"apify-client")," NPM package, and it is automatically configured using the `APIFY_API_BASE_URL`, and `APIFY_TOKEN` environment variables. You can override the token via the available options. That's useful if you want to use the client as a different Apify user than the SDK internals are using.",(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string"))))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opendataset"}),(0,i.kt)("h2",{id:"apifyopendatasetdatasetidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openDataset([datasetIdOrName], [options])")),(0,i.kt)("p",null,"Opens a dataset and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. The\nactual data is stored either on the local filesystem or in the cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[datasetIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the dataset to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default dataset\nassociated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openkeyvaluestore"}),(0,i.kt)("h2",{id:"apifyopenkeyvaluestorestoreidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openKeyValueStore([storeIdOrName], [options])")),(0,i.kt)("p",null,"Opens a key-value store and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,"Key-value stores are used to store records or files, along with their MIME content type. The records are stored and retrieved using a unique key. The\nactual data is stored either on a local filesystem or in the Apify cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[storeIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the key-value store to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default\nkey-value store associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestlist"}),(0,i.kt)("h2",{id:"apifyopenrequestlistlistname-sources-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestList(listName, sources, [options])")),(0,i.kt)("p",null,"Opens a request list and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that is already initialized."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," represents a list of URLs to crawl, which is always stored in memory. To enable picking up where left off after a\nprocess restart, the request list sources are persisted to the key-value store at initialization of the list. Then, while crawling, a small state\nobject is regularly persisted to keep track of the crawling status."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sources = ['https://www.example.com', 'https://www.google.com', 'https://www.bing.com'];\n\nconst requestList = await Apify.openRequestList('my-name', sources);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"listName")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," - Name of the request list to be opened. Setting a name enables the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to be persisted in the\nkey-value store. This is useful in case of a restart or migration. Since ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is only stored in memory, a restart or migration wipes it\nclean. Setting a name will enable the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to survive those situations and continue where it left off."),(0,i.kt)("p",{parentName:"li"},"The name will be used as a prefix in key-value store, producing keys such as ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_STATE")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_SOURCES"),"."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),", the list will not be persisted and will only be stored in memory. Process restart will then cause the list to be crawled again from the\nbeginning. We suggest always using a name.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"sources")),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|string)>"))," - An array of sources of URLs for the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," initializes. This is a measure to\nprevent memory leaks in situations when millions of sources are added."))),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," to download the\nsource URLs from a given remote location. The URLs will be parsed from the received response. In this case you can limit the URLs using ",(0,i.kt)("inlineCode",{parentName:"p"},"regex"),"\nparameter containing regular expression pattern for URLs to be included."),(0,i.kt)("p",null,"For details, see the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - The ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," options. Note that the\n",(0,i.kt)("inlineCode",{parentName:"li"},"listName")," parameter supersedes the ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persiststatekey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistStateKey"))," and\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey"))," options and the ",(0,i.kt)("inlineCode",{parentName:"li"},"sources")," parameter supersedes the\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," option.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestqueue"}),(0,i.kt)("h2",{id:"apifyopenrequestqueuequeueidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestQueue([queueIdOrName], [options])")),(0,i.kt)("p",null,"Opens a request queue and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud. The queue is\nused for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports\nboth breadth-first and depth-first crawling orders."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[queueIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the request queue to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default request\nqueue associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opensessionpool"}),(0,i.kt)("h2",{id:"apifyopensessionpoolsessionpooloptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openSessionPool(sessionPoolOptions)")),(0,i.kt)("p",null,"Opens a SessionPool and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that is already initialized."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionPoolOptions")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"pushdata"}),(0,i.kt)("h2",{id:"apifypushdataitem"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.pushData(item)")),(0,i.kt)("p",null,"Stores an object or an array of objects to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," of the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset();\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,i.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data are stored!"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object or array of objects containing data to be stored in the default dataset. The objects must be serializable to JSON\nand the JSON representation of each object must be smaller than 9MB.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"setvalue"}),(0,i.kt)("h2",{id:"apifysetvaluekey-value-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.setValue(key, value, [options])")),(0,i.kt)("p",null,"Stores or deletes a value in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"To get a value from the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," - Record data, which can be one of the following values:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,i.kt)("li",{parentName:"ul"},"If no ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(n),k=r,c=m["".concat(p,".").concat(k)]||m[k]||d[k]||i;return n?a.createElement(c,o(o({ref:t},u),{},{components:n})):a.createElement(c,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:r,o[1]=l;for(var s=2;s{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var n=t(87462),a=t(63366),p=(t(67294),t(3905)),o=["components"],i={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},l=void 0,u={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-2.3/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl",source:"@site/versioned_docs/version-2.3/examples/puppeteer_recursive_crawl.md",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_recursive_crawl.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"version-2.3/docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/2.3/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/2.3/examples/puppeteer-with-proxy"}},c={},s=[],f={toc:s},m="wrapper";function d(e){var r=e.components,t=(0,a.Z)(e,o);return(0,p.kt)(m,(0,n.Z)({},f,t,{components:r,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"Run the following example to perform a recursive crawl\nof a website using ",(0,p.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n });\n\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>d});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),s=u(t),m=a,d=s["".concat(l,".").concat(m)]||s[m]||f[m]||p;return t?n.createElement(d,o(o({ref:r},c),{},{components:t})):n.createElement(d,o({ref:r},c))}));function d(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var p=t.length,o=new Array(p);o[0]=m;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var n=t(87462),a=t(63366),p=(t(67294),t(3905)),o=["components"],i={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},l=void 0,u={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-2.3/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl",source:"@site/versioned_docs/version-2.3/examples/puppeteer_recursive_crawl.md",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_recursive_crawl.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"version-2.3/docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/2.3/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/2.3/examples/puppeteer-with-proxy"}},c={},s=[],f={toc:s},m="wrapper";function d(e){var r=e.components,t=(0,a.Z)(e,o);return(0,p.kt)(m,(0,n.Z)({},f,t,{components:r,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"Run the following example to perform a recursive crawl\nof a website using ",(0,p.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n });\n\n await crawler.run();\n});\n")))}d.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>d});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},s="mdxType",f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),s=u(t),m=a,d=s["".concat(l,".").concat(m)]||s[m]||f[m]||p;return t?n.createElement(d,o(o({ref:r},c),{},{components:t})):n.createElement(d,o({ref:r},c))}));function d(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var p=t.length,o=new Array(p);o[0]=m;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-session-options",title:"SessionOptions",id:"session-options"},l=void 0,p={unversionedId:"typedefs/session-options",id:"version-1.3/typedefs/session-options",title:"SessionOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SessionOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-options",permalink:"/sdk/js/docs/1.3/typedefs/session-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-session-options",title:"SessionOptions",id:"session-options"},sidebar:"version-1.3/docs",previous:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-options"},next:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-pool-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"maxAgeSecs",id:"maxagesecs",level:3},{value:"userData",id:"userdata",level:3},{value:"maxErrorScore",id:"maxerrorscore",level:3},{value:"errorScoreDecrement",id:"errorscoredecrement",level:3},{value:"createdAt",id:"createdat",level:3},{value:"expiresAt",id:"expiresat",level:3},{value:"usageCount",id:"usagecount",level:3},{value:"errorCount",id:"errorcount",level:3},{value:"maxUsageCount",id:"maxusagecount",level:3},{value:"sessionPool",id:"sessionpool",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,s.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"sessionoptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"id"},(0,s.kt)("inlineCode",{parentName:"h3"},"id")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"Id of session used for generating fingerprints. It is used as proxy session name."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxagesecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxAgeSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3000")),(0,s.kt)("p",null,"Number of seconds after which the session is considered as expired."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"userdata"},(0,s.kt)("inlineCode",{parentName:"h3"},"userData")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Object")),(0,s.kt)("p",null,"Object where custom user data can be stored. For example custom headers."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxerrorscore"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3")),(0,s.kt)("p",null,"Maximum number of marking session as blocked usage. If the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," reaches the ",(0,s.kt)("inlineCode",{parentName:"p"},"maxErrorScore")," session is marked as block and it is thrown away.\nIt starts at 0. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markBad")," function increases the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by 1. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markGood")," will decrease the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by\n",(0,s.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement")),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorscoredecrement"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.5")),(0,s.kt)("p",null,"It is used for healing the session. For example: if your session is marked bad two times, but it is successful on the third attempt it's errorScore is\ndecremented by this number."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"createdat"},(0,s.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of creation."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"expiresat"},(0,s.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of expiration."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session has been used."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorcount"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session is marked bad."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 50")),(0,s.kt)("p",null,"Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"sessionpool"},(0,s.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,s.kt)("p",null,"SessionPool instance. Session will emit the ",(0,s.kt)("inlineCode",{parentName:"p"},"sessionRetired")," event on this instance."),(0,s.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||s;return n?r.createElement(k,i(i({ref:t},d),{},{components:n})):r.createElement(k,i({ref:t},d))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-session-options",title:"SessionOptions",id:"session-options"},l=void 0,p={unversionedId:"typedefs/session-options",id:"version-1.3/typedefs/session-options",title:"SessionOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SessionOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-options",permalink:"/sdk/js/docs/1.3/typedefs/session-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-session-options",title:"SessionOptions",id:"session-options"},sidebar:"version-1.3/docs",previous:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-options"},next:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-pool-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"maxAgeSecs",id:"maxagesecs",level:3},{value:"userData",id:"userdata",level:3},{value:"maxErrorScore",id:"maxerrorscore",level:3},{value:"errorScoreDecrement",id:"errorscoredecrement",level:3},{value:"createdAt",id:"createdat",level:3},{value:"expiresAt",id:"expiresat",level:3},{value:"usageCount",id:"usagecount",level:3},{value:"errorCount",id:"errorcount",level:3},{value:"maxUsageCount",id:"maxusagecount",level:3},{value:"sessionPool",id:"sessionpool",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,s.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"sessionoptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"id"},(0,s.kt)("inlineCode",{parentName:"h3"},"id")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"Id of session used for generating fingerprints. It is used as proxy session name."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxagesecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxAgeSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3000")),(0,s.kt)("p",null,"Number of seconds after which the session is considered as expired."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"userdata"},(0,s.kt)("inlineCode",{parentName:"h3"},"userData")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Object")),(0,s.kt)("p",null,"Object where custom user data can be stored. For example custom headers."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxerrorscore"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3")),(0,s.kt)("p",null,"Maximum number of marking session as blocked usage. If the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," reaches the ",(0,s.kt)("inlineCode",{parentName:"p"},"maxErrorScore")," session is marked as block and it is thrown away.\nIt starts at 0. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markBad")," function increases the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by 1. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markGood")," will decrease the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by\n",(0,s.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement")),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorscoredecrement"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.5")),(0,s.kt)("p",null,"It is used for healing the session. For example: if your session is marked bad two times, but it is successful on the third attempt it's errorScore is\ndecremented by this number."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"createdat"},(0,s.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of creation."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"expiresat"},(0,s.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of expiration."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session has been used."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorcount"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session is marked bad."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 50")),(0,s.kt)("p",null,"Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"sessionpool"},(0,s.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,s.kt)("p",null,"SessionPool instance. Session will emit the ",(0,s.kt)("inlineCode",{parentName:"p"},"sessionRetired")," event on this instance."),(0,s.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||s;return n?r.createElement(k,i(i({ref:t},d),{},{components:n})):r.createElement(k,i({ref:t},d))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p{o.d(n,{Z:()=>i});var t=o(67294),s=o(88746),r=o(6141),a=o(6832);const i=function(e){var n=e.to,o=e.children,i=(0,r.E)(),l=i.version,c=i.isLast;if((0,a.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(s.default,{to:"/api/"+n},o);var u=l+"/";return"current"===l?u="next/":c&&(u=""),t.createElement(s.default,{to:"/api/"+u+n},o)}},26569:(e,n,o)=>{o.d(n,{B:()=>i,T:()=>a});var t=o(67294),s=o(88746),r="https://crawlee.dev",a=function(e){var n=e.to,o=e.children,a=e.version;return t.createElement(s.default,{href:r+"/api"+(a?"/"+a:"")+"/"+n},o)},i=function(e){var n=e.to,o=e.children;return t.createElement(s.default,{href:r+"/"+n},o)}},41896:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>d,contentTitle:()=>u,default:()=>h,frontMatter:()=>c,metadata:()=>p,toc:()=>m});var t,s=o(87462),r=o(63366),a=(o(67294),o(3905)),i=(o(68889),o(26569)),l=["components"],c={id:"session-management",title:"Session Management"},u=void 0,p={unversionedId:"guides/session-management",id:"guides/session-management",title:"Session Management",description:"​SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/../docs/guides/session_management.mdx",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/next/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/session_management.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/next/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/next/guides/type-script-actor"}},d={},m=[],g=(t="Crawlee",function(e){return console.warn("Component "+t+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:m},y="wrapper";function h(e){var n=e.components,o=(0,r.Z)(e,l);return(0,a.kt)(y,(0,s.Z)({},f,o,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"\u200b",(0,a.kt)(g,{to:"core/class/SessionPool",mdxType:"Crawlee"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,a.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,a.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"PuppeteerCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"CheerioCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"BasicCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"}," const { gotScraping } = require('got-scraping');\n const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await gotScraping(requestOptions);\n } catch (e) {\n if (e === \"SomeNetworkError\") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n }\n});\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example solo usage")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"Actor.main(async () => {\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await SessionPool.open(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,a.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}h.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>u,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),c=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},u=function(e){var n=c(e.components);return t.createElement(l.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(o),m=s,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},u),{},{components:o})):t.createElement(g,a({ref:n},u))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{o.d(n,{Z:()=>i});var t=o(67294),s=o(88746),r=o(6141),a=o(6832);const i=function(e){var n=e.to,o=e.children,i=(0,r.E)(),l=i.version,c=i.isLast;if((0,a.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(s.default,{to:"/api/"+n},o);var u=l+"/";return"current"===l?u="next/":c&&(u=""),t.createElement(s.default,{to:"/api/"+u+n},o)}},26569:(e,n,o)=>{o.d(n,{B:()=>i,T:()=>a});var t=o(67294),s=o(88746),r="https://crawlee.dev",a=function(e){var n=e.to,o=e.children,a=e.version;return t.createElement(s.default,{href:r+"/api"+(a?"/"+a:"")+"/"+n},o)},i=function(e){var n=e.to,o=e.children;return t.createElement(s.default,{href:r+"/"+n},o)}},41896:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>d,contentTitle:()=>u,default:()=>h,frontMatter:()=>c,metadata:()=>p,toc:()=>m});var t,s=o(87462),r=o(63366),a=(o(67294),o(3905)),i=(o(68889),o(26569)),l=["components"],c={id:"session-management",title:"Session Management"},u=void 0,p={unversionedId:"guides/session-management",id:"guides/session-management",title:"Session Management",description:"​SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/../docs/guides/session_management.mdx",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/next/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/session_management.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/next/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/next/guides/type-script-actor"}},d={},m=[],g=(t="Crawlee",function(e){return console.warn("Component "+t+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:m},y="wrapper";function h(e){var n=e.components,o=(0,r.Z)(e,l);return(0,a.kt)(y,(0,s.Z)({},f,o,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"\u200b",(0,a.kt)(g,{to:"core/class/SessionPool",mdxType:"Crawlee"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,a.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,a.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"PuppeteerCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"CheerioCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"BasicCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"}," const { gotScraping } = require('got-scraping');\n const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await gotScraping(requestOptions);\n } catch (e) {\n if (e === \"SomeNetworkError\") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n }\n});\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example solo usage")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"Actor.main(async () => {\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await SessionPool.open(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,a.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}h.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>u,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),c=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},u=function(e){var n=c(e.components);return t.createElement(l.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(o),m=s,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},u),{},{components:o})):t.createElement(g,a({ref:n},u))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={},s=void 0,c={unversionedId:"readme/support",id:"readme/support",title:"support",description:"Support",source:"@site/../docs/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/next/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/support.md",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},l={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"support"},"Support"),(0,o.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,o.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,o.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,o.kt)("h2",{id:"contributing"},"Contributing"),(0,o.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,o.kt)("h2",{id:"license"},"License"),(0,o.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,o.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,o.kt)("p",null,"Many thanks to ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,c={unversionedId:"readme/support",id:"readme/support",title:"support",description:"Support",source:"@site/../docs/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/next/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/support.md",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},l={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"queue-operation-info",title:"QueueOperationInfo"},s=void 0,p={unversionedId:"typedefs/queue-operation-info",id:"version-2.3/typedefs/queue-operation-info",title:"QueueOperationInfo",description:"A helper class that is used to report results from various RequestQueue functions as well as",source:"@site/versioned_docs/version-2.3/typedefs/QueueOperationInfo.md",sourceDirName:"typedefs",slug:"/typedefs/queue-operation-info",permalink:"/sdk/js/docs/2.3/typedefs/queue-operation-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/QueueOperationInfo.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"queue-operation-info",title:"QueueOperationInfo"},sidebar:"version-2.3/docs",previous:{title:"MemoryInfo",permalink:"/sdk/js/docs/2.3/typedefs/memory-info"},next:{title:"RequestListState",permalink:"/sdk/js/docs/2.3/typedefs/request-list-state"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"wasAlreadyPresent",id:"wasalreadypresent",level:3},{value:"wasAlreadyHandled",id:"wasalreadyhandled",level:3},{value:"requestId",id:"requestid",level:3},{value:"request",id:"request",level:3}],c={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"queueoperationinfo"}),(0,o.kt)("p",null,"A helper class that is used to report results from various ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," functions as well as\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"wasalreadypresent"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyPresent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already present in the queue."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"wasalreadyhandled"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyHandled")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already marked as handled."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestid"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ID of the added request"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object passed to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue")," function."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||c[f]||o;return r?n.createElement(m,i(i({ref:t},u),{},{components:r})):n.createElement(m,i({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"queue-operation-info",title:"QueueOperationInfo"},s=void 0,u={unversionedId:"typedefs/queue-operation-info",id:"version-2.3/typedefs/queue-operation-info",title:"QueueOperationInfo",description:"A helper class that is used to report results from various RequestQueue functions as well as",source:"@site/versioned_docs/version-2.3/typedefs/QueueOperationInfo.md",sourceDirName:"typedefs",slug:"/typedefs/queue-operation-info",permalink:"/sdk/js/docs/2.3/typedefs/queue-operation-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/QueueOperationInfo.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"queue-operation-info",title:"QueueOperationInfo"},sidebar:"version-2.3/docs",previous:{title:"MemoryInfo",permalink:"/sdk/js/docs/2.3/typedefs/memory-info"},next:{title:"RequestListState",permalink:"/sdk/js/docs/2.3/typedefs/request-list-state"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"wasAlreadyPresent",id:"wasalreadypresent",level:3},{value:"wasAlreadyHandled",id:"wasalreadyhandled",level:3},{value:"requestId",id:"requestid",level:3},{value:"request",id:"request",level:3}],c={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"queueoperationinfo"}),(0,o.kt)("p",null,"A helper class that is used to report results from various ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," functions as well as\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"wasalreadypresent"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyPresent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already present in the queue."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"wasalreadyhandled"},(0,o.kt)("inlineCode",{parentName:"h3"},"wasAlreadyHandled")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Indicates if request was already marked as handled."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestid"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ID of the added request"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object passed to the ",(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue")," function."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),u=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||c[f]||o;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:a,i[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),o=["components"],i={id_old:"version-2.3.0-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},s=void 0,p={unversionedId:"api/cheerio-crawler",id:"version-2.3/api/cheerio-crawler",title:"CheerioCrawler",description:"Provides a framework for the parallel crawling of web pages using plain HTTP requests and cheerio HTML",source:"@site/versioned_docs/version-2.3/api/CheerioCrawler.md",sourceDirName:"api",slug:"/api/cheerio-crawler",permalink:"/sdk/js/docs/2.3/api/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/CheerioCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},sidebar:"version-2.3/docs",previous:{title:"BasicCrawler",permalink:"/sdk/js/docs/2.3/api/basic-crawler"},next:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/2.3/api/playwright-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new CheerioCrawler(options)",id:"new-cheeriocrawleroptions",level:2},{value:"cheerioCrawler.optionsShape",id:"cheeriocrawleroptionsshape",level:2},{value:"cheerioCrawler.use(extension)",id:"cheeriocrawleruseextension",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("p",null,"Provides a framework for the parallel crawling of web pages using plain HTTP requests and ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," HTML\nparser. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," uses raw HTTP requests to download web pages, it is very fast and efficient on data bandwidth. However, if the target website\nrequires JavaScript to display the content, you might need to use ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," instead, because it loads the pages using full-featured headless Chrome browser."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads each URL using a plain HTTP request, parses the HTML content using ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," and\nthen invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction"))," to extract page\ndata using a ",(0,l.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery"),"-like interface to the parsed HTML DOM."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads the web pages using the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," utility function. As opposed to the\nbrowser based crawlers that are automatically encoding the URLs, the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," function will not\ndo so. We either need to manually encode the URLs via ",(0,l.kt)("inlineCode",{parentName:"p"},"encodeURI()")," function, or set ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding: true")," in the ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which\nwill automatically encode all the URLs before accessing them."),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"We can either use ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding")," or encode manually, but not both - it would result in double encoding and therefore lead to invalid URLs.")),(0,l.kt)("p",null,"We can use the ",(0,l.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," to adjust ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n },\n]\n")),(0,l.kt)("p",null,"By default, ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," only processes web pages with the ",(0,l.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME content types (as reported by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"Content-Type")," HTTP header), and skips pages with other content types. If you want the crawler to process other content types, use the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#additionalmimetypes",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.additionalMimeTypes"))," constructor option. Beware that the parsing\nbehavior differs for HTML, XML, JSON and other types of content. For details, see\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction")),"."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ request, response, body, contentType, $ }) => {\n const data = [];\n\n // Do some data extraction from the page with Cheerio.\n $('.some-collection').each((index, el) => {\n data.push({\n title: $(el)\n .find('.some-title')\n .text(),\n });\n });\n\n // Save the data to dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n data,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("h2",{id:"new-cheeriocrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new CheerioCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/cheerio-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"cheeriocrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"use"}),(0,l.kt)("h2",{id:"cheeriocrawleruseextension"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.use(extension)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"EXPERIMENTAL")," Function for attaching CrawlerExtensions such as the Unblockers."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"extension")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"CrawlerExtension")," - Crawler extension that overrides the crawler configuration.")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),h=n,m=c["".concat(s,".").concat(h)]||c[h]||d[h]||l;return r?a.createElement(m,o(o({ref:t},u),{},{components:r})):a.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,o=new Array(l);o[0]=h;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),o=["components"],i={id_old:"version-2.3.0-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},s=void 0,p={unversionedId:"api/cheerio-crawler",id:"version-2.3/api/cheerio-crawler",title:"CheerioCrawler",description:"Provides a framework for the parallel crawling of web pages using plain HTTP requests and cheerio HTML",source:"@site/versioned_docs/version-2.3/api/CheerioCrawler.md",sourceDirName:"api",slug:"/api/cheerio-crawler",permalink:"/sdk/js/docs/2.3/api/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/CheerioCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-cheerio-crawler",title:"CheerioCrawler",id:"cheerio-crawler"},sidebar:"version-2.3/docs",previous:{title:"BasicCrawler",permalink:"/sdk/js/docs/2.3/api/basic-crawler"},next:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/2.3/api/playwright-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new CheerioCrawler(options)",id:"new-cheeriocrawleroptions",level:2},{value:"cheerioCrawler.optionsShape",id:"cheeriocrawleroptionsshape",level:2},{value:"cheerioCrawler.use(extension)",id:"cheeriocrawleruseextension",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("p",null,"Provides a framework for the parallel crawling of web pages using plain HTTP requests and ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," HTML\nparser. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," uses raw HTTP requests to download web pages, it is very fast and efficient on data bandwidth. However, if the target website\nrequires JavaScript to display the content, you might need to use ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," instead, because it loads the pages using full-featured headless Chrome browser."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads each URL using a plain HTTP request, parses the HTML content using ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," and\nthen invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction"))," to extract page\ndata using a ",(0,l.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery"),"-like interface to the parsed HTML DOM."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," downloads the web pages using the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," utility function. As opposed to the\nbrowser based crawlers that are automatically encoding the URLs, the ",(0,l.kt)("inlineCode",{parentName:"p"},"["),"utils.requestAsBrowser()",(0,l.kt)("inlineCode",{parentName:"p"},"](../api/utils#requestasbrowser)")," function will not\ndo so. We either need to manually encode the URLs via ",(0,l.kt)("inlineCode",{parentName:"p"},"encodeURI()")," function, or set ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding: true")," in the ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which\nwill automatically encode all the URLs before accessing them."),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"We can either use ",(0,l.kt)("inlineCode",{parentName:"p"},"forceUrlEncoding")," or encode manually, but not both - it would result in double encoding and therefore lead to invalid URLs.")),(0,l.kt)("p",null,"We can use the ",(0,l.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," to adjust ",(0,l.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n },\n]\n")),(0,l.kt)("p",null,"By default, ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," only processes web pages with the ",(0,l.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME content types (as reported by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"Content-Type")," HTTP header), and skips pages with other content types. If you want the crawler to process other content types, use the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#additionalmimetypes",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.additionalMimeTypes"))," constructor option. Beware that the parsing\nbehavior differs for HTML, XML, JSON and other types of content. For details, see\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.handlePageFunction")),"."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ request, response, body, contentType, $ }) => {\n const data = [];\n\n // Do some data extraction from the page with Cheerio.\n $('.some-collection').each((index, el) => {\n data.push({\n title: $(el)\n .find('.some-title')\n .text(),\n });\n });\n\n // Save the data to dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n data,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"cheeriocrawler"}),(0,l.kt)("h2",{id:"new-cheeriocrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new CheerioCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/cheerio-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"cheeriocrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"use"}),(0,l.kt)("h2",{id:"cheeriocrawleruseextension"},(0,l.kt)("inlineCode",{parentName:"h2"},"cheerioCrawler.use(extension)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"EXPERIMENTAL")," Function for attaching CrawlerExtensions such as the Unblockers."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"extension")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"CrawlerExtension")," - Crawler extension that overrides the crawler configuration.")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(r),h=n,m=c["".concat(s,".").concat(h)]||c[h]||d[h]||l;return r?a.createElement(m,o(o({ref:t},u),{},{components:r})):a.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,o=new Array(l);o[0]=h;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id_old:"version-2.3.0-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"},l=void 0,s={unversionedId:"typedefs/puppeteer-hook",id:"version-2.3/typedefs/puppeteer-hook",title:"PuppeteerHook",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerHook.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-hook",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHook.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerhook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"any"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(r),f=o,m=c["".concat(l,".").concat(f)]||c[f]||d[f]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:o,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id_old:"version-2.3.0-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"},l=void 0,s={unversionedId:"typedefs/puppeteer-hook",id:"version-2.3/typedefs/puppeteer-hook",title:"PuppeteerHook",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerHook.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-hook",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHook.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-hook",title:"PuppeteerHook",id:"puppeteer-hook"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerhook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"any"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(r),f=o,m=c["".concat(l,".").concat(f)]||c[f]||d[f]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:o,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),i=["components"],a={id_old:"version-1.3-memory-info",title:"MemoryInfo",id:"memory-info"},l=void 0,p={unversionedId:"typedefs/memory-info",id:"version-1.3/typedefs/memory-info",title:"MemoryInfo",description:"Describes memory usage of an Actor.",source:"@site/versioned_docs/version-1.3/typedefs/MemoryInfo.md",sourceDirName:"typedefs",slug:"/typedefs/memory-info",permalink:"/sdk/js/docs/1.3/typedefs/memory-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/MemoryInfo.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-memory-info",title:"MemoryInfo",id:"memory-info"},sidebar:"version-1.3/docs",previous:{title:"DatasetContent",permalink:"/sdk/js/docs/1.3/typedefs/dataset-content"},next:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/1.3/typedefs/queue-operation-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"totalBytes",id:"totalbytes",level:3},{value:"freeBytes",id:"freebytes",level:3},{value:"usedBytes",id:"usedbytes",level:3},{value:"mainProcessBytes",id:"mainprocessbytes",level:3},{value:"childProcessesBytes",id:"childprocessesbytes",level:3}],m={toc:c},u="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,s.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"memoryinfo"}),(0,s.kt)("p",null,"Describes memory usage of an Actor."),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"totalbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"totalBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Total memory available in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"freebytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"freeBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of free memory in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usedbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"usedBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used (= totalBytes - freeBytes)"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"mainprocessbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"mainProcessBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used the current Node.js process"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"childprocessesbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"childProcessesBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used by child processes of the current Node.js process"),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(r),u=o,y=c["".concat(l,".").concat(u)]||c[u]||m[u]||s;return r?n.createElement(y,i(i({ref:t},d),{},{components:r})):n.createElement(y,i({ref:t},d))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,i=new Array(s);i[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),i=["components"],a={id_old:"version-1.3-memory-info",title:"MemoryInfo",id:"memory-info"},l=void 0,p={unversionedId:"typedefs/memory-info",id:"version-1.3/typedefs/memory-info",title:"MemoryInfo",description:"Describes memory usage of an Actor.",source:"@site/versioned_docs/version-1.3/typedefs/MemoryInfo.md",sourceDirName:"typedefs",slug:"/typedefs/memory-info",permalink:"/sdk/js/docs/1.3/typedefs/memory-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/MemoryInfo.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-memory-info",title:"MemoryInfo",id:"memory-info"},sidebar:"version-1.3/docs",previous:{title:"DatasetContent",permalink:"/sdk/js/docs/1.3/typedefs/dataset-content"},next:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/1.3/typedefs/queue-operation-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"totalBytes",id:"totalbytes",level:3},{value:"freeBytes",id:"freebytes",level:3},{value:"usedBytes",id:"usedbytes",level:3},{value:"mainProcessBytes",id:"mainprocessbytes",level:3},{value:"childProcessesBytes",id:"childprocessesbytes",level:3}],m={toc:c},u="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,s.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"memoryinfo"}),(0,s.kt)("p",null,"Describes memory usage of an Actor."),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"totalbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"totalBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Total memory available in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"freebytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"freeBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of free memory in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usedbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"usedBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used (= totalBytes - freeBytes)"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"mainprocessbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"mainProcessBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used the current Node.js process"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"childprocessesbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"childProcessesBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used by child processes of the current Node.js process"),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(r),u=o,y=c["".concat(l,".").concat(u)]||c[u]||m[u]||s;return r?n.createElement(y,i(i({ref:t},d),{},{components:r})):n.createElement(y,i({ref:t},d))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,i=new Array(s);i[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),o=["components"],i={id_old:"version-1.3-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},p=void 0,s={unversionedId:"api/playwright-crawler",id:"version-1.3/api/playwright-crawler",title:"PlaywrightCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with",source:"@site/versioned_docs/version-1.3/api/PlaywrightCrawler.md",sourceDirName:"api",slug:"/api/playwright-crawler",permalink:"/sdk/js/docs/1.3/api/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PlaywrightCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},sidebar:"version-1.3/docs",previous:{title:"CheerioCrawler",permalink:"/sdk/js/docs/1.3/api/cheerio-crawler"},next:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/1.3/api/puppeteer-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"browserPool",id:"browserpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new PlaywrightCrawler(options)",id:"new-playwrightcrawleroptions",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,o);return(0,l.kt)(h,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs\nenabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"Playwright")," uses headless browser to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Playwright instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class. Many constructor options such as\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#maxopenpagesperinstance",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.maxOpenPagesPerInstance"))," or"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Playwright.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("h2",{id:"new-playwrightcrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PlaywrightCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/playwright-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=r.createContext({}),s=function(e){var t=r.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),h=n,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||l;return a?r.createElement(m,o(o({ref:t},u),{},{components:a})):r.createElement(m,o({ref:t},u))}));function m(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,o=new Array(l);o[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),o=["components"],i={id_old:"version-1.3-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},p=void 0,s={unversionedId:"api/playwright-crawler",id:"version-1.3/api/playwright-crawler",title:"PlaywrightCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with",source:"@site/versioned_docs/version-1.3/api/PlaywrightCrawler.md",sourceDirName:"api",slug:"/api/playwright-crawler",permalink:"/sdk/js/docs/1.3/api/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PlaywrightCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},sidebar:"version-1.3/docs",previous:{title:"CheerioCrawler",permalink:"/sdk/js/docs/1.3/api/cheerio-crawler"},next:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/1.3/api/puppeteer-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"browserPool",id:"browserpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new PlaywrightCrawler(options)",id:"new-playwrightcrawleroptions",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,o);return(0,l.kt)(h,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs\nenabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"Playwright")," uses headless browser to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Playwright instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class. Many constructor options such as\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#maxopenpagesperinstance",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.maxOpenPagesPerInstance"))," or"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Playwright.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("h2",{id:"new-playwrightcrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PlaywrightCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/playwright-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=r.createContext({}),s=function(e){var t=r.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),h=n,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||l;return a?r.createElement(m,o(o({ref:t},u),{},{components:a})):r.createElement(m,o({ref:t},u))}));function m(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,o=new Array(l);o[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>l});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],c={id_old:"version-1.3-proxy-configuration-function",title:"ProxyConfigurationFunction",id:"proxy-configuration-function"},p=void 0,u={unversionedId:"typedefs/proxy-configuration-function",id:"version-1.3/typedefs/proxy-configuration-function",title:"ProxyConfigurationFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/ProxyConfigurationFunction.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-function",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-proxy-configuration-function",title:"ProxyConfigurationFunction",id:"proxy-configuration-function"}},s={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfigurationfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),l=u(n),d=o,y=l["".concat(p,".").concat(d)]||l[d]||f[d]||i;return n?r.createElement(y,a(a({ref:t},s),{},{components:n})):r.createElement(y,a({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[l]="string"==typeof e?e:o,a[1]=c;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>l});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],c={id_old:"version-1.3-proxy-configuration-function",title:"ProxyConfigurationFunction",id:"proxy-configuration-function"},p=void 0,u={unversionedId:"typedefs/proxy-configuration-function",id:"version-1.3/typedefs/proxy-configuration-function",title:"ProxyConfigurationFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/ProxyConfigurationFunction.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-function",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-proxy-configuration-function",title:"ProxyConfigurationFunction",id:"proxy-configuration-function"}},s={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfigurationfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),l=u(n),d=o,y=l["".concat(p,".").concat(d)]||l[d]||f[d]||i;return n?r.createElement(y,a(a({ref:t},s),{},{components:n})):r.createElement(y,a({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[l]="string"==typeof e?e:o,a[1]=c;for(var u=2;u{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],i={id_old:"version-1.3-request-transform",title:"RequestTransform",id:"request-transform"},u=void 0,p={unversionedId:"typedefs/request-transform",id:"version-1.3/typedefs/request-transform",title:"RequestTransform",description:"Takes an Apify object and changes it's attributes in a desired way. This user-function is used",source:"@site/versioned_docs/version-1.3/typedefs/RequestTransform.md",sourceDirName:"typedefs",slug:"/typedefs/request-transform",permalink:"/sdk/js/docs/1.3/typedefs/request-transform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestTransform.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-transform",title:"RequestTransform",id:"request-transform"},sidebar:"version-1.3/docs",previous:{title:"CreateSession",permalink:"/sdk/js/docs/1.3/typedefs/create-session"},next:{title:"ActorRun",permalink:"/sdk/js/docs/1.3/typedefs/actor-run"}},l={},c=[],f={toc:c},d="wrapper";function m(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requesttransform"}),(0,o.kt)("p",null,"Takes an Apify {RequestOptions} object and changes it's attributes in a desired way. This user-function is used\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," to modify requests before enqueuing them."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"original")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Request options to be modified.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - The modified request options to enqueue."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var u=n.createContext({}),p=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,u=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),c=p(r),d=s,m=c["".concat(u,".").concat(d)]||c[d]||f[d]||o;return r?n.createElement(m,a(a({ref:t},l),{},{components:r})):n.createElement(m,a({ref:t},l))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[c]="string"==typeof e?e:s,a[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],i={id_old:"version-1.3-request-transform",title:"RequestTransform",id:"request-transform"},u=void 0,p={unversionedId:"typedefs/request-transform",id:"version-1.3/typedefs/request-transform",title:"RequestTransform",description:"Takes an Apify object and changes it's attributes in a desired way. This user-function is used",source:"@site/versioned_docs/version-1.3/typedefs/RequestTransform.md",sourceDirName:"typedefs",slug:"/typedefs/request-transform",permalink:"/sdk/js/docs/1.3/typedefs/request-transform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestTransform.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-transform",title:"RequestTransform",id:"request-transform"},sidebar:"version-1.3/docs",previous:{title:"CreateSession",permalink:"/sdk/js/docs/1.3/typedefs/create-session"},next:{title:"ActorRun",permalink:"/sdk/js/docs/1.3/typedefs/actor-run"}},l={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requesttransform"}),(0,o.kt)("p",null,"Takes an Apify {RequestOptions} object and changes it's attributes in a desired way. This user-function is used\n",(0,o.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," to modify requests before enqueuing them."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"original")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Request options to be modified.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - The modified request options to enqueue."),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var u=n.createContext({}),p=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,u=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),c=p(r),f=s,m=c["".concat(u,".").concat(f)]||c[f]||d[f]||o;return r?n.createElement(m,a(a({ref:t},l),{},{components:r})):n.createElement(m,a({ref:t},l))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[c]="string"==typeof e?e:s,a[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>s});var n=r(87462),p=r(63366),a=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-launch-puppeteer",title:"LaunchPuppeteer",id:"launch-puppeteer"},i=void 0,u={unversionedId:"typedefs/launch-puppeteer",id:"version-1.3/typedefs/launch-puppeteer",title:"LaunchPuppeteer",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/LaunchPuppeteer.md",sourceDirName:"typedefs",slug:"/typedefs/launch-puppeteer",permalink:"/sdk/js/docs/1.3/typedefs/launch-puppeteer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteer.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-launch-puppeteer",title:"LaunchPuppeteer",id:"launch-puppeteer"}},c={},s=[],d={toc:s},f="wrapper";function m(e){var t=e.components,r=(0,p.Z)(e,o);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"launchpuppeteer"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/launch-puppeteer-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerOptions"))," - Arguments passed to this callback.")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")," - Promise that resolves to Puppeteer's ",(0,a.kt)("inlineCode",{parentName:"p"},"Browser")," instance. This might be obtained by calling\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},"puppeteer.launch()")," directly, or by delegating to\n",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()")),"."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(p[r]=e[r]);return p}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(p[r]=e[r])}return p}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,p=e.mdxType,a=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),s=u(r),f=p,m=s["".concat(i,".").concat(f)]||s[f]||d[f]||a;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function m(e,t){var r=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var a=r.length,o=new Array(a);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[s]="string"==typeof e?e:p,o[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>s});var n=r(87462),p=r(63366),a=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-launch-puppeteer",title:"LaunchPuppeteer",id:"launch-puppeteer"},i=void 0,u={unversionedId:"typedefs/launch-puppeteer",id:"version-1.3/typedefs/launch-puppeteer",title:"LaunchPuppeteer",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/LaunchPuppeteer.md",sourceDirName:"typedefs",slug:"/typedefs/launch-puppeteer",permalink:"/sdk/js/docs/1.3/typedefs/launch-puppeteer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteer.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-launch-puppeteer",title:"LaunchPuppeteer",id:"launch-puppeteer"}},c={},s=[],d={toc:s},f="wrapper";function m(e){var t=e.components,r=(0,p.Z)(e,o);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"launchpuppeteer"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/launch-puppeteer-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerOptions"))," - Arguments passed to this callback.")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")," - Promise that resolves to Puppeteer's ",(0,a.kt)("inlineCode",{parentName:"p"},"Browser")," instance. This might be obtained by calling\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},"puppeteer.launch()")," directly, or by delegating to\n",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()")),"."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(p[r]=e[r]);return p}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(p[r]=e[r])}return p}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,p=e.mdxType,a=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),s=u(r),f=p,m=s["".concat(i,".").concat(f)]||s[f]||d[f]||a;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function m(e,t){var r=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var a=r.length,o=new Array(a);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[s]="string"==typeof e?e:p,o[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=["components"],l={},s=void 0,p={unversionedId:"readme/overview",id:"readme/overview",title:"overview",description:"Overview",source:"@site/../docs/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/next/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/overview.md",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,o.kt)(d,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," - Serves as an alternative approach to the static helpers exported from the package.\nThis class can be used to control the current actor run and to interact with the actor's environment. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ApifyClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," - Allows user to interact with the Apify platform from code, control and schedule actors on the platform and access the result data stores.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," - Helper class encapsulating the configuration of the current actor run.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/PlatformEventManager",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlatformEventManager"))," - Event emitter for the platform and SDK events. Can be used to track actor run performance or serverless container migration.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," - Configures connection to a proxy server with the provided options. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for all connections. The proxy servers are managed by Apify Proxy.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/RequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,m=u["".concat(s,".").concat(d)]||u[d]||f[d]||o;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=["components"],l={},s=void 0,p={unversionedId:"readme/overview",id:"readme/overview",title:"overview",description:"Overview",source:"@site/../docs/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/next/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/overview.md",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,o.kt)(d,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," - Serves as an alternative approach to the static helpers exported from the package.\nThis class can be used to control the current actor run and to interact with the actor's environment. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ApifyClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," - Allows user to interact with the Apify platform from code, control and schedule actors on the platform and access the result data stores.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," - Helper class encapsulating the configuration of the current actor run.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/PlatformEventManager",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlatformEventManager"))," - Event emitter for the platform and SDK events. Can be used to track actor run performance or serverless container migration.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," - Configures connection to a proxy server with the provided options. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for all connections. The proxy servers are managed by Apify Proxy.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/RequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,m=u["".concat(s,".").concat(d)]||u[d]||f[d]||o;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-dataset-content",title:"DatasetContent",id:"dataset-content"},s=void 0,p={unversionedId:"typedefs/dataset-content",id:"version-1.3/typedefs/dataset-content",title:"DatasetContent",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/DatasetContent.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-content",permalink:"/sdk/js/docs/1.3/typedefs/dataset-content",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetContent.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-dataset-content",title:"DatasetContent",id:"dataset-content"},sidebar:"version-1.3/docs",previous:{title:"ApifyEnv",permalink:"/sdk/js/docs/1.3/typedefs/apify-env"},next:{title:"MemoryInfo",permalink:"/sdk/js/docs/1.3/typedefs/memory-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"items",id:"items",level:3},{value:"total",id:"total",level:3},{value:"offset",id:"offset",level:3},{value:"count",id:"count",level:3},{value:"limit",id:"limit",level:3}],u={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"datasetcontent"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"items"},(0,a.kt)("inlineCode",{parentName:"h3"},"items")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Dataset entries based on chosen format parameter."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"total"},(0,a.kt)("inlineCode",{parentName:"h3"},"total")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Total count of entries in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"offset"},(0,a.kt)("inlineCode",{parentName:"h3"},"offset")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the first returned entry in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"count"},(0,a.kt)("inlineCode",{parentName:"h3"},"count")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Count of dataset entries returned in this set."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},(0,a.kt)("inlineCode",{parentName:"h3"},"limit")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of dataset entries requested."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),f=o,m=c["".concat(s,".").concat(f)]||c[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-dataset-content",title:"DatasetContent",id:"dataset-content"},s=void 0,p={unversionedId:"typedefs/dataset-content",id:"version-1.3/typedefs/dataset-content",title:"DatasetContent",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/DatasetContent.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-content",permalink:"/sdk/js/docs/1.3/typedefs/dataset-content",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetContent.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-dataset-content",title:"DatasetContent",id:"dataset-content"},sidebar:"version-1.3/docs",previous:{title:"ApifyEnv",permalink:"/sdk/js/docs/1.3/typedefs/apify-env"},next:{title:"MemoryInfo",permalink:"/sdk/js/docs/1.3/typedefs/memory-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"items",id:"items",level:3},{value:"total",id:"total",level:3},{value:"offset",id:"offset",level:3},{value:"count",id:"count",level:3},{value:"limit",id:"limit",level:3}],u={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"datasetcontent"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"items"},(0,a.kt)("inlineCode",{parentName:"h3"},"items")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Dataset entries based on chosen format parameter."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"total"},(0,a.kt)("inlineCode",{parentName:"h3"},"total")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Total count of entries in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"offset"},(0,a.kt)("inlineCode",{parentName:"h3"},"offset")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the first returned entry in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"count"},(0,a.kt)("inlineCode",{parentName:"h3"},"count")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Count of dataset entries returned in this set."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},(0,a.kt)("inlineCode",{parentName:"h3"},"limit")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of dataset entries requested."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),f=o,m=c["".concat(s,".").concat(f)]||c[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),a=["components"],p={id:"post-response",title:"PostResponse"},i=void 0,l={unversionedId:"typedefs/post-response",id:"version-2.3/typedefs/post-response",title:"PostResponse",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PostResponse.md",sourceDirName:"typedefs",slug:"/typedefs/post-response",permalink:"/sdk/js/docs/2.3/typedefs/post-response",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponse.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"post-response",title:"PostResponse"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"postresponse"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/post-response-inputs",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PostResponseInputs"))," - Arguments passed to this callback.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"Promise")),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(i,".").concat(f)]||u[f]||d[f]||s;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=f;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[u]="string"==typeof e?e:o,a[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),a=["components"],p={id:"post-response",title:"PostResponse"},i=void 0,l={unversionedId:"typedefs/post-response",id:"version-2.3/typedefs/post-response",title:"PostResponse",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PostResponse.md",sourceDirName:"typedefs",slug:"/typedefs/post-response",permalink:"/sdk/js/docs/2.3/typedefs/post-response",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponse.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"post-response",title:"PostResponse"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"postresponse"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/post-response-inputs",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PostResponseInputs"))," - Arguments passed to this callback.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"Promise")),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(i,".").concat(f)]||u[f]||d[f]||s;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=f;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[u]="string"==typeof e?e:o,a[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>k,frontMatter:()=>s,metadata:()=>d,toc:()=>u});var r=n(87462),i=n(63366),a=(n(67294),n(3905)),l=["components"],s={id_old:"version-1.3-statistic-state",title:"StatisticState",id:"statistic-state"},o=void 0,d={unversionedId:"typedefs/statistic-state",id:"version-1.3/typedefs/statistic-state",title:"StatisticState",description:"Contains the statistics state",source:"@site/versioned_docs/version-1.3/typedefs/StatisticState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-state",permalink:"/sdk/js/docs/1.3/typedefs/statistic-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticState.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-statistic-state",title:"StatisticState",id:"statistic-state"}},p={},u=[{value:"Properties",id:"properties",level:2},{value:"requestsFinished",id:"requestsfinished",level:3},{value:"requestsFailed",id:"requestsfailed",level:3},{value:"requestsRetries",id:"requestsretries",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestMinDurationMillis",id:"requestmindurationmillis",level:3},{value:"requestMaxDurationMillis",id:"requestmaxdurationmillis",level:3},{value:"requestTotalFailedDurationMillis",id:"requesttotalfaileddurationmillis",level:3},{value:"requestTotalFinishedDurationMillis",id:"requesttotalfinisheddurationmillis",level:3},{value:"crawlerStartedAt",id:"crawlerstartedat",level:3},{value:"crawlerFinishedAt",id:"crawlerfinishedat",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,i.Z)(e,l);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticstate"}),(0,a.kt)("p",null,"Contains the statistics state"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestsfinished"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinished")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailed"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailed")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmindurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMinDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmaxdurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMaxDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerstartedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerStartedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerfinishedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerFinishedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=r.createContext({}),d=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=d(n),m=i,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[u]="string"==typeof e?e:i,l[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>k,frontMatter:()=>s,metadata:()=>d,toc:()=>u});var r=n(87462),i=n(63366),a=(n(67294),n(3905)),l=["components"],s={id_old:"version-1.3-statistic-state",title:"StatisticState",id:"statistic-state"},o=void 0,d={unversionedId:"typedefs/statistic-state",id:"version-1.3/typedefs/statistic-state",title:"StatisticState",description:"Contains the statistics state",source:"@site/versioned_docs/version-1.3/typedefs/StatisticState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-state",permalink:"/sdk/js/docs/1.3/typedefs/statistic-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticState.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-statistic-state",title:"StatisticState",id:"statistic-state"}},p={},u=[{value:"Properties",id:"properties",level:2},{value:"requestsFinished",id:"requestsfinished",level:3},{value:"requestsFailed",id:"requestsfailed",level:3},{value:"requestsRetries",id:"requestsretries",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestMinDurationMillis",id:"requestmindurationmillis",level:3},{value:"requestMaxDurationMillis",id:"requestmaxdurationmillis",level:3},{value:"requestTotalFailedDurationMillis",id:"requesttotalfaileddurationmillis",level:3},{value:"requestTotalFinishedDurationMillis",id:"requesttotalfinisheddurationmillis",level:3},{value:"crawlerStartedAt",id:"crawlerstartedat",level:3},{value:"crawlerFinishedAt",id:"crawlerfinishedat",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,i.Z)(e,l);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticstate"}),(0,a.kt)("p",null,"Contains the statistics state"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestsfinished"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinished")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailed"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailed")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmindurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMinDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmaxdurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMaxDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerstartedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerStartedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerfinishedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerFinishedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=r.createContext({}),d=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=d(n),m=i,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[u]="string"==typeof e?e:i,l[1]=s;for(var d=2;d{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],l={id:"puppeteer-handle-page",title:"PuppeteerHandlePage"},i=void 0,s={unversionedId:"typedefs/puppeteer-handle-page",id:"version-2.3/typedefs/puppeteer-handle-page",title:"PuppeteerHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePage.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-handle-page",title:"PuppeteerHandlePage"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"},next:{title:"PuppeteerHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepage"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))," | ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,p.kt)("inlineCode",{parentName:"li"},"Object"))),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||p;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[d]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],l={id:"puppeteer-handle-page",title:"PuppeteerHandlePage"},i=void 0,s={unversionedId:"typedefs/puppeteer-handle-page",id:"version-2.3/typedefs/puppeteer-handle-page",title:"PuppeteerHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePage.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-handle-page",title:"PuppeteerHandlePage"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"},next:{title:"PuppeteerHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepage"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))," | ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,p.kt)("inlineCode",{parentName:"li"},"Object"))),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),f=a,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||p;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[d]="string"==typeof e?e:a,o[1]=l;for(var s=2;s{n.d(t,{Z:()=>l});var a=n(67294),r=n(34334);const c={tabItem:"tabItem_Ymn6"};function l(e){var t=e.children,n=e.hidden,l=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(c.tabItem,l),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var a=n(87462),r=n(67294),c=n(34334),l=n(63735),o=n(38224),u=n(5730);const i={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,p=[],d=(0,l.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=p.indexOf(t),a=s[n].value;a!==o&&(d(t),u(a))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var a,r=p.indexOf(e.currentTarget)+1;n=null!=(a=p[r])?a:p[0];break;case"ArrowLeft":var c,l=p.indexOf(e.currentTarget)-1;n=null!=(c=p[l])?c:p[p.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,c.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,l=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return p.push(e)},onKeyDown:b,onClick:m},l,{className:(0,c.Z)("tabs__item",i.tabItem,null==l?void 0:l.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function p(e){var t=e.lazy,n=e.children,a=e.selectedValue,c=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var l=c.find((function(e){return e.props.value===a}));return l?(0,r.cloneElement)(l,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},c.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function d(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,c.Z)("tabs-container",i.tabList)},r.createElement(s,(0,a.Z)({},e,t)),r.createElement(p,(0,a.Z)({},e,t)))}function m(e){var t=(0,u.Z)();return r.createElement(d,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>d});var a=n(67294),r=n(16550),c=n(34423),l=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function i(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,l.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,n=void 0!==t&&t,l=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:l});return[(0,c._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function d(e){var t,n,r,c,l=e.defaultValue,u=e.queryString,d=void 0!==u&&u,m=e.groupId,b=i(e),g=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:l,tabValues:b})})),h=g[0],y=g[1],I=p({queryString:d,groupId:m}),w=I[0],v=I[1],f=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,o.Nk)(t),r=n[0],c=n[1],[r,(0,a.useCallback)((function(e){t&&c.set(e)}),[t,c])]),X=f[0],G=f[1],x=function(){var e=null!=w?w:X;return s({value:e,tabValues:b})?e:null}();return(0,a.useLayoutEffect)((function(){x&&y(x)}),[x]),{selectedValue:h,selectValue:(0,a.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),v(e),G(e)}),[v,G,b]),tabValues:b}}},52125:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>y,contentTitle:()=>g,default:()=>X,frontMatter:()=>b,metadata:()=>h,toc:()=>I});var a=n(87462),r=n(63366),c=(n(67294),n(3905)),l=n(65559),o=n(30433);n(14563);const u={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nconst screenshot = await page.screenshot();\n\n// Save the screenshot to the default key-value store\nawait Actor.setValue('my-key', screenshot, { contentType: 'image/png' });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCB1cmwgPSAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nO1xcbi8vIFN0YXJ0IGEgYnJvd3NlclxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBPcGVuIG5ldyB0YWIgaW4gdGhlIGJyb3dzZXJcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuXFxuLy8gTmF2aWdhdGUgdG8gdGhlIFVSTFxcbmF3YWl0IHBhZ2UuZ290byh1cmwpO1xcblxcbi8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG5jb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuXFxuLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgnbXkta2V5Jywgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuXFxuLy8gQ2xvc2UgUHVwcGV0ZWVyXFxuYXdhaXQgYnJvd3Nlci5jbG9zZSgpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.xy-Qn13nROyNEPEB6pUG8xQ1VfIjq56rsat4wKqhq9o"},i={code:"import { Actor } from 'apify';\nimport { launchPuppeteer, utils } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nawait utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciwgdXRpbHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgdXJsID0gJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vJztcXG4vLyBTdGFydCBhIGJyb3dzZXJcXG5jb25zdCBicm93c2VyID0gYXdhaXQgbGF1bmNoUHVwcGV0ZWVyKCk7XFxuXFxuLy8gT3BlbiBuZXcgdGFiIGluIHRoZSBicm93c2VyXFxuY29uc3QgcGFnZSA9IGF3YWl0IGJyb3dzZXIubmV3UGFnZSgpO1xcblxcbi8vIE5hdmlnYXRlIHRvIHRoZSBVUkxcXG5hd2FpdCBwYWdlLmdvdG8odXJsKTtcXG5cXG4vLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90XFxuYXdhaXQgdXRpbHMucHVwcGV0ZWVyLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleTogJ215LWtleScsIHNhdmVIdG1sOiBmYWxzZSB9KTtcXG5cXG4vLyBDbG9zZSBQdXBwZXRlZXJcXG5hd2FpdCBicm93c2VyLmNsb3NlKCk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.QSyAaQjtq2wJi2-pHooiFMBrLOELGoFYIBj8kQcDYtA"},s={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Actor.setValue(key, screenshot, { contentType: 'image/png' });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgUHVwcGV0ZWVyQ3Jhd2xlclxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUHVwcGV0ZWVyQ3Jhd2xlcih7XFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICAvLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90IHdpdGggUHVwcGV0ZWVyXFxuICAgICAgICBjb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuICAgICAgICAvLyBDb252ZXJ0IHRoZSBVUkwgaW50byBhIHZhbGlkIGtleVxcbiAgICAgICAgY29uc3Qga2V5ID0gcmVxdWVzdC51cmwucmVwbGFjZSgvWzovXS9nLCAnXycpO1xcbiAgICAgICAgLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG4gICAgICAgIGF3YWl0IEFjdG9yLnNldFZhbHVlKGtleSwgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyB9LFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.V_BcbfCWH__rcmGznaMSLm6R1wTtqF583QKH4Z3n5Uc"},p={code:"import { PuppeteerCrawler, puppeteerUtils } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await puppeteerUtils.saveSnapshot(page, { key, saveHtml: false });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIHB1cHBldGVlclV0aWxzIH0gZnJvbSAnY3Jhd2xlZSc7XFxuaW1wb3J0IHsgQWN0b3IgfSBmcm9tICdhcGlmeSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIFB1cHBldGVlckNyYXdsZXJcXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgLy8gQ29udmVydCB0aGUgVVJMIGludG8gYSB2YWxpZCBrZXlcXG4gICAgICAgIGNvbnN0IGtleSA9IHJlcXVlc3QudXJsLnJlcGxhY2UoL1s6L10vZywgJ18nKTtcXG4gICAgICAgIC8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG4gICAgICAgIGF3YWl0IHB1cHBldGVlclV0aWxzLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleSwgc2F2ZUh0bWw6IGZhbHNlIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.2SyyQ1VmxXhmOlrpTJRLqsinn3178wgSbrygIl4JJdg"};var d,m=["components"],b={id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},g=void 0,h={unversionedId:"examples/capture-screenshot",id:"examples/capture-screenshot",title:"Capture a screenshot using Puppeteer",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/../docs/examples/puppeteer_capture_screenshot.mdx",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/next/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_capture_screenshot.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},sidebar:"docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/next/examples/playwright-crawler"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/next/examples/puppeteer-crawler"}},y={},I=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),v={toc:I},f="wrapper";function X(e){var t=e.components,n=(0,r.Z)(e,m);return(0,c.kt)(f,(0,a.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)("p",null,"This example captures a screenshot of a web page using ",(0,c.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,c.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))),(0,c.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))),(0,c.kt)("p",null,"In both examples using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,c.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}X.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),i=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=i(e.components);return a.createElement(u.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,c=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=i(n),m=r,b=p["".concat(u,".").concat(m)]||p[m]||d[m]||c;return n?a.createElement(b,l(l({ref:t},s),{},{components:n})):a.createElement(b,l({ref:t},s))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var c=n.length,l=new Array(c);l[0]=m;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[p]="string"==typeof e?e:r,l[1]=o;for(var i=2;i{n.d(t,{Z:()=>l});var r=n(67294),a=n(34334);const c={tabItem:"tabItem_Ymn6"};function l(e){var t=e.children,n=e.hidden,l=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(c.tabItem,l),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),c=n(34334),l=n(63735),o=n(38224),u=n(5730);const i={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,p=[],d=(0,l.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=p.indexOf(t),r=s[n].value;r!==o&&(d(t),u(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=p.indexOf(e.currentTarget)+1;n=null!=(r=p[a])?r:p[0];break;case"ArrowLeft":var c,l=p.indexOf(e.currentTarget)-1;n=null!=(c=p[l])?c:p[p.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,c.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,l=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return p.push(e)},onKeyDown:b,onClick:m},l,{className:(0,c.Z)("tabs__item",i.tabItem,null==l?void 0:l.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function p(e){var t=e.lazy,n=e.children,r=e.selectedValue,c=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var l=c.find((function(e){return e.props.value===r}));return l?(0,a.cloneElement)(l,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},c.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function d(e){var t=(0,o.Y)(e);return a.createElement("div",{className:(0,c.Z)("tabs-container",i.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(p,(0,r.Z)({},e,t)))}function m(e){var t=(0,u.Z)();return a.createElement(d,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>d});var r=n(67294),a=n(16550),c=n(34423),l=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function i(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,l.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,n=void 0!==t&&t,l=e.groupId,o=(0,a.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:l});return[(0,c._X)(u),(0,r.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function d(e){var t,n,a,c,l=e.defaultValue,u=e.queryString,d=void 0!==u&&u,m=e.groupId,b=i(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:l,tabValues:b})})),h=g[0],y=g[1],I=p({queryString:d,groupId:m}),w=I[0],v=I[1],f=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,o.Nk)(t),a=n[0],c=n[1],[a,(0,r.useCallback)((function(e){t&&c.set(e)}),[t,c])]),X=f[0],G=f[1],x=function(){var e=null!=w?w:X;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){x&&y(x)}),[x]),{selectedValue:h,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),v(e),G(e)}),[v,G,b]),tabValues:b}}},52125:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>y,contentTitle:()=>g,default:()=>X,frontMatter:()=>b,metadata:()=>h,toc:()=>I});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=n(65559),o=n(30433);n(14563);const u={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nconst screenshot = await page.screenshot();\n\n// Save the screenshot to the default key-value store\nawait Actor.setValue('my-key', screenshot, { contentType: 'image/png' });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCB1cmwgPSAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nO1xcbi8vIFN0YXJ0IGEgYnJvd3NlclxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBPcGVuIG5ldyB0YWIgaW4gdGhlIGJyb3dzZXJcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuXFxuLy8gTmF2aWdhdGUgdG8gdGhlIFVSTFxcbmF3YWl0IHBhZ2UuZ290byh1cmwpO1xcblxcbi8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG5jb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuXFxuLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgnbXkta2V5Jywgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuXFxuLy8gQ2xvc2UgUHVwcGV0ZWVyXFxuYXdhaXQgYnJvd3Nlci5jbG9zZSgpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.xy-Qn13nROyNEPEB6pUG8xQ1VfIjq56rsat4wKqhq9o"},i={code:"import { Actor } from 'apify';\nimport { launchPuppeteer, utils } from 'crawlee';\n\nawait Actor.init();\n\nconst url = 'http://www.example.com/';\n// Start a browser\nconst browser = await launchPuppeteer();\n\n// Open new tab in the browser\nconst page = await browser.newPage();\n\n// Navigate to the URL\nawait page.goto(url);\n\n// Capture the screenshot\nawait utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n\n// Close Puppeteer\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciwgdXRpbHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgdXJsID0gJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vJztcXG4vLyBTdGFydCBhIGJyb3dzZXJcXG5jb25zdCBicm93c2VyID0gYXdhaXQgbGF1bmNoUHVwcGV0ZWVyKCk7XFxuXFxuLy8gT3BlbiBuZXcgdGFiIGluIHRoZSBicm93c2VyXFxuY29uc3QgcGFnZSA9IGF3YWl0IGJyb3dzZXIubmV3UGFnZSgpO1xcblxcbi8vIE5hdmlnYXRlIHRvIHRoZSBVUkxcXG5hd2FpdCBwYWdlLmdvdG8odXJsKTtcXG5cXG4vLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90XFxuYXdhaXQgdXRpbHMucHVwcGV0ZWVyLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleTogJ215LWtleScsIHNhdmVIdG1sOiBmYWxzZSB9KTtcXG5cXG4vLyBDbG9zZSBQdXBwZXRlZXJcXG5hd2FpdCBicm93c2VyLmNsb3NlKCk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.QSyAaQjtq2wJi2-pHooiFMBrLOELGoFYIBj8kQcDYtA"},s={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Actor.setValue(key, screenshot, { contentType: 'image/png' });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgUHVwcGV0ZWVyQ3Jhd2xlclxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUHVwcGV0ZWVyQ3Jhd2xlcih7XFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICAvLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90IHdpdGggUHVwcGV0ZWVyXFxuICAgICAgICBjb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuICAgICAgICAvLyBDb252ZXJ0IHRoZSBVUkwgaW50byBhIHZhbGlkIGtleVxcbiAgICAgICAgY29uc3Qga2V5ID0gcmVxdWVzdC51cmwucmVwbGFjZSgvWzovXS9nLCAnXycpO1xcbiAgICAgICAgLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG4gICAgICAgIGF3YWl0IEFjdG9yLnNldFZhbHVlKGtleSwgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyB9LFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.V_BcbfCWH__rcmGznaMSLm6R1wTtqF583QKH4Z3n5Uc"},p={code:"import { PuppeteerCrawler, puppeteerUtils } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\n// Create a PuppeteerCrawler\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page }) {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await puppeteerUtils.saveSnapshot(page, { key, saveHtml: false });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIHB1cHBldGVlclV0aWxzIH0gZnJvbSAnY3Jhd2xlZSc7XFxuaW1wb3J0IHsgQWN0b3IgfSBmcm9tICdhcGlmeSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIFB1cHBldGVlckNyYXdsZXJcXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgLy8gQ29udmVydCB0aGUgVVJMIGludG8gYSB2YWxpZCBrZXlcXG4gICAgICAgIGNvbnN0IGtleSA9IHJlcXVlc3QudXJsLnJlcGxhY2UoL1s6L10vZywgJ18nKTtcXG4gICAgICAgIC8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG4gICAgICAgIGF3YWl0IHB1cHBldGVlclV0aWxzLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleSwgc2F2ZUh0bWw6IGZhbHNlIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.2SyyQ1VmxXhmOlrpTJRLqsinn3178wgSbrygIl4JJdg"};var d,m=["components"],b={id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},g=void 0,h={unversionedId:"examples/capture-screenshot",id:"examples/capture-screenshot",title:"Capture a screenshot using Puppeteer",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/../docs/examples/puppeteer_capture_screenshot.mdx",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/next/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_capture_screenshot.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot using Puppeteer"},sidebar:"docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/next/examples/playwright-crawler"},next:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/next/examples/puppeteer-crawler"}},y={},I=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),v={toc:I},f="wrapper";function X(e){var t=e.components,n=(0,a.Z)(e,m);return(0,c.kt)(f,(0,r.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)("p",null,"This example captures a screenshot of a web page using ",(0,c.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,c.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))),(0,c.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,c.kt)(l.Z,{groupId:"puppeteer-capture-screenshot",mdxType:"Tabs"},(0,c.kt)(o.Z,{value:"pagescreenshot",label:"Page Screenshot",mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s)),(0,c.kt)(o.Z,{value:"crawlerutilsscreenshot",label:"Crawler Utils Screenshot",default:!0,mdxType:"TabItem"},(0,c.kt)("p",null,"Using ",(0,c.kt)("inlineCode",{parentName:"p"},"puppeteerUtils.saveSnapshot()"),":"),(0,c.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))),(0,c.kt)("p",null,"In both examples using ",(0,c.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,c.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}X.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=i(n),m=a,b=p["".concat(u,".").concat(m)]||p[m]||d[m]||c;return n?r.createElement(b,l(l({ref:t},s),{},{components:n})):r.createElement(b,l({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=m;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[p]="string"==typeof e?e:a,l[1]=o;for(var i=2;i{o.d(n,{Z:()=>i});var t=o(67294),s=o(88746),r=o(6141),a=o(6832);const i=function(e){var n=e.to,o=e.children,i=(0,r.E)(),l=i.version,c=i.isLast;if((0,a.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(s.default,{to:"/api/"+n},o);var u=l+"/";return"current"===l?u="next/":c&&(u=""),t.createElement(s.default,{to:"/api/"+u+n},o)}},26569:(e,n,o)=>{o.d(n,{B:()=>i,T:()=>a});var t=o(67294),s=o(88746),r="https://crawlee.dev",a=function(e){var n=e.to,o=e.children,a=e.version;return t.createElement(s.default,{href:r+"/api"+(a?"/"+a:"")+"/"+n},o)},i=function(e){var n=e.to,o=e.children;return t.createElement(s.default,{href:r+"/"+n},o)}},37634:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var t=o(87462),s=o(63366),r=(o(67294),o(3905)),a=(o(68889),o(26569)),i=["components"],l={id:"session-management",title:"Session Management"},c=void 0,u={unversionedId:"guides/session-management",id:"version-3.0/guides/session-management",title:"Session Management",description:"​SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-3.0/guides/session_management.mdx",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/3.0/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/session_management.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/3.0/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/3.0/guides/type-script-actor"}},p={},d=[],m={toc:d},g="wrapper";function f(e){var n=e.components,o=(0,s.Z)(e,i);return(0,r.kt)(g,(0,t.Z)({},m,o,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"\u200b",(0,r.kt)(a.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,r.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,r.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)(a.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"strong"},"PuppeteerCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)(a.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"strong"},"CheerioCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)(a.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"strong"},"BasicCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"}," const { gotScraping } = require('got-scraping');\n const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await gotScraping(requestOptions);\n } catch (e) {\n if (e === \"SomeNetworkError\") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n }\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example solo usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"Actor.main(async () => {\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await SessionPool.open(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,r.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}f.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>u,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),c=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},u=function(e){var n=c(e.components);return t.createElement(l.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(o),m=s,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},u),{},{components:o})):t.createElement(g,a({ref:n},u))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{o.d(n,{Z:()=>i});var t=o(67294),s=o(88746),r=o(6141),a=o(6832);const i=function(e){var n=e.to,o=e.children,i=(0,r.E)(),l=i.version,c=i.isLast;if((0,a.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(s.default,{to:"/api/"+n},o);var u=l+"/";return"current"===l?u="next/":c&&(u=""),t.createElement(s.default,{to:"/api/"+u+n},o)}},26569:(e,n,o)=>{o.d(n,{B:()=>i,T:()=>a});var t=o(67294),s=o(88746),r="https://crawlee.dev",a=function(e){var n=e.to,o=e.children,a=e.version;return t.createElement(s.default,{href:r+"/api"+(a?"/"+a:"")+"/"+n},o)},i=function(e){var n=e.to,o=e.children;return t.createElement(s.default,{href:r+"/"+n},o)}},37634:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var t=o(87462),s=o(63366),r=(o(67294),o(3905)),a=(o(68889),o(26569)),i=["components"],l={id:"session-management",title:"Session Management"},c=void 0,u={unversionedId:"guides/session-management",id:"version-3.0/guides/session-management",title:"Session Management",description:"​SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-3.0/guides/session_management.mdx",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/3.0/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/session_management.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/3.0/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/3.0/guides/type-script-actor"}},p={},d=[],m={toc:d},g="wrapper";function f(e){var n=e.components,o=(0,s.Z)(e,i);return(0,r.kt)(g,(0,t.Z)({},m,o,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"\u200b",(0,r.kt)(a.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,r.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,r.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)(a.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"strong"},"PuppeteerCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)(a.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"strong"},"CheerioCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage in ",(0,r.kt)(a.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"strong"},"BasicCrawler")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"}," const { gotScraping } = require('got-scraping');\n const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await gotScraping(requestOptions);\n } catch (e) {\n if (e === \"SomeNetworkError\") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n }\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example solo usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"Actor.main(async () => {\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await SessionPool.open(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,r.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}f.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>u,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),c=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},u=function(e){var n=c(e.components);return t.createElement(l.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(o),m=s,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},u),{},{components:o})):t.createElement(g,a({ref:n},u))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{r.d(t,{Z:()=>o});var a=r(67294),n=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return a.createElement("div",{role:"tabpanel",className:(0,n.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>d});var a=r(87462),n=r(67294),l=r(34334),o=r(63735),i=r(38224),u=r(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function c(e){var t=e.className,r=e.block,i=e.selectedValue,u=e.selectValue,c=e.tabValues,p=[],m=(0,o.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,r=p.indexOf(t),a=c[r].value;a!==i&&(m(t),u(a))},f=function(e){var t,r=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var a,n=p.indexOf(e.currentTarget)+1;r=null!=(a=p[n])?a:p[0];break;case"ArrowLeft":var l,o=p.indexOf(e.currentTarget)-1;r=null!=(l=p[o])?l:p[p.length-1]}null==(t=r)||t.focus()};return n.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},c.map((function(e){var t=e.value,r=e.label,o=e.attributes;return n.createElement("li",(0,a.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return p.push(e)},onKeyDown:f,onClick:d},o,{className:(0,l.Z)("tabs__item",s.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===t})}),null!=r?r:t)})))}function p(e){var t=e.lazy,r=e.children,a=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===a}));return o?(0,n.cloneElement)(o,{className:"margin-top--md"}):null}return n.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,n.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function m(e){var t=(0,i.Y)(e);return n.createElement("div",{className:(0,l.Z)("tabs-container",s.tabList)},n.createElement(c,(0,a.Z)({},e,t)),n.createElement(p,(0,a.Z)({},e,t)))}function d(e){var t=(0,u.Z)();return n.createElement(m,(0,a.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>m});var a=r(67294),n=r(16550),l=r(34423),o=r(20636),i=r(99200);function u(e){return function(e){var t,r;return null!=(t=null==(r=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,r=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function c(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function p(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,i=(0,n.k6)(),u=function(e){var t=e.queryString,r=void 0!==t&&t,a=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:r,groupId:o});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(i.location.search);t.set(u,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[u,i])]}function m(e){var t,r,n,l,o=e.defaultValue,u=e.queryString,m=void 0!==u&&u,d=e.groupId,f=s(e),w=(0,a.useState)((function(){return function(e){var t,r=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!c({value:r,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var n=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:o,tabValues:f})})),v=w[0],y=w[1],b=p({queryString:m,groupId:d}),h=b[0],g=b[1],k=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),r=(0,i.Nk)(t),n=r[0],l=r[1],[n,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=k[0],C=k[1],O=function(){var e=null!=h?h:x;return c({value:e,tabValues:f})?e:null}();return(0,a.useLayoutEffect)((function(){O&&y(O)}),[O]),{selectedValue:v,selectValue:(0,a.useCallback)((function(e){if(!c({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);y(e),g(e),C(e)}),[g,C,f]),tabValues:f}}},29214:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>v,contentTitle:()=>f,default:()=>g,frontMatter:()=>d,metadata:()=>w,toc:()=>y});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),o=r(65559),i=r(30433),u=r(14563);const s="import { Actor } from 'apify';\nimport { CheerioCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",c="import { Actor } from 'apify';\nimport { PuppeteerCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",p="import { PlaywrightCrawler, downloadListOfUrls } from 'crawlee';\nimport { Actor } from 'apify/src';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n";var m=["components"],d={id:"crawl-sitemap",title:"Crawl a sitemap"},f=void 0,w={unversionedId:"examples/crawl-sitemap",id:"version-3.0/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-3.0/examples/crawl_sitemap.mdx",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/3.0/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_sitemap.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/3.0/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-some-links"}},v={},y=[],b={toc:y},h="wrapper";function g(e){var t=e.components,r=(0,n.Z)(e,m);return(0,l.kt)(h,(0,a.Z)({},b,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},s)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p))))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var u=a.createContext({}),s=function(e){var t=a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=s(e.components);return a.createElement(u.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,u=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=s(r),d=n,f=p["".concat(u,".").concat(d)]||p[d]||m[d]||l;return r?a.createElement(f,o(o({ref:t},c),{},{components:r})):a.createElement(f,o({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[p]="string"==typeof e?e:n,o[1]=i;for(var s=2;s{t.d(r,{Z:()=>o});var a=t(67294),n=t(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var r=e.children,t=e.hidden,o=e.className;return a.createElement("div",{role:"tabpanel",className:(0,n.Z)(l.tabItem,o),hidden:t},r)}},65559:(e,r,t)=>{t.d(r,{Z:()=>d});var a=t(87462),n=t(67294),l=t(34334),o=t(63735),i=t(38224),u=t(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function c(e){var r=e.className,t=e.block,i=e.selectedValue,u=e.selectValue,c=e.tabValues,p=[],m=(0,o.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var r=e.currentTarget,t=p.indexOf(r),a=c[t].value;a!==i&&(m(r),u(a))},f=function(e){var r,t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var a,n=p.indexOf(e.currentTarget)+1;t=null!=(a=p[n])?a:p[0];break;case"ArrowLeft":var l,o=p.indexOf(e.currentTarget)-1;t=null!=(l=p[o])?l:p[p.length-1]}null==(r=t)||r.focus()};return n.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":t},r)},c.map((function(e){var r=e.value,t=e.label,o=e.attributes;return n.createElement("li",(0,a.Z)({role:"tab",tabIndex:i===r?0:-1,"aria-selected":i===r,key:r,ref:function(e){return p.push(e)},onKeyDown:f,onClick:d},o,{className:(0,l.Z)("tabs__item",s.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===r})}),null!=t?t:r)})))}function p(e){var r=e.lazy,t=e.children,a=e.selectedValue,l=(Array.isArray(t)?t:[t]).filter(Boolean);if(r){var o=l.find((function(e){return e.props.value===a}));return o?(0,n.cloneElement)(o,{className:"margin-top--md"}):null}return n.createElement("div",{className:"margin-top--md"},l.map((function(e,r){return(0,n.cloneElement)(e,{key:r,hidden:e.props.value!==a})})))}function m(e){var r=(0,i.Y)(e);return n.createElement("div",{className:(0,l.Z)("tabs-container",s.tabList)},n.createElement(c,(0,a.Z)({},e,r)),n.createElement(p,(0,a.Z)({},e,r)))}function d(e){var r=(0,u.Z)();return n.createElement(m,(0,a.Z)({key:String(r)},e))}},38224:(e,r,t)=>{t.d(r,{Y:()=>m});var a=t(67294),n=t(16550),l=t(34423),o=t(20636),i=t(99200);function u(e){return function(e){var r,t;return null!=(r=null==(t=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(r=e.props)&&"object"==typeof r&&"value"in r)return e;var r;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:t.filter(Boolean))?r:[]}(e).map((function(e){var r=e.props;return{value:r.value,label:r.label,attributes:r.attributes,default:r.default}}))}function s(e){var r=e.values,t=e.children;return(0,a.useMemo)((function(){var e=null!=r?r:u(t);return function(e){var r=(0,o.l)(e,(function(e,r){return e.value===r.value}));if(r.length>0)throw new Error('Docusaurus error: Duplicate values "'+r.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[r,t])}function c(e){var r=e.value;return e.tabValues.some((function(e){return e.value===r}))}function p(e){var r=e.queryString,t=void 0!==r&&r,o=e.groupId,i=(0,n.k6)(),u=function(e){var r=e.queryString,t=void 0!==r&&r,a=e.groupId;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:t,groupId:o});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var r=new URLSearchParams(i.location.search);r.set(u,e),i.replace(Object.assign({},i.location,{search:r.toString()}))}}),[u,i])]}function m(e){var r,t,n,l,o=e.defaultValue,u=e.queryString,m=void 0!==u&&u,d=e.groupId,f=s(e),w=(0,a.useState)((function(){return function(e){var r,t=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!c({value:t,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+t+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return t}var n=null!=(r=a.find((function(e){return e.default})))?r:a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:o,tabValues:f})})),v=w[0],y=w[1],b=p({queryString:m,groupId:d}),h=b[0],g=b[1],k=(r=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),t=(0,i.Nk)(r),n=t[0],l=t[1],[n,(0,a.useCallback)((function(e){r&&l.set(e)}),[r,l])]),x=k[0],C=k[1],O=function(){var e=null!=h?h:x;return c({value:e,tabValues:f})?e:null}();return(0,a.useLayoutEffect)((function(){O&&y(O)}),[O]),{selectedValue:v,selectValue:(0,a.useCallback)((function(e){if(!c({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);y(e),g(e),C(e)}),[g,C,f]),tabValues:f}}},29214:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>v,contentTitle:()=>f,default:()=>g,frontMatter:()=>d,metadata:()=>w,toc:()=>y});var a=t(87462),n=t(63366),l=(t(67294),t(3905)),o=t(65559),i=t(30433),u=t(14563);const s="import { Actor } from 'apify';\nimport { CheerioCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",c="import { Actor } from 'apify';\nimport { PuppeteerCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",p="import { PlaywrightCrawler, downloadListOfUrls } from 'crawlee';\nimport { Actor } from 'apify/src';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n";var m=["components"],d={id:"crawl-sitemap",title:"Crawl a sitemap"},f=void 0,w={unversionedId:"examples/crawl-sitemap",id:"version-3.0/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-3.0/examples/crawl_sitemap.mdx",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/3.0/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_sitemap.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/3.0/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-some-links"}},v={},y=[],b={toc:y},h="wrapper";function g(e){var r=e.components,t=(0,n.Z)(e,m);return(0,l.kt)(h,(0,a.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},s)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p))))}g.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var a=t(67294);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var r=1;r=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var u=a.createContext({}),s=function(e){var r=a.useContext(u),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return a.createElement(u.Provider,{value:r},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var r=e.children;return a.createElement(a.Fragment,{},r)}},d=a.forwardRef((function(e,r){var t=e.components,n=e.mdxType,l=e.originalType,u=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=s(t),d=n,f=p["".concat(u,".").concat(d)]||p[d]||m[d]||l;return t?a.createElement(f,o(o({ref:r},c),{},{components:t})):a.createElement(f,o({ref:r},c))}));function f(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var l=t.length,o=new Array(l);o[0]=d;var i={};for(var u in r)hasOwnProperty.call(r,u)&&(i[u]=r[u]);i.originalType=e,i[p]="string"==typeof e?e:n,o[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>g});var r=n(87462),o=n(63366),l=(n(67294),n(3905)),i=["components"],a={id:"logger-options",title:"LoggerOptions"},p=void 0,s={unversionedId:"typedefs/logger-options",id:"version-2.3/typedefs/logger-options",title:"LoggerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/LoggerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/logger-options",permalink:"/sdk/js/docs/2.3/typedefs/logger-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/LoggerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"logger-options",title:"LoggerOptions"},sidebar:"version-2.3/docs",previous:{title:"ProxyInfo",permalink:"/sdk/js/docs/2.3/typedefs/proxy-info"},next:{title:"RequestOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-options"}},d={},g=[{value:"Properties",id:"properties",level:2},{value:"level",id:"level",level:3},{value:"maxDepth",id:"maxdepth",level:3},{value:"maxStringLength",id:"maxstringlength",level:3},{value:"prefix",id:"prefix",level:3},{value:"suffix",id:"suffix",level:3},{value:"logger",id:"logger",level:3},{value:"data",id:"data",level:3}],c={toc:g},u="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,l.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"loggeroptions"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"level"},(0,l.kt)("inlineCode",{parentName:"h3"},"level")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxdepth"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxDepth")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Max depth of data object that will be logged. Anything deeper than the limit will be stripped off."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxstringlength"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxStringLength")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 2000")),(0,l.kt)("p",null,"Max length of the string to be logged. Longer strings will be truncated."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"prefix"},(0,l.kt)("inlineCode",{parentName:"h3"},"prefix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Prefix to be prepended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"suffix"},(0,l.kt)("inlineCode",{parentName:"h3"},"suffix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Suffix that will be appended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"logger"},(0,l.kt)("inlineCode",{parentName:"h3"},"logger")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Logger")),(0,l.kt)("p",null,"Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LoggerJson"),"\nthat formats each log line as a JSON."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"data"},(0,l.kt)("inlineCode",{parentName:"h3"},"data")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Record")),(0,l.kt)("p",null,"Additional data to be added to each log line."),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,p=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),g=s(n),u=o,m=g["".concat(p,".").concat(u)]||g[u]||c[u]||l;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=u;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[g]="string"==typeof e?e:o,i[1]=a;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>g});var r=n(87462),o=n(63366),l=(n(67294),n(3905)),i=["components"],a={id:"logger-options",title:"LoggerOptions"},p=void 0,s={unversionedId:"typedefs/logger-options",id:"version-2.3/typedefs/logger-options",title:"LoggerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/LoggerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/logger-options",permalink:"/sdk/js/docs/2.3/typedefs/logger-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/LoggerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"logger-options",title:"LoggerOptions"},sidebar:"version-2.3/docs",previous:{title:"ProxyInfo",permalink:"/sdk/js/docs/2.3/typedefs/proxy-info"},next:{title:"RequestOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-options"}},d={},g=[{value:"Properties",id:"properties",level:2},{value:"level",id:"level",level:3},{value:"maxDepth",id:"maxdepth",level:3},{value:"maxStringLength",id:"maxstringlength",level:3},{value:"prefix",id:"prefix",level:3},{value:"suffix",id:"suffix",level:3},{value:"logger",id:"logger",level:3},{value:"data",id:"data",level:3}],c={toc:g},u="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,l.kt)(u,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"loggeroptions"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"level"},(0,l.kt)("inlineCode",{parentName:"h3"},"level")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxdepth"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxDepth")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 4")),(0,l.kt)("p",null,"Max depth of data object that will be logged. Anything deeper than the limit will be stripped off."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"maxstringlength"},(0,l.kt)("inlineCode",{parentName:"h3"},"maxStringLength")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")," ",(0,l.kt)("code",null," = 2000")),(0,l.kt)("p",null,"Max length of the string to be logged. Longer strings will be truncated."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"prefix"},(0,l.kt)("inlineCode",{parentName:"h3"},"prefix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Prefix to be prepended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"suffix"},(0,l.kt)("inlineCode",{parentName:"h3"},"suffix")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Suffix that will be appended the each logged line."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"logger"},(0,l.kt)("inlineCode",{parentName:"h3"},"logger")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Logger")),(0,l.kt)("p",null,"Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use ",(0,l.kt)("inlineCode",{parentName:"p"},"log.LoggerJson"),"\nthat formats each log line as a JSON."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"data"},(0,l.kt)("inlineCode",{parentName:"h3"},"data")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Record")),(0,l.kt)("p",null,"Additional data to be added to each log line."),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,p=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),g=s(n),u=o,m=g["".concat(p,".").concat(u)]||g[u]||c[u]||l;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=u;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[g]="string"==typeof e?e:o,i[1]=a;for(var s=2;s{n.r(t),n.d(t,{assets:()=>m,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),o=["components"],s={id:"snapshotter",title:"Snapshotter"},i=void 0,p={unversionedId:"api/snapshotter",id:"version-2.3/api/snapshotter",title:"Snapshotter",description:"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history",source:"@site/versioned_docs/version-2.3/api/Snapshotter.md",sourceDirName:"api",slug:"/api/snapshotter",permalink:"/sdk/js/docs/2.3/api/snapshotter",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Snapshotter.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"snapshotter",title:"Snapshotter"},sidebar:"version-2.3/docs",previous:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/2.3/api/proxy-configuration"},next:{title:"SystemStatus",permalink:"/sdk/js/docs/2.3/api/system-status"}},m={},u=[{value:"new Snapshotter([options])",id:"new-snapshotteroptions",level:2},{value:"snapshotter.log",id:"snapshotterlog",level:2},{value:"snapshotter.start()",id:"snapshotterstart",level:2},{value:"snapshotter.stop()",id:"snapshotterstop",level:2},{value:"snapshotter.getMemorySample([sampleDurationMillis])",id:"snapshottergetmemorysamplesampledurationmillis",level:2},{value:"snapshotter.getEventLoopSample([sampleDurationMillis])",id:"snapshottergeteventloopsamplesampledurationmillis",level:2},{value:"snapshotter.getCpuSample([sampleDurationMillis])",id:"snapshottergetcpusamplesampledurationmillis",level:2},{value:"snapshotter.getClientSample(sampleDurationMillis)",id:"snapshottergetclientsamplesampledurationmillis",level:2}],d={toc:u},h="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"snapshotter"}),(0,l.kt)("p",null,"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history\nof the snapshots. It tracks the following resources: Memory, EventLoop, API and CPU. The class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,l.kt)("p",null,"When running on the Apify platform, the CPU and memory statistics are provided by the platform, as collected from the running Docker container. When\nrunning locally, ",(0,l.kt)("inlineCode",{parentName:"p"},"Snapshotter")," makes its own statistics by querying the OS."),(0,l.kt)("p",null,"CPU becomes overloaded locally when its current use exceeds the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxUsedCpuRatio")," option or when Apify platform marks it as overloaded."),(0,l.kt)("p",null,"Memory becomes overloaded if its current use exceeds the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxUsedMemoryRatio")," option. It's computed using the total memory available to the container\nwhen running on the Apify platform and a quarter of total system memory when running locally. Max total memory when running locally may be overridden\nby using the ",(0,l.kt)("inlineCode",{parentName:"p"},"APIFY_MEMORY_MBYTES")," environment variable."),(0,l.kt)("p",null,"Event loop becomes overloaded if it slows down by more than the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxBlockedMillis")," option."),(0,l.kt)("p",null,"Client becomes overloaded when rate limit errors (429 - Too Many Requests), typically received from the request queue, exceed the set limit within the\nset interval."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"snapshotter"}),(0,l.kt)("h2",{id:"new-snapshotteroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Snapshotter([options])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"Snapshotter")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"snapshotterlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"start"}),(0,l.kt)("h2",{id:"snapshotterstart"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.start()")),(0,l.kt)("p",null,"Starts capturing snapshots at configured intervals."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"stop"}),(0,l.kt)("h2",{id:"snapshotterstop"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.stop()")),(0,l.kt)("p",null,"Stops all resource capturing."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getmemorysample"}),(0,l.kt)("h2",{id:"snapshottergetmemorysamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getMemorySample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest memory snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"geteventloopsample"}),(0,l.kt)("h2",{id:"snapshottergeteventloopsamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getEventLoopSample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest event loop snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a\nfull snapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getcpusample"}),(0,l.kt)("h2",{id:"snapshottergetcpusamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getCpuSample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest CPU snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getclientsample"}),(0,l.kt)("h2",{id:"snapshottergetclientsamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getClientSample(sampleDurationMillis)")),(0,l.kt)("p",null,"Returns a sample of latest Client snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"sampleDurationMillis")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},m=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,c=u["".concat(i,".").concat(h)]||u[h]||d[h]||l;return n?a.createElement(c,o(o({ref:t},m),{},{components:n})):a.createElement(c,o({ref:t},m))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=h;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:r,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>m,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),o=["components"],s={id:"snapshotter",title:"Snapshotter"},i=void 0,p={unversionedId:"api/snapshotter",id:"version-2.3/api/snapshotter",title:"Snapshotter",description:"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history",source:"@site/versioned_docs/version-2.3/api/Snapshotter.md",sourceDirName:"api",slug:"/api/snapshotter",permalink:"/sdk/js/docs/2.3/api/snapshotter",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Snapshotter.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"snapshotter",title:"Snapshotter"},sidebar:"version-2.3/docs",previous:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/2.3/api/proxy-configuration"},next:{title:"SystemStatus",permalink:"/sdk/js/docs/2.3/api/system-status"}},m={},u=[{value:"new Snapshotter([options])",id:"new-snapshotteroptions",level:2},{value:"snapshotter.log",id:"snapshotterlog",level:2},{value:"snapshotter.start()",id:"snapshotterstart",level:2},{value:"snapshotter.stop()",id:"snapshotterstop",level:2},{value:"snapshotter.getMemorySample([sampleDurationMillis])",id:"snapshottergetmemorysamplesampledurationmillis",level:2},{value:"snapshotter.getEventLoopSample([sampleDurationMillis])",id:"snapshottergeteventloopsamplesampledurationmillis",level:2},{value:"snapshotter.getCpuSample([sampleDurationMillis])",id:"snapshottergetcpusamplesampledurationmillis",level:2},{value:"snapshotter.getClientSample(sampleDurationMillis)",id:"snapshottergetclientsamplesampledurationmillis",level:2}],d={toc:u},h="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"snapshotter"}),(0,l.kt)("p",null,"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history\nof the snapshots. It tracks the following resources: Memory, EventLoop, API and CPU. The class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,l.kt)("p",null,"When running on the Apify platform, the CPU and memory statistics are provided by the platform, as collected from the running Docker container. When\nrunning locally, ",(0,l.kt)("inlineCode",{parentName:"p"},"Snapshotter")," makes its own statistics by querying the OS."),(0,l.kt)("p",null,"CPU becomes overloaded locally when its current use exceeds the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxUsedCpuRatio")," option or when Apify platform marks it as overloaded."),(0,l.kt)("p",null,"Memory becomes overloaded if its current use exceeds the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxUsedMemoryRatio")," option. It's computed using the total memory available to the container\nwhen running on the Apify platform and a quarter of total system memory when running locally. Max total memory when running locally may be overridden\nby using the ",(0,l.kt)("inlineCode",{parentName:"p"},"APIFY_MEMORY_MBYTES")," environment variable."),(0,l.kt)("p",null,"Event loop becomes overloaded if it slows down by more than the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxBlockedMillis")," option."),(0,l.kt)("p",null,"Client becomes overloaded when rate limit errors (429 - Too Many Requests), typically received from the request queue, exceed the set limit within the\nset interval."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"snapshotter"}),(0,l.kt)("h2",{id:"new-snapshotteroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Snapshotter([options])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"Snapshotter")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"snapshotterlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"start"}),(0,l.kt)("h2",{id:"snapshotterstart"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.start()")),(0,l.kt)("p",null,"Starts capturing snapshots at configured intervals."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"stop"}),(0,l.kt)("h2",{id:"snapshotterstop"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.stop()")),(0,l.kt)("p",null,"Stops all resource capturing."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getmemorysample"}),(0,l.kt)("h2",{id:"snapshottergetmemorysamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getMemorySample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest memory snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"geteventloopsample"}),(0,l.kt)("h2",{id:"snapshottergeteventloopsamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getEventLoopSample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest event loop snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a\nfull snapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getcpusample"}),(0,l.kt)("h2",{id:"snapshottergetcpusamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getCpuSample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest CPU snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getclientsample"}),(0,l.kt)("h2",{id:"snapshottergetclientsamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getClientSample(sampleDurationMillis)")),(0,l.kt)("p",null,"Returns a sample of latest Client snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"sampleDurationMillis")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},m=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,c=u["".concat(i,".").concat(h)]||u[h]||d[h]||l;return n?a.createElement(c,o(o({ref:t},m),{},{components:n})):a.createElement(c,o({ref:t},m))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=h;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:r,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],l={id:"playwright-handle-page-function",title:"PlaywrightHandlePageFunction"},p=void 0,c={unversionedId:"typedefs/playwright-handle-page-function",id:"version-2.3/typedefs/playwright-handle-page-function",title:"PlaywrightHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-handle-page-function",title:"PlaywrightHandlePageFunction"},sidebar:"version-2.3/docs",previous:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request-inputs"},next:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"}},s={},u=[],d={toc:u},f="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrighthandlepagefunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-handle-page-function-param",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunctionParam"))," |\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,y=u["".concat(p,".").concat(f)]||u[f]||d[f]||i;return n?r.createElement(y,o(o({ref:t},s),{},{components:n})):r.createElement(y,o({ref:t},s))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id:"playwright-handle-page-function",title:"PlaywrightHandlePageFunction"},p=void 0,c={unversionedId:"typedefs/playwright-handle-page-function",id:"version-2.3/typedefs/playwright-handle-page-function",title:"PlaywrightHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-handle-page-function",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-handle-page-function",title:"PlaywrightHandlePageFunction"},sidebar:"version-2.3/docs",previous:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request-inputs"},next:{title:"PlaywrightHandlePageFunctionParam",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"}},s={},u=[],d={toc:u},f="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrighthandlepagefunction"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/playwright-handle-page-function-param",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunctionParam"))," |\n",(0,o.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,y=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return n?r.createElement(y,i(i({ref:t},s),{},{components:n})):r.createElement(y,i({ref:t},s))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>k,contentTitle:()=>p,default:()=>N,frontMatter:()=>o,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),l=["components"],o={id_old:"version-1.3-configuration",title:"Configuration",id:"configuration"},p=void 0,d={unversionedId:"api/configuration",id:"version-1.3/api/configuration",title:"Configuration",description:"Configuration is a value object holding the SDK configuration. We can use it in two ways:",source:"@site/versioned_docs/version-1.3/api/Configuration.md",sourceDirName:"api",slug:"/api/configuration",permalink:"/sdk/js/docs/1.3/api/configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Configuration.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-configuration",title:"Configuration",id:"configuration"},sidebar:"version-1.3/docs",previous:{title:"Apify",permalink:"/sdk/js/docs/1.3/api/apify"},next:{title:"BasicCrawler",permalink:"/sdk/js/docs/1.3/api/basic-crawler"}},k={},m=[{value:"Supported Configuration Options",id:"supported-configuration-options",level:2},{value:"Advanced Configuration Options",id:"advanced-configuration-options",level:2},{value:"Not Supported environment variables",id:"not-supported-environment-variables",level:2},{value:"new Configuration(options)",id:"new-configurationoptions",level:2},{value:"configuration.get(key, [defaultValue])",id:"configurationgetkey-defaultvalue",level:2},{value:"configuration.set(key, [value])",id:"configurationsetkey-value",level:2},{value:"configuration.getClient([options])",id:"configurationgetclientoptions",level:2},{value:"configuration.getStorageLocal([options])",id:"configurationgetstoragelocaloptions",level:2},{value:"configuration.createClient([options])",id:"configurationcreateclientoptions",level:2},{value:"configuration.createStorageLocal([options])",id:"configurationcreatestoragelocaloptions",level:2},{value:"Configuration.getGlobalConfig()",id:"configurationgetglobalconfig",level:2}],u={toc:m},s="wrapper";function N(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(s,(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"configuration"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," is a value object holding the SDK configuration. We can use it in two ways:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"When using ",(0,r.kt)("inlineCode",{parentName:"li"},"Apify")," class, we can get the instance configuration via ",(0,r.kt)("inlineCode",{parentName:"li"},"sdk.config"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify');\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"To get the global configuration (singleton instance). It will respect the environment variables.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"console.log(Configuration.getGlobalConfig().get('token')); // returns the token from APIFY_TOKEN env var\n")),(0,r.kt)("h2",{id:"supported-configuration-options"},"Supported Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultDatasetId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_DATASET_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultKeyValueStoreId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultRequestQueueId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageDir")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'./apify_storage'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageEnableWalMode")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"true"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"persistStateIntervalMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PERSIST_STATE_INTERVAL_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"60e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"token")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"advanced-configuration-options"},"Advanced Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorEventsWsUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_EVENTS_WS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorRunId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_RUN_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorTaskId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_TASK_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"apiBaseUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_API_BASE_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'https://api.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"4321"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://localhost:4321'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"inputKey")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_INPUT_KEY")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'INPUT'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"isAtHome")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_IS_AT_HOME")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"metamorphAfterSleepMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_METAMORPH_AFTER_SLEEP_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"300e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyHostname")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_HOSTNAME")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPassword")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PASSWORD")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"8000"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyStatusUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_STATUS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"userId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_USER_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"not-supported-environment-variables"},"Not Supported environment variables"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"MEMORY_MBYTES")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"HEADLESS")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"XVFB")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CHROME_EXECUTABLE_PATH"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"exports.configuration"}),(0,r.kt)("h2",{id:"new-configurationoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new Configuration(options)")),(0,r.kt)("p",null,"Creates new ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance with provided options. Env vars will have precedence over those."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Record"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"get"}),(0,r.kt)("h2",{id:"configurationgetkey-defaultvalue"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.get(key, [defaultValue])")),(0,r.kt)("p",null,"Returns configured value. First checks the environment variables, then provided configuration, fallbacks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"defaultValue")," argument if provided,\notherwise uses the default value as described in the above section."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[defaultValue]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"set"}),(0,r.kt)("h2",{id:"configurationsetkey-value"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.set(key, [value])")),(0,r.kt)("p",null,"Sets value for given option. Only affects this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance, the value will not be propagated down to the env var. To reset a value, we\ncan omit the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument or pass ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," there."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[value]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getclient"}),(0,r.kt)("h2",{id:"configurationgetclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getClient([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the API URL and token, so calling this method with different options will return multiple instances, one for each variant of\nthe options."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getstoragelocal"}),(0,r.kt)("h2",{id:"configurationgetstoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getStorageLocal([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," option, so calling this method with different ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," will return multiple instances, one for each\ndirectory."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createclient"}),(0,r.kt)("h2",{id:"configurationcreateclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createClient([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyClient using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createstoragelocal"}),(0,r.kt)("h2",{id:"configurationcreatestoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createStorageLocal([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyStorageLocal using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getglobalconfig"}),(0,r.kt)("h2",{id:"configurationgetglobalconfig"},(0,r.kt)("inlineCode",{parentName:"h2"},"Configuration.getGlobalConfig()")),(0,r.kt)("p",null,"Returns the global configuration instance. It will respect the environment variables. As opposed to this method, we can also get the SDK instance\nconfiguration via ",(0,r.kt)("inlineCode",{parentName:"p"},"sdk.config")," property."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))),(0,r.kt)("hr",null))}N.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>k,kt:()=>N});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},k=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},s=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),m=d(n),s=i,N=m["".concat(p,".").concat(s)]||m[s]||u[s]||r;return n?a.createElement(N,l(l({ref:t},k),{},{components:n})):a.createElement(N,l({ref:t},k))}));function N(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=s;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[m]="string"==typeof e?e:i,l[1]=o;for(var d=2;d{n.r(t),n.d(t,{assets:()=>k,contentTitle:()=>p,default:()=>g,frontMatter:()=>o,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),l=["components"],o={id_old:"version-1.3-configuration",title:"Configuration",id:"configuration"},p=void 0,d={unversionedId:"api/configuration",id:"version-1.3/api/configuration",title:"Configuration",description:"Configuration is a value object holding the SDK configuration. We can use it in two ways:",source:"@site/versioned_docs/version-1.3/api/Configuration.md",sourceDirName:"api",slug:"/api/configuration",permalink:"/sdk/js/docs/1.3/api/configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Configuration.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-configuration",title:"Configuration",id:"configuration"},sidebar:"version-1.3/docs",previous:{title:"Apify",permalink:"/sdk/js/docs/1.3/api/apify"},next:{title:"BasicCrawler",permalink:"/sdk/js/docs/1.3/api/basic-crawler"}},k={},m=[{value:"Supported Configuration Options",id:"supported-configuration-options",level:2},{value:"Advanced Configuration Options",id:"advanced-configuration-options",level:2},{value:"Not Supported environment variables",id:"not-supported-environment-variables",level:2},{value:"new Configuration(options)",id:"new-configurationoptions",level:2},{value:"configuration.get(key, [defaultValue])",id:"configurationgetkey-defaultvalue",level:2},{value:"configuration.set(key, [value])",id:"configurationsetkey-value",level:2},{value:"configuration.getClient([options])",id:"configurationgetclientoptions",level:2},{value:"configuration.getStorageLocal([options])",id:"configurationgetstoragelocaloptions",level:2},{value:"configuration.createClient([options])",id:"configurationcreateclientoptions",level:2},{value:"configuration.createStorageLocal([options])",id:"configurationcreatestoragelocaloptions",level:2},{value:"Configuration.getGlobalConfig()",id:"configurationgetglobalconfig",level:2}],u={toc:m},s="wrapper";function g(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(s,(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"configuration"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," is a value object holding the SDK configuration. We can use it in two ways:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"When using ",(0,r.kt)("inlineCode",{parentName:"li"},"Apify")," class, we can get the instance configuration via ",(0,r.kt)("inlineCode",{parentName:"li"},"sdk.config"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify');\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"To get the global configuration (singleton instance). It will respect the environment variables.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"console.log(Configuration.getGlobalConfig().get('token')); // returns the token from APIFY_TOKEN env var\n")),(0,r.kt)("h2",{id:"supported-configuration-options"},"Supported Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultDatasetId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_DATASET_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultKeyValueStoreId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultRequestQueueId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageDir")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'./apify_storage'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageEnableWalMode")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"true"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"persistStateIntervalMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PERSIST_STATE_INTERVAL_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"60e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"token")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"advanced-configuration-options"},"Advanced Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorEventsWsUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_EVENTS_WS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorRunId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_RUN_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorTaskId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_TASK_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"apiBaseUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_API_BASE_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'https://api.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"4321"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://localhost:4321'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"inputKey")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_INPUT_KEY")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'INPUT'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"isAtHome")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_IS_AT_HOME")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"metamorphAfterSleepMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_METAMORPH_AFTER_SLEEP_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"300e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyHostname")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_HOSTNAME")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPassword")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PASSWORD")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"8000"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyStatusUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_STATUS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"userId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_USER_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"not-supported-environment-variables"},"Not Supported environment variables"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"MEMORY_MBYTES")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"HEADLESS")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"XVFB")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CHROME_EXECUTABLE_PATH"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"exports.configuration"}),(0,r.kt)("h2",{id:"new-configurationoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new Configuration(options)")),(0,r.kt)("p",null,"Creates new ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance with provided options. Env vars will have precedence over those."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Record"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"get"}),(0,r.kt)("h2",{id:"configurationgetkey-defaultvalue"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.get(key, [defaultValue])")),(0,r.kt)("p",null,"Returns configured value. First checks the environment variables, then provided configuration, fallbacks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"defaultValue")," argument if provided,\notherwise uses the default value as described in the above section."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[defaultValue]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"set"}),(0,r.kt)("h2",{id:"configurationsetkey-value"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.set(key, [value])")),(0,r.kt)("p",null,"Sets value for given option. Only affects this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance, the value will not be propagated down to the env var. To reset a value, we\ncan omit the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument or pass ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," there."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[value]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getclient"}),(0,r.kt)("h2",{id:"configurationgetclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getClient([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the API URL and token, so calling this method with different options will return multiple instances, one for each variant of\nthe options."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getstoragelocal"}),(0,r.kt)("h2",{id:"configurationgetstoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getStorageLocal([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," option, so calling this method with different ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," will return multiple instances, one for each\ndirectory."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createclient"}),(0,r.kt)("h2",{id:"configurationcreateclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createClient([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyClient using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createstoragelocal"}),(0,r.kt)("h2",{id:"configurationcreatestoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createStorageLocal([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyStorageLocal using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getglobalconfig"}),(0,r.kt)("h2",{id:"configurationgetglobalconfig"},(0,r.kt)("inlineCode",{parentName:"h2"},"Configuration.getGlobalConfig()")),(0,r.kt)("p",null,"Returns the global configuration instance. It will respect the environment variables. As opposed to this method, we can also get the SDK instance\nconfiguration via ",(0,r.kt)("inlineCode",{parentName:"p"},"sdk.config")," property."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))),(0,r.kt)("hr",null))}g.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>k,kt:()=>g});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},k=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},s=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),m=d(n),s=i,g=m["".concat(p,".").concat(s)]||m[s]||u[s]||r;return n?a.createElement(g,l(l({ref:t},k),{},{components:n})):a.createElement(g,l({ref:t},k))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=s;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[m]="string"==typeof e?e:i,l[1]=o;for(var d=2;d{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],l={id:"system-status-options",title:"SystemStatusOptions"},i=void 0,p={unversionedId:"typedefs/system-status-options",id:"version-2.3/typedefs/system-status-options",title:"SystemStatusOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SystemStatusOptions.md",sourceDirName:"typedefs",slug:"/typedefs/system-status-options",permalink:"/sdk/js/docs/2.3/typedefs/system-status-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemStatusOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"system-status-options",title:"SystemStatusOptions"},sidebar:"version-2.3/docs",previous:{title:"StealthOptions",permalink:"/sdk/js/docs/2.3/typedefs/stealth-options"},next:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page"}},d={},m=[{value:"Properties",id:"properties",level:2},{value:"currentHistorySecs",id:"currenthistorysecs",level:3},{value:"maxMemoryOverloadedRatio",id:"maxmemoryoverloadedratio",level:3},{value:"maxEventLoopOverloadedRatio",id:"maxeventloopoverloadedratio",level:3},{value:"maxCpuOverloadedRatio",id:"maxcpuoverloadedratio",level:3},{value:"maxClientOverloadedRatio",id:"maxclientoverloadedratio",level:3},{value:"snapshotter",id:"snapshotter",level:3}],u={toc:m},c="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(c,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"systemstatusoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"currenthistorysecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"currentHistorySecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 5")),(0,a.kt)("p",null,"Defines max age of snapshots used in the ",(0,a.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," measurement."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxmemoryoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxMemoryOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.2")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxeventloopoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxEventLoopOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.6")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxcpuoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxCpuOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.4")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxclientoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxClientOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.3")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"snapshotter"},(0,a.kt)("inlineCode",{parentName:"h3"},"snapshotter")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Snapshotter")," instance to be queried for ",(0,a.kt)("inlineCode",{parentName:"p"},"SystemStatus"),"."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(r),c=o,y=m["".concat(i,".").concat(c)]||m[c]||u[c]||a;return r?n.createElement(y,s(s({ref:t},d),{},{components:r})):n.createElement(y,s({ref:t},d))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[m]="string"==typeof e?e:o,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],l={id:"system-status-options",title:"SystemStatusOptions"},i=void 0,p={unversionedId:"typedefs/system-status-options",id:"version-2.3/typedefs/system-status-options",title:"SystemStatusOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SystemStatusOptions.md",sourceDirName:"typedefs",slug:"/typedefs/system-status-options",permalink:"/sdk/js/docs/2.3/typedefs/system-status-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemStatusOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"system-status-options",title:"SystemStatusOptions"},sidebar:"version-2.3/docs",previous:{title:"StealthOptions",permalink:"/sdk/js/docs/2.3/typedefs/stealth-options"},next:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page"}},d={},m=[{value:"Properties",id:"properties",level:2},{value:"currentHistorySecs",id:"currenthistorysecs",level:3},{value:"maxMemoryOverloadedRatio",id:"maxmemoryoverloadedratio",level:3},{value:"maxEventLoopOverloadedRatio",id:"maxeventloopoverloadedratio",level:3},{value:"maxCpuOverloadedRatio",id:"maxcpuoverloadedratio",level:3},{value:"maxClientOverloadedRatio",id:"maxclientoverloadedratio",level:3},{value:"snapshotter",id:"snapshotter",level:3}],u={toc:m},c="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(c,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"systemstatusoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"currenthistorysecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"currentHistorySecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 5")),(0,a.kt)("p",null,"Defines max age of snapshots used in the ",(0,a.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," measurement."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxmemoryoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxMemoryOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.2")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxeventloopoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxEventLoopOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.6")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxcpuoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxCpuOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.4")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxclientoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxClientOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.3")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"snapshotter"},(0,a.kt)("inlineCode",{parentName:"h3"},"snapshotter")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Snapshotter")," instance to be queried for ",(0,a.kt)("inlineCode",{parentName:"p"},"SystemStatus"),"."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(r),c=o,y=m["".concat(i,".").concat(c)]||m[c]||u[c]||a;return r?n.createElement(y,s(s({ref:t},d),{},{components:r})):n.createElement(y,s({ref:t},d))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[m]="string"==typeof e?e:o,s[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),p=["components"],a={id_old:"version-1.3-post-response-inputs",title:"PostResponseInputs",id:"post-response-inputs"},i=void 0,l={unversionedId:"typedefs/post-response-inputs",id:"version-1.3/typedefs/post-response-inputs",title:"PostResponseInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PostResponseInputs.md",sourceDirName:"typedefs",slug:"/typedefs/post-response-inputs",permalink:"/sdk/js/docs/1.3/typedefs/post-response-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponseInputs.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-post-response-inputs",title:"PostResponseInputs",id:"post-response-inputs"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"response",id:"response",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,s.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"postresponseinputs"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"response"},(0,s.kt)("inlineCode",{parentName:"h3"},"response")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"IncomingMessage")," | ",(0,s.kt)("inlineCode",{parentName:"p"},"Readable")),(0,s.kt)("p",null,"stream"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"request"},(0,s.kt)("inlineCode",{parentName:"h3"},"request")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Request"))),(0,s.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"session"},(0,s.kt)("inlineCode",{parentName:"h3"},"session")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Session"))),(0,s.kt)("p",null,"The current session"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"proxyinfo"},(0,s.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,s.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,s.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"crawler"},(0,s.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),l=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),c=l(n),f=o,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||s;return n?r.createElement(m,p(p({ref:t},u),{},{components:n})):r.createElement(m,p({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,p=new Array(s);p[0]=f;var a={};for(var i in t)hasOwnProperty.call(t,i)&&(a[i]=t[i]);a.originalType=e,a[c]="string"==typeof e?e:o,p[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),p=["components"],a={id_old:"version-1.3-post-response-inputs",title:"PostResponseInputs",id:"post-response-inputs"},i=void 0,l={unversionedId:"typedefs/post-response-inputs",id:"version-1.3/typedefs/post-response-inputs",title:"PostResponseInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PostResponseInputs.md",sourceDirName:"typedefs",slug:"/typedefs/post-response-inputs",permalink:"/sdk/js/docs/1.3/typedefs/post-response-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponseInputs.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-post-response-inputs",title:"PostResponseInputs",id:"post-response-inputs"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"response",id:"response",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,s.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"postresponseinputs"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"response"},(0,s.kt)("inlineCode",{parentName:"h3"},"response")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"IncomingMessage")," | ",(0,s.kt)("inlineCode",{parentName:"p"},"Readable")),(0,s.kt)("p",null,"stream"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"request"},(0,s.kt)("inlineCode",{parentName:"h3"},"request")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Request"))),(0,s.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"session"},(0,s.kt)("inlineCode",{parentName:"h3"},"session")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Session"))),(0,s.kt)("p",null,"The current session"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"proxyinfo"},(0,s.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,s.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,s.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"crawler"},(0,s.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),l=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),c=l(n),f=o,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||s;return n?r.createElement(m,p(p({ref:t},u),{},{components:n})):r.createElement(m,p({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,p=new Array(s);p[0]=f;var a={};for(var i in t)hasOwnProperty.call(t,i)&&(a[i]=t[i]);a.originalType=e,a[c]="string"==typeof e?e:o,p[1]=a;for(var l=2;l{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),s=i.version,c=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var d=s+"/";return"current"===s?d="next/":c&&(d=""),n.createElement(a.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>l});var n=r(67294),a=r(88746),o="https://crawlee.dev",l=function(e){var t=e.to,r=e.children,l=e.version;return n.createElement(a.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},25509:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>u,default:()=>g,frontMatter:()=>p,metadata:()=>m,toc:()=>b});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=(r(14563),r(68889)),i=r(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a CheerioCrawler\nconst crawler = new CheerioCrawler({\n // Limits the crawler to only 10 requests (do not use if you want to crawl all links)\n maxRequestsPerCrawl: 10,\n // Function called for each URL\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add some links from page to the crawler's RequestQueue\n await enqueueLinks({\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n },\n});\n\n// Define the starting URL and run the crawler\nawait crawler.run(['https://apify.com/store']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko"};var c,d=["components"],p={id:"crawl-some-links",title:"Crawl some links on a website"},u=void 0,m={unversionedId:"examples/crawl-some-links",id:"version-3.1/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.",source:"@site/versioned_docs/version-3.1/examples/crawl_some_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_some_links.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/examples/forms"}},y={},b=[],f=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),C={toc:b},h="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,d);return(0,o.kt)(h,(0,n.Z)({},C,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," example uses the ",(0,o.kt)(i.T,{to:"core/class/PseudoUrl",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"pseudoUrls"))," property in the ",(0,o.kt)(i.T,{to:"cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"))," method to only add links to the ",(0,o.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," queue if they match the specified regular expression."),(0,o.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(r),m=a,y=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),s=i.version,c=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var d=s+"/";return"current"===s?d="next/":c&&(d=""),n.createElement(a.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>l});var n=r(67294),a=r(88746),o="https://crawlee.dev",l=function(e){var t=e.to,r=e.children,l=e.version;return n.createElement(a.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},25509:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>u,default:()=>g,frontMatter:()=>p,metadata:()=>m,toc:()=>b});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=(r(14563),r(68889)),i=r(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a CheerioCrawler\nconst crawler = new CheerioCrawler({\n // Limits the crawler to only 10 requests (do not use if you want to crawl all links)\n maxRequestsPerCrawl: 10,\n // Function called for each URL\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add some links from page to the crawler's RequestQueue\n await enqueueLinks({\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n },\n});\n\n// Define the starting URL and run the crawler\nawait crawler.run(['https://apify.com/store']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko"};var c,d=["components"],p={id:"crawl-some-links",title:"Crawl some links on a website"},u=void 0,m={unversionedId:"examples/crawl-some-links",id:"version-3.1/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.",source:"@site/versioned_docs/version-3.1/examples/crawl_some_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_some_links.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/examples/forms"}},y={},b=[],f=(c="RunnableCodeBlock",function(e){return console.warn("Component "+c+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),C={toc:b},h="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,d);return(0,o.kt)(h,(0,n.Z)({},C,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," example uses the ",(0,o.kt)(i.T,{to:"core/class/PseudoUrl",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"pseudoUrls"))," property in the ",(0,o.kt)(i.T,{to:"cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"))," method to only add links to the ",(0,o.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," queue if they match the specified regular expression."),(0,o.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(r),m=a,y=p["".concat(s,".").concat(m)]||p[m]||u[m]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id:"proxy-configuration-options",title:"ProxyConfigurationOptions"},l=void 0,s={unversionedId:"typedefs/proxy-configuration-options",id:"version-2.3/typedefs/proxy-configuration-options",title:"ProxyConfigurationOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/ProxyConfigurationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-options",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-configuration-options",title:"ProxyConfigurationOptions"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"},next:{title:"ProxyInfo",permalink:"/sdk/js/docs/2.3/typedefs/proxy-info"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"password",id:"password",level:3},{value:"groups",id:"groups",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"apifyProxyGroups",id:"apifyproxygroups",level:3},{value:"apifyProxyCountry",id:"apifyproxycountry",level:3},{value:"proxyUrls",id:"proxyurls",level:3},{value:"newUrlFunction",id:"newurlfunction",level:3}],d={toc:c},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyconfigurationoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries. on the Apify cloud, or when using the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxygroups"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyGroups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," option in your crawler code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxycountry"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyCountry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," option in your crawler\ncode."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurls"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrls")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will\ncause an error to be thrown on initialize."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"newurlfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"newUrlFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationFunction"))),(0,a.kt)("p",null,"Custom function that allows you to generate the new proxy URL dynamically. It gets the ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," as a parameter and should always return stringified\nproxy URL. This function is used to generate the URL when ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl"))," or\n",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo"))," is called."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),c=s(n),y=o,f=c["".concat(l,".").concat(y)]||c[y]||d[y]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[c]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id:"proxy-configuration-options",title:"ProxyConfigurationOptions"},l=void 0,s={unversionedId:"typedefs/proxy-configuration-options",id:"version-2.3/typedefs/proxy-configuration-options",title:"ProxyConfigurationOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/ProxyConfigurationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-options",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-configuration-options",title:"ProxyConfigurationOptions"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerLaunchContext",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"},next:{title:"ProxyInfo",permalink:"/sdk/js/docs/2.3/typedefs/proxy-info"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"password",id:"password",level:3},{value:"groups",id:"groups",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"apifyProxyGroups",id:"apifyproxygroups",level:3},{value:"apifyProxyCountry",id:"apifyproxycountry",level:3},{value:"proxyUrls",id:"proxyurls",level:3},{value:"newUrlFunction",id:"newurlfunction",level:3}],d={toc:c},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyconfigurationoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries. on the Apify cloud, or when using the\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxygroups"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyGroups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"groups")," option in your crawler code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"apifyproxycountry"},(0,a.kt)("inlineCode",{parentName:"h3"},"apifyProxyCountry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Same option as ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," which can be used to configurate the proxy by UI input schema. You should use the ",(0,a.kt)("inlineCode",{parentName:"p"},"countryCode")," option in your crawler\ncode."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurls"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrls")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will\ncause an error to be thrown on initialize."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"newurlfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"newUrlFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationFunction"))),(0,a.kt)("p",null,"Custom function that allows you to generate the new proxy URL dynamically. It gets the ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," as a parameter and should always return stringified\nproxy URL. This function is used to generate the URL when ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl"))," or\n",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo"))," is called."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),c=s(n),y=o,f=c["".concat(l,".").concat(y)]||c[y]||d[y]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[c]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{r.d(t,{Z:()=>s});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const s=function(e){var t=e.to,r=e.children,s=(0,o.E)(),l=s.version,c=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=l+"/";return"current"===l?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>s,T:()=>i});var n=r(67294),a=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return n.createElement(a.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},s=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},25327:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>f,contentTitle:()=>d,default:()=>k,frontMatter:()=>u,metadata:()=>m,toc:()=>w});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(14563),s=r(68889),l=r(26569);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a CheerioCrawler\nconst crawler = new CheerioCrawler({\n // Limits the crawler to only 10 requests (do not use if you want to crawl all links)\n maxRequestsPerCrawl: 10,\n // Function called for each URL\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add some links from page to the crawler's RequestQueue\n await enqueueLinks({\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n },\n});\n\n// Define the starting URL and run the crawler\nawait crawler.run(['https://apify.com/store']);\n\nawait Actor.exit();\n";var p=["components"],u={id:"crawl-some-links",title:"Crawl some links on a website"},d=void 0,m={unversionedId:"examples/crawl-some-links",id:"version-3.0/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.",source:"@site/versioned_docs/version-3.0/examples/crawl_some_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/3.0/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_some_links.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/3.0/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/3.0/examples/forms"}},f={},w=[],y={toc:w},h="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(h,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)(l.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," example uses the ",(0,o.kt)(l.T,{to:"core/class/PseudoUrl",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"pseudoUrls"))," property in the ",(0,o.kt)(l.T,{to:"cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"))," method to only add links to the ",(0,o.kt)(s.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," queue if they match the specified regular expression."),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},c))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{r.d(t,{Z:()=>s});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const s=function(e){var t=e.to,r=e.children,s=(0,o.E)(),l=s.version,c=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=l+"/";return"current"===l?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>s,T:()=>i});var n=r(67294),a=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return n.createElement(a.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},s=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},25327:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>f,contentTitle:()=>d,default:()=>k,frontMatter:()=>u,metadata:()=>m,toc:()=>w});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(14563),s=r(68889),l=r(26569);const c="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a CheerioCrawler\nconst crawler = new CheerioCrawler({\n // Limits the crawler to only 10 requests (do not use if you want to crawl all links)\n maxRequestsPerCrawl: 10,\n // Function called for each URL\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add some links from page to the crawler's RequestQueue\n await enqueueLinks({\n pseudoUrls: ['http[s?]://apify.com/[.+]/[.+]'],\n });\n },\n});\n\n// Define the starting URL and run the crawler\nawait crawler.run(['https://apify.com/store']);\n\nawait Actor.exit();\n";var p=["components"],u={id:"crawl-some-links",title:"Crawl some links on a website"},d=void 0,m={unversionedId:"examples/crawl-some-links",id:"version-3.0/examples/crawl-some-links",title:"Crawl some links on a website",description:"This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.",source:"@site/versioned_docs/version-3.0/examples/crawl_some_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-some-links",permalink:"/sdk/js/docs/3.0/examples/crawl-some-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_some_links.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-some-links",title:"Crawl some links on a website"},sidebar:"docs",previous:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/3.0/examples/crawl-sitemap"},next:{title:"Forms",permalink:"/sdk/js/docs/3.0/examples/forms"}},f={},w=[],y={toc:w},h="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(h,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This ",(0,o.kt)(l.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," example uses the ",(0,o.kt)(l.T,{to:"core/class/PseudoUrl",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"pseudoUrls"))," property in the ",(0,o.kt)(l.T,{to:"cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"))," method to only add links to the ",(0,o.kt)(s.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," queue if they match the specified regular expression."),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},c))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{r.d(t,{Z:()=>i});var n=r(67294),s=r(88746),a=r(6141),o=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,a.E)(),u=i.version,l=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(s.default,{to:"/api/"+t},r);var p=u+"/";return"current"===u?p="next/":l&&(p=""),n.createElement(s.default,{to:"/api/"+p+t},r)}},40295:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>d,toc:()=>h});var n,s=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(68889),u=["components"],l={id:"request-storage",title:"Request Storage"},p=void 0,d={unversionedId:"guides/request-storage",id:"version-3.0/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.0/guides/request_storage.mdx",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/3.0/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/request_storage.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/3.0/guides/apify-platform"},next:{title:"Result Storage",permalink:"/sdk/js/docs/3.0/guides/result-storage"}},c={},h=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],m=(n="CrawleeApiLink",function(e){return console.warn("Component "+n+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:h},q="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,u);return(0,o.kt)(q,(0,s.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await RequestQueue.open();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,o.kt)("h2",{id:"request-list"},"Request list"),(0,o.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,o.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,o.kt)(m,{to:"core/class/RequestList",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestList"))," class."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await RequestList.open('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,o.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,o.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,o.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,o.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,o.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await RequestList.open('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await RequestQueue.open();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,a=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=s,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||a;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=r.length,o=new Array(a);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:s,o[1]=i;for(var l=2;l{r.d(t,{Z:()=>i});var n=r(67294),s=r(88746),a=r(6141),o=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,a.E)(),u=i.version,l=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(s.default,{to:"/api/"+t},r);var p=u+"/";return"current"===u?p="next/":l&&(p=""),n.createElement(s.default,{to:"/api/"+p+t},r)}},40295:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>d,toc:()=>h});var n,s=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(68889),u=["components"],l={id:"request-storage",title:"Request Storage"},p=void 0,d={unversionedId:"guides/request-storage",id:"version-3.0/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.0/guides/request_storage.mdx",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/3.0/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/request_storage.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/3.0/guides/apify-platform"},next:{title:"Result Storage",permalink:"/sdk/js/docs/3.0/guides/result-storage"}},c={},h=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],m=(n="CrawleeApiLink",function(e){return console.warn("Component "+n+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:h},q="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,u);return(0,o.kt)(q,(0,s.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await RequestQueue.open();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,o.kt)("h2",{id:"request-list"},"Request list"),(0,o.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,o.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,o.kt)(m,{to:"core/class/RequestList",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestList"))," class."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await RequestList.open('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,o.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,o.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,o.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,o.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,o.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await RequestList.open('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await RequestQueue.open();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,a=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=s,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||a;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=r.length,o=new Array(a);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:s,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=["components"],i={id:"actor-run",title:"ActorRun"},p=void 0,u={unversionedId:"typedefs/actor-run",id:"version-2.3/typedefs/actor-run",title:"ActorRun",description:"Represents information about an actor run, as returned by the Apify.call() or Apify.callTask()",source:"@site/versioned_docs/version-2.3/typedefs/ActorRun.md",sourceDirName:"typedefs",slug:"/typedefs/actor-run",permalink:"/sdk/js/docs/2.3/typedefs/actor-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ActorRun.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"actor-run",title:"ActorRun"},sidebar:"version-2.3/docs",previous:{title:"RequestTransform",permalink:"/sdk/js/docs/2.3/typedefs/request-transform"},next:{title:"ApifyCallError",permalink:"/sdk/js/docs/2.3/api/apify-call-error"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"actId",id:"actid",level:3},{value:"startedAt",id:"startedat",level:3},{value:"finishedAt",id:"finishedat",level:3},{value:"status",id:"status",level:3},{value:"meta",id:"meta",level:3},{value:"stats",id:"stats",level:3},{value:"options",id:"options",level:3},{value:"buildId",id:"buildid",level:3},{value:"buildNumber",id:"buildnumber",level:3},{value:"exitCode",id:"exitcode",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"defaultRequestQueueId",id:"defaultrequestqueueid",level:3},{value:"containerUrl",id:"containerurl",level:3},{value:"output",id:"output",level:3}],c={toc:s},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,l.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"actorrun"}),(0,l.kt)("p",null,"Represents information about an actor run, as returned by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.callTask()")),"\nfunction. The object is almost equivalent to the JSON response of the\n",(0,l.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Actor run")," Apify API endpoint and extended with certain fields. For more\ndetails, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run",target:"_blank",rel:"noopener"},"Runs.")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor run ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"actid"},(0,l.kt)("inlineCode",{parentName:"h3"},"actId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"startedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run started"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"finishedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"finishedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run finished. Contains ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," for running actors."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"status"},(0,l.kt)("inlineCode",{parentName:"h3"},"status")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Status of the run. For possible values, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actors/running#lifecycle",target:"_blank",rel:"noopener"},"Run lifecycle")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"meta"},(0,l.kt)("inlineCode",{parentName:"h3"},"meta")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run meta-data. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "origin": "API",\n "clientIp": "1.2.3.4",\n "userAgent": "ApifyClient/0.2.13 (Linux; Node/v8.11.3)"\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"An object containing various actor run statistics. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "inputBodyLen": 22,\n "restartCount": 0,\n "workersUsed": 1,\n}\n')),(0,l.kt)("p",null,"Beware that object fields might change in future releases."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"options"},(0,l.kt)("inlineCode",{parentName:"h3"},"options")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run options. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "build": "latest",\n "waitSecs": 0,\n "memoryMbytes": 256,\n "diskMbytes": 512\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildid"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the actor build used for the run. For details, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build",target:"_blank",rel:"noopener"},"Builds")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildnumber"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildNumber")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Number of the actor build used for the run. For example, ",(0,l.kt)("inlineCode",{parentName:"p"},"0.0.10"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"exitcode"},(0,l.kt)("inlineCode",{parentName:"h3"},"exitCode")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Exit code of the actor run process. It's ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if actor is still running."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default key-value store associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultdatasetid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default dataset associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Dataset"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultrequestqueueid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultRequestQueueId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default request queue associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"containerurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"containerUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL on which the web server running inside actor run's Docker container can be accessed. For more details, see\n",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#container-web-server",target:"_blank",rel:"noopener"},"Container web server")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"output"},(0,l.kt)("inlineCode",{parentName:"h3"},"output")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")),(0,l.kt)("p",null,"Contains output of the actor run. The value is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," in case the actor is still running, or if you pass ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," to the ",(0,l.kt)("inlineCode",{parentName:"p"},"fetchOutput"),"\noption of ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()")),"."),(0,l.kt)("p",null,"For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "contentType": "application/json; charset=utf-8",\n "body": {\n "message": "Hello world!"\n }\n}\n')),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),s=u(n),k=a,m=s["".concat(p,".").concat(k)]||s[k]||c[k]||l;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=["components"],i={id:"actor-run",title:"ActorRun"},p=void 0,u={unversionedId:"typedefs/actor-run",id:"version-2.3/typedefs/actor-run",title:"ActorRun",description:"Represents information about an actor run, as returned by the Apify.call() or Apify.callTask()",source:"@site/versioned_docs/version-2.3/typedefs/ActorRun.md",sourceDirName:"typedefs",slug:"/typedefs/actor-run",permalink:"/sdk/js/docs/2.3/typedefs/actor-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ActorRun.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"actor-run",title:"ActorRun"},sidebar:"version-2.3/docs",previous:{title:"RequestTransform",permalink:"/sdk/js/docs/2.3/typedefs/request-transform"},next:{title:"ApifyCallError",permalink:"/sdk/js/docs/2.3/api/apify-call-error"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"actId",id:"actid",level:3},{value:"startedAt",id:"startedat",level:3},{value:"finishedAt",id:"finishedat",level:3},{value:"status",id:"status",level:3},{value:"meta",id:"meta",level:3},{value:"stats",id:"stats",level:3},{value:"options",id:"options",level:3},{value:"buildId",id:"buildid",level:3},{value:"buildNumber",id:"buildnumber",level:3},{value:"exitCode",id:"exitcode",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"defaultRequestQueueId",id:"defaultrequestqueueid",level:3},{value:"containerUrl",id:"containerurl",level:3},{value:"output",id:"output",level:3}],c={toc:s},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,l.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"actorrun"}),(0,l.kt)("p",null,"Represents information about an actor run, as returned by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.callTask()")),"\nfunction. The object is almost equivalent to the JSON response of the\n",(0,l.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Actor run")," Apify API endpoint and extended with certain fields. For more\ndetails, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run",target:"_blank",rel:"noopener"},"Runs.")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor run ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"actid"},(0,l.kt)("inlineCode",{parentName:"h3"},"actId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"startedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run started"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"finishedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"finishedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run finished. Contains ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," for running actors."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"status"},(0,l.kt)("inlineCode",{parentName:"h3"},"status")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Status of the run. For possible values, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actors/running#lifecycle",target:"_blank",rel:"noopener"},"Run lifecycle")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"meta"},(0,l.kt)("inlineCode",{parentName:"h3"},"meta")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run meta-data. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "origin": "API",\n "clientIp": "1.2.3.4",\n "userAgent": "ApifyClient/0.2.13 (Linux; Node/v8.11.3)"\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"An object containing various actor run statistics. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "inputBodyLen": 22,\n "restartCount": 0,\n "workersUsed": 1,\n}\n')),(0,l.kt)("p",null,"Beware that object fields might change in future releases."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"options"},(0,l.kt)("inlineCode",{parentName:"h3"},"options")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run options. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "build": "latest",\n "waitSecs": 0,\n "memoryMbytes": 256,\n "diskMbytes": 512\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildid"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the actor build used for the run. For details, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build",target:"_blank",rel:"noopener"},"Builds")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildnumber"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildNumber")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Number of the actor build used for the run. For example, ",(0,l.kt)("inlineCode",{parentName:"p"},"0.0.10"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"exitcode"},(0,l.kt)("inlineCode",{parentName:"h3"},"exitCode")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Exit code of the actor run process. It's ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if actor is still running."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default key-value store associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultdatasetid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default dataset associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Dataset"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultrequestqueueid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultRequestQueueId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default request queue associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"containerurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"containerUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL on which the web server running inside actor run's Docker container can be accessed. For more details, see\n",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#container-web-server",target:"_blank",rel:"noopener"},"Container web server")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"output"},(0,l.kt)("inlineCode",{parentName:"h3"},"output")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")),(0,l.kt)("p",null,"Contains output of the actor run. The value is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," in case the actor is still running, or if you pass ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," to the ",(0,l.kt)("inlineCode",{parentName:"p"},"fetchOutput"),"\noption of ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()")),"."),(0,l.kt)("p",null,"For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "contentType": "application/json; charset=utf-8",\n "body": {\n "message": "Hello world!"\n }\n}\n')),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),s=u(n),k=a,m=s["".concat(p,".").concat(k)]||s[k]||c[k]||l;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-crawling-context",title:"CrawlingContext",id:"crawling-context"},p=void 0,s={unversionedId:"typedefs/crawling-context",id:"version-1.3/typedefs/crawling-context",title:"CrawlingContext",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/crawling-context",permalink:"/sdk/js/docs/1.3/typedefs/crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CrawlingContext.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawling-context",title:"CrawlingContext",id:"crawling-context"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"response",id:"response",level:3}],u={toc:d},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"crawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"request"},(0,a.kt)("inlineCode",{parentName:"h3"},"request")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"session"},(0,a.kt)("inlineCode",{parentName:"h3"},"session")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyinfo"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"response"},(0,a.kt)("inlineCode",{parentName:"h3"},"response")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-crawling-context",title:"CrawlingContext",id:"crawling-context"},p=void 0,s={unversionedId:"typedefs/crawling-context",id:"version-1.3/typedefs/crawling-context",title:"CrawlingContext",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CrawlingContext.md",sourceDirName:"typedefs",slug:"/typedefs/crawling-context",permalink:"/sdk/js/docs/1.3/typedefs/crawling-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CrawlingContext.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawling-context",title:"CrawlingContext",id:"crawling-context"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"response",id:"response",level:3}],u={toc:d},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"crawlingcontext"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"request"},(0,a.kt)("inlineCode",{parentName:"h3"},"request")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"session"},(0,a.kt)("inlineCode",{parentName:"h3"},"session")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyinfo"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"response"},(0,a.kt)("inlineCode",{parentName:"h3"},"response")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{a.d(t,{Z:()=>d});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const d=function(e){var t=e.to,a=e.children,d=(0,o.E)(),s=d.version,p=d.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var l=s+"/";return"current"===s?l="next/":p&&(l=""),n.createElement(r.default,{to:"/api/"+l+t},a)}},6182:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>h,contentTitle:()=>u,default:()=>k,frontMatter:()=>c,metadata:()=>m,toc:()=>y});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(14563),a(68889));const d={code:"import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst dataset = await Actor.openDataset<{ headingCount: number }>();\n\n// calling map function and filtering through mapped items\nconst moreThan5headers = (await dataset.map((item) => item.headingCount)).filter((count) => count > 5);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_with_more_than_5_headers', moreThan5headers);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBkYXRhc2V0ID0gYXdhaXQgQWN0b3Iub3BlbkRhdGFzZXQ8eyBoZWFkaW5nQ291bnQ6IG51bWJlciB9PigpO1xcblxcbi8vIGNhbGxpbmcgbWFwIGZ1bmN0aW9uIGFuZCBmaWx0ZXJpbmcgdGhyb3VnaCBtYXBwZWQgaXRlbXNcXG5jb25zdCBtb3JlVGhhbjVoZWFkZXJzID0gKGF3YWl0IGRhdGFzZXQubWFwKChpdGVtKSA9PiBpdGVtLmhlYWRpbmdDb3VudCkpLmZpbHRlcigoY291bnQpID0-IGNvdW50ID4gNSk7XFxuXFxuLy8gc2F2aW5nIHJlc3VsdCBvZiBtYXAgdG8gZGVmYXVsdCBLZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgncGFnZXNfd2l0aF9tb3JlX3RoYW5fNV9oZWFkZXJzJywgbW9yZVRoYW41aGVhZGVycyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.Q-rNIQYAy8a-1WsGs9suJ81WRuf_op1ZO2rCzoYyeAs"},s={code:"import { Actor } from 'apify';\n\nconst dataset = await Actor.openDataset();\n\n// calling reduce function and using memo to calculate number of headers\nconst pagesHeadingCount = await dataset.reduce((memo, value) => {\n return memo += value.headingCount;\n}, 0);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_heading_count', pagesHeadingCount);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmNvbnN0IGRhdGFzZXQgPSBhd2FpdCBBY3Rvci5vcGVuRGF0YXNldCgpO1xcblxcbi8vIGNhbGxpbmcgcmVkdWNlIGZ1bmN0aW9uIGFuZCB1c2luZyBtZW1vIHRvIGNhbGN1bGF0ZSBudW1iZXIgb2YgaGVhZGVyc1xcbmNvbnN0IHBhZ2VzSGVhZGluZ0NvdW50ID0gYXdhaXQgZGF0YXNldC5yZWR1Y2UoKG1lbW8sIHZhbHVlKSA9PiB7XFxuICAgIHJldHVybiBtZW1vICs9IHZhbHVlLmhlYWRpbmdDb3VudDtcXG59LCAwKTtcXG5cXG4vLyBzYXZpbmcgcmVzdWx0IG9mIG1hcCB0byBkZWZhdWx0IEtleS12YWx1ZSBzdG9yZVxcbmF3YWl0IEFjdG9yLnNldFZhbHVlKCdwYWdlc19oZWFkaW5nX2NvdW50JywgcGFnZXNIZWFkaW5nQ291bnQpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.1ViXq6_den8WcUl-TG3DdWceExG2yJNw4qobM_aNXao"};var p,l=["components"],c={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},u=void 0,m={unversionedId:"examples/map-and-reduce",id:"version-3.1/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Dataset map",source:"@site/versioned_docs/version-3.1/examples/map_and_reduce.mdx",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/map_and_reduce.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"docs",previous:{title:"Forms",permalink:"/sdk/js/docs/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/examples/playwright-crawler"}},h={},y=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],b=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:y},g="wrapper";function k(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(g,(0,n.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#map",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"map")),"\nand ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"reduce"))," methods. Both methods can be used to simplify\nthe dataset results workflow process. Both can be called on the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()")),"\nmethod to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>l,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return a?n.createElement(h,i(i({ref:t},l),{},{components:a})):n.createElement(h,i({ref:t},l))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var d={};for(var s in t)hasOwnProperty.call(t,s)&&(d[s]=t[s]);d.originalType=e,d[c]="string"==typeof e?e:r,i[1]=d;for(var p=2;p{a.d(t,{Z:()=>d});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const d=function(e){var t=e.to,a=e.children,d=(0,o.E)(),s=d.version,p=d.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var l=s+"/";return"current"===s?l="next/":p&&(l=""),n.createElement(r.default,{to:"/api/"+l+t},a)}},6182:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>h,contentTitle:()=>u,default:()=>k,frontMatter:()=>c,metadata:()=>m,toc:()=>y});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(14563),a(68889));const d={code:"import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst dataset = await Actor.openDataset<{ headingCount: number }>();\n\n// calling map function and filtering through mapped items\nconst moreThan5headers = (await dataset.map((item) => item.headingCount)).filter((count) => count > 5);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_with_more_than_5_headers', moreThan5headers);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBkYXRhc2V0ID0gYXdhaXQgQWN0b3Iub3BlbkRhdGFzZXQ8eyBoZWFkaW5nQ291bnQ6IG51bWJlciB9PigpO1xcblxcbi8vIGNhbGxpbmcgbWFwIGZ1bmN0aW9uIGFuZCBmaWx0ZXJpbmcgdGhyb3VnaCBtYXBwZWQgaXRlbXNcXG5jb25zdCBtb3JlVGhhbjVoZWFkZXJzID0gKGF3YWl0IGRhdGFzZXQubWFwKChpdGVtKSA9PiBpdGVtLmhlYWRpbmdDb3VudCkpLmZpbHRlcigoY291bnQpID0-IGNvdW50ID4gNSk7XFxuXFxuLy8gc2F2aW5nIHJlc3VsdCBvZiBtYXAgdG8gZGVmYXVsdCBLZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgncGFnZXNfd2l0aF9tb3JlX3RoYW5fNV9oZWFkZXJzJywgbW9yZVRoYW41aGVhZGVycyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.Q-rNIQYAy8a-1WsGs9suJ81WRuf_op1ZO2rCzoYyeAs"},s={code:"import { Actor } from 'apify';\n\nconst dataset = await Actor.openDataset();\n\n// calling reduce function and using memo to calculate number of headers\nconst pagesHeadingCount = await dataset.reduce((memo, value) => {\n return memo += value.headingCount;\n}, 0);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_heading_count', pagesHeadingCount);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmNvbnN0IGRhdGFzZXQgPSBhd2FpdCBBY3Rvci5vcGVuRGF0YXNldCgpO1xcblxcbi8vIGNhbGxpbmcgcmVkdWNlIGZ1bmN0aW9uIGFuZCB1c2luZyBtZW1vIHRvIGNhbGN1bGF0ZSBudW1iZXIgb2YgaGVhZGVyc1xcbmNvbnN0IHBhZ2VzSGVhZGluZ0NvdW50ID0gYXdhaXQgZGF0YXNldC5yZWR1Y2UoKG1lbW8sIHZhbHVlKSA9PiB7XFxuICAgIHJldHVybiBtZW1vICs9IHZhbHVlLmhlYWRpbmdDb3VudDtcXG59LCAwKTtcXG5cXG4vLyBzYXZpbmcgcmVzdWx0IG9mIG1hcCB0byBkZWZhdWx0IEtleS12YWx1ZSBzdG9yZVxcbmF3YWl0IEFjdG9yLnNldFZhbHVlKCdwYWdlc19oZWFkaW5nX2NvdW50JywgcGFnZXNIZWFkaW5nQ291bnQpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.1ViXq6_den8WcUl-TG3DdWceExG2yJNw4qobM_aNXao"};var p,l=["components"],c={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},u=void 0,m={unversionedId:"examples/map-and-reduce",id:"version-3.1/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Dataset map",source:"@site/versioned_docs/version-3.1/examples/map_and_reduce.mdx",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/map_and_reduce.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"docs",previous:{title:"Forms",permalink:"/sdk/js/docs/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/examples/playwright-crawler"}},h={},y=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],b=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:y},g="wrapper";function k(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(g,(0,n.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#map",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"map")),"\nand ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"reduce"))," methods. Both methods can be used to simplify\nthe dataset results workflow process. Both can be called on the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()")),"\nmethod to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)(i.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)(i.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>l,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,l=d(e,["components","mdxType","originalType","parentName"]),c=p(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||u[m]||o;return a?n.createElement(h,i(i({ref:t},l),{},{components:a})):n.createElement(h,i({ref:t},l))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var d={};for(var s in t)hasOwnProperty.call(t,s)&&(d[s]=t[s]);d.originalType=e,d[c]="string"==typeof e?e:r,i[1]=d;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),s=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-use-stealth-mode",title:"Use stealth mode",id:"use-stealth-mode"},l=void 0,p={unversionedId:"examples/use-stealth-mode",id:"version-1.3/examples/use-stealth-mode",title:"Use stealth mode",description:"Stealth mode allows you to bypass anti-scraping techniques that use",source:"@site/versioned_docs/version-1.3/examples/use_stealth_mode.md",sourceDirName:"examples",slug:"/examples/use-stealth-mode",permalink:"/sdk/js/docs/1.3/examples/use-stealth-mode",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/use_stealth_mode.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-use-stealth-mode",title:"Use stealth mode",id:"use-stealth-mode"},sidebar:"version-1.3/docs",previous:{title:"Synchronous run",permalink:"/sdk/js/docs/1.3/examples/synchronous-run"},next:{title:"Apify",permalink:"/sdk/js/docs/1.3/api/apify"}},c={},u=[{value:"Single-browser instances",id:"single-browser-instances",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,r.Z)(e,o);return(0,s.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"Stealth mode allows you to bypass anti-scraping techniques that use\n",(0,s.kt)("a",{parentName:"p",href:"https://pixelprivacy.com/resources/browser-fingerprinting/",target:"_blank",rel:"noopener"},"browser fingerprinting"),". It overrides the attributes specified for\n",(0,s.kt)("a",{parentName:"p",href:"https://developers.google.com/web/updates/2017/04/headless-chrome",target:"_blank",rel:"noopener"},"headless")," browser mode, making your headless browser harder to distinguish from\nthe full Chrome browser."),(0,s.kt)("p",null,"To activate stealth mode, you need to ",(0,s.kt)("inlineCode",{parentName:"p"},"useChrome"),", run ",(0,s.kt)("inlineCode",{parentName:"p"},"headless")," and turn ",(0,s.kt)("inlineCode",{parentName:"p"},"stealth")," on in your\n",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"launchContext")),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-js"},"const launchContext = {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n};\n")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', ['https://news.ycombinator.com/']);\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n launchContext: {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n // You can override default stealth options\n // stealthOptions: {\n // addLanguage: false,\n // },\n },\n handlePageFunction: async ({ page }) => {\n const data = await page.$$eval('.athing', $posts => {\n const scrapedData = [];\n // Get the title of each post on Hacker News\n $posts.forEach($post => {\n const title = $post.querySelector('.title a').innerText;\n scrapedData.push({\n title: `The title is: ${title}`,\n });\n });\n return scrapedData;\n });\n // Save the data array to the Apify dataSet\n await Apify.pushData(data);\n },\n });\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"You can then specify the ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/stealth-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"stealthOptions")),", which allow you to adapt to different anti-scraping\ntechniques. All the options are set to ",(0,s.kt)("inlineCode",{parentName:"p"},"true")," by default. The number of options does not affect performance."),(0,s.kt)("p",null,"While the default configuration will be fine in many cases, you can adapt the options to your use case."),(0,s.kt)("h3",{id:"single-browser-instances"},"Single-browser instances"),(0,s.kt)("p",null,"You can also use stealth mode in single-browser instances when using ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/apify#launchpuppeteer",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer")),".\nThe ",(0,s.kt)("inlineCode",{parentName:"p"},"launchContext")," is the same."))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||s;return n?a.createElement(m,o(o({ref:t},c),{},{components:n})):a.createElement(m,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:r,o[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),s=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-use-stealth-mode",title:"Use stealth mode",id:"use-stealth-mode"},l=void 0,p={unversionedId:"examples/use-stealth-mode",id:"version-1.3/examples/use-stealth-mode",title:"Use stealth mode",description:"Stealth mode allows you to bypass anti-scraping techniques that use",source:"@site/versioned_docs/version-1.3/examples/use_stealth_mode.md",sourceDirName:"examples",slug:"/examples/use-stealth-mode",permalink:"/sdk/js/docs/1.3/examples/use-stealth-mode",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/use_stealth_mode.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-use-stealth-mode",title:"Use stealth mode",id:"use-stealth-mode"},sidebar:"version-1.3/docs",previous:{title:"Synchronous run",permalink:"/sdk/js/docs/1.3/examples/synchronous-run"},next:{title:"Apify",permalink:"/sdk/js/docs/1.3/api/apify"}},c={},u=[{value:"Single-browser instances",id:"single-browser-instances",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,r.Z)(e,o);return(0,s.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"Stealth mode allows you to bypass anti-scraping techniques that use\n",(0,s.kt)("a",{parentName:"p",href:"https://pixelprivacy.com/resources/browser-fingerprinting/",target:"_blank",rel:"noopener"},"browser fingerprinting"),". It overrides the attributes specified for\n",(0,s.kt)("a",{parentName:"p",href:"https://developers.google.com/web/updates/2017/04/headless-chrome",target:"_blank",rel:"noopener"},"headless")," browser mode, making your headless browser harder to distinguish from\nthe full Chrome browser."),(0,s.kt)("p",null,"To activate stealth mode, you need to ",(0,s.kt)("inlineCode",{parentName:"p"},"useChrome"),", run ",(0,s.kt)("inlineCode",{parentName:"p"},"headless")," and turn ",(0,s.kt)("inlineCode",{parentName:"p"},"stealth")," on in your\n",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"launchContext")),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-js"},"const launchContext = {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n};\n")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', ['https://news.ycombinator.com/']);\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n launchContext: {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n // You can override default stealth options\n // stealthOptions: {\n // addLanguage: false,\n // },\n },\n handlePageFunction: async ({ page }) => {\n const data = await page.$$eval('.athing', $posts => {\n const scrapedData = [];\n // Get the title of each post on Hacker News\n $posts.forEach($post => {\n const title = $post.querySelector('.title a').innerText;\n scrapedData.push({\n title: `The title is: ${title}`,\n });\n });\n return scrapedData;\n });\n // Save the data array to the Apify dataSet\n await Apify.pushData(data);\n },\n });\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"You can then specify the ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/stealth-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"stealthOptions")),", which allow you to adapt to different anti-scraping\ntechniques. All the options are set to ",(0,s.kt)("inlineCode",{parentName:"p"},"true")," by default. The number of options does not affect performance."),(0,s.kt)("p",null,"While the default configuration will be fine in many cases, you can adapt the options to your use case."),(0,s.kt)("h3",{id:"single-browser-instances"},"Single-browser instances"),(0,s.kt)("p",null,"You can also use stealth mode in single-browser instances when using ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/apify#launchpuppeteer",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer")),".\nThe ",(0,s.kt)("inlineCode",{parentName:"p"},"launchContext")," is the same."))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||s;return n?a.createElement(m,o(o({ref:t},c),{},{components:n})):a.createElement(m,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:r,o[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id:"accept-user-input",title:"Accept user input"},s=void 0,c={unversionedId:"examples/accept-user-input",id:"version-2.3/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-2.3/examples/accept_user_input.md",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/2.3/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/accept_user_input.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"version-2.3/docs",previous:{title:"Examples",permalink:"/sdk/js/docs/2.3/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/2.3/examples/add-data-to-dataset"}},l={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { Actor } = require('apify');\n\nActor.main(async () => {\n const input = await Actor.getInput();\n console.log(input);\n});\n")),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to\nthe ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id:"accept-user-input",title:"Accept user input"},s=void 0,c={unversionedId:"examples/accept-user-input",id:"version-2.3/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-2.3/examples/accept_user_input.md",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/2.3/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/accept_user_input.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"version-2.3/docs",previous:{title:"Examples",permalink:"/sdk/js/docs/2.3/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/2.3/examples/add-data-to-dataset"}},l={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { Actor } = require('apify');\n\nActor.main(async () => {\n const input = await Actor.getInput();\n console.log(input);\n});\n")),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to\nthe ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>k,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var r=n(87462),i=n(63366),a=(n(67294),n(3905)),l=["components"],s={id:"statistic-state",title:"StatisticState"},o=void 0,p={unversionedId:"typedefs/statistic-state",id:"version-2.3/typedefs/statistic-state",title:"StatisticState",description:"Contains the statistics state",source:"@site/versioned_docs/version-2.3/typedefs/StatisticState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-state",permalink:"/sdk/js/docs/2.3/typedefs/statistic-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticState.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"statistic-state",title:"StatisticState"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"requestsFinished",id:"requestsfinished",level:3},{value:"requestsFailed",id:"requestsfailed",level:3},{value:"requestsRetries",id:"requestsretries",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestMinDurationMillis",id:"requestmindurationmillis",level:3},{value:"requestMaxDurationMillis",id:"requestmaxdurationmillis",level:3},{value:"requestTotalFailedDurationMillis",id:"requesttotalfaileddurationmillis",level:3},{value:"requestTotalFinishedDurationMillis",id:"requesttotalfinisheddurationmillis",level:3},{value:"crawlerStartedAt",id:"crawlerstartedat",level:3},{value:"crawlerFinishedAt",id:"crawlerfinishedat",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,i.Z)(e,l);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticstate"}),(0,a.kt)("p",null,"Contains the statistics state"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestsfinished"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinished")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailed"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailed")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmindurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMinDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmaxdurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMaxDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerstartedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerStartedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerfinishedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerFinishedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=r.createContext({}),p=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[u]="string"==typeof e?e:i,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>k,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var r=n(87462),i=n(63366),a=(n(67294),n(3905)),l=["components"],s={id:"statistic-state",title:"StatisticState"},o=void 0,p={unversionedId:"typedefs/statistic-state",id:"version-2.3/typedefs/statistic-state",title:"StatisticState",description:"Contains the statistics state",source:"@site/versioned_docs/version-2.3/typedefs/StatisticState.md",sourceDirName:"typedefs",slug:"/typedefs/statistic-state",permalink:"/sdk/js/docs/2.3/typedefs/statistic-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticState.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"statistic-state",title:"StatisticState"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"requestsFinished",id:"requestsfinished",level:3},{value:"requestsFailed",id:"requestsfailed",level:3},{value:"requestsRetries",id:"requestsretries",level:3},{value:"requestsFailedPerMinute",id:"requestsfailedperminute",level:3},{value:"requestsFinishedPerMinute",id:"requestsfinishedperminute",level:3},{value:"requestMinDurationMillis",id:"requestmindurationmillis",level:3},{value:"requestMaxDurationMillis",id:"requestmaxdurationmillis",level:3},{value:"requestTotalFailedDurationMillis",id:"requesttotalfaileddurationmillis",level:3},{value:"requestTotalFinishedDurationMillis",id:"requesttotalfinisheddurationmillis",level:3},{value:"crawlerStartedAt",id:"crawlerstartedat",level:3},{value:"crawlerFinishedAt",id:"crawlerfinishedat",level:3},{value:"crawlerRuntimeMillis",id:"crawlerruntimemillis",level:3},{value:"statsPersistedAt",id:"statspersistedat",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,i.Z)(e,l);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"statisticstate"}),(0,a.kt)("p",null,"Contains the statistics state"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"requestsfinished"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinished")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailed"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailed")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfailedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFailedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestsfinishedperminute"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestsFinishedPerMinute")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmindurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMinDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestmaxdurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestMaxDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfaileddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFailedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttotalfinisheddurationmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTotalFinishedDurationMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerstartedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerStartedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerfinishedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerFinishedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawlerruntimemillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawlerRuntimeMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"statspersistedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"statsPersistedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"null")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=r.createContext({}),p=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(o.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,o=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(o,".").concat(m)]||u[m]||c[m]||a;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,l=new Array(a);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[u]="string"==typeof e?e:i,l[1]=s;for(var p=2;p{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],l={id_old:"version-1.3-map-and-reduce",title:"Dataset Map and Reduce methods",id:"map-and-reduce"},i=void 0,p={unversionedId:"examples/map-and-reduce",id:"version-1.3/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Apify dataset map and",source:"@site/versioned_docs/version-1.3/examples/map_and_reduce.md",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/1.3/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/map_and_reduce.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-map-and-reduce",title:"Dataset Map and Reduce methods",id:"map-and-reduce"},sidebar:"version-1.3/docs",previous:{title:"Handle broken links",permalink:"/sdk/js/docs/1.3/examples/handle-broken-links"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/1.3/examples/playwright-crawler"}},d={},u=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(c,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify dataset")," ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#map",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"map"))," and\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#reduce",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"reduce"))," methods. Both methods can be used to simplify the dataset results workflow process. Both can be called on the\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/apify_storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset.PushData()"))," method to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling map function and filtering through mapped items\n const moreThan5headers = (await dataSet.map(item => item.headingCount)).filter(count => count > 5);\n\n // saving result of map to default Key-value store\n await Apify.setValue('pages_with_more_than_5_headers', moreThan5headers);\n});\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8];\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#datasetreduceiteratee-memo-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling reduce function and using memo to calculate number of headers\n const pagesHeadingCount = await dataSet.reduce((memo, value) => {\n memo += value.headingCount;\n return memo;\n }, 0);\n\n // saving result of reduce to default Key-value store\n await Apify.setValue('pages_heading_count', pagesHeadingCount);\n});\n")),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},"key-value store")," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23;\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),p=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(a),c=r,h=u["".concat(i,".").concat(c)]||u[c]||m[c]||o;return a?n.createElement(h,s(s({ref:t},d),{},{components:a})):n.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:r,s[1]=l;for(var p=2;p{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],l={id_old:"version-1.3-map-and-reduce",title:"Dataset Map and Reduce methods",id:"map-and-reduce"},i=void 0,p={unversionedId:"examples/map-and-reduce",id:"version-1.3/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Apify dataset map and",source:"@site/versioned_docs/version-1.3/examples/map_and_reduce.md",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/1.3/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/map_and_reduce.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-map-and-reduce",title:"Dataset Map and Reduce methods",id:"map-and-reduce"},sidebar:"version-1.3/docs",previous:{title:"Handle broken links",permalink:"/sdk/js/docs/1.3/examples/handle-broken-links"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/1.3/examples/playwright-crawler"}},d={},u=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(c,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify dataset")," ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#map",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"map"))," and\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#reduce",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"reduce"))," methods. Both methods can be used to simplify the dataset results workflow process. Both can be called on the\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/apify_storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset.PushData()"))," method to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling map function and filtering through mapped items\n const moreThan5headers = (await dataSet.map(item => item.headingCount)).filter(count => count > 5);\n\n // saving result of map to default Key-value store\n await Apify.setValue('pages_with_more_than_5_headers', moreThan5headers);\n});\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8];\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#datasetreduceiteratee-memo-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling reduce function and using memo to calculate number of headers\n const pagesHeadingCount = await dataSet.reduce((memo, value) => {\n memo += value.headingCount;\n return memo;\n }, 0);\n\n // saving result of reduce to default Key-value store\n await Apify.setValue('pages_heading_count', pagesHeadingCount);\n});\n")),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},"key-value store")," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23;\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),p=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(a),c=r,h=u["".concat(i,".").concat(c)]||u[c]||m[c]||o;return a?n.createElement(h,s(s({ref:t},d),{},{components:a})):n.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:r,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>u,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id:"upgrading-to-v2",title:"Upgrading to v2"},u=void 0,l={unversionedId:"upgrading/upgrading-to-v2",id:"upgrading/upgrading-to-v2",title:"Upgrading to v2",description:"- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.",source:"@site/../docs/upgrading/upgrading_v2.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v2",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v2",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v2.md",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v2",title:"Upgrading to v2"},sidebar:"docs",previous:{title:"Upgrading to v1",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v1"},next:{title:"Upgrading to v3",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v3"}},s={},c=[],d={toc:c},g="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(g,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"BREAKING"),": Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"BREAKING"),": Bump ",(0,o.kt)("inlineCode",{parentName:"li"},"cheerio")," to ",(0,o.kt)("inlineCode",{parentName:"li"},"1.0.0-rc.10")," from ",(0,o.kt)("inlineCode",{parentName:"li"},"rc.3"),". There were breaking changes in ",(0,o.kt)("inlineCode",{parentName:"li"},"cheerio")," between the versions so this bump might be breaking for you as well."),(0,o.kt)("li",{parentName:"ul"},"Remove ",(0,o.kt)("inlineCode",{parentName:"li"},"LiveViewServer")," which was deprecated before release of SDK v1.")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,u=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=l(r),g=a,m=c["".concat(u,".").concat(g)]||c[g]||d[g]||o;return r?n.createElement(m,i(i({ref:t},s),{},{components:r})):n.createElement(m,i({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=g;var p={};for(var u in t)hasOwnProperty.call(t,u)&&(p[u]=t[u]);p.originalType=e,p[c]="string"==typeof e?e:a,i[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>u,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],p={id:"upgrading-to-v2",title:"Upgrading to v2"},u=void 0,s={unversionedId:"upgrading/upgrading-to-v2",id:"upgrading/upgrading-to-v2",title:"Upgrading to v2",description:"- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.",source:"@site/../docs/upgrading/upgrading_v2.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v2",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v2",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v2.md",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v2",title:"Upgrading to v2"},sidebar:"docs",previous:{title:"Upgrading to v1",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v1"},next:{title:"Upgrading to v3",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v3"}},l={},c=[],d={toc:c},g="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(g,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"BREAKING"),": Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"BREAKING"),": Bump ",(0,a.kt)("inlineCode",{parentName:"li"},"cheerio")," to ",(0,a.kt)("inlineCode",{parentName:"li"},"1.0.0-rc.10")," from ",(0,a.kt)("inlineCode",{parentName:"li"},"rc.3"),". There were breaking changes in ",(0,a.kt)("inlineCode",{parentName:"li"},"cheerio")," between the versions so this bump might be breaking for you as well."),(0,a.kt)("li",{parentName:"ul"},"Remove ",(0,a.kt)("inlineCode",{parentName:"li"},"LiveViewServer")," which was deprecated before release of SDK v1.")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var u=n.createContext({}),s=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},g=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,u=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),c=s(r),g=o,m=c["".concat(u,".").concat(g)]||c[g]||d[g]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=g;var p={};for(var u in t)hasOwnProperty.call(t,u)&&(p[u]=t[u]);p.originalType=e,p[c]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>y,frontMatter:()=>u,metadata:()=>l,toc:()=>p});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],u={id_old:"version-1.3-request-as-browser-result",title:"RequestAsBrowserResult",id:"request-as-browser-result"},i=void 0,l={unversionedId:"typedefs/request-as-browser-result",id:"version-1.3/typedefs/request-as-browser-result",title:"RequestAsBrowserResult",description:"---",source:"@site/versioned_docs/version-1.3/typedefs/RequestAsBrowserResult.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-result",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-result",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserResult.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-as-browser-result",title:"RequestAsBrowserResult",id:"request-as-browser-result"}},c={},p=[],d={toc:p},f="wrapper";function y(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestasbrowserresult"}),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,i=e.parentName,c=u(e,["components","mdxType","originalType","parentName"]),p=l(r),f=s,y=p["".concat(i,".").concat(f)]||p[f]||d[f]||o;return r?n.createElement(y,a(a({ref:t},c),{},{components:r})):n.createElement(y,a({ref:t},c))}));function y(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[p]="string"==typeof e?e:s,a[1]=u;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>y,frontMatter:()=>u,metadata:()=>l,toc:()=>p});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],u={id_old:"version-1.3-request-as-browser-result",title:"RequestAsBrowserResult",id:"request-as-browser-result"},i=void 0,l={unversionedId:"typedefs/request-as-browser-result",id:"version-1.3/typedefs/request-as-browser-result",title:"RequestAsBrowserResult",description:"---",source:"@site/versioned_docs/version-1.3/typedefs/RequestAsBrowserResult.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-result",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-result",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserResult.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-as-browser-result",title:"RequestAsBrowserResult",id:"request-as-browser-result"}},c={},p=[],d={toc:p},f="wrapper";function y(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestasbrowserresult"}),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,i=e.parentName,c=u(e,["components","mdxType","originalType","parentName"]),p=l(r),f=s,y=p["".concat(i,".").concat(f)]||p[f]||d[f]||o;return r?n.createElement(y,a(a({ref:t},c),{},{components:r})):n.createElement(y,a({ref:t},c))}));function y(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[p]="string"==typeof e?e:s,a[1]=u;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-cheerio-crawler",title:"Cheerio crawler",id:"cheerio-crawler"},l=void 0,c={unversionedId:"examples/cheerio-crawler",id:"version-1.3/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using",source:"@site/versioned_docs/version-1.3/examples/cheerio_crawler.md",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/1.3/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/cheerio_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-cheerio-crawler",title:"Cheerio crawler",id:"cheerio-crawler"},sidebar:"version-1.3/docs",previous:{title:"Capture a screenshot",permalink:"/sdk/js/docs/1.3/examples/capture-screenshot"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-all-links"}},p={},u=[],d={toc:u},h="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(h,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using\na plain HTTP request, parse the HTML using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title\nand all ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.utils contains various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nconst { log } = Apify.utils;\nlog.setLevel(log.LEVELS.DEBUG);\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create an instance of the RequestList class that contains a list of URLs to crawl.\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Create an instance of the CheerioCrawler class - a crawler\n // that automatically loads the URLs and parses their HTML using the cheerio library.\n const crawler = new Apify.CheerioCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n handlePageTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n handlePageFunction: async ({ request, $ }) => {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the default dataset. In local configuration,\n // the data will be stored as JSON files in ./apify_storage/datasets/default\n await Apify.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n log.debug(`Request ${request.url} failed twice.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n log.debug('Crawler finished.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),h=a,f=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>s,metadata:()=>c,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-cheerio-crawler",title:"Cheerio crawler",id:"cheerio-crawler"},l=void 0,c={unversionedId:"examples/cheerio-crawler",id:"version-1.3/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using",source:"@site/versioned_docs/version-1.3/examples/cheerio_crawler.md",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/1.3/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/cheerio_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-cheerio-crawler",title:"Cheerio crawler",id:"cheerio-crawler"},sidebar:"version-1.3/docs",previous:{title:"Capture a screenshot",permalink:"/sdk/js/docs/1.3/examples/capture-screenshot"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-all-links"}},p={},u=[],d={toc:u},h="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(h,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using\na plain HTTP request, parse the HTML using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title\nand all ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.utils contains various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nconst { log } = Apify.utils;\nlog.setLevel(log.LEVELS.DEBUG);\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create an instance of the RequestList class that contains a list of URLs to crawl.\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Create an instance of the CheerioCrawler class - a crawler\n // that automatically loads the URLs and parses their HTML using the cheerio library.\n const crawler = new Apify.CheerioCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n handlePageTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n handlePageFunction: async ({ request, $ }) => {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the default dataset. In local configuration,\n // the data will be stored as JSON files in ./apify_storage/datasets/default\n await Apify.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n log.debug(`Request ${request.url} failed twice.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n log.debug('Crawler finished.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),h=a,f=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],s={id:"social-handles",title:"SocialHandles"},l=void 0,p={unversionedId:"typedefs/social-handles",id:"version-2.3/typedefs/social-handles",title:"SocialHandles",description:"Representation of social handles parsed from a HTML page.",source:"@site/versioned_docs/version-2.3/typedefs/SocialHandles.md",sourceDirName:"typedefs",slug:"/typedefs/social-handles",permalink:"/sdk/js/docs/2.3/typedefs/social-handles",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SocialHandles.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"social-handles",title:"SocialHandles"},sidebar:"version-2.3/docs",previous:{title:"SessionState",permalink:"/sdk/js/docs/2.3/typedefs/session-state"},next:{title:"SystemInfo",permalink:"/sdk/js/docs/2.3/typedefs/system-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"emails",id:"emails",level:3},{value:"phones",id:"phones",level:3},{value:"phonesUncertain",id:"phonesuncertain",level:3},{value:"linkedIns",id:"linkedins",level:3},{value:"twitters",id:"twitters",level:3},{value:"instagrams",id:"instagrams",level:3},{value:"facebooks",id:"facebooks",level:3},{value:"youtubes",id:"youtubes",level:3},{value:"tiktoks",id:"tiktoks",level:3},{value:"pinterests",id:"pinterests",level:3},{value:"discords",id:"discords",level:3}],k={toc:c},u="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(u,(0,r.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"socialhandles"}),(0,i.kt)("p",null,"Representation of social handles parsed from a HTML page."),(0,i.kt)("p",null,"The object has the following structure:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n emails: String[],\n phones: String[],\n phonesUncertain: String[],\n linkedIns: String[],\n twitters: String[],\n instagrams: String[],\n facebooks: String[],\n youtubes: String[],\n tiktoks: String[],\n pinterests: String[],\n discords: String[],\n}\n")),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"emails"},(0,i.kt)("inlineCode",{parentName:"h3"},"emails")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"phones"},(0,i.kt)("inlineCode",{parentName:"h3"},"phones")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"phonesuncertain"},(0,i.kt)("inlineCode",{parentName:"h3"},"phonesUncertain")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"linkedins"},(0,i.kt)("inlineCode",{parentName:"h3"},"linkedIns")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"twitters"},(0,i.kt)("inlineCode",{parentName:"h3"},"twitters")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"instagrams"},(0,i.kt)("inlineCode",{parentName:"h3"},"instagrams")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"facebooks"},(0,i.kt)("inlineCode",{parentName:"h3"},"facebooks")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"youtubes"},(0,i.kt)("inlineCode",{parentName:"h3"},"youtubes")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"tiktoks"},(0,i.kt)("inlineCode",{parentName:"h3"},"tiktoks")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"pinterests"},(0,i.kt)("inlineCode",{parentName:"h3"},"pinterests")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"discords"},(0,i.kt)("inlineCode",{parentName:"h3"},"discords")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(n),u=a,m=c["".concat(l,".").concat(u)]||c[u]||k[u]||i;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],s={id:"social-handles",title:"SocialHandles"},l=void 0,p={unversionedId:"typedefs/social-handles",id:"version-2.3/typedefs/social-handles",title:"SocialHandles",description:"Representation of social handles parsed from a HTML page.",source:"@site/versioned_docs/version-2.3/typedefs/SocialHandles.md",sourceDirName:"typedefs",slug:"/typedefs/social-handles",permalink:"/sdk/js/docs/2.3/typedefs/social-handles",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SocialHandles.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"social-handles",title:"SocialHandles"},sidebar:"version-2.3/docs",previous:{title:"SessionState",permalink:"/sdk/js/docs/2.3/typedefs/session-state"},next:{title:"SystemInfo",permalink:"/sdk/js/docs/2.3/typedefs/system-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"emails",id:"emails",level:3},{value:"phones",id:"phones",level:3},{value:"phonesUncertain",id:"phonesuncertain",level:3},{value:"linkedIns",id:"linkedins",level:3},{value:"twitters",id:"twitters",level:3},{value:"instagrams",id:"instagrams",level:3},{value:"facebooks",id:"facebooks",level:3},{value:"youtubes",id:"youtubes",level:3},{value:"tiktoks",id:"tiktoks",level:3},{value:"pinterests",id:"pinterests",level:3},{value:"discords",id:"discords",level:3}],k={toc:c},u="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(u,(0,r.Z)({},k,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"socialhandles"}),(0,i.kt)("p",null,"Representation of social handles parsed from a HTML page."),(0,i.kt)("p",null,"The object has the following structure:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n emails: String[],\n phones: String[],\n phonesUncertain: String[],\n linkedIns: String[],\n twitters: String[],\n instagrams: String[],\n facebooks: String[],\n youtubes: String[],\n tiktoks: String[],\n pinterests: String[],\n discords: String[],\n}\n")),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"emails"},(0,i.kt)("inlineCode",{parentName:"h3"},"emails")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"phones"},(0,i.kt)("inlineCode",{parentName:"h3"},"phones")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"phonesuncertain"},(0,i.kt)("inlineCode",{parentName:"h3"},"phonesUncertain")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"linkedins"},(0,i.kt)("inlineCode",{parentName:"h3"},"linkedIns")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"twitters"},(0,i.kt)("inlineCode",{parentName:"h3"},"twitters")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"instagrams"},(0,i.kt)("inlineCode",{parentName:"h3"},"instagrams")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"facebooks"},(0,i.kt)("inlineCode",{parentName:"h3"},"facebooks")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"youtubes"},(0,i.kt)("inlineCode",{parentName:"h3"},"youtubes")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"tiktoks"},(0,i.kt)("inlineCode",{parentName:"h3"},"tiktoks")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"pinterests"},(0,i.kt)("inlineCode",{parentName:"h3"},"pinterests")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"discords"},(0,i.kt)("inlineCode",{parentName:"h3"},"discords")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(n),u=a,m=c["".concat(l,".").concat(u)]||c[u]||k[u]||i;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>l});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],c={id:"proxy-configuration-function",title:"ProxyConfigurationFunction"},p=void 0,u={unversionedId:"typedefs/proxy-configuration-function",id:"version-2.3/typedefs/proxy-configuration-function",title:"ProxyConfigurationFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/ProxyConfigurationFunction.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-function",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-configuration-function",title:"ProxyConfigurationFunction"}},s={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfigurationfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),l=u(n),d=o,y=l["".concat(p,".").concat(d)]||l[d]||f[d]||i;return n?r.createElement(y,a(a({ref:t},s),{},{components:n})):r.createElement(y,a({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[l]="string"==typeof e?e:o,a[1]=c;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>l});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],c={id:"proxy-configuration-function",title:"ProxyConfigurationFunction"},p=void 0,u={unversionedId:"typedefs/proxy-configuration-function",id:"version-2.3/typedefs/proxy-configuration-function",title:"ProxyConfigurationFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/ProxyConfigurationFunction.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-configuration-function",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-configuration-function",title:"ProxyConfigurationFunction"}},s={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfigurationfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>y});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),l=u(n),d=o,y=l["".concat(p,".").concat(d)]||l[d]||f[d]||i;return n?r.createElement(y,a(a({ref:t},s),{},{components:n})):r.createElement(y,a({ref:t},s))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[l]="string"==typeof e?e:o,a[1]=c;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=["components"],l={},s=void 0,p={unversionedId:"readme/overview",id:"version-3.0/readme/overview",title:"overview",description:"Overview",source:"@site/versioned_docs/version-3.0/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/3.0/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/overview.md",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,o.kt)(d,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," - Serves as an alternative approach to the static helpers exported from the package.\nThis class can be used to control the current actor run and to interact with the actor's environment. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ApifyClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," - Allows user to interact with the Apify platform from code, control and schedule actors on the platform and access the result data stores.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," - Helper class encapsulating the configuration of the current actor run.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/PlatformEventManager",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlatformEventManager"))," - Event emitter for the platform and SDK events. Can be used to track actor run performance or serverless container migration.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," - Configures connection to a proxy server with the provided options. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for all connections. The proxy servers are managed by Apify Proxy.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/RequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,m=u["".concat(s,".").concat(d)]||u[d]||f[d]||o;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=["components"],l={},s=void 0,p={unversionedId:"readme/overview",id:"version-3.0/readme/overview",title:"overview",description:"Overview",source:"@site/versioned_docs/version-3.0/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/3.0/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/overview.md",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,o.kt)(d,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," - Serves as an alternative approach to the static helpers exported from the package.\nThis class can be used to control the current actor run and to interact with the actor's environment. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ApifyClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," - Allows user to interact with the Apify platform from code, control and schedule actors on the platform and access the result data stores.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," - Helper class encapsulating the configuration of the current actor run.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/PlatformEventManager",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlatformEventManager"))," - Event emitter for the platform and SDK events. Can be used to track actor run performance or serverless container migration.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," - Configures connection to a proxy server with the provided options. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for all connections. The proxy servers are managed by Apify Proxy.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/RequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,m=u["".concat(s,".").concat(d)]||u[d]||f[d]||o;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>y,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=["components"],i={id:"handle-failed-request-input",title:"HandleFailedRequestInput"},p=void 0,s={unversionedId:"typedefs/handle-failed-request-input",id:"version-2.3/typedefs/handle-failed-request-input",title:"HandleFailedRequestInput",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/HandleFailedRequestInput.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request-input",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequestInput.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"handle-failed-request-input",title:"HandleFailedRequestInput"},sidebar:"version-2.3/docs",previous:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request"},next:{title:"HandleRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-request"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"error",id:"error",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:u},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"handlefailedrequestinput"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"error"},(0,o.kt)("inlineCode",{parentName:"h3"},"error")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")),(0,o.kt)("p",null,"The Error thrown by ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original {Request} object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,y=u["".concat(p,".").concat(f)]||u[f]||c[f]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>y,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=["components"],i={id:"handle-failed-request-input",title:"HandleFailedRequestInput"},p=void 0,s={unversionedId:"typedefs/handle-failed-request-input",id:"version-2.3/typedefs/handle-failed-request-input",title:"HandleFailedRequestInput",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/HandleFailedRequestInput.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request-input",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequestInput.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"handle-failed-request-input",title:"HandleFailedRequestInput"},sidebar:"version-2.3/docs",previous:{title:"HandleFailedRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request"},next:{title:"HandleRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-request"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"error",id:"error",level:3},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:u},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"handlefailedrequestinput"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"error"},(0,o.kt)("inlineCode",{parentName:"h3"},"error")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")),(0,o.kt)("p",null,"The Error thrown by ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"The original {Request} object."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=s(r),f=a,y=u["".concat(p,".").concat(f)]||u[f]||c[f]||o;return r?n.createElement(y,l(l({ref:t},d),{},{components:r})):n.createElement(y,l({ref:t},d))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>c});var r=t(87462),a=t(63366),l=(t(67294),t(3905)),i=["components"],o={id:"crawl-all-links",title:"Crawl all links on a website"},s=void 0,u={unversionedId:"examples/crawl-all-links",id:"version-2.3/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates",source:"@site/versioned_docs/version-2.3/examples/crawl_all_links.md",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/2.3/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_all_links.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"version-2.3/docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/2.3/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/2.3/examples/crawl-multiple-urls"}},p={},c=[],d={toc:c},f="wrapper";function m(e){var n=e.components,t=(0,a.Z)(e,i);return(0,l.kt)(f,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates\nfrom page to page. If only the required parameters are defined, all links will be crawled."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=u(t),f=a,m=c["".concat(s,".").concat(f)]||c[f]||d[f]||l;return t?r.createElement(m,i(i({ref:n},p),{},{components:t})):r.createElement(m,i({ref:n},p))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=t.length,i=new Array(l);i[0]=f;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[c]="string"==typeof e?e:a,i[1]=o;for(var u=2;u{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>u,toc:()=>c});var r=t(87462),a=t(63366),l=(t(67294),t(3905)),i=["components"],o={id:"crawl-all-links",title:"Crawl all links on a website"},s=void 0,u={unversionedId:"examples/crawl-all-links",id:"version-2.3/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates",source:"@site/versioned_docs/version-2.3/examples/crawl_all_links.md",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/2.3/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_all_links.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"version-2.3/docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/2.3/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/2.3/examples/crawl-multiple-urls"}},p={},c=[],d={toc:c},f="wrapper";function m(e){var n=e.components,t=(0,a.Z)(e,i);return(0,l.kt)(f,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates\nfrom page to page. If only the required parameters are defined, all links will be crawled."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl,\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=r.createContext({}),u=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=u(e.components);return r.createElement(s.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=u(t),f=a,m=c["".concat(s,".").concat(f)]||c[f]||d[f]||l;return t?r.createElement(m,i(i({ref:n},p),{},{components:t})):r.createElement(m,i({ref:n},p))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var l=t.length,i=new Array(l);i[0]=f;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o[c]="string"==typeof e?e:a,i[1]=o;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"key-consumer",title:"KeyConsumer"},s=void 0,p={unversionedId:"typedefs/key-consumer",id:"version-2.3/typedefs/key-consumer",title:"KeyConsumer",description:"User-function used in the KeyValueStore.forEachKey() method.",source:"@site/versioned_docs/version-2.3/typedefs/KeyConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/key-consumer",permalink:"/sdk/js/docs/2.3/typedefs/key-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyConsumer.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"key-consumer",title:"KeyConsumer"},sidebar:"version-2.3/docs",previous:{title:"DatasetReducer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-reducer"},next:{title:"CreateSession",permalink:"/sdk/js/docs/2.3/typedefs/create-session"}},u={},c=[],m={toc:c},d="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(d,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#foreachkey",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.forEachKey()"))," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Current {KeyValue} key being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of the current key in ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"info")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," - Information about the current ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," entry.",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"size")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Size of the value associated with the current key in bytes.")))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(r),d=a,y=c["".concat(s,".").concat(d)]||c[d]||m[d]||o;return r?n.createElement(y,i(i({ref:t},u),{},{components:r})):n.createElement(y,i({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"key-consumer",title:"KeyConsumer"},s=void 0,p={unversionedId:"typedefs/key-consumer",id:"version-2.3/typedefs/key-consumer",title:"KeyConsumer",description:"User-function used in the KeyValueStore.forEachKey() method.",source:"@site/versioned_docs/version-2.3/typedefs/KeyConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/key-consumer",permalink:"/sdk/js/docs/2.3/typedefs/key-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyConsumer.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"key-consumer",title:"KeyConsumer"},sidebar:"version-2.3/docs",previous:{title:"DatasetReducer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-reducer"},next:{title:"CreateSession",permalink:"/sdk/js/docs/2.3/typedefs/create-session"}},u={},c=[],d={toc:c},m="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#foreachkey",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.forEachKey()"))," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Current {KeyValue} key being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of the current key in ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"info")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," - Information about the current ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," entry.",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"size")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Size of the value associated with the current key in bytes.")))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,y=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return r?n.createElement(y,i(i({ref:t},u),{},{components:r})):n.createElement(y,i({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>k,contentTitle:()=>p,default:()=>g,frontMatter:()=>o,metadata:()=>d,toc:()=>u});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),l=["components"],o={id:"configuration",title:"Configuration"},p=void 0,d={unversionedId:"api/configuration",id:"version-2.3/api/configuration",title:"Configuration",description:"Configuration is a value object holding the SDK configuration. We can use it in two ways:",source:"@site/versioned_docs/version-2.3/api/Configuration.md",sourceDirName:"api",slug:"/api/configuration",permalink:"/sdk/js/docs/2.3/api/configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Configuration.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"configuration",title:"Configuration"},sidebar:"version-2.3/docs",previous:{title:"Apify",permalink:"/sdk/js/docs/2.3/api/apify"},next:{title:"BasicCrawler",permalink:"/sdk/js/docs/2.3/api/basic-crawler"}},k={},u=[{value:"Supported Configuration Options",id:"supported-configuration-options",level:2},{value:"Advanced Configuration Options",id:"advanced-configuration-options",level:2},{value:"Not Supported environment variables",id:"not-supported-environment-variables",level:2},{value:"new Configuration(options)",id:"new-configurationoptions",level:2},{value:"configuration.storage",id:"configurationstorage",level:2},{value:"configuration.get(key, [defaultValue])",id:"configurationgetkey-defaultvalue",level:2},{value:"configuration.set(key, [value])",id:"configurationsetkey-value",level:2},{value:"configuration.getClient([options])",id:"configurationgetclientoptions",level:2},{value:"configuration.getStorageLocal([options])",id:"configurationgetstoragelocaloptions",level:2},{value:"configuration.createClient([options])",id:"configurationcreateclientoptions",level:2},{value:"configuration.createStorageLocal([options])",id:"configurationcreatestoragelocaloptions",level:2},{value:"Configuration.getGlobalConfig()",id:"configurationgetglobalconfig",level:2}],m={toc:u},s="wrapper";function g(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(s,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"configuration"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," is a value object holding the SDK configuration. We can use it in two ways:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"When using ",(0,r.kt)("inlineCode",{parentName:"li"},"Apify")," class, we can get the instance configuration via ",(0,r.kt)("inlineCode",{parentName:"li"},"sdk.config"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify');\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"To get the global configuration (singleton instance). It will respect the environment variables.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"console.log(Configuration.getGlobalConfig().get('token')); // returns the token from APIFY_TOKEN env var\n")),(0,r.kt)("h2",{id:"supported-configuration-options"},"Supported Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultDatasetId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_DATASET_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultKeyValueStoreId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultRequestQueueId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageDir")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'./apify_storage'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageEnableWalMode")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"true"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"persistStateIntervalMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PERSIST_STATE_INTERVAL_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"60e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"token")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"advanced-configuration-options"},"Advanced Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorEventsWsUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_EVENTS_WS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorRunId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_RUN_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorTaskId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_TASK_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"apiBaseUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_API_BASE_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'https://api.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"4321"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://localhost:4321'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"inputKey")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_INPUT_KEY")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'INPUT'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"isAtHome")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_IS_AT_HOME")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"metamorphAfterSleepMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_METAMORPH_AFTER_SLEEP_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"300e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyHostname")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_HOSTNAME")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPassword")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PASSWORD")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"8000"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyStatusUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_STATUS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"userId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_USER_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"not-supported-environment-variables"},"Not Supported environment variables"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"MEMORY_MBYTES")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"HEADLESS")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"XVFB")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CHROME_EXECUTABLE_PATH"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"exports.configuration"}),(0,r.kt)("h2",{id:"new-configurationoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new Configuration(options)")),(0,r.kt)("p",null,"Creates new ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance with provided options. Env vars will have precedence over those."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Record"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"storage"}),(0,r.kt)("h2",{id:"configurationstorage"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.storage")),(0,r.kt)("p",null,"Provides access to the current-instance-scoped Configuration without passing it around in parameters."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"get"}),(0,r.kt)("h2",{id:"configurationgetkey-defaultvalue"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.get(key, [defaultValue])")),(0,r.kt)("p",null,"Returns configured value. First checks the environment variables, then provided configuration, fallbacks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"defaultValue")," argument if provided,\notherwise uses the default value as described in the above section."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[defaultValue]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"set"}),(0,r.kt)("h2",{id:"configurationsetkey-value"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.set(key, [value])")),(0,r.kt)("p",null,"Sets value for given option. Only affects this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance, the value will not be propagated down to the env var. To reset a value, we\ncan omit the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument or pass ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," there."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[value]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getclient"}),(0,r.kt)("h2",{id:"configurationgetclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getClient([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the API URL and token, so calling this method with different options will return multiple instances, one for each variant of\nthe options."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getstoragelocal"}),(0,r.kt)("h2",{id:"configurationgetstoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getStorageLocal([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," option, so calling this method with different ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," will return multiple instances, one for each\ndirectory."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createclient"}),(0,r.kt)("h2",{id:"configurationcreateclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createClient([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyClient using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createstoragelocal"}),(0,r.kt)("h2",{id:"configurationcreatestoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createStorageLocal([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyStorageLocal using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getglobalconfig"}),(0,r.kt)("h2",{id:"configurationgetglobalconfig"},(0,r.kt)("inlineCode",{parentName:"h2"},"Configuration.getGlobalConfig()")),(0,r.kt)("p",null,"Returns the global configuration instance. It will respect the environment variables. When used inside SDK instance (",(0,r.kt)("inlineCode",{parentName:"p"},"sdk.main()"),"), the return value\nis equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"sdk.config"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))),(0,r.kt)("hr",null))}g.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>k,kt:()=>g});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},k=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},s=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),u=d(n),s=i,g=u["".concat(p,".").concat(s)]||u[s]||m[s]||r;return n?a.createElement(g,l(l({ref:t},k),{},{components:n})):a.createElement(g,l({ref:t},k))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=s;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var d=2;d{n.r(t),n.d(t,{assets:()=>k,contentTitle:()=>p,default:()=>g,frontMatter:()=>o,metadata:()=>d,toc:()=>u});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),l=["components"],o={id:"configuration",title:"Configuration"},p=void 0,d={unversionedId:"api/configuration",id:"version-2.3/api/configuration",title:"Configuration",description:"Configuration is a value object holding the SDK configuration. We can use it in two ways:",source:"@site/versioned_docs/version-2.3/api/Configuration.md",sourceDirName:"api",slug:"/api/configuration",permalink:"/sdk/js/docs/2.3/api/configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Configuration.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"configuration",title:"Configuration"},sidebar:"version-2.3/docs",previous:{title:"Apify",permalink:"/sdk/js/docs/2.3/api/apify"},next:{title:"BasicCrawler",permalink:"/sdk/js/docs/2.3/api/basic-crawler"}},k={},u=[{value:"Supported Configuration Options",id:"supported-configuration-options",level:2},{value:"Advanced Configuration Options",id:"advanced-configuration-options",level:2},{value:"Not Supported environment variables",id:"not-supported-environment-variables",level:2},{value:"new Configuration(options)",id:"new-configurationoptions",level:2},{value:"configuration.storage",id:"configurationstorage",level:2},{value:"configuration.get(key, [defaultValue])",id:"configurationgetkey-defaultvalue",level:2},{value:"configuration.set(key, [value])",id:"configurationsetkey-value",level:2},{value:"configuration.getClient([options])",id:"configurationgetclientoptions",level:2},{value:"configuration.getStorageLocal([options])",id:"configurationgetstoragelocaloptions",level:2},{value:"configuration.createClient([options])",id:"configurationcreateclientoptions",level:2},{value:"configuration.createStorageLocal([options])",id:"configurationcreatestoragelocaloptions",level:2},{value:"Configuration.getGlobalConfig()",id:"configurationgetglobalconfig",level:2}],m={toc:u},s="wrapper";function g(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(s,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"configuration"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," is a value object holding the SDK configuration. We can use it in two ways:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"When using ",(0,r.kt)("inlineCode",{parentName:"li"},"Apify")," class, we can get the instance configuration via ",(0,r.kt)("inlineCode",{parentName:"li"},"sdk.config"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify');\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"To get the global configuration (singleton instance). It will respect the environment variables.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"console.log(Configuration.getGlobalConfig().get('token')); // returns the token from APIFY_TOKEN env var\n")),(0,r.kt)("h2",{id:"supported-configuration-options"},"Supported Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultDatasetId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_DATASET_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultKeyValueStoreId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"defaultRequestQueueId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'default'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageDir")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'./apify_storage'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"localStorageEnableWalMode")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"true"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"persistStateIntervalMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PERSIST_STATE_INTERVAL_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"60e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"token")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"advanced-configuration-options"},"Advanced Configuration Options"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Key"),(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorEventsWsUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_EVENTS_WS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorRunId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_RUN_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"actorTaskId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_ACTOR_TASK_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"apiBaseUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_API_BASE_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'https://api.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"4321"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"containerUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_CONTAINER_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://localhost:4321'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"inputKey")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_INPUT_KEY")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'INPUT'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"isAtHome")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_IS_AT_HOME")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"metamorphAfterSleepMillis")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_METAMORPH_AFTER_SLEEP_MILLIS")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"300e3"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyHostname")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_HOSTNAME")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPassword")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PASSWORD")),(0,r.kt)("td",{parentName:"tr",align:null},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyPort")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_PORT")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"8000"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"proxyStatusUrl")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_PROXY_STATUS_URL")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"'http://proxy.apify.com'"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"userId")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"APIFY_USER_ID")),(0,r.kt)("td",{parentName:"tr",align:null},"-")))),(0,r.kt)("h2",{id:"not-supported-environment-variables"},"Not Supported environment variables"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"MEMORY_MBYTES")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"HEADLESS")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"XVFB")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CHROME_EXECUTABLE_PATH"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"exports.configuration"}),(0,r.kt)("h2",{id:"new-configurationoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new Configuration(options)")),(0,r.kt)("p",null,"Creates new ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance with provided options. Env vars will have precedence over those."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Record"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"storage"}),(0,r.kt)("h2",{id:"configurationstorage"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.storage")),(0,r.kt)("p",null,"Provides access to the current-instance-scoped Configuration without passing it around in parameters."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"get"}),(0,r.kt)("h2",{id:"configurationgetkey-defaultvalue"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.get(key, [defaultValue])")),(0,r.kt)("p",null,"Returns configured value. First checks the environment variables, then provided configuration, fallbacks to the ",(0,r.kt)("inlineCode",{parentName:"p"},"defaultValue")," argument if provided,\notherwise uses the default value as described in the above section."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[defaultValue]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"set"}),(0,r.kt)("h2",{id:"configurationsetkey-value"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.set(key, [value])")),(0,r.kt)("p",null,"Sets value for given option. Only affects this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance, the value will not be propagated down to the env var. To reset a value, we\ncan omit the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," argument or pass ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," there."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[value]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getclient"}),(0,r.kt)("h2",{id:"configurationgetclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getClient([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the API URL and token, so calling this method with different options will return multiple instances, one for each variant of\nthe options."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getstoragelocal"}),(0,r.kt)("h2",{id:"configurationgetstoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.getStorageLocal([options])")),(0,r.kt)("p",null,"Returns cached instance of ",(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))," using options as defined in the environment variables or in this\n",(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))," instance. Only first call of this method will create the client, following calls will return the same client\ninstance."),(0,r.kt)("p",null,"Caching works based on the ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," option, so calling this method with different ",(0,r.kt)("inlineCode",{parentName:"p"},"storageDir")," will return multiple instances, one for each\ndirectory."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createclient"}),(0,r.kt)("h2",{id:"configurationcreateclientoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createClient([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyClient using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"createstoragelocal"}),(0,r.kt)("h2",{id:"configurationcreatestoragelocaloptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"configuration.createStorageLocal([options])")),(0,r.kt)("p",null,"Creates an instance of ApifyStorageLocal using options as defined in the environment variables or in this ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration")," instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Internal"),":",(0,r.kt)("br",{parentName:"p"}),"\n",(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[storageDir]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[enableWalMode]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = true"))))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ApifyStorageLocal"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getglobalconfig"}),(0,r.kt)("h2",{id:"configurationgetglobalconfig"},(0,r.kt)("inlineCode",{parentName:"h2"},"Configuration.getGlobalConfig()")),(0,r.kt)("p",null,"Returns the global configuration instance. It will respect the environment variables. When used inside SDK instance (",(0,r.kt)("inlineCode",{parentName:"p"},"sdk.main()"),"), the return value\nis equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"sdk.config"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Configuration"))),(0,r.kt)("hr",null))}g.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>k,kt:()=>g});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},k=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},s=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,k=o(e,["components","mdxType","originalType","parentName"]),u=d(n),s=i,g=u["".concat(p,".").concat(s)]||u[s]||m[s]||r;return n?a.createElement(g,l(l({ref:t},k),{},{components:n})):a.createElement(g,l({ref:t},k))}));function g(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,l=new Array(r);l[0]=s;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:i,l[1]=o;for(var d=2;d{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],l={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},i=void 0,p={unversionedId:"examples/map-and-reduce",id:"version-2.3/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Apify dataset",source:"@site/versioned_docs/version-2.3/examples/map_and_reduce.md",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/2.3/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/map_and_reduce.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"version-2.3/docs",previous:{title:"Forms",permalink:"/sdk/js/docs/2.3/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/2.3/examples/playwright-crawler"}},d={},u=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(c,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify dataset"),"\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#map",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"map"))," and\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#reduce",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"reduce"))," methods. Both methods can be used to simplify the\ndataset results workflow process. Both can be called on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce"),"\ncan return any type) - neither method updates the dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page:\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under\n",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/apify_storage/datasets/default/"),".\nIf you want to simulate the functionality, you can use the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset.PushData()"))," method\nto save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods.\nIt produces a new array of values by mapping each value in the existing array through\na transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling map function and filtering through mapped items\n const moreThan5headers = (await dataSet.map((item) => item.headingCount)).filter((count) => count > 5);\n\n // saving result of map to default Key-value store\n await Apify.setValue('pages_with_more_than_5_headers', moreThan5headers);\n});\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number\nof headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[ 11, 8 ]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value.\nThe method iterates through the items in the dataset using the\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#datasetreduceiteratee-memo-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"memo")," argument"),".\nAfter performing the necessary calculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration,\nwhile the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling reduce function and using memo to calculate number of headers\n const pagesHeadingCount = await dataSet.reduce((memo, value) => {\n memo += value.headingCount;\n return memo;\n }, 0);\n\n // saving result of reduce to default Key-value store\n await Apify.setValue('pages_heading_count', pagesHeadingCount);\n});\n")),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains\nthe count of all headers for all scraped pages (all dataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},"key-value store")," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),p=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(a),c=r,h=u["".concat(i,".").concat(c)]||u[c]||m[c]||o;return a?n.createElement(h,s(s({ref:t},d),{},{components:a})):n.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:r,s[1]=l;for(var p=2;p{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],l={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},i=void 0,p={unversionedId:"examples/map-and-reduce",id:"version-2.3/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Apify dataset",source:"@site/versioned_docs/version-2.3/examples/map_and_reduce.md",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/2.3/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/map_and_reduce.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"version-2.3/docs",previous:{title:"Forms",permalink:"/sdk/js/docs/2.3/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/2.3/examples/playwright-crawler"}},d={},u=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],m={toc:u},c="wrapper";function h(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(c,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify dataset"),"\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#map",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"map"))," and\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#reduce",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"reduce"))," methods. Both methods can be used to simplify the\ndataset results workflow process. Both can be called on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce"),"\ncan return any type) - neither method updates the dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page:\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under\n",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/apify_storage/datasets/default/"),".\nIf you want to simulate the functionality, you can use the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset.PushData()"))," method\nto save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods.\nIt produces a new array of values by mapping each value in the existing array through\na transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling map function and filtering through mapped items\n const moreThan5headers = (await dataSet.map((item) => item.headingCount)).filter((count) => count > 5);\n\n // saving result of map to default Key-value store\n await Apify.setValue('pages_with_more_than_5_headers', moreThan5headers);\n});\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number\nof headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[ 11, 8 ]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value.\nThe method iterates through the items in the dataset using the\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset#datasetreduceiteratee-memo-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"memo")," argument"),".\nAfter performing the necessary calculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration,\nwhile the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // open default dataset\n const dataSet = await Apify.openDataset();\n\n // calling reduce function and using memo to calculate number of headers\n const pagesHeadingCount = await dataSet.reduce((memo, value) => {\n memo += value.headingCount;\n return memo;\n }, 0);\n\n // saving result of reduce to default Key-value store\n await Apify.setValue('pages_heading_count', pagesHeadingCount);\n});\n")),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains\nthe count of all headers for all scraped pages (all dataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/key-value-store",target:null,rel:null},"key-value store")," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),p=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(a),c=r,h=u["".concat(i,".").concat(c)]||u[c]||m[c]||o;return a?n.createElement(h,s(s({ref:t},d),{},{components:a})):n.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=c;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:r,s[1]=l;for(var p=2;p{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>d});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],p={id:"upgrading-to-v2",title:"Upgrading to v2"},s=void 0,u={unversionedId:"upgrading/upgrading-to-v2",id:"version-3.0/upgrading/upgrading-to-v2",title:"Upgrading to v2",description:"- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.",source:"@site/versioned_docs/version-3.0/upgrading/upgrading_v2.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v2",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v2",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v2.md",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v2",title:"Upgrading to v2"},sidebar:"docs",previous:{title:"Upgrading to v1",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v1"},next:{title:"Upgrading to v3",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v3"}},l={},d=[],c={toc:d},g="wrapper";function v(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(g,(0,n.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Bump ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," to ",(0,i.kt)("inlineCode",{parentName:"li"},"1.0.0-rc.10")," from ",(0,i.kt)("inlineCode",{parentName:"li"},"rc.3"),". There were breaking changes in ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," between the versions so this bump might be breaking for you as well."),(0,i.kt)("li",{parentName:"ul"},"Remove ",(0,i.kt)("inlineCode",{parentName:"li"},"LiveViewServer")," which was deprecated before release of SDK v1.")))}v.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>v});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},g=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=u(t),g=o,v=d["".concat(s,".").concat(g)]||d[g]||c[g]||i;return t?n.createElement(v,a(a({ref:r},l),{},{components:t})):n.createElement(v,a({ref:r},l))}));function v(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=g;var p={};for(var s in r)hasOwnProperty.call(r,s)&&(p[s]=r[s]);p.originalType=e,p[d]="string"==typeof e?e:o,a[1]=p;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>p,metadata:()=>u,toc:()=>d});var n=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],p={id:"upgrading-to-v2",title:"Upgrading to v2"},s=void 0,u={unversionedId:"upgrading/upgrading-to-v2",id:"version-3.0/upgrading/upgrading-to-v2",title:"Upgrading to v2",description:"- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.",source:"@site/versioned_docs/version-3.0/upgrading/upgrading_v2.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v2",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v2",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v2.md",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v2",title:"Upgrading to v2"},sidebar:"docs",previous:{title:"Upgrading to v1",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v1"},next:{title:"Upgrading to v3",permalink:"/sdk/js/docs/3.0/upgrading/upgrading-to-v3"}},l={},d=[],c={toc:d},g="wrapper";function m(e){var r=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(g,(0,n.Z)({},c,t,{components:r,mdxType:"MDXLayout"}),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"BREAKING"),": Bump ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," to ",(0,i.kt)("inlineCode",{parentName:"li"},"1.0.0-rc.10")," from ",(0,i.kt)("inlineCode",{parentName:"li"},"rc.3"),". There were breaking changes in ",(0,i.kt)("inlineCode",{parentName:"li"},"cheerio")," between the versions so this bump might be breaking for you as well."),(0,i.kt)("li",{parentName:"ul"},"Remove ",(0,i.kt)("inlineCode",{parentName:"li"},"LiveViewServer")," which was deprecated before release of SDK v1.")))}m.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=n.createContext({}),u=function(e){var r=n.useContext(s),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},l=function(e){var r=u(e.components);return n.createElement(s.Provider,{value:r},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},g=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=u(t),g=o,m=d["".concat(s,".").concat(g)]||d[g]||c[g]||i;return t?n.createElement(m,a(a({ref:r},l),{},{components:t})):n.createElement(m,a({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=g;var p={};for(var s in r)hasOwnProperty.call(r,s)&&(p[s]=r[s]);p.originalType=e,p[d]="string"==typeof e?e:o,a[1]=p;for(var u=2;u{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],s={id:"proxy-configuration",title:"ProxyConfiguration"},p=void 0,l={unversionedId:"api/proxy-configuration",id:"version-2.3/api/proxy-configuration",title:"ProxyConfiguration",description:"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based",source:"@site/versioned_docs/version-2.3/api/ProxyConfiguration.md",sourceDirName:"api",slug:"/api/proxy-configuration",permalink:"/sdk/js/docs/2.3/api/proxy-configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ProxyConfiguration.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-configuration",title:"ProxyConfiguration"},sidebar:"version-2.3/docs",previous:{title:"SessionPool",permalink:"/sdk/js/docs/2.3/api/session-pool"},next:{title:"Snapshotter",permalink:"/sdk/js/docs/2.3/api/snapshotter"}},u={},d=[{value:"proxyConfiguration.initialize()",id:"proxyconfigurationinitialize",level:2},{value:"proxyConfiguration.newProxyInfo([sessionId])",id:"proxyconfigurationnewproxyinfosessionid",level:2},{value:"proxyConfiguration.newUrl([sessionId])",id:"proxyconfigurationnewurlsessionid",level:2}],c={toc:d},y="wrapper";function f(e){var n=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(y,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfiguration"}),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections. You can get information about the currently used proxy by inspecting the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," property in your\ncrawler's page function. There, you can inspect the proxy's URL and other attributes."),(0,i.kt)("p",null,"The proxy servers are managed by ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". To be able to use Apify Proxy, you need an Apify account and access to\nthe selected proxies. If you provide no configuration option, the proxies will be managed automatically using a smart algorithm."),(0,i.kt)("p",null,"If you want to use your own proxies, use the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," option. Your\nlist of proxy URLs will be rotated by the configuration if this option is provided."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"proxyconfigurationinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.initialize()")),(0,i.kt)("p",null,"Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups if Apify Proxy configuration is used. Also checks\nif country has access to Apify Proxy groups if the country code is provided."),(0,i.kt)("p",null,"You should use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration"))," function to create a pre-initialized ",(0,i.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"),"\ninstance instead of calling this manually."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newproxyinfo"}),(0,i.kt)("h2",{id:"proxyconfigurationnewproxyinfosessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newProxyInfo([sessionId])")),(0,i.kt)("p",null,"This function creates a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," info object. It is used by CheerioCrawler and PuppeteerCrawler to generate proxy\nURLs and also to allow the user to inspect the currently used proxy via the handlePageFunction parameter: proxyInfo. Use it if you want to work with a\nrich representation of a proxy URL. If you need the URL string only, use ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string. Property sessionId of ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," is always returned as a type\nstring.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," - represents information about used proxy and its configuration."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newurl"}),(0,i.kt)("h2",{id:"proxyconfigurationnewurlsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newUrl([sessionId])")),(0,i.kt)("p",null,"Returns a new proxy URL based on provided configuration options and the ",(0,i.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")," - A string with a proxy URL, including authentication credentials and port number. For example,\n",(0,i.kt)("inlineCode",{parentName:"p"},"http://bob:password123@proxy.example.com:8000")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},y=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(t),y=o,f=d["".concat(p,".").concat(y)]||d[y]||c[y]||i;return t?r.createElement(f,a(a({ref:n},u),{},{components:t})):r.createElement(f,a({ref:n},u))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var r=t(87462),o=t(63366),i=(t(67294),t(3905)),a=["components"],s={id:"proxy-configuration",title:"ProxyConfiguration"},p=void 0,l={unversionedId:"api/proxy-configuration",id:"version-2.3/api/proxy-configuration",title:"ProxyConfiguration",description:"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based",source:"@site/versioned_docs/version-2.3/api/ProxyConfiguration.md",sourceDirName:"api",slug:"/api/proxy-configuration",permalink:"/sdk/js/docs/2.3/api/proxy-configuration",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ProxyConfiguration.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-configuration",title:"ProxyConfiguration"},sidebar:"version-2.3/docs",previous:{title:"SessionPool",permalink:"/sdk/js/docs/2.3/api/session-pool"},next:{title:"Snapshotter",permalink:"/sdk/js/docs/2.3/api/snapshotter"}},u={},d=[{value:"proxyConfiguration.initialize()",id:"proxyconfigurationinitialize",level:2},{value:"proxyConfiguration.newProxyInfo([sessionId])",id:"proxyconfigurationnewproxyinfosessionid",level:2},{value:"proxyConfiguration.newUrl([sessionId])",id:"proxyconfigurationnewurlsessionid",level:2}],c={toc:d},y="wrapper";function f(e){var n=e.components,t=(0,o.Z)(e,a);return(0,i.kt)(y,(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"proxyconfiguration"}),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections. You can get information about the currently used proxy by inspecting the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," property in your\ncrawler's page function. There, you can inspect the proxy's URL and other attributes."),(0,i.kt)("p",null,"The proxy servers are managed by ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". To be able to use Apify Proxy, you need an Apify account and access to\nthe selected proxies. If you provide no configuration option, the proxies will be managed automatically using a smart algorithm."),(0,i.kt)("p",null,"If you want to use your own proxies, use the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," option. Your\nlist of proxy URLs will be rotated by the configuration if this option is provided."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"proxyconfigurationinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.initialize()")),(0,i.kt)("p",null,"Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups if Apify Proxy configuration is used. Also checks\nif country has access to Apify Proxy groups if the country code is provided."),(0,i.kt)("p",null,"You should use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration"))," function to create a pre-initialized ",(0,i.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"),"\ninstance instead of calling this manually."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newproxyinfo"}),(0,i.kt)("h2",{id:"proxyconfigurationnewproxyinfosessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newProxyInfo([sessionId])")),(0,i.kt)("p",null,"This function creates a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," info object. It is used by CheerioCrawler and PuppeteerCrawler to generate proxy\nURLs and also to allow the user to inspect the currently used proxy via the handlePageFunction parameter: proxyInfo. Use it if you want to work with a\nrich representation of a proxy URL. If you need the URL string only, use ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newUrl")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string. Property sessionId of ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," is always returned as a type\nstring.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))," - represents information about used proxy and its configuration."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newurl"}),(0,i.kt)("h2",{id:"proxyconfigurationnewurlsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"proxyConfiguration.newUrl([sessionId])")),(0,i.kt)("p",null,"Returns a new proxy URL based on provided configuration options and the ",(0,i.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Represents the identifier of user ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," that can be managed by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," or you can use the Apify Proxy ",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/proxy#sessions",target:"_blank",rel:"noopener"},"Session")," identifier. When the provided\nsessionId is a number, it's converted to a string.")),(0,i.kt)("p",null,"All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The\nidentifier must not be longer than 50 characters and include only the following: ",(0,i.kt)("inlineCode",{parentName:"p"},"0-9"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"a-z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"A-Z"),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"."'),", ",(0,i.kt)("inlineCode",{parentName:"p"},'"_"')," and ",(0,i.kt)("inlineCode",{parentName:"p"},'"~"'),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"string")," - A string with a proxy URL, including authentication credentials and port number. For example,\n",(0,i.kt)("inlineCode",{parentName:"p"},"http://bob:password123@proxy.example.com:8000")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},y=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(t),y=o,f=d["".concat(p,".").concat(y)]||d[y]||c[y]||i;return t?r.createElement(f,a(a({ref:n},u),{},{components:t})):r.createElement(f,a({ref:n},u))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=y;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id:"prepare-request-inputs",title:"PrepareRequestInputs"},l=void 0,s={unversionedId:"typedefs/prepare-request-inputs",id:"version-2.3/typedefs/prepare-request-inputs",title:"PrepareRequestInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PrepareRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request-inputs",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequestInputs.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"prepare-request-inputs",title:"PrepareRequestInputs"},sidebar:"version-2.3/docs",previous:{title:"PrepareRequest",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request"},next:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"preparerequestinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("p",null,"The current session"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,o.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"crawler"},(0,o.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(r),f=a,y=c["".concat(l,".").concat(f)]||c[f]||d[f]||o;return r?n.createElement(y,p(p({ref:t},u),{},{components:r})):n.createElement(y,p({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:a,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id:"prepare-request-inputs",title:"PrepareRequestInputs"},l=void 0,s={unversionedId:"typedefs/prepare-request-inputs",id:"version-2.3/typedefs/prepare-request-inputs",title:"PrepareRequestInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PrepareRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request-inputs",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequestInputs.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"prepare-request-inputs",title:"PrepareRequestInputs"},sidebar:"version-2.3/docs",previous:{title:"PrepareRequest",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request"},next:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequestinputs"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"request"},(0,p.kt)("inlineCode",{parentName:"h3"},"request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"session"},(0,p.kt)("inlineCode",{parentName:"h3"},"session")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Session"))),(0,p.kt)("p",null,"The current session"),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyinfo"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,p.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,p.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,p.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(r),f=a,y=c["".concat(l,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(y,o(o({ref:t},u),{},{components:r})):n.createElement(y,o({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>d,default:()=>f,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-dataset-reducer",title:"DatasetReducer",id:"dataset-reducer"},d=void 0,p={unversionedId:"typedefs/dataset-reducer",id:"version-1.3/typedefs/dataset-reducer",title:"DatasetReducer",description:"User-function used in the Dataset.reduce() API.",source:"@site/versioned_docs/version-1.3/typedefs/DatasetReducer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-reducer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-reducer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetReducer.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-dataset-reducer",title:"DatasetReducer",id:"dataset-reducer"},sidebar:"version-1.3/docs",previous:{title:"DatasetMapper",permalink:"/sdk/js/docs/1.3/typedefs/dataset-mapper"},next:{title:"KeyConsumer",permalink:"/sdk/js/docs/1.3/typedefs/key-consumer"}},l={},c=[],u={toc:c},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetreducer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.reduce()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Previous state of the reduction."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var d=n.createContext({}),p=function(e){var t=n.useContext(d),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(d.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,d=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,f=c["".concat(d,".").concat(m)]||c[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},l),{},{components:r})):n.createElement(f,i({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s[c]="string"==typeof e?e:a,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>d,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-dataset-reducer",title:"DatasetReducer",id:"dataset-reducer"},p=void 0,d={unversionedId:"typedefs/dataset-reducer",id:"version-1.3/typedefs/dataset-reducer",title:"DatasetReducer",description:"User-function used in the Dataset.reduce() API.",source:"@site/versioned_docs/version-1.3/typedefs/DatasetReducer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-reducer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-reducer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetReducer.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-dataset-reducer",title:"DatasetReducer",id:"dataset-reducer"},sidebar:"version-1.3/docs",previous:{title:"DatasetMapper",permalink:"/sdk/js/docs/1.3/typedefs/dataset-mapper"},next:{title:"KeyConsumer",permalink:"/sdk/js/docs/1.3/typedefs/key-consumer"}},l={},c=[],u={toc:c},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetreducer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.reduce()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Previous state of the reduction."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),d=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),c=d(r),m=a,f=c["".concat(p,".").concat(m)]||c[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},l),{},{components:r})):n.createElement(f,i({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[c]="string"==typeof e?e:a,i[1]=s;for(var d=2;d{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>s});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={id:"adhoc-webhook",title:"AdhocWebhook"},l=void 0,d={unversionedId:"typedefs/adhoc-webhook",id:"version-2.3/typedefs/adhoc-webhook",title:"AdhocWebhook",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/AdhocWebhook.md",sourceDirName:"typedefs",slug:"/typedefs/adhoc-webhook",permalink:"/sdk/js/docs/2.3/typedefs/adhoc-webhook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AdhocWebhook.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"adhoc-webhook",title:"AdhocWebhook"}},c={},s=[{value:"Properties",id:"properties",level:2},{value:"eventTypes",id:"eventtypes",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"idempotencyKey",id:"idempotencykey",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3}],u={toc:s},y="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(y,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"adhocwebhook"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"idempotencykey"},(0,a.kt)("inlineCode",{parentName:"h3"},"idempotencyKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),d=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),s=d(r),y=o,m=s["".concat(l,".").concat(y)]||s[y]||u[y]||a;return r?n.createElement(m,p(p({ref:t},c),{},{components:r})):n.createElement(m,p({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[s]="string"==typeof e?e:o,p[1]=i;for(var d=2;d{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],l={id:"adhoc-webhook",title:"AdhocWebhook"},i=void 0,d={unversionedId:"typedefs/adhoc-webhook",id:"version-2.3/typedefs/adhoc-webhook",title:"AdhocWebhook",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/AdhocWebhook.md",sourceDirName:"typedefs",slug:"/typedefs/adhoc-webhook",permalink:"/sdk/js/docs/2.3/typedefs/adhoc-webhook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AdhocWebhook.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"adhoc-webhook",title:"AdhocWebhook"}},c={},s=[{value:"Properties",id:"properties",level:2},{value:"eventTypes",id:"eventtypes",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"idempotencyKey",id:"idempotencykey",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3}],u={toc:s},y="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(y,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"adhocwebhook"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"idempotencykey"},(0,a.kt)("inlineCode",{parentName:"h3"},"idempotencyKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),d=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=d(e.components);return n.createElement(i.Provider,{value:t},e.children)},s="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),s=d(r),y=o,m=s["".concat(i,".").concat(y)]||s[y]||u[y]||a;return r?n.createElement(m,p(p({ref:t},c),{},{components:r})):n.createElement(m,p({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[s]="string"==typeof e?e:o,p[1]=l;for(var d=2;d{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),s=["components"],o={id_old:"version-1.3-prepare-request",title:"PrepareRequest",id:"prepare-request"},i=void 0,l={unversionedId:"typedefs/prepare-request",id:"version-1.3/typedefs/prepare-request",title:"PrepareRequest",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PrepareRequest.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequest.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-prepare-request",title:"PrepareRequest",id:"prepare-request"},sidebar:"version-1.3/docs",previous:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/handle-request-inputs"},next:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request-inputs"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,s);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequest"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/prepare-request-inputs",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PrepareRequestInputs"))," - Arguments passed to this callback.")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(m,s(s({ref:t},u),{},{components:r})):n.createElement(m,s({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,s=new Array(p);s[0]=f;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[c]="string"==typeof e?e:a,s[1]=o;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-prepare-request",title:"PrepareRequest",id:"prepare-request"},i=void 0,l={unversionedId:"typedefs/prepare-request",id:"version-1.3/typedefs/prepare-request",title:"PrepareRequest",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PrepareRequest.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequest.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-prepare-request",title:"PrepareRequest",id:"prepare-request"},sidebar:"version-1.3/docs",previous:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/handle-request-inputs"},next:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request-inputs"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequest"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/prepare-request-inputs",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PrepareRequestInputs"))," - Arguments passed to this callback.")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var l=2;l{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),c=i.version,s=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=c+"/";return"current"===c?p="next/":s&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},17423:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>y,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905));r(14563),r(68889);const l={code:"import { gotScraping } from 'got-scraping';\n\n// Get the HTML of a web page\nconst { body } = await gotScraping({ url: 'https://www.example.com' });\nconsole.log(body);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE"};var i,c=["components"],s={id:"crawl-single-url",title:"Crawl a single URL"},p=void 0,d={unversionedId:"examples/crawl-single-url",id:"version-3.1/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the got-scraping npm package",source:"@site/versioned_docs/version-3.1/examples/crawl_single_url.mdx",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_single_url.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/examples/crawl-sitemap"}},u={},m=[],g=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:m},b="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(b,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping"))," npm package\nto grab the HTML of a web page."),(0,o.kt)(g,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},l),(0,o.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,o.kt)("a",{parentName:"p",href:"./accept-user-input",target:null,rel:null},"Accept User Input")," example."))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(g,l(l({ref:t},p),{},{components:r})):n.createElement(g,l({ref:t},p))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[d]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),c=i.version,s=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=c+"/";return"current"===c?p="next/":s&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},17423:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>y,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905));r(14563),r(68889);const l={code:"import { gotScraping } from 'got-scraping';\n\n// Get the HTML of a web page\nconst { body } = await gotScraping({ url: 'https://www.example.com' });\nconsole.log(body);\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE"};var i,c=["components"],s={id:"crawl-single-url",title:"Crawl a single URL"},p=void 0,d={unversionedId:"examples/crawl-single-url",id:"version-3.1/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the got-scraping npm package",source:"@site/versioned_docs/version-3.1/examples/crawl_single_url.mdx",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_single_url.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/examples/crawl-sitemap"}},u={},m=[],g=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:m},b="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(b,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping"))," npm package\nto grab the HTML of a web page."),(0,o.kt)(g,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},l),(0,o.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,o.kt)("a",{parentName:"p",href:"./accept-user-input",target:null,rel:null},"Accept User Input")," example."))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>g});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(g,l(l({ref:t},p),{},{components:r})):n.createElement(g,l({ref:t},p))}));function g(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[d]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.d(t,{Z:()=>i});var a=n(67294),r=n(88746),l=n(6141),c=n(6832);const i=function(e){var t=e.to,n=e.children,i=(0,l.E)(),o=i.version,s=i.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var g=o+"/";return"current"===o?g="next/":s&&(g=""),a.createElement(r.default,{to:"/api/"+g+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>i,T:()=>c});var a=n(67294),r=n(88746),l="https://crawlee.dev",c=function(e){var t=e.to,n=e.children,c=e.version;return a.createElement(r.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},n)},i=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},90133:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>I,default:()=>y,frontMatter:()=>d,metadata:()=>p,toc:()=>h});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),c=(n(14563),n(68889)),i=n(26569);const o={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PlaywrightCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Playwright.\nconst crawler = new PlaywrightCrawler({\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.processedRequests.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs"};var s,g=["components"],d={id:"playwright-crawler",title:"Playwright crawler"},I=void 0,p={unversionedId:"examples/playwright-crawler",id:"version-3.1/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/versioned_docs/version-3.1/examples/playwright_crawler.mdx",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/playwright_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/examples/map-and-reduce"},next:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/examples/capture-screenshot"}},u={},h=[],C=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),b={toc:h},m="wrapper";function y(e){var t=e.components,n=(0,r.Z)(e,g);return(0,l.kt)(m,(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"\nin combination with ",(0,l.kt)(c.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," to\nrecursively scrape the ",(0,l.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,l.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(C,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},o))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},g=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,g=i(e,["components","mdxType","originalType","parentName"]),d=s(n),p=r,u=d["".concat(o,".").concat(p)]||d[p]||I[p]||l;return n?a.createElement(u,c(c({ref:t},g),{},{components:n})):a.createElement(u,c({ref:t},g))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,c=new Array(l);c[0]=p;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:r,c[1]=i;for(var s=2;s{n.d(t,{Z:()=>i});var a=n(67294),r=n(88746),l=n(6141),c=n(6832);const i=function(e){var t=e.to,n=e.children,i=(0,l.E)(),o=i.version,s=i.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var g=o+"/";return"current"===o?g="next/":s&&(g=""),a.createElement(r.default,{to:"/api/"+g+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>i,T:()=>c});var a=n(67294),r=n(88746),l="https://crawlee.dev",c=function(e){var t=e.to,n=e.children,c=e.version;return a.createElement(r.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},n)},i=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},90133:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>I,default:()=>y,frontMatter:()=>d,metadata:()=>p,toc:()=>h});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),c=(n(14563),n(68889)),i=n(26569);const o={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PlaywrightCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Playwright.\nconst crawler = new PlaywrightCrawler({\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.processedRequests.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs"};var s,g=["components"],d={id:"playwright-crawler",title:"Playwright crawler"},I=void 0,p={unversionedId:"examples/playwright-crawler",id:"version-3.1/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/versioned_docs/version-3.1/examples/playwright_crawler.mdx",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/playwright_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/examples/map-and-reduce"},next:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/examples/capture-screenshot"}},u={},h=[],C=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),b={toc:h},m="wrapper";function y(e){var t=e.components,n=(0,r.Z)(e,g);return(0,l.kt)(m,(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"\nin combination with ",(0,l.kt)(c.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," to\nrecursively scrape the ",(0,l.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,l.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(C,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},o))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},g=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,g=i(e,["components","mdxType","originalType","parentName"]),d=s(n),p=r,u=d["".concat(o,".").concat(p)]||d[p]||I[p]||l;return n?a.createElement(u,c(c({ref:t},g),{},{components:n})):a.createElement(u,c({ref:t},g))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,c=new Array(l);c[0]=p;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:r,c[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-hook",title:"Hook",id:"hook"},p=void 0,s={unversionedId:"typedefs/hook",id:"version-1.3/typedefs/hook",title:"Hook",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/Hook.md",sourceDirName:"typedefs",slug:"/typedefs/hook",permalink:"/sdk/js/docs/1.3/typedefs/hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/Hook.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-hook",title:"Hook",id:"hook"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"hook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-hook",title:"Hook",id:"hook"},p=void 0,s={unversionedId:"typedefs/hook",id:"version-1.3/typedefs/hook",title:"Hook",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/Hook.md",sourceDirName:"typedefs",slug:"/typedefs/hook",permalink:"/sdk/js/docs/1.3/typedefs/hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/Hook.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-hook",title:"Hook",id:"hook"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"hook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[d]="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.d(t,{Z:()=>s});var n=r(67294),a=r(88746),i=r(6141),o=r(6832);const s=function(e){var t=e.to,r=e.children,s=(0,i.E)(),l=s.version,c=s.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=l+"/";return"current"===l?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>s,T:()=>o});var n=r(67294),a=r(88746),i="https://crawlee.dev",o=function(e){var t=e.to,r=e.children,o=e.version;return n.createElement(a.default,{href:i+"/api"+(o?"/"+o:"")+"/"+t},r)},s=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:i+"/"+t},r)}},45800:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>f,contentTitle:()=>d,default:()=>g,frontMatter:()=>u,metadata:()=>h,toc:()=>m});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),o=r(14563),s=r(68889),l=r(26569);const c="import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PlaywrightCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Playwright.\nconst crawler = new PlaywrightCrawler({\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.processedRequests.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n";var p=["components"],u={id:"playwright-crawler",title:"Playwright crawler"},d=void 0,h={unversionedId:"examples/playwright-crawler",id:"version-3.0/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/versioned_docs/version-3.0/examples/playwright_crawler.mdx",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/3.0/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/playwright_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/3.0/examples/map-and-reduce"},next:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/3.0/examples/capture-screenshot"}},f={},m=[],w={toc:m},y="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,p);return(0,i.kt)(y,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"This example demonstrates how to use ",(0,i.kt)(l.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"\nin combination with ",(0,i.kt)(s.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," to\nrecursively scrape the ",(0,i.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,i.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,i.kt)(o.Z,{className:"language-js",mdxType:"CodeBlock"},c))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),h=a,f=u["".concat(l,".").concat(h)]||u[h]||d[h]||i;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.d(t,{Z:()=>s});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const s=function(e){var t=e.to,r=e.children,s=(0,o.E)(),l=s.version,c=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=l+"/";return"current"===l?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>s,T:()=>i});var n=r(67294),a=r(88746),o="https://crawlee.dev",i=function(e){var t=e.to,r=e.children,i=e.version;return n.createElement(a.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},r)},s=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},45800:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>f,contentTitle:()=>d,default:()=>g,frontMatter:()=>u,metadata:()=>h,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(14563),s=r(68889),l=r(26569);const c="import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PlaywrightCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Playwright.\nconst crawler = new PlaywrightCrawler({\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.processedRequests.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n";var p=["components"],u={id:"playwright-crawler",title:"Playwright crawler"},d=void 0,h={unversionedId:"examples/playwright-crawler",id:"version-3.0/examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/versioned_docs/version-3.0/examples/playwright_crawler.mdx",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/3.0/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/playwright_crawler.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/3.0/examples/map-and-reduce"},next:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/3.0/examples/capture-screenshot"}},f={},m=[],w={toc:m},y="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(y,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(l.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"\nin combination with ",(0,o.kt)(s.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," to\nrecursively scrape the ",(0,o.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,o.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},c))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),h=a,f=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-2.3/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-2.3/guides/typescript_actor.md",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/2.3/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/typescript_actor.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"version-2.3/docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/2.3/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/2.3/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Apify.getInput()) as any; // getInput returns Promise|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Apify.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-2.3/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-2.3/guides/typescript_actor.md",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/2.3/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/typescript_actor.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"version-2.3/docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/2.3/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/2.3/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Apify.getInput()) as any; // getInput returns Promise|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Apify.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>p,metadata:()=>o,toc:()=>c});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-pseudo-url",title:"PseudoUrl",id:"pseudo-url"},s=void 0,o={unversionedId:"api/pseudo-url",id:"version-1.3/api/pseudo-url",title:"PseudoUrl",description:"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the",source:"@site/versioned_docs/version-1.3/api/PseudoUrl.md",sourceDirName:"api",slug:"/api/pseudo-url",permalink:"/sdk/js/docs/1.3/api/pseudo-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PseudoUrl.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-pseudo-url",title:"PseudoUrl",id:"pseudo-url"},sidebar:"version-1.3/docs",previous:{title:"RequestQueue",permalink:"/sdk/js/docs/1.3/api/request-queue"},next:{title:"utils",permalink:"/sdk/js/docs/1.3/api/utils"}},u={},c=[{value:"new PseudoUrl(purl, requestTemplate)",id:"new-pseudourlpurl-requesttemplate",level:2},{value:"pseudoUrl.matches(url)",id:"pseudourlmatchesurl",level:2},{value:"pseudoUrl.createRequest(urlOrProps)",id:"pseudourlcreaterequesturlorprops",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,l.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("p",null,"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function."),(0,l.kt)("p",null,"A PURL is simply a URL with special directives enclosed in ",(0,l.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Currently, the only supported directive is ",(0,l.kt)("inlineCode",{parentName:"p"},"[RegExp]"),", which defines a\nJavaScript-style regular expression to match against the URL."),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class can be constructed either using a pseudo-URL string or a regular expression (an instance of the ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object). With a\npseudo-URL string, the matching is always case-insensitive. If you need case-sensitive matching, use an appropriate ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object."),(0,l.kt)("p",null,"For example, a PURL ",(0,l.kt)("inlineCode",{parentName:"p"},"http://www.example.com/pages/[(\\w|-)*]")," will match all of the following URLs:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/my-awesome-page")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/something"))),(0,l.kt)("p",null,"Be careful to correctly escape special characters in the pseudo-URL string. If either ",(0,l.kt)("inlineCode",{parentName:"p"},"[")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"]")," is part of the normal query string, it must be\nencoded as ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5B]")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5D]"),", respectively. For example, the following PURL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[\\x5B]load[\\x5D]=1\n")),(0,l.kt)("p",null,"will match the URL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[load]=1\n")),(0,l.kt)("p",null,"If the regular expression in the pseudo-URL contains a backslash character (",")",", you need to escape it with another back backslash, as shown in the\nexample below."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Using a pseudo-URL string\nconst purl = new Apify.PseudoUrl('http://www.example.com/pages/[(\\\\w|-)+]', {\n userData: { foo: 'bar' },\n});\n\n// Using a regular expression\nconst purl2 = new Apify.PseudoUrl(/http:\\/\\/www\\.example\\.com\\/pages\\/(\\w|-)+/);\n\nif (purl.matches('http://www.example.com/pages/my-awesome-page')) console.log('Match!');\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("h2",{id:"new-pseudourlpurl-requesttemplate"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PseudoUrl(purl, requestTemplate)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"purl")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," - A pseudo-URL string or a regular expression object. Using a ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," instance enables more granular control,\nsuch as making the matching case sensitive."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"requestTemplate")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Options for the new ",(0,l.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," instances created for\nmatching URLs by the ",(0,l.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"matches"}),(0,l.kt)("h2",{id:"pseudourlmatchesurl"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.matches(url)")),(0,l.kt)("p",null,"Determines whether a URL matches this pseudo-URL pattern."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - URL to be matched.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," - Returns ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," if given URL matches pseudo-URL."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"createrequest"}),(0,l.kt)("h2",{id:"pseudourlcreaterequesturlorprops"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.createRequest(urlOrProps)")),(0,l.kt)("p",null,"Creates a Request object from a provided ",(0,l.kt)("inlineCode",{parentName:"p"},"requestTemplate")," and a given URL or an object that specifies \\$",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," properties. In\ncase of a collision the properties will override the template, except for ",(0,l.kt)("inlineCode",{parentName:"p"},"userData"),", which will be merged together, with the ",(0,l.kt)("inlineCode",{parentName:"p"},"userData")," property\nhaving preference over the template. This enables dynamic overriding of the template."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"urlOrProps")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"Object"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),c=o(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||l;return n?r.createElement(k,i(i({ref:t},u),{},{components:n})):r.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[c]="string"==typeof e?e:a,i[1]=p;for(var o=2;o{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>p,metadata:()=>o,toc:()=>c});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-pseudo-url",title:"PseudoUrl",id:"pseudo-url"},s=void 0,o={unversionedId:"api/pseudo-url",id:"version-1.3/api/pseudo-url",title:"PseudoUrl",description:"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the",source:"@site/versioned_docs/version-1.3/api/PseudoUrl.md",sourceDirName:"api",slug:"/api/pseudo-url",permalink:"/sdk/js/docs/1.3/api/pseudo-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PseudoUrl.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-pseudo-url",title:"PseudoUrl",id:"pseudo-url"},sidebar:"version-1.3/docs",previous:{title:"RequestQueue",permalink:"/sdk/js/docs/1.3/api/request-queue"},next:{title:"utils",permalink:"/sdk/js/docs/1.3/api/utils"}},u={},c=[{value:"new PseudoUrl(purl, requestTemplate)",id:"new-pseudourlpurl-requesttemplate",level:2},{value:"pseudoUrl.matches(url)",id:"pseudourlmatchesurl",level:2},{value:"pseudoUrl.createRequest(urlOrProps)",id:"pseudourlcreaterequesturlorprops",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,l.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("p",null,"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function."),(0,l.kt)("p",null,"A PURL is simply a URL with special directives enclosed in ",(0,l.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Currently, the only supported directive is ",(0,l.kt)("inlineCode",{parentName:"p"},"[RegExp]"),", which defines a\nJavaScript-style regular expression to match against the URL."),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class can be constructed either using a pseudo-URL string or a regular expression (an instance of the ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object). With a\npseudo-URL string, the matching is always case-insensitive. If you need case-sensitive matching, use an appropriate ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object."),(0,l.kt)("p",null,"For example, a PURL ",(0,l.kt)("inlineCode",{parentName:"p"},"http://www.example.com/pages/[(\\w|-)*]")," will match all of the following URLs:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/my-awesome-page")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/something"))),(0,l.kt)("p",null,"Be careful to correctly escape special characters in the pseudo-URL string. If either ",(0,l.kt)("inlineCode",{parentName:"p"},"[")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"]")," is part of the normal query string, it must be\nencoded as ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5B]")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5D]"),", respectively. For example, the following PURL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[\\x5B]load[\\x5D]=1\n")),(0,l.kt)("p",null,"will match the URL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[load]=1\n")),(0,l.kt)("p",null,"If the regular expression in the pseudo-URL contains a backslash character (",")",", you need to escape it with another back backslash, as shown in the\nexample below."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Using a pseudo-URL string\nconst purl = new Apify.PseudoUrl('http://www.example.com/pages/[(\\\\w|-)+]', {\n userData: { foo: 'bar' },\n});\n\n// Using a regular expression\nconst purl2 = new Apify.PseudoUrl(/http:\\/\\/www\\.example\\.com\\/pages\\/(\\w|-)+/);\n\nif (purl.matches('http://www.example.com/pages/my-awesome-page')) console.log('Match!');\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("h2",{id:"new-pseudourlpurl-requesttemplate"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PseudoUrl(purl, requestTemplate)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"purl")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," - A pseudo-URL string or a regular expression object. Using a ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," instance enables more granular control,\nsuch as making the matching case sensitive."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"requestTemplate")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Options for the new ",(0,l.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," instances created for\nmatching URLs by the ",(0,l.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"matches"}),(0,l.kt)("h2",{id:"pseudourlmatchesurl"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.matches(url)")),(0,l.kt)("p",null,"Determines whether a URL matches this pseudo-URL pattern."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - URL to be matched.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," - Returns ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," if given URL matches pseudo-URL."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"createrequest"}),(0,l.kt)("h2",{id:"pseudourlcreaterequesturlorprops"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.createRequest(urlOrProps)")),(0,l.kt)("p",null,"Creates a Request object from a provided ",(0,l.kt)("inlineCode",{parentName:"p"},"requestTemplate")," and a given URL or an object that specifies \\$",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," properties. In\ncase of a collision the properties will override the template, except for ",(0,l.kt)("inlineCode",{parentName:"p"},"userData"),", which will be merged together, with the ",(0,l.kt)("inlineCode",{parentName:"p"},"userData")," property\nhaving preference over the template. This enables dynamic overriding of the template."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"urlOrProps")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"Object"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),c=o(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||l;return n?r.createElement(k,i(i({ref:t},u),{},{components:n})):r.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[c]="string"==typeof e?e:a,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),i=["components"],o={id_old:"version-1.3-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},s=void 0,p={unversionedId:"api/basic-crawler",id:"version-1.3/api/basic-crawler",title:"BasicCrawler",description:"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of",source:"@site/versioned_docs/version-1.3/api/BasicCrawler.md",sourceDirName:"api",slug:"/api/basic-crawler",permalink:"/sdk/js/docs/1.3/api/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BasicCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},sidebar:"version-1.3/docs",previous:{title:"Configuration",permalink:"/sdk/js/docs/1.3/api/configuration"},next:{title:"CheerioCrawler",permalink:"/sdk/js/docs/1.3/api/cheerio-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new BasicCrawler(options)",id:"new-basiccrawleroptions",level:2},{value:"basicCrawler.log",id:"basiccrawlerlog",level:2},{value:"basicCrawler.sessionPoolOptions",id:"basiccrawlersessionpooloptions",level:2},{value:"basicCrawler.run()",id:"basiccrawlerrun",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,a=(0,n.Z)(e,i);return(0,l.kt)(m,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"basiccrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of\nURLs enabling recursive crawling of websites."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," is a low-level tool that requires the user to implement the page download and data extraction functionality themselves. If you want a\ncrawler that already facilitates this functionality, please consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," for\neach ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object, which represents a single URL to crawl. The ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects are fed from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," options are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes if there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.BasicCrawler({\n requestList,\n handleRequestFunction: async ({ request }) => {\n // 'request' contains an instance of the Request class\n // Here we simply fetch the HTML of the page and store it to a dataset\n const { body } = await Apify.utils.requestAsBrowser(request);\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to change the concurrency settings on the\nfly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.basiccrawler"}),(0,l.kt)("h2",{id:"new-basiccrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new BasicCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/basic-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"BasicCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"basiccrawlerlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"sessionpooloptions"}),(0,l.kt)("h2",{id:"basiccrawlersessionpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.sessionPoolOptions")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"basiccrawlerrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.run()")),(0,l.kt)("p",null,"Runs the crawler. Returns a promise that gets resolved once all the requests are processed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=n,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||l;return a?r.createElement(k,i(i({ref:t},u),{},{components:a})):r.createElement(k,i({ref:t},u))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:n,i[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),i=["components"],o={id_old:"version-1.3-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},s=void 0,p={unversionedId:"api/basic-crawler",id:"version-1.3/api/basic-crawler",title:"BasicCrawler",description:"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of",source:"@site/versioned_docs/version-1.3/api/BasicCrawler.md",sourceDirName:"api",slug:"/api/basic-crawler",permalink:"/sdk/js/docs/1.3/api/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BasicCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-basic-crawler",title:"BasicCrawler",id:"basic-crawler"},sidebar:"version-1.3/docs",previous:{title:"Configuration",permalink:"/sdk/js/docs/1.3/api/configuration"},next:{title:"CheerioCrawler",permalink:"/sdk/js/docs/1.3/api/cheerio-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new BasicCrawler(options)",id:"new-basiccrawleroptions",level:2},{value:"basicCrawler.log",id:"basiccrawlerlog",level:2},{value:"basicCrawler.sessionPoolOptions",id:"basiccrawlersessionpooloptions",level:2},{value:"basicCrawler.run()",id:"basiccrawlerrun",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,a=(0,n.Z)(e,i);return(0,l.kt)(m,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"basiccrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages. The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of\nURLs enabling recursive crawling of websites."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," is a low-level tool that requires the user to implement the page download and data extraction functionality themselves. If you want a\ncrawler that already facilitates this functionality, please consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),",\n",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," invokes the user-provided ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," for\neach ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object, which represents a single URL to crawl. The ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects are fed from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.requestQueue"))," options are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes if there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,"New requests are only dispatched when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("inlineCode",{parentName:"p"},"autoscaledPoolOptions")," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency"),"\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," options are available directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," constructor."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare a list of URLs to crawl\nconst requestList = new Apify.RequestList({\n sources: [{ url: 'http://www.example.com/page-1' }, { url: 'http://www.example.com/page-2' }],\n});\nawait requestList.initialize();\n\n// Crawl the URLs\nconst crawler = new Apify.BasicCrawler({\n requestList,\n handleRequestFunction: async ({ request }) => {\n // 'request' contains an instance of the Request class\n // Here we simply fetch the HTML of the page and store it to a dataset\n const { body } = await Apify.utils.requestAsBrowser(request);\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to change the concurrency settings on the\nfly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"exports.basiccrawler"}),(0,l.kt)("h2",{id:"new-basiccrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new BasicCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/basic-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"BasicCrawler")," parameters are passed via an options object.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"basiccrawlerlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"sessionpooloptions"}),(0,l.kt)("h2",{id:"basiccrawlersessionpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.sessionPoolOptions")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"basiccrawlerrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"basicCrawler.run()")),(0,l.kt)("p",null,"Runs the crawler. Returns a promise that gets resolved once all the requests are processed."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>k});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=p(a),m=n,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||l;return a?r.createElement(k,i(i({ref:t},u),{},{components:a})):r.createElement(k,i({ref:t},u))}));function k(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:n,i[1]=o;for(var p=2;p{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"upgrading-to-v1",title:"Upgrading to v1"},p=void 0,s={unversionedId:"upgrading/upgrading-to-v1",id:"version-3.1/upgrading/upgrading-to-v1",title:"Upgrading to v1",description:"Summary",source:"@site/versioned_docs/version-3.1/upgrading/upgrading_v1.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v1",permalink:"/sdk/js/docs/upgrading/upgrading-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v1.md",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v1",title:"Upgrading to v1"},sidebar:"docs",previous:{title:"Upgrading",permalink:"/sdk/js/docs/upgrading"},next:{title:"Upgrading to v2",permalink:"/sdk/js/docs/upgrading/upgrading-to-v2"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"Map of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"autoscaledPool was moved under crawlingContext.crawler",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of PuppeteerPool with BrowserPool",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running BrowserPool",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of BrowserController",id:"introduction-of-browsercontroller",level:3},{value:"BrowserPool methods vs PuppeteerPool",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated PuppeteerCrawlerOptions",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of gotoFunction",id:"removal-of-gotofunction",level:3},{value:"launchPuppeteerOptions => launchContext",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of launchPuppeteerFunction",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},h="wrapper";function m(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),h=o,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return t?a.createElement(m,l(l({ref:n},u),{},{components:t})):a.createElement(m,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=h;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"upgrading-to-v1",title:"Upgrading to v1"},p=void 0,s={unversionedId:"upgrading/upgrading-to-v1",id:"version-3.1/upgrading/upgrading-to-v1",title:"Upgrading to v1",description:"Summary",source:"@site/versioned_docs/version-3.1/upgrading/upgrading_v1.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v1",permalink:"/sdk/js/docs/upgrading/upgrading-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v1.md",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v1",title:"Upgrading to v1"},sidebar:"docs",previous:{title:"Upgrading",permalink:"/sdk/js/docs/upgrading"},next:{title:"Upgrading to v2",permalink:"/sdk/js/docs/upgrading/upgrading-to-v2"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"Map of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"autoscaledPool was moved under crawlingContext.crawler",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of PuppeteerPool with BrowserPool",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running BrowserPool",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of BrowserController",id:"introduction-of-browsercontroller",level:3},{value:"BrowserPool methods vs PuppeteerPool",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated PuppeteerCrawlerOptions",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of gotoFunction",id:"removal-of-gotofunction",level:3},{value:"launchPuppeteerOptions => launchContext",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of launchPuppeteerFunction",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},h="wrapper";function m(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}m.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},h=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),h=o,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||r;return t?a.createElement(m,l(l({ref:n},u),{},{components:t})):a.createElement(m,l({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=h;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{n.d(t,{Z:()=>i});var a=n(67294),r=n(34334);const l={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(87462),r=n(67294),l=n(34334),i=n(63735),o=n(38224),u=n(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function c(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,c=e.tabValues,m=[],p=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,n=m.indexOf(t),a=c[n].value;a!==o&&(p(t),u(a))},f=function(e){var t,n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var a,r=m.indexOf(e.currentTarget)+1;n=null!=(a=m[r])?a:m[0];break;case"ArrowLeft":var l,i=m.indexOf(e.currentTarget)-1;n=null!=(l=m[i])?l:m[m.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},c.map((function(e){var t=e.value,n=e.label,i=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return m.push(e)},onKeyDown:f,onClick:d},i,{className:(0,l.Z)("tabs__item",s.tabItem,null==i?void 0:i.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function m(e){var t=e.lazy,n=e.children,a=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var i=l.find((function(e){return e.props.value===a}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function p(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",s.tabList)},r.createElement(c,(0,a.Z)({},e,t)),r.createElement(m,(0,a.Z)({},e,t)))}function d(e){var t=(0,u.Z)();return r.createElement(p,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var a=n(67294),r=n(16550),l=n(34423),i=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function c(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function m(e){var t=e.queryString,n=void 0!==t&&t,i=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:i});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function p(e){var t,n,r,l,i=e.defaultValue,u=e.queryString,p=void 0!==u&&u,d=e.groupId,f=s(e),h=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!c({value:n,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:f})})),y=h[0],w=h[1],v=m({queryString:p,groupId:d}),k=v[0],b=v[1],g=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),n=(0,o.Nk)(t),r=n[0],l=n[1],[r,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),C=g[0],x=g[1],q=function(){var e=null!=k?k:C;return c({value:e,tabValues:f})?e:null}();return(0,a.useLayoutEffect)((function(){q&&w(q)}),[q]),{selectedValue:y,selectValue:(0,a.useCallback)((function(e){if(!c({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);w(e),b(e),x(e)}),[b,x,f]),tabValues:f}}},68889:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(67294),r=n(88746),l=n(6141),i=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),u=o.version,s=o.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var c=u+"/";return"current"===u?c="next/":s&&(c=""),a.createElement(r.default,{to:"/api/"+c+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>i});var a=n(67294),r=n(88746),l="https://crawlee.dev",i=function(e){var t=e.to,n=e.children,i=e.version;return a.createElement(r.default,{href:l+"/api"+(i?"/"+i:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},49854:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>v,contentTitle:()=>y,default:()=>C,frontMatter:()=>h,metadata:()=>w,toc:()=>k});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=n(65559),o=n(30433),u=n(14563),s=n(68889),c=n(26569);const m="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'all' will enqueue all links found\n // highlight-next-line\n strategy: 'all',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-hostname'\n // strategy: 'same-hostname',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",d="import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-subdomain'\n // strategy: 'same-subdomain',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n";var f=["components"],h={id:"crawl-relative-links",title:"Crawl a website with relative links"},y=void 0,w={unversionedId:"examples/crawl-relative-links",id:"version-3.0/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"When crawling a website, you may encounter different types of links present that you may want to crawl.",source:"@site/versioned_docs/version-3.0/examples/crawl_relative_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/3.0/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_relative_links.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/3.0/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/3.0/examples/crawl-single-url"}},v={},k=[],b={toc:k},g="wrapper";function C(e){var t=e.components,n=(0,r.Z)(e,f);return(0,l.kt)(g,(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"When crawling a website, you may encounter different types of links present that you may want to crawl.\nTo facilitate the easy crawling of such links, we provide the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method on the crawler context, which will\nautomatically find links and add them to the crawler's ",(0,l.kt)(s.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"."),(0,l.kt)("p",null,"We provide 3 different strategies for crawling relative links:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#All",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"All")),", which will enqueue all links found, regardless of the domain they point to."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameHostname",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameHostname")),", which will enqueue all links found for the same hostname (regardless of any subdomains present)."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameSubdomain",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameSubdomain")),", which will enqueue all links found that have the same subdomain and hostname. This is the default strategy.")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For these examples, we are using the ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),", however\nthe same method is available for both the ",(0,l.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"\nand ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", and you use it\nthe exact same way.")),(0,l.kt)(i.Z,{groupId:"enqueue_strategy",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"all",label:"All Links",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"Any urls found will be matched by this strategy, even if they go off of the site you are currently crawling.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},m)),(0,l.kt)(o.Z,{value:"same_hostname",label:"Same Hostname",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will match relative urls, urls that point to the same\nfull domain or urls that point to any subdomain of the provided domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example"),"\nor ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example")," will all be matched by this strategy.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p)),(0,l.kt)(o.Z,{value:"same-subdomain",label:"Same Subdomain",default:!0,mdxType:"TabItem"},(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This is the default strategy when calling ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", so you don't have to specify it.")),(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will only match relative urls or urls that point to the same\nfull domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example"),"\nwill all be matched by this strategy, while ",(0,l.kt)("inlineCode",{parentName:"p"},"https://other-subdomain.example.com")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"https://otherexample.com")," will not.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},d))))}C.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),s=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(u.Provider,{value:t},e.children)},m="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=s(n),d=r,f=m["".concat(u,".").concat(d)]||m[d]||p[d]||l;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[m]="string"==typeof e?e:r,i[1]=o;for(var s=2;s{n.d(t,{Z:()=>i});var a=n(67294),r=n(34334);const l={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>d});var a=n(87462),r=n(67294),l=n(34334),i=n(63735),o=n(38224),u=n(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function c(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,c=e.tabValues,m=[],p=(0,i.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var t=e.currentTarget,n=m.indexOf(t),a=c[n].value;a!==o&&(p(t),u(a))},f=function(e){var t,n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var a,r=m.indexOf(e.currentTarget)+1;n=null!=(a=m[r])?a:m[0];break;case"ArrowLeft":var l,i=m.indexOf(e.currentTarget)-1;n=null!=(l=m[i])?l:m[m.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},c.map((function(e){var t=e.value,n=e.label,i=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return m.push(e)},onKeyDown:f,onClick:d},i,{className:(0,l.Z)("tabs__item",s.tabItem,null==i?void 0:i.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function m(e){var t=e.lazy,n=e.children,a=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var i=l.find((function(e){return e.props.value===a}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function p(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",s.tabList)},r.createElement(c,(0,a.Z)({},e,t)),r.createElement(m,(0,a.Z)({},e,t)))}function d(e){var t=(0,u.Z)();return r.createElement(p,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var a=n(67294),r=n(16550),l=n(34423),i=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function s(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function c(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function m(e){var t=e.queryString,n=void 0!==t&&t,i=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:i});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function p(e){var t,n,r,l,i=e.defaultValue,u=e.queryString,p=void 0!==u&&u,d=e.groupId,f=s(e),h=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!c({value:n,tabValues:a}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:f})})),y=h[0],w=h[1],v=m({queryString:p,groupId:d}),k=v[0],b=v[1],g=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),n=(0,o.Nk)(t),r=n[0],l=n[1],[r,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),C=g[0],x=g[1],q=function(){var e=null!=k?k:C;return c({value:e,tabValues:f})?e:null}();return(0,a.useLayoutEffect)((function(){q&&w(q)}),[q]),{selectedValue:y,selectValue:(0,a.useCallback)((function(e){if(!c({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);w(e),b(e),x(e)}),[b,x,f]),tabValues:f}}},68889:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(67294),r=n(88746),l=n(6141),i=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),u=o.version,s=o.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var c=u+"/";return"current"===u?c="next/":s&&(c=""),a.createElement(r.default,{to:"/api/"+c+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>i});var a=n(67294),r=n(88746),l="https://crawlee.dev",i=function(e){var t=e.to,n=e.children,i=e.version;return a.createElement(r.default,{href:l+"/api"+(i?"/"+i:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},49854:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>v,contentTitle:()=>y,default:()=>C,frontMatter:()=>h,metadata:()=>w,toc:()=>k});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=n(65559),o=n(30433),u=n(14563),s=n(68889),c=n(26569);const m="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'all' will enqueue all links found\n // highlight-next-line\n strategy: 'all',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-hostname'\n // strategy: 'same-hostname',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",d="import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-subdomain'\n // strategy: 'same-subdomain',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n";var f=["components"],h={id:"crawl-relative-links",title:"Crawl a website with relative links"},y=void 0,w={unversionedId:"examples/crawl-relative-links",id:"version-3.0/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"When crawling a website, you may encounter different types of links present that you may want to crawl.",source:"@site/versioned_docs/version-3.0/examples/crawl_relative_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/3.0/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_relative_links.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/3.0/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/3.0/examples/crawl-single-url"}},v={},k=[],b={toc:k},g="wrapper";function C(e){var t=e.components,n=(0,r.Z)(e,f);return(0,l.kt)(g,(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"When crawling a website, you may encounter different types of links present that you may want to crawl.\nTo facilitate the easy crawling of such links, we provide the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method on the crawler context, which will\nautomatically find links and add them to the crawler's ",(0,l.kt)(s.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"."),(0,l.kt)("p",null,"We provide 3 different strategies for crawling relative links:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#All",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"All")),", which will enqueue all links found, regardless of the domain they point to."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameHostname",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameHostname")),", which will enqueue all links found for the same hostname (regardless of any subdomains present)."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameSubdomain",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameSubdomain")),", which will enqueue all links found that have the same subdomain and hostname. This is the default strategy.")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For these examples, we are using the ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),", however\nthe same method is available for both the ",(0,l.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"\nand ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", and you use it\nthe exact same way.")),(0,l.kt)(i.Z,{groupId:"enqueue_strategy",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"all",label:"All Links",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"Any urls found will be matched by this strategy, even if they go off of the site you are currently crawling.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},m)),(0,l.kt)(o.Z,{value:"same_hostname",label:"Same Hostname",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will match relative urls, urls that point to the same\nfull domain or urls that point to any subdomain of the provided domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example"),"\nor ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example")," will all be matched by this strategy.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p)),(0,l.kt)(o.Z,{value:"same-subdomain",label:"Same Subdomain",default:!0,mdxType:"TabItem"},(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This is the default strategy when calling ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", so you don't have to specify it.")),(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will only match relative urls or urls that point to the same\nfull domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example"),"\nwill all be matched by this strategy, while ",(0,l.kt)("inlineCode",{parentName:"p"},"https://other-subdomain.example.com")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"https://otherexample.com")," will not.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},d))))}C.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),s=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(u.Provider,{value:t},e.children)},m="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=s(n),d=r,f=m["".concat(u,".").concat(d)]||m[d]||p[d]||l;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[m]="string"==typeof e?e:r,i[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>o,metadata:()=>d,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),i=["components"],o={id:"handle-failed-request",title:"HandleFailedRequest"},s=void 0,d={unversionedId:"typedefs/handle-failed-request",id:"version-2.3/typedefs/handle-failed-request",title:"HandleFailedRequest",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/HandleFailedRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequest.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"handle-failed-request",title:"HandleFailedRequest"},sidebar:"version-2.3/docs",previous:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"},next:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request-input"}},p={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,l.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlefailedrequest"}),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/handle-failed-request-input",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"HandleFailedRequestInput"))," - Arguments passed to this callback.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=d(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||c[f]||l;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=f;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var d=2;d{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],i={id:"handle-failed-request",title:"HandleFailedRequest"},s=void 0,d={unversionedId:"typedefs/handle-failed-request",id:"version-2.3/typedefs/handle-failed-request",title:"HandleFailedRequest",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/HandleFailedRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-failed-request",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequest.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"handle-failed-request",title:"HandleFailedRequest"},sidebar:"version-2.3/docs",previous:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"},next:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/2.3/typedefs/handle-failed-request-input"}},p={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlefailedrequest"}),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/handle-failed-request-input",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"HandleFailedRequestInput"))," - Arguments passed to this callback.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),d=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||c[f]||l;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var d=2;d{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-request-storage",title:"Request Storage",id:"request-storage"},u=void 0,l={unversionedId:"guides/request-storage",id:"version-1.3/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-1.3/guides/request_storage.md",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/1.3/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/request_storage.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-storage",title:"Request Storage",id:"request-storage"},sidebar:"version-1.3/docs",previous:{title:"Getting Started",permalink:"/sdk/js/docs/1.3/guides/getting-started"},next:{title:"Result Storage",permalink:"/sdk/js/docs/1.3/guides/result-storage"}},p={},d=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],c={toc:d},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,s.kt)(h,(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,s.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,s.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Related links")),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,s.kt)("h2",{id:"request-queue"},"Request queue"),(0,s.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,s.kt)("p",null,"Each actor run is associated with a ",(0,s.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,s.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,s.kt)("p",null,"Note that ",(0,s.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,s.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await Apify.openRequestQueue();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,s.kt)("h2",{id:"request-list"},"Request list"),(0,s.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,s.kt)("a",{parentName:"p",href:"../guides/results-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,s.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-list",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,s.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,s.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,s.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,s.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,s.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await Apify.openRequestQueue();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var u=a.createContext({}),l=function(e){var t=a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=n,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||s;return r?a.createElement(m,o(o({ref:t},p),{},{components:r})):a.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,o=new Array(s);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:n,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-request-storage",title:"Request Storage",id:"request-storage"},u=void 0,l={unversionedId:"guides/request-storage",id:"version-1.3/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-1.3/guides/request_storage.md",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/1.3/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/request_storage.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-storage",title:"Request Storage",id:"request-storage"},sidebar:"version-1.3/docs",previous:{title:"Getting Started",permalink:"/sdk/js/docs/1.3/guides/getting-started"},next:{title:"Result Storage",permalink:"/sdk/js/docs/1.3/guides/result-storage"}},p={},d=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],c={toc:d},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,s.kt)(h,(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,s.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,s.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Related links")),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,s.kt)("h2",{id:"request-queue"},"Request queue"),(0,s.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,s.kt)("p",null,"Each actor run is associated with a ",(0,s.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,s.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,s.kt)("p",null,"Note that ",(0,s.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,s.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await Apify.openRequestQueue();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,s.kt)("h2",{id:"request-list"},"Request list"),(0,s.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,s.kt)("a",{parentName:"p",href:"../guides/results-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,s.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-list",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,s.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,s.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,s.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,s.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,s.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await Apify.openRequestQueue();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var u=a.createContext({}),l=function(e){var t=a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=n,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||s;return r?a.createElement(m,o(o({ref:t},p),{},{components:r})):a.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,o=new Array(s);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:n,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>y,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),s=["components"],i={id_old:"version-1.3-synchronous-run",title:"Synchronous run",id:"synchronous-run"},p=void 0,c={unversionedId:"examples/synchronous-run",id:"version-1.3/examples/synchronous-run",title:"Synchronous run",description:"This example shows a quick actor that has a run time of just a few seconds. It opens a web page (the Wikipedia home page),",source:"@site/versioned_docs/version-1.3/examples/synchronous_run.md",sourceDirName:"examples",slug:"/examples/synchronous-run",permalink:"/sdk/js/docs/1.3/examples/synchronous-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/synchronous_run.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-synchronous-run",title:"Synchronous run",id:"synchronous-run"},sidebar:"version-1.3/docs",previous:{title:"Screenshots",permalink:"/sdk/js/docs/1.3/examples/screenshots"},next:{title:"Use stealth mode",permalink:"/sdk/js/docs/1.3/examples/use-stealth-mode"}},l={},u=[],d={toc:u},m="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,s);return(0,a.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example shows a quick actor that has a run time of just a few seconds. It opens a ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org",target:"_blank",rel:"noopener"},"web page"),' (the Wikipedia home page),\nwhich contains a list of "Did you know" texts that change daily. The actor scrapes all the "Did you know" items and saves them to the default dataset.'),(0,a.kt)("p",null,"This actor can be invoked synchronously using a single HTTP request to directly obtain its output as a response, using the\n",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input",target:"_blank",rel:"noopener"},"Run actor synchronously")," Apify API endpoint."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch web browser.\n const browser = await Apify.launchPuppeteer({ launchOptions: { headless: true } });\n // Load https://en.wikipedia.org and get all \"Did you know\" texts.\n console.log('Opening web page...');\n const page = await browser.newPage();\n await page.goto('https://en.wikipedia.org');\n\n // Get all \"Did you know\" items from the page.\n console.log('Getting \"Did you know\" items from the page.');\n const results = await page.$$eval('div#mp-dyk > ul li', nodes => nodes.map(node => node.innerText.replace('...', 'Did you know')));\n console.log(results);\n\n // Save all the items to the Apify dataSet.\n await Apify.pushData(results);\n console.log('Actor finished.');\n\n // Close browser\n await browser.close();\n});\n")))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=o,y=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return n?r.createElement(y,s(s({ref:t},l),{},{components:n})):r.createElement(y,s({ref:t},l))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>y,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),s=["components"],i={id_old:"version-1.3-synchronous-run",title:"Synchronous run",id:"synchronous-run"},p=void 0,c={unversionedId:"examples/synchronous-run",id:"version-1.3/examples/synchronous-run",title:"Synchronous run",description:"This example shows a quick actor that has a run time of just a few seconds. It opens a web page (the Wikipedia home page),",source:"@site/versioned_docs/version-1.3/examples/synchronous_run.md",sourceDirName:"examples",slug:"/examples/synchronous-run",permalink:"/sdk/js/docs/1.3/examples/synchronous-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/synchronous_run.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-synchronous-run",title:"Synchronous run",id:"synchronous-run"},sidebar:"version-1.3/docs",previous:{title:"Screenshots",permalink:"/sdk/js/docs/1.3/examples/screenshots"},next:{title:"Use stealth mode",permalink:"/sdk/js/docs/1.3/examples/use-stealth-mode"}},l={},u=[],d={toc:u},m="wrapper";function y(e){var t=e.components,n=(0,o.Z)(e,s);return(0,a.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example shows a quick actor that has a run time of just a few seconds. It opens a ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org",target:"_blank",rel:"noopener"},"web page"),' (the Wikipedia home page),\nwhich contains a list of "Did you know" texts that change daily. The actor scrapes all the "Did you know" items and saves them to the default dataset.'),(0,a.kt)("p",null,"This actor can be invoked synchronously using a single HTTP request to directly obtain its output as a response, using the\n",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input",target:"_blank",rel:"noopener"},"Run actor synchronously")," Apify API endpoint."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch web browser.\n const browser = await Apify.launchPuppeteer({ launchOptions: { headless: true } });\n // Load https://en.wikipedia.org and get all \"Did you know\" texts.\n console.log('Opening web page...');\n const page = await browser.newPage();\n await page.goto('https://en.wikipedia.org');\n\n // Get all \"Did you know\" items from the page.\n console.log('Getting \"Did you know\" items from the page.');\n const results = await page.$$eval('div#mp-dyk > ul li', nodes => nodes.map(node => node.innerText.replace('...', 'Did you know')));\n console.log(results);\n\n // Save all the items to the Apify dataSet.\n await Apify.pushData(results);\n console.log('Actor finished.');\n\n // Close browser\n await browser.close();\n});\n")))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=o,y=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return n?r.createElement(y,s(s({ref:t},l),{},{components:n})):r.createElement(y,s({ref:t},l))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-proxy-info",title:"ProxyInfo",id:"proxy-info"},l=void 0,s={unversionedId:"typedefs/proxy-info",id:"version-1.3/typedefs/proxy-info",title:"ProxyInfo",description:"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of",source:"@site/versioned_docs/version-1.3/typedefs/ProxyInfo.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-info",permalink:"/sdk/js/docs/1.3/typedefs/proxy-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyInfo.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-proxy-info",title:"ProxyInfo",id:"proxy-info"},sidebar:"version-1.3/docs",previous:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-options"},next:{title:"LoggerOptions",permalink:"/sdk/js/docs/1.3/typedefs/logger-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"sessionId",id:"sessionid",level:3},{value:"url",id:"url",level:3},{value:"groups",id:"groups",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"password",id:"password",level:3},{value:"hostname",id:"hostname",level:3},{value:"port",id:"port",level:3}],c={toc:u},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyinfo"}),(0,a.kt)("p",null,"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of\ncrawlers, you can get this object by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo")),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\n// Getting proxyInfo object by calling class method directly\nconst proxyInfo = proxyConfiguration.newProxyInfo();\n\n// In crawler\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n // Getting used proxy URL\n const proxyUrl = proxyInfo.url;\n\n // Getting ID of used Session\n const sessionIdentifier = proxyInfo.sessionId;\n }\n})\n\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"sessionid"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The identifier of used ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session")),", if used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The URL of the proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors on the Apify cloud, or when using the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"hostname"},(0,a.kt)("inlineCode",{parentName:"h3"},"hostname")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Hostname of your proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"port"},(0,a.kt)("inlineCode",{parentName:"h3"},"port")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Proxy port."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),y=o,f=u["".concat(l,".").concat(y)]||u[y]||c[y]||a;return n?r.createElement(f,i(i({ref:t},d),{},{components:n})):r.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id_old:"version-1.3-proxy-info",title:"ProxyInfo",id:"proxy-info"},l=void 0,s={unversionedId:"typedefs/proxy-info",id:"version-1.3/typedefs/proxy-info",title:"ProxyInfo",description:"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of",source:"@site/versioned_docs/version-1.3/typedefs/ProxyInfo.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-info",permalink:"/sdk/js/docs/1.3/typedefs/proxy-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyInfo.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-proxy-info",title:"ProxyInfo",id:"proxy-info"},sidebar:"version-1.3/docs",previous:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-options"},next:{title:"LoggerOptions",permalink:"/sdk/js/docs/1.3/typedefs/logger-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"sessionId",id:"sessionid",level:3},{value:"url",id:"url",level:3},{value:"groups",id:"groups",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"password",id:"password",level:3},{value:"hostname",id:"hostname",level:3},{value:"port",id:"port",level:3}],c={toc:u},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyinfo"}),(0,a.kt)("p",null,"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of\ncrawlers, you can get this object by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo")),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\n// Getting proxyInfo object by calling class method directly\nconst proxyInfo = proxyConfiguration.newProxyInfo();\n\n// In crawler\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n // Getting used proxy URL\n const proxyUrl = proxyInfo.url;\n\n // Getting ID of used Session\n const sessionIdentifier = proxyInfo.sessionId;\n }\n})\n\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"sessionid"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The identifier of used ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session")),", if used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The URL of the proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors on the Apify cloud, or when using the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"hostname"},(0,a.kt)("inlineCode",{parentName:"h3"},"hostname")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Hostname of your proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"port"},(0,a.kt)("inlineCode",{parentName:"h3"},"port")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Proxy port."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),y=o,f=u["".concat(l,".").concat(y)]||u[y]||c[y]||a;return n?r.createElement(f,i(i({ref:t},d),{},{components:n})):r.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,i[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],i={id_old:"version-1.3-create-session",title:"CreateSession",id:"create-session"},l=void 0,c={unversionedId:"typedefs/create-session",id:"version-1.3/typedefs/create-session",title:"CreateSession",description:"Factory user-function which creates customized Session instances.",source:"@site/versioned_docs/version-1.3/typedefs/CreateSession.md",sourceDirName:"typedefs",slug:"/typedefs/create-session",permalink:"/sdk/js/docs/1.3/typedefs/create-session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CreateSession.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-create-session",title:"CreateSession",id:"create-session"},sidebar:"version-1.3/docs",previous:{title:"KeyConsumer",permalink:"/sdk/js/docs/1.3/typedefs/key-consumer"},next:{title:"RequestTransform",permalink:"/sdk/js/docs/1.3/typedefs/request-transform"}},p={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"createsession"}),(0,o.kt)("p",null,"Factory user-function which creates customized ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"sessionPool")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," - Pool requesting the new session.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(r),f=s,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,a(a({ref:t},p),{},{components:r})):n.createElement(m,a({ref:t},p))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],i={id_old:"version-1.3-create-session",title:"CreateSession",id:"create-session"},l=void 0,c={unversionedId:"typedefs/create-session",id:"version-1.3/typedefs/create-session",title:"CreateSession",description:"Factory user-function which creates customized Session instances.",source:"@site/versioned_docs/version-1.3/typedefs/CreateSession.md",sourceDirName:"typedefs",slug:"/typedefs/create-session",permalink:"/sdk/js/docs/1.3/typedefs/create-session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CreateSession.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-create-session",title:"CreateSession",id:"create-session"},sidebar:"version-1.3/docs",previous:{title:"KeyConsumer",permalink:"/sdk/js/docs/1.3/typedefs/key-consumer"},next:{title:"RequestTransform",permalink:"/sdk/js/docs/1.3/typedefs/request-transform"}},p={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"createsession"}),(0,o.kt)("p",null,"Factory user-function which creates customized ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"sessionPool")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," - Pool requesting the new session.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(r),f=s,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,a(a({ref:t},p),{},{components:r})):n.createElement(m,a({ref:t},p))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>u,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],l={id_old:"version-1.3-key-value-store-value-types",title:"KeyValueStoreValueTypes",id:"key-value-store-value-types"},p=void 0,u={unversionedId:"typedefs/key-value-store-value-types",id:"version-1.3/typedefs/key-value-store-value-types",title:"KeyValueStoreValueTypes",description:"---",source:"@site/versioned_docs/version-1.3/typedefs/KeyValueStoreValueTypes.md",sourceDirName:"typedefs",slug:"/typedefs/key-value-store-value-types",permalink:"/sdk/js/docs/1.3/typedefs/key-value-store-value-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyValueStoreValueTypes.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-key-value-store-value-types",title:"KeyValueStoreValueTypes",id:"key-value-store-value-types"}},i={},c=[],y={toc:c},d="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(d,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"keyvaluestorevaluetypes"}),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>i,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),u=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},i=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,i=l(e,["components","mdxType","originalType","parentName"]),c=u(r),d=o,f=c["".concat(p,".").concat(d)]||c[d]||y[d]||a;return r?n.createElement(f,s(s({ref:t},i),{},{components:r})):n.createElement(f,s({ref:t},i))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:o,s[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>f,frontMatter:()=>l,metadata:()=>u,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],l={id_old:"version-1.3-key-value-store-value-types",title:"KeyValueStoreValueTypes",id:"key-value-store-value-types"},p=void 0,u={unversionedId:"typedefs/key-value-store-value-types",id:"version-1.3/typedefs/key-value-store-value-types",title:"KeyValueStoreValueTypes",description:"---",source:"@site/versioned_docs/version-1.3/typedefs/KeyValueStoreValueTypes.md",sourceDirName:"typedefs",slug:"/typedefs/key-value-store-value-types",permalink:"/sdk/js/docs/1.3/typedefs/key-value-store-value-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyValueStoreValueTypes.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-key-value-store-value-types",title:"KeyValueStoreValueTypes",id:"key-value-store-value-types"}},i={},c=[],y={toc:c},d="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(d,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"keyvaluestorevaluetypes"}),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>i,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),u=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},i=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,i=l(e,["components","mdxType","originalType","parentName"]),c=u(r),d=o,f=c["".concat(p,".").concat(d)]||c[d]||y[d]||a;return r?n.createElement(f,s(s({ref:t},i),{},{components:r})):n.createElement(f,s({ref:t},i))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:o,s[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>h,frontMatter:()=>s,metadata:()=>p,toc:()=>d});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],s={id:"snapshotter-options",title:"SnapshotterOptions"},l=void 0,p={unversionedId:"typedefs/snapshotter-options",id:"version-2.3/typedefs/snapshotter-options",title:"SnapshotterOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SnapshotterOptions.md",sourceDirName:"typedefs",slug:"/typedefs/snapshotter-options",permalink:"/sdk/js/docs/2.3/typedefs/snapshotter-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SnapshotterOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"snapshotter-options",title:"SnapshotterOptions"},sidebar:"version-2.3/docs",previous:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-pool-options"},next:{title:"StealthOptions",permalink:"/sdk/js/docs/2.3/typedefs/stealth-options"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"eventLoopSnapshotIntervalSecs",id:"eventloopsnapshotintervalsecs",level:3},{value:"clientSnapshotIntervalSecs",id:"clientsnapshotintervalsecs",level:3},{value:"maxBlockedMillis",id:"maxblockedmillis",level:3},{value:"cpuSnapshotIntervalSecs",id:"cpusnapshotintervalsecs",level:3},{value:"maxUsedCpuRatio",id:"maxusedcpuratio",level:3},{value:"memorySnapshotIntervalSecs",id:"memorysnapshotintervalsecs",level:3},{value:"maxUsedMemoryRatio",id:"maxusedmemoryratio",level:3},{value:"maxClientErrors",id:"maxclienterrors",level:3},{value:"snapshotHistorySecs",id:"snapshothistorysecs",level:3}],m={toc:d},u="wrapper";function h(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(u,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"snapshotteroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"eventloopsnapshotintervalsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventLoopSnapshotIntervalSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.5")),(0,a.kt)("p",null,"Defines the interval of measuring the event loop response time."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"clientsnapshotintervalsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"clientSnapshotIntervalSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Defines the interval of checking the current state of the remote API client."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxblockedmillis"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxBlockedMillis")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 50")),(0,a.kt)("p",null,"Maximum allowed delay of the event loop in milliseconds. Exceeding this limit overloads the event loop."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"cpusnapshotintervalsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"cpuSnapshotIntervalSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Defines the interval of measuring CPU usage. This is only used when running locally. On the Apify platform, the statistics are provided externally at\na fixed interval."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxusedcpuratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxUsedCpuRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.95")),(0,a.kt)("p",null,"Defines the maximum usage of CPU. Exceeding this limit overloads the CPU."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"memorysnapshotintervalsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"memorySnapshotIntervalSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Defines the interval of measuring memory consumption. This is only used when running locally. On the Apify platform, the statistics are provided\nexternally at a fixed interval. The measurement itself is resource intensive (25 - 50ms async). Therefore, setting this interval below 1 second is not\nrecommended."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxusedmemoryratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxUsedMemoryRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.7")),(0,a.kt)("p",null,"Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxclienterrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxClientErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Defines the maximum number of new rate limit errors within the given interval."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"snapshothistorysecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"snapshotHistorySecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance."),(0,a.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),u=o,h=d["".concat(l,".").concat(u)]||d[u]||m[u]||a;return n?r.createElement(h,i(i({ref:t},c),{},{components:n})):r.createElement(h,i({ref:t},c))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>h,frontMatter:()=>a,metadata:()=>p,toc:()=>d});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),s=["components"],a={id:"snapshotter-options",title:"SnapshotterOptions"},l=void 0,p={unversionedId:"typedefs/snapshotter-options",id:"version-2.3/typedefs/snapshotter-options",title:"SnapshotterOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SnapshotterOptions.md",sourceDirName:"typedefs",slug:"/typedefs/snapshotter-options",permalink:"/sdk/js/docs/2.3/typedefs/snapshotter-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SnapshotterOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"snapshotter-options",title:"SnapshotterOptions"},sidebar:"version-2.3/docs",previous:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-pool-options"},next:{title:"StealthOptions",permalink:"/sdk/js/docs/2.3/typedefs/stealth-options"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"eventLoopSnapshotIntervalSecs",id:"eventloopsnapshotintervalsecs",level:3},{value:"clientSnapshotIntervalSecs",id:"clientsnapshotintervalsecs",level:3},{value:"maxBlockedMillis",id:"maxblockedmillis",level:3},{value:"cpuSnapshotIntervalSecs",id:"cpusnapshotintervalsecs",level:3},{value:"maxUsedCpuRatio",id:"maxusedcpuratio",level:3},{value:"memorySnapshotIntervalSecs",id:"memorysnapshotintervalsecs",level:3},{value:"maxUsedMemoryRatio",id:"maxusedmemoryratio",level:3},{value:"maxClientErrors",id:"maxclienterrors",level:3},{value:"snapshotHistorySecs",id:"snapshothistorysecs",level:3}],m={toc:d},u="wrapper";function h(e){var t=e.components,n=(0,o.Z)(e,s);return(0,i.kt)(u,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"snapshotteroptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"eventloopsnapshotintervalsecs"},(0,i.kt)("inlineCode",{parentName:"h3"},"eventLoopSnapshotIntervalSecs")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 0.5")),(0,i.kt)("p",null,"Defines the interval of measuring the event loop response time."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"clientsnapshotintervalsecs"},(0,i.kt)("inlineCode",{parentName:"h3"},"clientSnapshotIntervalSecs")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 1")),(0,i.kt)("p",null,"Defines the interval of checking the current state of the remote API client."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"maxblockedmillis"},(0,i.kt)("inlineCode",{parentName:"h3"},"maxBlockedMillis")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 50")),(0,i.kt)("p",null,"Maximum allowed delay of the event loop in milliseconds. Exceeding this limit overloads the event loop."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"cpusnapshotintervalsecs"},(0,i.kt)("inlineCode",{parentName:"h3"},"cpuSnapshotIntervalSecs")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 1")),(0,i.kt)("p",null,"Defines the interval of measuring CPU usage. This is only used when running locally. On the Apify platform, the statistics are provided externally at\na fixed interval."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"maxusedcpuratio"},(0,i.kt)("inlineCode",{parentName:"h3"},"maxUsedCpuRatio")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 0.95")),(0,i.kt)("p",null,"Defines the maximum usage of CPU. Exceeding this limit overloads the CPU."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"memorysnapshotintervalsecs"},(0,i.kt)("inlineCode",{parentName:"h3"},"memorySnapshotIntervalSecs")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 1")),(0,i.kt)("p",null,"Defines the interval of measuring memory consumption. This is only used when running locally. On the Apify platform, the statistics are provided\nexternally at a fixed interval. The measurement itself is resource intensive (25 - 50ms async). Therefore, setting this interval below 1 second is not\nrecommended."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"maxusedmemoryratio"},(0,i.kt)("inlineCode",{parentName:"h3"},"maxUsedMemoryRatio")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 0.7")),(0,i.kt)("p",null,"Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"maxclienterrors"},(0,i.kt)("inlineCode",{parentName:"h3"},"maxClientErrors")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 1")),(0,i.kt)("p",null,"Defines the maximum number of new rate limit errors within the given interval."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"snapshothistorysecs"},(0,i.kt)("inlineCode",{parentName:"h3"},"snapshotHistorySecs")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," ",(0,i.kt)("code",null," = 60")),(0,i.kt)("p",null,"Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance."),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),d=p(n),u=o,h=d["".concat(l,".").concat(u)]||d[u]||m[u]||i;return n?r.createElement(h,s(s({ref:t},c),{},{components:n})):r.createElement(h,s({ref:t},c))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[d]="string"==typeof e?e:o,s[1]=a;for(var p=2;p{r.d(t,{Z:()=>o});var n=r(67294),a=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>m});var n=r(87462),a=r(67294),l=r(34334),o=r(63735),c=r(38224),i=r(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,r=e.block,c=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,r=d.indexOf(t),n=s[r].value;n!==c&&(p(t),i(n))},b=function(e){var t,r=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,a=d.indexOf(e.currentTarget)+1;r=null!=(n=d[a])?n:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;r=null!=(l=d[o])?l:d[d.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},s.map((function(e){var t=e.value,r=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:c===t?0:-1,"aria-selected":c===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",u.tabItem,null==o?void 0:o.className,{"tabs__item--active":c===t})}),null!=r?r:t)})))}function d(e){var t=e.lazy,r=e.children,n=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function p(e){var t=(0,c.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,n.Z)({},e,t)),a.createElement(d,(0,n.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>p});var n=r(67294),a=r(16550),l=r(34423),o=r(20636),c=r(99200);function i(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:i(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,c=(0,a.k6)(),i=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:o});return[(0,l._X)(i),(0,n.useCallback)((function(e){if(i){var t=new URLSearchParams(c.location.search);t.set(i,e),c.replace(Object.assign({},c.location,{search:t.toString()}))}}),[i,c])]}function p(e){var t,r,a,l,o=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=u(e),f=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!s({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),y=f[0],g=f[1],I=d({queryString:p,groupId:m}),w=I[0],v=I[1],h=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),r=(0,c.Nk)(t),a=r[0],l=r[1],[a,(0,n.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=h[0],C=h[1],X=function(){var e=null!=w?w:x;return s({value:e,tabValues:b})?e:null}();return(0,n.useLayoutEffect)((function(){X&&g(X)}),[X]),{selectedValue:y,selectValue:(0,n.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);g(e),v(e),C(e)}),[v,C,b]),tabValues:b}}},97030:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>b,default:()=>h,frontMatter:()=>m,metadata:()=>f,toc:()=>g});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=r(65559),c=r(30433);r(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig"},s={code:"import { PlaywrightCrawler, downloadListOfUrls } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c"};var d,p=["components"],m={id:"crawl-sitemap",title:"Crawl a sitemap"},b=void 0,f={unversionedId:"examples/crawl-sitemap",id:"version-3.1/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-3.1/examples/crawl_sitemap.mdx",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_sitemap.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/examples/crawl-some-links"}},y={},g=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),w={toc:g},v="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,p);return(0,l.kt)(v,(0,n.Z)({},w,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(c.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(c.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(c.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=u(r),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return r?n.createElement(b,o(o({ref:t},s),{},{components:r})):n.createElement(b,o({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var u=2;u{r.d(t,{Z:()=>o});var n=r(67294),a=r(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,r=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:r},t)}},65559:(e,t,r)=>{r.d(t,{Z:()=>m});var n=r(87462),a=r(67294),l=r(34334),o=r(63735),c=r(38224),i=r(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,r=e.block,c=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,r=d.indexOf(t),n=s[r].value;n!==c&&(p(t),i(n))},b=function(e){var t,r=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,a=d.indexOf(e.currentTarget)+1;r=null!=(n=d[a])?n:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;r=null!=(l=d[o])?l:d[d.length-1]}null==(t=r)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":r},t)},s.map((function(e){var t=e.value,r=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:c===t?0:-1,"aria-selected":c===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",u.tabItem,null==o?void 0:o.className,{"tabs__item--active":c===t})}),null!=r?r:t)})))}function d(e){var t=e.lazy,r=e.children,n=e.selectedValue,l=(Array.isArray(r)?r:[r]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function p(e){var t=(0,c.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,n.Z)({},e,t)),a.createElement(d,(0,n.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,n.Z)({key:String(t)},e))}},38224:(e,t,r)=>{r.d(t,{Y:()=>p});var n=r(67294),a=r(16550),l=r(34423),o=r(20636),c=r(99200);function i(e){return function(e){var t,r;return null!=(t=null==(r=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:r.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,r=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:i(r);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,r])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,r=void 0!==t&&t,o=e.groupId,c=(0,a.k6)(),i=function(e){var t=e.queryString,r=void 0!==t&&t,n=e.groupId;if("string"==typeof r)return r;if(!1===r)return null;if(!0===r&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:r,groupId:o});return[(0,l._X)(i),(0,n.useCallback)((function(e){if(i){var t=new URLSearchParams(c.location.search);t.set(i,e),c.replace(Object.assign({},c.location,{search:t.toString()}))}}),[i,c])]}function p(e){var t,r,a,l,o=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=u(e),f=(0,n.useState)((function(){return function(e){var t,r=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(r){if(!s({value:r,tabValues:n}))throw new Error('Docusaurus error: The has a defaultValue "'+r+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return r}var a=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),y=f[0],g=f[1],I=d({queryString:p,groupId:m}),v=I[0],w=I[1],h=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),r=(0,c.Nk)(t),a=r[0],l=r[1],[a,(0,n.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=h[0],C=h[1],X=function(){var e=null!=v?v:x;return s({value:e,tabValues:b})?e:null}();return(0,n.useLayoutEffect)((function(){X&&g(X)}),[X]),{selectedValue:y,selectValue:(0,n.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);g(e),w(e),C(e)}),[w,C,b]),tabValues:b}}},97030:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>y,contentTitle:()=>b,default:()=>h,frontMatter:()=>m,metadata:()=>f,toc:()=>g});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=r(65559),c=r(30433);r(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler, downloadListOfUrls } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig"},s={code:"import { PlaywrightCrawler, downloadListOfUrls } from 'crawlee';\nimport { Actor } from 'apify';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request }) {\n console.log(request.url);\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl a sitemap)\n});\n\nconst listOfUrls = await downloadListOfUrls({ url: 'https://apify.com/sitemap.xml' });\n\n// Run the crawler\nawait crawler.run(listOfUrls);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c"};var d,p=["components"],m={id:"crawl-sitemap",title:"Crawl a sitemap"},b=void 0,f={unversionedId:"examples/crawl-sitemap",id:"version-3.1/examples/crawl-sitemap",title:"Crawl a sitemap",description:"This example downloads and crawls the URLs from a sitemap.",source:"@site/versioned_docs/version-3.1/examples/crawl_sitemap.mdx",sourceDirName:"examples",slug:"/examples/crawl-sitemap",permalink:"/sdk/js/docs/examples/crawl-sitemap",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_sitemap.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-sitemap",title:"Crawl a sitemap"},sidebar:"docs",previous:{title:"Crawl a single URL",permalink:"/sdk/js/docs/examples/crawl-single-url"},next:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/examples/crawl-some-links"}},y={},g=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),v={toc:g},w="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,p);return(0,l.kt)(w,(0,n.Z)({},v,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example downloads and crawls the URLs from a sitemap."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(c.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(c.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(c.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>b});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},s=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=c(e,["components","mdxType","originalType","parentName"]),d=u(r),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return r?n.createElement(b,o(o({ref:t},s),{},{components:r})):n.createElement(b,o({ref:t},s))}));function b(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[d]="string"==typeof e?e:a,o[1]=c;for(var u=2;u{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),s=i.version,c=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=s+"/";return"current"===s?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},64594:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=r(14563);r(68889);const i="import { gotScraping } from 'got-scraping';\n\n// Get the HTML of a web page\nconst { body } = await gotScraping({ url: 'https://www.example.com' });\nconsole.log(body);\n";var s=["components"],c={id:"crawl-single-url",title:"Crawl a single URL"},p=void 0,u={unversionedId:"examples/crawl-single-url",id:"version-3.0/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the got-scraping npm package",source:"@site/versioned_docs/version-3.0/examples/crawl_single_url.mdx",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/3.0/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_single_url.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/3.0/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/3.0/examples/crawl-sitemap"}},m={},d=[],f={toc:d},g="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(g,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping"))," npm package\nto grab the HTML of a web page."),(0,o.kt)(l.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,o.kt)("a",{parentName:"p",href:"./accept-user-input",target:null,rel:null},"Accept User Input")," example."))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(r),d=a,f=u["".concat(s,".").concat(d)]||u[d]||m[d]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),l=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),s=i.version,c=i.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=s+"/";return"current"===s?p="next/":c&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},64594:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>y,frontMatter:()=>c,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),l=r(14563);r(68889);const i="import { gotScraping } from 'got-scraping';\n\n// Get the HTML of a web page\nconst { body } = await gotScraping({ url: 'https://www.example.com' });\nconsole.log(body);\n";var s=["components"],c={id:"crawl-single-url",title:"Crawl a single URL"},p=void 0,u={unversionedId:"examples/crawl-single-url",id:"version-3.0/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the got-scraping npm package",source:"@site/versioned_docs/version-3.0/examples/crawl_single_url.mdx",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/3.0/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_single_url.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/3.0/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/3.0/examples/crawl-sitemap"}},d={},m=[],f={toc:m},g="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(g,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"got-scraping"))," npm package\nto grab the HTML of a web page."),(0,o.kt)(l.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,o.kt)("a",{parentName:"p",href:"./accept-user-input",target:null,rel:null},"Accept User Input")," example."))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-snapshotter-options",title:"SnapshotterOptions",id:"snapshotter-options"},l=void 0,p={unversionedId:"typedefs/snapshotter-options",id:"version-1.3/typedefs/snapshotter-options",title:"SnapshotterOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SnapshotterOptions.md",sourceDirName:"typedefs",slug:"/typedefs/snapshotter-options",permalink:"/sdk/js/docs/1.3/typedefs/snapshotter-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SnapshotterOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-snapshotter-options",title:"SnapshotterOptions",id:"snapshotter-options"},sidebar:"version-1.3/docs",previous:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-pool-options"},next:{title:"StealthOptions",permalink:"/sdk/js/docs/1.3/typedefs/stealth-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"eventLoopSnapshotIntervalSecs",id:"eventloopsnapshotintervalsecs",level:3},{value:"clientSnapshotIntervalSecs",id:"clientsnapshotintervalsecs",level:3},{value:"maxBlockedMillis",id:"maxblockedmillis",level:3},{value:"cpuSnapshotIntervalSecs",id:"cpusnapshotintervalsecs",level:3},{value:"maxUsedCpuRatio",id:"maxusedcpuratio",level:3},{value:"memorySnapshotIntervalSecs",id:"memorysnapshotintervalsecs",level:3},{value:"maxUsedMemoryRatio",id:"maxusedmemoryratio",level:3},{value:"maxClientErrors",id:"maxclienterrors",level:3},{value:"snapshotHistorySecs",id:"snapshothistorysecs",level:3}],m={toc:c},u="wrapper";function h(e){var t=e.components,n=(0,o.Z)(e,i);return(0,s.kt)(u,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"snapshotteroptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"eventloopsnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"eventLoopSnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.5")),(0,s.kt)("p",null,"Defines the interval of measuring the event loop response time."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"clientsnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"clientSnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the interval of checking the current state of the remote API client."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxblockedmillis"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxBlockedMillis")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 50")),(0,s.kt)("p",null,"Maximum allowed delay of the event loop in milliseconds. Exceeding this limit overloads the event loop."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"cpusnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"cpuSnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the interval of measuring CPU usage. This is only used when running locally. On the Apify platform, the statistics are provided externally at\na fixed interval."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusedcpuratio"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsedCpuRatio")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.95")),(0,s.kt)("p",null,"Defines the maximum usage of CPU. Exceeding this limit overloads the CPU."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"memorysnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"memorySnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the interval of measuring memory consumption. This is only used when running locally. On the Apify platform, the statistics are provided\nexternally at a fixed interval. The measurement itself is resource intensive (25 - 50ms async). Therefore, setting this interval below 1 second is not\nrecommended."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusedmemoryratio"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsedMemoryRatio")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.7")),(0,s.kt)("p",null,"Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxclienterrors"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxClientErrors")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the maximum number of new rate limit errors within the given interval."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"snapshothistorysecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"snapshotHistorySecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 60")),(0,s.kt)("p",null,"Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance."),(0,s.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),u=o,h=c["".concat(l,".").concat(u)]||c[u]||m[u]||s;return n?r.createElement(h,i(i({ref:t},d),{},{components:n})):r.createElement(h,i({ref:t},d))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-snapshotter-options",title:"SnapshotterOptions",id:"snapshotter-options"},l=void 0,p={unversionedId:"typedefs/snapshotter-options",id:"version-1.3/typedefs/snapshotter-options",title:"SnapshotterOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SnapshotterOptions.md",sourceDirName:"typedefs",slug:"/typedefs/snapshotter-options",permalink:"/sdk/js/docs/1.3/typedefs/snapshotter-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SnapshotterOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-snapshotter-options",title:"SnapshotterOptions",id:"snapshotter-options"},sidebar:"version-1.3/docs",previous:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-pool-options"},next:{title:"StealthOptions",permalink:"/sdk/js/docs/1.3/typedefs/stealth-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"eventLoopSnapshotIntervalSecs",id:"eventloopsnapshotintervalsecs",level:3},{value:"clientSnapshotIntervalSecs",id:"clientsnapshotintervalsecs",level:3},{value:"maxBlockedMillis",id:"maxblockedmillis",level:3},{value:"cpuSnapshotIntervalSecs",id:"cpusnapshotintervalsecs",level:3},{value:"maxUsedCpuRatio",id:"maxusedcpuratio",level:3},{value:"memorySnapshotIntervalSecs",id:"memorysnapshotintervalsecs",level:3},{value:"maxUsedMemoryRatio",id:"maxusedmemoryratio",level:3},{value:"maxClientErrors",id:"maxclienterrors",level:3},{value:"snapshotHistorySecs",id:"snapshothistorysecs",level:3}],m={toc:c},u="wrapper";function h(e){var t=e.components,n=(0,o.Z)(e,i);return(0,s.kt)(u,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"snapshotteroptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"eventloopsnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"eventLoopSnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.5")),(0,s.kt)("p",null,"Defines the interval of measuring the event loop response time."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"clientsnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"clientSnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the interval of checking the current state of the remote API client."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxblockedmillis"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxBlockedMillis")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 50")),(0,s.kt)("p",null,"Maximum allowed delay of the event loop in milliseconds. Exceeding this limit overloads the event loop."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"cpusnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"cpuSnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the interval of measuring CPU usage. This is only used when running locally. On the Apify platform, the statistics are provided externally at\na fixed interval."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusedcpuratio"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsedCpuRatio")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.95")),(0,s.kt)("p",null,"Defines the maximum usage of CPU. Exceeding this limit overloads the CPU."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"memorysnapshotintervalsecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"memorySnapshotIntervalSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the interval of measuring memory consumption. This is only used when running locally. On the Apify platform, the statistics are provided\nexternally at a fixed interval. The measurement itself is resource intensive (25 - 50ms async). Therefore, setting this interval below 1 second is not\nrecommended."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusedmemoryratio"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsedMemoryRatio")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.7")),(0,s.kt)("p",null,"Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxclienterrors"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxClientErrors")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 1")),(0,s.kt)("p",null,"Defines the maximum number of new rate limit errors within the given interval."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"snapshothistorysecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"snapshotHistorySecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 60")),(0,s.kt)("p",null,"Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance."),(0,s.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),u=o,h=c["".concat(l,".").concat(u)]||c[u]||m[u]||s;return n?r.createElement(h,i(i({ref:t},d),{},{components:n})):r.createElement(h,i({ref:t},d))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=u;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-request-as-browser-options",title:"RequestAsBrowserOptions",id:"request-as-browser-options"},l=void 0,p={unversionedId:"typedefs/request-as-browser-options",id:"version-1.3/typedefs/request-as-browser-options",title:"RequestAsBrowserOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/RequestAsBrowserOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-options",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-as-browser-options",title:"RequestAsBrowserOptions",id:"request-as-browser-options"},sidebar:"version-1.3/docs",previous:{title:"RequestListOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-list-options"},next:{title:"SessionOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"method",id:"method",level:3},{value:"headers",id:"headers",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"headerGeneratorOptions",id:"headergeneratoroptions",level:3},{value:"languageCode",id:"languagecode",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"useMobileVersion",id:"usemobileversion",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"useInsecureHttpParser",id:"useinsecurehttpparser",level:3},{value:"abortFunction",id:"abortfunction",level:3},{value:"useHttp2",id:"usehttp2",level:3},{value:"forceUrlEncoding",id:"forceurlencoding",level:3}],c={toc:u},k="wrapper";function h(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(k,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestasbrowseroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL of the target endpoint. Supports both HTTP and HTTPS schemes."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"method"},(0,a.kt)("inlineCode",{parentName:"h3"},"method")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"\\",'"',"GET\\",'"','"')),(0,a.kt)("p",null,"HTTP method."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"headers"},(0,a.kt)("inlineCode",{parentName:"h3"},"headers")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"Additional HTTP headers to add. It's only recommended to use this option, with headers that are typically added by websites, such as cookies.\nOverriding default browser headers will remove the masking this function provides."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"An HTTP proxy to be passed down to the HTTP request. Supports proxy authentication with Basic Auth."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"headergeneratoroptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"headerGeneratorOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"object")),(0,a.kt)("p",null,"Configuration to be used for generating correct browser headers. See the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"header-generator"))," library."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"languagecode"},(0,a.kt)("inlineCode",{parentName:"h3"},"languageCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"en",'"')),(0,a.kt)("p",null,"Two-letter ISO 639 language code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"US",'"')),(0,a.kt)("p",null,"Two-letter ISO 3166 country code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usemobileversion"},(0,a.kt)("inlineCode",{parentName:"h3"},"useMobileVersion")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true"),", the function uses User-Agent of a mobile browser."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true, SSL/TLS certificate errors will be ignored."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useinsecurehttpparser"},(0,a.kt)("inlineCode",{parentName:"h3"},"useInsecureHttpParser")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Node.js' HTTP parser is stricter than parsers used by web browsers, which prevents scraping of websites whose servers do not comply with HTTP specs,\neither by accident or due to some anti-scraping protections, causing e.g. the ",(0,a.kt)("inlineCode",{parentName:"p"},"invalid header value char")," error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option\nforces the HTTP parser to ignore certain errors which lets you scrape such websites. However, it will also open your application to some security\nvulnerabilities, although the risk should be negligible as these vulnerabilities mainly relate to server applications, not clients. Learn more in this\n",(0,a.kt)("a",{parentName:"p",href:"https://snyk.io/blog/node-js-release-fixes-a-critical-http-security-vulnerability/",target:"_blank",rel:"noopener"},"blog post"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"abortfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"abortFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/abort-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AbortFunction"))),(0,a.kt)("p",null,"Function accepts ",(0,a.kt)("inlineCode",{parentName:"p"},"response")," object as a single parameter and should return ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),". If function returns true, request gets aborted."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usehttp2"},(0,a.kt)("inlineCode",{parentName:"h3"},"useHttp2")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to false, it will prevent use of HTTP2 requests. This is strongly discouraged. Websites expect HTTP2 connections, because browsers use HTTP2 by\ndefault. It will automatically downgrade to HTTP/1.1 for websites that do not support HTTP2. For Node 10 this option is always set to ",(0,a.kt)("inlineCode",{parentName:"p"},"false")," because\nNode 10 does not support HTTP2 very well. Upgrade to Node 12 for better performance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"forceurlencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"forceUrlEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Automatically encode URLs via ",(0,a.kt)("inlineCode",{parentName:"p"},"encodeURI()")," before resolving them."),(0,a.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>h});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,h=u["".concat(l,".").concat(k)]||u[k]||c[k]||a;return r?n.createElement(h,i(i({ref:t},d),{},{components:r})):n.createElement(h,i({ref:t},d))}));function h(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=k;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-request-as-browser-options",title:"RequestAsBrowserOptions",id:"request-as-browser-options"},l=void 0,p={unversionedId:"typedefs/request-as-browser-options",id:"version-1.3/typedefs/request-as-browser-options",title:"RequestAsBrowserOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/RequestAsBrowserOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-options",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-as-browser-options",title:"RequestAsBrowserOptions",id:"request-as-browser-options"},sidebar:"version-1.3/docs",previous:{title:"RequestListOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-list-options"},next:{title:"SessionOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"url",id:"url",level:3},{value:"method",id:"method",level:3},{value:"headers",id:"headers",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"headerGeneratorOptions",id:"headergeneratoroptions",level:3},{value:"languageCode",id:"languagecode",level:3},{value:"countryCode",id:"countrycode",level:3},{value:"useMobileVersion",id:"usemobileversion",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"useInsecureHttpParser",id:"useinsecurehttpparser",level:3},{value:"abortFunction",id:"abortfunction",level:3},{value:"useHttp2",id:"usehttp2",level:3},{value:"forceUrlEncoding",id:"forceurlencoding",level:3}],c={toc:u},k="wrapper";function h(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(k,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestasbrowseroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL of the target endpoint. Supports both HTTP and HTTPS schemes."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"method"},(0,a.kt)("inlineCode",{parentName:"h3"},"method")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"\\",'"',"GET\\",'"','"')),(0,a.kt)("p",null,"HTTP method."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"headers"},(0,a.kt)("inlineCode",{parentName:"h3"},"headers")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"Additional HTTP headers to add. It's only recommended to use this option, with headers that are typically added by websites, such as cookies.\nOverriding default browser headers will remove the masking this function provides."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"An HTTP proxy to be passed down to the HTTP request. Supports proxy authentication with Basic Auth."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"headergeneratoroptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"headerGeneratorOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"object")),(0,a.kt)("p",null,"Configuration to be used for generating correct browser headers. See the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/header-generator",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"header-generator"))," library."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"languagecode"},(0,a.kt)("inlineCode",{parentName:"h3"},"languageCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"en",'"')),(0,a.kt)("p",null,"Two-letter ISO 639 language code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ",(0,a.kt)("code",null," = ",'"',"US",'"')),(0,a.kt)("p",null,"Two-letter ISO 3166 country code."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usemobileversion"},(0,a.kt)("inlineCode",{parentName:"h3"},"useMobileVersion")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true"),", the function uses User-Agent of a mobile browser."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true, SSL/TLS certificate errors will be ignored."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useinsecurehttpparser"},(0,a.kt)("inlineCode",{parentName:"h3"},"useInsecureHttpParser")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"Node.js' HTTP parser is stricter than parsers used by web browsers, which prevents scraping of websites whose servers do not comply with HTTP specs,\neither by accident or due to some anti-scraping protections, causing e.g. the ",(0,a.kt)("inlineCode",{parentName:"p"},"invalid header value char")," error. The ",(0,a.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option\nforces the HTTP parser to ignore certain errors which lets you scrape such websites. However, it will also open your application to some security\nvulnerabilities, although the risk should be negligible as these vulnerabilities mainly relate to server applications, not clients. Learn more in this\n",(0,a.kt)("a",{parentName:"p",href:"https://snyk.io/blog/node-js-release-fixes-a-critical-http-security-vulnerability/",target:"_blank",rel:"noopener"},"blog post"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"abortfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"abortFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/abort-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AbortFunction"))),(0,a.kt)("p",null,"Function accepts ",(0,a.kt)("inlineCode",{parentName:"p"},"response")," object as a single parameter and should return ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),". If function returns true, request gets aborted."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usehttp2"},(0,a.kt)("inlineCode",{parentName:"h3"},"useHttp2")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to false, it will prevent use of HTTP2 requests. This is strongly discouraged. Websites expect HTTP2 connections, because browsers use HTTP2 by\ndefault. It will automatically downgrade to HTTP/1.1 for websites that do not support HTTP2. For Node 10 this option is always set to ",(0,a.kt)("inlineCode",{parentName:"p"},"false")," because\nNode 10 does not support HTTP2 very well. Upgrade to Node 12 for better performance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"forceurlencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"forceUrlEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Automatically encode URLs via ",(0,a.kt)("inlineCode",{parentName:"p"},"encodeURI()")," before resolving them."),(0,a.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>h});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,h=u["".concat(l,".").concat(k)]||u[k]||c[k]||a;return r?n.createElement(h,i(i({ref:t},d),{},{components:r})):n.createElement(h,i({ref:t},d))}));function h(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=k;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var p=2;p{a.d(t,{Z:()=>i});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const i=function(e){var t=e.to,a=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var d=l+"/";return"current"===l?d="next/":p&&(d=""),r.createElement(n.default,{to:"/api/"+d+t},a)}},7574:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>c});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(68889),i=["components"],l={id:"result-storage",title:"Result Storage"},p=void 0,d={unversionedId:"guides/result-storage",id:"version-3.0/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.0/guides/result_storage.mdx",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/3.0/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/result_storage.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/3.0/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/3.0/guides/environment-variables"}},u={},c=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],f={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)(s.Z,{to:"apify/class/Actor#getValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.getValue()"))," and ",(0,o.kt)(s.Z,{to:"apify/class/Actor#setValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Actor.getInput();\n\n// Write actor output to the default key-value store.\nawait Actor.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Actor.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/capture-screenshot",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)(s.Z,{to:"apify/class/Actor#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Actor.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Actor.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(a),f=n,h=u["".concat(l,".").concat(f)]||u[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},d),{},{components:a})):r.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.d(t,{Z:()=>i});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const i=function(e){var t=e.to,a=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var d=l+"/";return"current"===l?d="next/":p&&(d=""),r.createElement(n.default,{to:"/api/"+d+t},a)}},7574:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>c});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(68889),i=["components"],l={id:"result-storage",title:"Result Storage"},p=void 0,d={unversionedId:"guides/result-storage",id:"version-3.0/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.0/guides/result_storage.mdx",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/3.0/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/result_storage.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/3.0/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/3.0/guides/environment-variables"}},u={},c=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],f={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)(s.Z,{to:"apify/class/Actor#getValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.getValue()"))," and ",(0,o.kt)(s.Z,{to:"apify/class/Actor#setValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Actor.getInput();\n\n// Write actor output to the default key-value store.\nawait Actor.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Actor.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/capture-screenshot",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)(s.Z,{to:"apify/class/Actor#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Actor.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Actor.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(a),f=n,h=u["".concat(l,".").concat(f)]||u[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},d),{},{components:a})):r.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-2.3.0-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},s=void 0,p={unversionedId:"typedefs/cheerio-crawler-options",id:"version-2.3/typedefs/cheerio-crawler-options",title:"CheerioCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CheerioCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},sidebar:"version-2.3/docs",previous:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/basic-crawler-options"},next:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/playwright-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"prepareRequestFunction",id:"preparerequestfunction",level:3},{value:"postResponseFunction",id:"postresponsefunction",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"requestTimeoutSecs",id:"requesttimeoutsecs",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"additionalMimeTypes",id:"additionalmimetypes",level:3},{value:"suggestResponseEncoding",id:"suggestresponseencoding",level:3},{value:"forceResponseEncoding",id:"forceresponseencoding",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"cheeriocrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioHandlePage"))),(0,a.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each page loaded and parsed by the crawler."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n // The Cheerio object's function with the parsed HTML.\n $: Cheerio,\n\n // The request body of the web page, whose type depends on the content type.\n body: String|Buffer,\n\n // The parsed object from JSON for responses with the \"application/json\" content types.\n // For other content types it's null.\n json: Object,\n\n // Apify.Request object with details of the requested web page\n request: Request,\n\n // Parsed Content-Type HTTP header: { type, encoding }\n contentType: Object,\n\n // An instance of Node's http.IncomingMessage object,\n response: Object,\n\n // Session object, useful to work around anti-scraping protections\n session: Session\n\n // ProxyInfo object with information about currently used proxy\n proxyInfo: ProxyInfo\n\n // The running cheerio crawler instance.\n crawler: CheerioCrawler\n}\n")),(0,a.kt)("p",null,"Type of ",(0,a.kt)("inlineCode",{parentName:"p"},"body")," depends on the ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header of the web page:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"String for ",(0,a.kt)("inlineCode",{parentName:"li"},"text/html"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xhtml+xml"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xml")," MIME content types"),(0,a.kt)("li",{parentName:"ul"},"Buffer for others MIME content types")),(0,a.kt)("p",null,"Parsed ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header using ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/content-type",target:"_blank",rel:"noopener"},"content-type package")," is stored in ",(0,a.kt)("inlineCode",{parentName:"p"},"contentType"),"."),(0,a.kt)("p",null,"Cheerio is available only for HTML and XML content types."),(0,a.kt)("p",null,"With the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object representing the URL to crawl."),(0,a.kt)("p",null,"If the function returns, the returned promise is awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"preparerequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"prepareRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/prepare-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PrepareRequest"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes before the HTTP request is made to the target resource. This function is suitable for setting dynamic properties such as\ncookies to the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the initialized request and the ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," instance corresponds to used\nsession."),(0,a.kt)("p",null,"The function should modify the properties of the passed ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance in place because there are already earlier references to\nit. Making a copy and returning it from this function is therefore not supported, because it would create inconsistencies where different parts of SDK\nwould have access to a different ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postresponsefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"postResponseFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/post-response",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PostResponse"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes right after the HTTP request is made to the target resource and response is returned. This function is suitable for\noverriding custom properties of response e.g. setting headers because of response parsing."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerioCrawlerOptions = {\n // ...\n postResponseFunction: ({ request, response }) => {\n if (request.userData.parseAsJSON) {\n response.headers['content-type'] = 'application/json; charset=utf-8';\n }\n },\n};\n")),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n response: Object,\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"The response is an instance of Node's http.IncomingMessage object."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 30")),(0,a.kt)("p",null,"Timeout in which the HTTP request to the resource needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true, SSL certificate errors will be ignored."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided\nand rotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n error: Error,\n request: Request,\n session: Session,\n $: Cheerio,\n body: String|Buffer,\n json: Object,\n contentType: Object,\n response: Object,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("p",null,"See ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/cheerio_crawler.js#L13",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowser()")," function the\ncrawler calls to navigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n // ...\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"additionalmimetypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"additionalMimeTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of ",(0,a.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types",target:"_blank"},"MIME types")," you want the crawler to load and process. By default, only ",(0,a.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME types are\nsupported."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"suggestresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"suggestResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Sadly, there are some websites which use invalid headers.\nThose are encoded using the UTF-8 encoding. If those sites actually use a different encoding, the response will be corrupted. You can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"suggestResponseEncoding")," to fall back to a certain encoding, if you know that your target website uses it. To force a certain encoding, disregarding\nthe response headers, use ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#forceresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.forceResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will fall back to windows-1250 encoding if none found\nsuggestResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"forceresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"forceResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"forceResponseEncoding")," to force a certain encoding,\ndisregarding the response headers. To only provide a default for missing encodings, use\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#suggestresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.suggestResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will force windows-1250 encoding even if headers say otherwise\nforceResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestFunction")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction"),"\nand ",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction")," options are provided by ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and cannot be overridden. Reasonable ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," defaults are provided to account for the fact that ",(0,a.kt)("inlineCode",{parentName:"p"},"cheerio")," parses HTML synchronously and therefore blocks the\nevent loop."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true Crawler will automatically use Session Pool. It will automatically retire sessions on 403, 401 and 429 status codes. It also marks\nSession as bad after a request timeout."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," constructor."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("p",null,'It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request. It passes the\n"Cookie" header to the request with the session cookies.'),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),h=o,k=c["".concat(s,".").concat(h)]||c[h]||d[h]||a;return n?r.createElement(k,i(i({ref:t},u),{},{components:n})):r.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-2.3.0-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},s=void 0,p={unversionedId:"typedefs/cheerio-crawler-options",id:"version-2.3/typedefs/cheerio-crawler-options",title:"CheerioCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CheerioCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},sidebar:"version-2.3/docs",previous:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/basic-crawler-options"},next:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/playwright-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"prepareRequestFunction",id:"preparerequestfunction",level:3},{value:"postResponseFunction",id:"postresponsefunction",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"requestTimeoutSecs",id:"requesttimeoutsecs",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"additionalMimeTypes",id:"additionalmimetypes",level:3},{value:"suggestResponseEncoding",id:"suggestresponseencoding",level:3},{value:"forceResponseEncoding",id:"forceresponseencoding",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"cheeriocrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioHandlePage"))),(0,a.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each page loaded and parsed by the crawler."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n // The Cheerio object's function with the parsed HTML.\n $: Cheerio,\n\n // The request body of the web page, whose type depends on the content type.\n body: String|Buffer,\n\n // The parsed object from JSON for responses with the \"application/json\" content types.\n // For other content types it's null.\n json: Object,\n\n // Apify.Request object with details of the requested web page\n request: Request,\n\n // Parsed Content-Type HTTP header: { type, encoding }\n contentType: Object,\n\n // An instance of Node's http.IncomingMessage object,\n response: Object,\n\n // Session object, useful to work around anti-scraping protections\n session: Session\n\n // ProxyInfo object with information about currently used proxy\n proxyInfo: ProxyInfo\n\n // The running cheerio crawler instance.\n crawler: CheerioCrawler\n}\n")),(0,a.kt)("p",null,"Type of ",(0,a.kt)("inlineCode",{parentName:"p"},"body")," depends on the ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header of the web page:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"String for ",(0,a.kt)("inlineCode",{parentName:"li"},"text/html"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xhtml+xml"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xml")," MIME content types"),(0,a.kt)("li",{parentName:"ul"},"Buffer for others MIME content types")),(0,a.kt)("p",null,"Parsed ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header using ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/content-type",target:"_blank",rel:"noopener"},"content-type package")," is stored in ",(0,a.kt)("inlineCode",{parentName:"p"},"contentType"),"."),(0,a.kt)("p",null,"Cheerio is available only for HTML and XML content types."),(0,a.kt)("p",null,"With the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object representing the URL to crawl."),(0,a.kt)("p",null,"If the function returns, the returned promise is awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"preparerequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"prepareRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/prepare-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PrepareRequest"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes before the HTTP request is made to the target resource. This function is suitable for setting dynamic properties such as\ncookies to the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the initialized request and the ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," instance corresponds to used\nsession."),(0,a.kt)("p",null,"The function should modify the properties of the passed ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance in place because there are already earlier references to\nit. Making a copy and returning it from this function is therefore not supported, because it would create inconsistencies where different parts of SDK\nwould have access to a different ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postresponsefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"postResponseFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/post-response",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PostResponse"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes right after the HTTP request is made to the target resource and response is returned. This function is suitable for\noverriding custom properties of response e.g. setting headers because of response parsing."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerioCrawlerOptions = {\n // ...\n postResponseFunction: ({ request, response }) => {\n if (request.userData.parseAsJSON) {\n response.headers['content-type'] = 'application/json; charset=utf-8';\n }\n },\n};\n")),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n response: Object,\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"The response is an instance of Node's http.IncomingMessage object."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 30")),(0,a.kt)("p",null,"Timeout in which the HTTP request to the resource needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true, SSL certificate errors will be ignored."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided\nand rotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n error: Error,\n request: Request,\n session: Session,\n $: Cheerio,\n body: String|Buffer,\n json: Object,\n contentType: Object,\n response: Object,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("p",null,"See ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/cheerio_crawler.js#L13",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowser()")," function the\ncrawler calls to navigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n // ...\n },\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"additionalmimetypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"additionalMimeTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"An array of ",(0,a.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types",target:"_blank"},"MIME types")," you want the crawler to load and process. By default, only ",(0,a.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME types are\nsupported."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"suggestresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"suggestResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Sadly, there are some websites which use invalid headers.\nThose are encoded using the UTF-8 encoding. If those sites actually use a different encoding, the response will be corrupted. You can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"suggestResponseEncoding")," to fall back to a certain encoding, if you know that your target website uses it. To force a certain encoding, disregarding\nthe response headers, use ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#forceresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.forceResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will fall back to windows-1250 encoding if none found\nsuggestResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"forceresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"forceResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"forceResponseEncoding")," to force a certain encoding,\ndisregarding the response headers. To only provide a default for missing encodings, use\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#suggestresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.suggestResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will force windows-1250 encoding even if headers say otherwise\nforceResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestFunction")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction"),"\nand ",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction")," options are provided by ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and cannot be overridden. Reasonable ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," defaults are provided to account for the fact that ",(0,a.kt)("inlineCode",{parentName:"p"},"cheerio")," parses HTML synchronously and therefore blocks the\nevent loop."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true Crawler will automatically use Session Pool. It will automatically retire sessions on 403, 401 and 429 status codes. It also marks\nSession as bad after a request timeout."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," constructor."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("p",null,'It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request. It passes the\n"Cookie" header to the request with the session cookies.'),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),h=o,k=c["".concat(s,".").concat(h)]||c[h]||d[h]||a;return n?r.createElement(k,i(i({ref:t},u),{},{components:n})):r.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.d(t,{Z:()=>o});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,n=e.hidden,o=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),o=n(63735),u=n(38224),i=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,u=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==u&&(p(t),i(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;n=null!=(l=d[o])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,o=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:u===t?0:-1,"aria-selected":u===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",c.tabItem,null==o?void 0:o.className,{"tabs__item--active":u===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===r}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,u.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),o=n(20636),u=n(99200);function i(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:i(n);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,o=e.groupId,u=(0,a.k6)(),i=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:o});return[(0,l._X)(i),(0,r.useCallback)((function(e){if(i){var t=new URLSearchParams(u.location.search);t.set(i,e),u.replace(Object.assign({},u.location,{search:t.toString()}))}}),[i,u])]}function p(e){var t,n,a,l,o=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=c(e),y=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),g=y[0],f=y[1],I=d({queryString:p,groupId:m}),h=I[0],w=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,u.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=v[0],X=v[1],C=function(){var e=null!=h?h:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){C&&f(C)}),[C]),{selectedValue:g,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);f(e),w(e),X(e)}),[w,X,b]),tabValues:b}}},51944:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>b,default:()=>v,frontMatter:()=>m,metadata:()=>y,toc:()=>f});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=n(65559),u=n(30433);n(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc"},c={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8"};var d,p=["components"],m={id:"crawl-all-links",title:"Crawl all links on a website"},b=void 0,y={unversionedId:"examples/crawl-all-links",id:"examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/../docs/examples/crawl_all_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/next/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_all_links.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/next/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/next/examples/crawl-multiple-urls"}},g={},f=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:f},w="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(w,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(u.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(u.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},c)),(0,l.kt)(u.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),c=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,o(o({ref:t},s),{},{components:n})):r.createElement(b,o({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[d]="string"==typeof e?e:a,o[1]=u;for(var c=2;c{n.d(t,{Z:()=>o});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,n=e.hidden,o=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),o=n(63735),u=n(38224),i=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,u=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==u&&(p(t),i(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;n=null!=(l=d[o])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,o=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:u===t?0:-1,"aria-selected":u===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",c.tabItem,null==o?void 0:o.className,{"tabs__item--active":u===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===r}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,u.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),o=n(20636),u=n(99200);function i(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:i(n);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,o=e.groupId,u=(0,a.k6)(),i=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:o});return[(0,l._X)(i),(0,r.useCallback)((function(e){if(i){var t=new URLSearchParams(u.location.search);t.set(i,e),u.replace(Object.assign({},u.location,{search:t.toString()}))}}),[i,u])]}function p(e){var t,n,a,l,o=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=c(e),y=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),g=y[0],f=y[1],I=d({queryString:p,groupId:m}),h=I[0],w=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,u.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=v[0],X=v[1],C=function(){var e=null!=h?h:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){C&&f(C)}),[C]),{selectedValue:g,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);f(e),w(e),X(e)}),[w,X,b]),tabValues:b}}},51944:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>b,default:()=>v,frontMatter:()=>m,metadata:()=>y,toc:()=>f});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=n(65559),u=n(30433);n(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc"},c={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8"};var d,p=["components"],m={id:"crawl-all-links",title:"Crawl all links on a website"},b=void 0,y={unversionedId:"examples/crawl-all-links",id:"examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/../docs/examples/crawl_all_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/next/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_all_links.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/next/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/next/examples/crawl-multiple-urls"}},g={},f=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:f},w="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(w,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(u.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(u.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},c)),(0,l.kt)(u.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),c=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=u(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,o(o({ref:t},s),{},{components:n})):r.createElement(b,o({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[d]="string"==typeof e?e:a,o[1]=u;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-forms",title:"Forms",id:"forms"},l=void 0,p={unversionedId:"examples/forms",id:"version-1.3/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to automatically fill and submit a search form to look up",source:"@site/versioned_docs/version-1.3/examples/forms.md",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/1.3/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/forms.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-forms",title:"Forms",id:"forms"},sidebar:"version-1.3/docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-some-links"},next:{title:"Handle broken links",permalink:"/sdk/js/docs/1.3/examples/handle-broken-links"}},c={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,s);return(0,o.kt)(d,(0,a.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to automatically fill and submit a search form to look up\nrepositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer. The actor first fills in the search term, repository owner, start date\nand language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch the web browser.\n const browser = await Apify.launchPuppeteer();\n\n // Create and navigate new page\n console.log('Open target page');\n const page = await browser.newPage();\n await page.goto('https://github.com/search/advanced');\n\n // Fill form fields and select desired search options\n console.log('Fill in search form');\n await page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\n await page.type('#search_from', 'apify');\n await page.type('#search_date', '>2015');\n await page.select('select#search_language', 'JavaScript');\n\n // Submit the form and wait for full load of next page\n console.log('Submit search form');\n await Promise.all([page.waitForNavigation(), page.click('#adv_code_search button[type=\"submit\"]')]);\n\n // Obtain and print list of search results\n const results = await page.$$eval('div.f4.text-normal a', nodes =>\n nodes.map(node => ({\n url: node.href,\n name: node.innerText,\n })),\n );\n console.log('Results:', results);\n\n // Store data in default dataset\n await Apify.pushData(results);\n\n // Close browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),p=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||o;return r?a.createElement(f,s(s({ref:t},c),{},{components:r})):a.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-forms",title:"Forms",id:"forms"},l=void 0,p={unversionedId:"examples/forms",id:"version-1.3/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to automatically fill and submit a search form to look up",source:"@site/versioned_docs/version-1.3/examples/forms.md",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/1.3/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/forms.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-forms",title:"Forms",id:"forms"},sidebar:"version-1.3/docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-some-links"},next:{title:"Handle broken links",permalink:"/sdk/js/docs/1.3/examples/handle-broken-links"}},c={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,s);return(0,o.kt)(d,(0,a.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to automatically fill and submit a search form to look up\nrepositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer. The actor first fills in the search term, repository owner, start date\nand language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch the web browser.\n const browser = await Apify.launchPuppeteer();\n\n // Create and navigate new page\n console.log('Open target page');\n const page = await browser.newPage();\n await page.goto('https://github.com/search/advanced');\n\n // Fill form fields and select desired search options\n console.log('Fill in search form');\n await page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\n await page.type('#search_from', 'apify');\n await page.type('#search_date', '>2015');\n await page.select('select#search_language', 'JavaScript');\n\n // Submit the form and wait for full load of next page\n console.log('Submit search form');\n await Promise.all([page.waitForNavigation(), page.click('#adv_code_search button[type=\"submit\"]')]);\n\n // Obtain and print list of search results\n const results = await page.$$eval('div.f4.text-normal a', nodes =>\n nodes.map(node => ({\n url: node.href,\n name: node.innerText,\n })),\n );\n console.log('Results:', results);\n\n // Store data in default dataset\n await Apify.pushData(results);\n\n // Close browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),p=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||o;return r?a.createElement(f,s(s({ref:t},c),{},{components:r})):a.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=["components"],l={id_old:"version-1.3-call-actor",title:"Call actor",id:"call-actor"},c=void 0,p={unversionedId:"examples/call-actor",id:"version-1.3/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using Apify.call() and how to call the Apify API using",source:"@site/versioned_docs/version-1.3/examples/call_actor.md",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/1.3/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/call_actor.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-call-actor",title:"Call actor",id:"call-actor"},sidebar:"version-1.3/docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/1.3/examples/basic-crawler"},next:{title:"Capture a screenshot",permalink:"/sdk/js/docs/1.3/examples/capture-screenshot"}},s={},d=[],m={toc:d},u="wrapper";function f(e){var t=e.components,a=(0,r.Z)(e,i);return(0,o.kt)(u,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#client",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.client")),". The script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com")," and\nsends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),". Go to the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page to obtain your API token and set it to the\n",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable, or run the script using the Apify CLI. If you deploy this actor\nto the Apify Cloud, you can do things like set up a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)")," base image on the ",(0,o.kt)("strong",{parentName:"p"},"Source")," tab\nwhen configuring the actor.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch the web browser.\n const browser = await Apify.launchPuppeteer();\n\n console.log('Obtaining own email address...');\n const apifyClient = Apify.newClient();\n const user = await apifyClient.user().get();\n\n // Load randomword.com and get a random word\n console.log('Fetching a random word.');\n const page = await browser.newPage();\n await page.goto('https://randomword.com/');\n const randomWord = await page.$eval('#shared_section', el => el.outerHTML);\n\n // Send random word to your email. For that, you can use an actor we already\n // have available on the platform under the name: apify/send-mail.\n // The second parameter to the Apify.call() invocation is the actor's\n // desired input. You can find the required input parameters by checking\n // the actor's documentation page: https://apify.com/apify/send-mail\n console.log(`Sending email to ${user.email}...`);\n await Apify.call('apify/send-mail', {\n to: user.email,\n subject: 'Random Word',\n html: `

Random Word

${randomWord}`,\n });\n console.log('Email sent. Good luck!');\n\n // Close Browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>f});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var c=n.createContext({}),p=function(e){var t=n.useContext(c),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},s=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(a),u=r,f=d["".concat(c,".").concat(u)]||d[u]||m[u]||o;return a?n.createElement(f,i(i({ref:t},s),{},{components:a})):n.createElement(f,i({ref:t},s))}));function f(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:r,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-call-actor",title:"Call actor",id:"call-actor"},c=void 0,p={unversionedId:"examples/call-actor",id:"version-1.3/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using Apify.call() and how to call the Apify API using",source:"@site/versioned_docs/version-1.3/examples/call_actor.md",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/1.3/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/call_actor.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-call-actor",title:"Call actor",id:"call-actor"},sidebar:"version-1.3/docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/1.3/examples/basic-crawler"},next:{title:"Capture a screenshot",permalink:"/sdk/js/docs/1.3/examples/capture-screenshot"}},s={},d=[],m={toc:d},u="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#client",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.client")),". The script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com")," and\nsends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),". Go to the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page to obtain your API token and set it to the\n",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable, or run the script using the Apify CLI. If you deploy this actor\nto the Apify Cloud, you can do things like set up a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)")," base image on the ",(0,o.kt)("strong",{parentName:"p"},"Source")," tab\nwhen configuring the actor.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch the web browser.\n const browser = await Apify.launchPuppeteer();\n\n console.log('Obtaining own email address...');\n const apifyClient = Apify.newClient();\n const user = await apifyClient.user().get();\n\n // Load randomword.com and get a random word\n console.log('Fetching a random word.');\n const page = await browser.newPage();\n await page.goto('https://randomword.com/');\n const randomWord = await page.$eval('#shared_section', el => el.outerHTML);\n\n // Send random word to your email. For that, you can use an actor we already\n // have available on the platform under the name: apify/send-mail.\n // The second parameter to the Apify.call() invocation is the actor's\n // desired input. You can find the required input parameters by checking\n // the actor's documentation page: https://apify.com/apify/send-mail\n console.log(`Sending email to ${user.email}...`);\n await Apify.call('apify/send-mail', {\n to: user.email,\n subject: 'Random Word',\n html: `

Random Word

${randomWord}`,\n });\n console.log('Email sent. Good luck!');\n\n // Close Browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),p=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(c.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(n),u=r,f=d["".concat(c,".").concat(u)]||d[u]||m[u]||o;return n?a.createElement(f,i(i({ref:t},s),{},{components:n})):a.createElement(f,i({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l[d]="string"==typeof e?e:r,i[1]=l;for(var p=2;p{r.r(n),r.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>d,frontMatter:()=>s,metadata:()=>l,toc:()=>y});var t=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-proxy-management",title:"Proxy Management",id:"proxy-management"},p=void 0,l={unversionedId:"guides/proxy-management",id:"version-1.3/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-1.3/guides/proxy_management.md",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/1.3/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/proxy_management.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-proxy-management",title:"Proxy Management",id:"proxy-management"},sidebar:"version-1.3/docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/1.3/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/1.3/guides/session-management"}},u={},y=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],c={toc:y},f="wrapper";function d(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class.\nYou create an instance using the ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration()")),"\nfunction. See the ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions"))," for all\nthe possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nand ",(0,a.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyConfiguration.newUrl()"))," allows you to pass\na ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair,\nand subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same\n",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression\nof a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class for more information on how keeping\na real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas\nApify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await Apify.openSessionPool({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember.\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#newurlfunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.newUrlFunction")),"\nenable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.\nVisit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}d.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>u,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},u=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},y="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),y=l(r),f=o,d=y["".concat(p,".").concat(f)]||y[f]||c[f]||a;return r?t.createElement(d,i(i({ref:n},u),{},{components:r})):t.createElement(d,i({ref:n},u))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[y]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(n),r.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>d,frontMatter:()=>s,metadata:()=>l,toc:()=>y});var t=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-proxy-management",title:"Proxy Management",id:"proxy-management"},p=void 0,l={unversionedId:"guides/proxy-management",id:"version-1.3/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-1.3/guides/proxy_management.md",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/1.3/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/proxy_management.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-proxy-management",title:"Proxy Management",id:"proxy-management"},sidebar:"version-1.3/docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/1.3/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/1.3/guides/session-management"}},u={},y=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],c={toc:y},f="wrapper";function d(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class.\nYou create an instance using the ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration()")),"\nfunction. See the ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions"))," for all\nthe possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nand ",(0,a.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyConfiguration.newUrl()"))," allows you to pass\na ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair,\nand subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same\n",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression\nof a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class for more information on how keeping\na real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas\nApify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await Apify.openSessionPool({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember.\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#newurlfunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.newUrlFunction")),"\nenable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.\nVisit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}d.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>u,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},u=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},y="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),y=l(r),f=o,d=y["".concat(p,".").concat(f)]||y[f]||c[f]||a;return r?t.createElement(d,i(i({ref:n},u),{},{components:r})):t.createElement(d,i({ref:n},u))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[y]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>y,frontMatter:()=>u,metadata:()=>c,toc:()=>p});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],u={id:"request-as-browser-result",title:"RequestAsBrowserResult"},i=void 0,c={unversionedId:"typedefs/request-as-browser-result",id:"version-2.3/typedefs/request-as-browser-result",title:"RequestAsBrowserResult",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/RequestAsBrowserResult.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-result",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-result",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserResult.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-as-browser-result",title:"RequestAsBrowserResult"}},l={},p=[],f={toc:p},d="wrapper";function y(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestasbrowserresult"}),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>y});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,i=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=c(r),d=s,y=p["".concat(i,".").concat(d)]||p[d]||f[d]||o;return r?n.createElement(y,a(a({ref:t},l),{},{components:r})):n.createElement(y,a({ref:t},l))}));function y(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=d;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[p]="string"==typeof e?e:s,a[1]=u;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>y,frontMatter:()=>u,metadata:()=>c,toc:()=>p});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],u={id:"request-as-browser-result",title:"RequestAsBrowserResult"},i=void 0,c={unversionedId:"typedefs/request-as-browser-result",id:"version-2.3/typedefs/request-as-browser-result",title:"RequestAsBrowserResult",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/RequestAsBrowserResult.md",sourceDirName:"typedefs",slug:"/typedefs/request-as-browser-result",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-result",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserResult.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-as-browser-result",title:"RequestAsBrowserResult"}},l={},p=[],f={toc:p},d="wrapper";function y(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"requestasbrowserresult"}),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>y});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,i=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=c(r),d=s,y=p["".concat(i,".").concat(d)]||p[d]||f[d]||o;return r?n.createElement(y,a(a({ref:t},l),{},{components:r})):n.createElement(y,a({ref:t},l))}));function y(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=d;var u={};for(var i in t)hasOwnProperty.call(t,i)&&(u[i]=t[i]);u.originalType=e,u[p]="string"==typeof e?e:s,a[1]=u;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>k,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var r=n(87462),a=n(63366),p=(n(67294),n(3905)),l=["components"],o={id_old:"version-1.3-puppeteer-handle-page-inputs",title:"PuppeteerHandlePageInputs",id:"puppeteer-handle-page-inputs"},i=void 0,s={unversionedId:"typedefs/puppeteer-handle-page-inputs",id:"version-1.3/typedefs/puppeteer-handle-page-inputs",title:"PuppeteerHandlePageInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageInputs.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page-inputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageInputs.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-handle-page-inputs",title:"PuppeteerHandlePageInputs",id:"puppeteer-handle-page-inputs"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"},next:{title:"DatasetConsumer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-consumer"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"response",id:"response",level:3},{value:"page",id:"page",level:3},{value:"puppeteerPool",id:"puppeteerpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:d},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,p.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepageinputs"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"request"},(0,p.kt)("inlineCode",{parentName:"h3"},"request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("p",null,"An instance of the ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"response"},(0,p.kt)("inlineCode",{parentName:"h3"},"response")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerResponse")),(0,p.kt)("p",null,"An instance of the Puppeteer ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as\nreturned by ",(0,p.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"page"},(0,p.kt)("inlineCode",{parentName:"h3"},"page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerPage")),(0,p.kt)("p",null,"is an instance of the Puppeteer ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"Page"))),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"puppeteerpool"},(0,p.kt)("inlineCode",{parentName:"h3"},"puppeteerPool")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))),(0,p.kt)("p",null,"An instance of the ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))," used by this ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"autoscaledpool"},(0,p.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,p.kt)("p",null,"A reference to the underlying ",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler#run",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler.run()"))," function. You can use it to change the concurrency\nsettings on the fly, to pause the crawler by calling ",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"session"},(0,p.kt)("inlineCode",{parentName:"h3"},"session")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Session"))),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyinfo"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,p.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,k=d["".concat(i,".").concat(m)]||d[m]||c[m]||p;return n?r.createElement(k,l(l({ref:t},u),{},{components:n})):r.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=n.length,l=new Array(p);l[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,l[1]=o;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>k,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var r=n(87462),a=n(63366),p=(n(67294),n(3905)),l=["components"],o={id_old:"version-1.3-puppeteer-handle-page-inputs",title:"PuppeteerHandlePageInputs",id:"puppeteer-handle-page-inputs"},i=void 0,s={unversionedId:"typedefs/puppeteer-handle-page-inputs",id:"version-1.3/typedefs/puppeteer-handle-page-inputs",title:"PuppeteerHandlePageInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageInputs.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page-inputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageInputs.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-handle-page-inputs",title:"PuppeteerHandlePageInputs",id:"puppeteer-handle-page-inputs"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"},next:{title:"DatasetConsumer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-consumer"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"response",id:"response",level:3},{value:"page",id:"page",level:3},{value:"puppeteerPool",id:"puppeteerpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:d},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,l);return(0,p.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepageinputs"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"request"},(0,p.kt)("inlineCode",{parentName:"h3"},"request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("p",null,"An instance of the ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"response"},(0,p.kt)("inlineCode",{parentName:"h3"},"response")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerResponse")),(0,p.kt)("p",null,"An instance of the Puppeteer ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as\nreturned by ",(0,p.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"page"},(0,p.kt)("inlineCode",{parentName:"h3"},"page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerPage")),(0,p.kt)("p",null,"is an instance of the Puppeteer ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"Page"))),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"puppeteerpool"},(0,p.kt)("inlineCode",{parentName:"h3"},"puppeteerPool")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))),(0,p.kt)("p",null,"An instance of the ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))," used by this ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"autoscaledpool"},(0,p.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,p.kt)("p",null,"A reference to the underlying ",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler#run",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler.run()"))," function. You can use it to change the concurrency\nsettings on the fly, to pause the crawler by calling ",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,p.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"session"},(0,p.kt)("inlineCode",{parentName:"h3"},"session")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Session"))),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyinfo"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,p.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,k=d["".concat(i,".").concat(m)]||d[m]||c[m]||p;return n?r.createElement(k,l(l({ref:t},u),{},{components:n})):r.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=n.length,l=new Array(p);l[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,l[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id_old:"version-1.3-key-value-store",title:"KeyValueStore",id:"key-value-store"},p=void 0,s={unversionedId:"api/key-value-store",id:"version-1.3/api/key-value-store",title:"KeyValueStore",description:"The KeyValueStore class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data",source:"@site/versioned_docs/version-1.3/api/KeyValueStore.md",sourceDirName:"api",slug:"/api/key-value-store",permalink:"/sdk/js/docs/1.3/api/key-value-store",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/KeyValueStore.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-key-value-store",title:"KeyValueStore",id:"key-value-store"},sidebar:"version-1.3/docs",previous:{title:"Dataset",permalink:"/sdk/js/docs/1.3/api/dataset"},next:{title:"AutoscaledPool",permalink:"/sdk/js/docs/1.3/api/autoscaled-pool"}},u={},d=[{value:"keyValueStore.getValue(key)",id:"keyvaluestoregetvaluekey",level:2},{value:"keyValueStore.setValue(key, value, [options])",id:"keyvaluestoresetvaluekey-value-options",level:2},{value:"keyValueStore.drop()",id:"keyvaluestoredrop",level:2},{value:"keyValueStore.getPublicUrl(key)",id:"keyvaluestoregetpublicurlkey",level:2},{value:"keyValueStore.forEachKey(iteratee, [options])",id:"keyvaluestoreforeachkeyiteratee-options",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(c,(0,n.Z)({},k,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyvaluestore"}),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data\nrecord is represented by a unique key and associated with a MIME content type. Key-value stores are ideal for saving screenshots, actor inputs and\noutputs, web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Do not instantiate this class directly, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function instead."),(0,o.kt)("p",null,"Each actor run is associated with a default key-value store, which is created exclusively for the run. By convention, the actor input and output are\nstored into the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically, input and output are JSON files, although it can\nbe any other format. To access the default key-value store directly, you can use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," convenience functions."),(0,o.kt)("p",null,"To access the input, you can also use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getinput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," convenience function."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," stores its data either on local disk or in the Apify cloud, depending on whether the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," or ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variables are set."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{INDEX}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key-value store has ID: ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"If the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable is set but\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," not, the data is stored in the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/key-value-store",target:"_blank",rel:"noopener"},"Apify Key-value store")," cloud storage. Note that you can force usage of the cloud storage also by\npassing the ",(0,o.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function, even if the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," variable is set."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store.\nconst input = await Apify.getInput();\n// Get some value from the default key-value store.\nconst otherValue = await Apify.getValue('my-key');\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write a record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read a record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Drop (delete) the store\nawait store.drop();\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getvalue"}),(0,o.kt)("h2",{id:"keyvaluestoregetvaluekey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getValue(key)")),(0,o.kt)("p",null,"Gets a value from the key-value store."),(0,o.kt)("p",null,"The function returns a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to the record value, whose JavaScript type depends on the MIME content type of the record. Records with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json")," content type are automatically parsed and returned as a JavaScript object. Similarly, records with ",(0,o.kt)("inlineCode",{parentName:"p"},"text/plain")," content types\nare returned as a string. For all other content types, the value is returned as a raw ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer"))," instance."),(0,o.kt)("p",null,"If the record does not exist, the function resolves to ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),"."),(0,o.kt)("p",null,"To save or delete a value in the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst buffer = await store.getValue('screenshot1.png');\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise"))," - Returns a promise that resolves to an object, string or\n",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setvalue"}),(0,o.kt)("h2",{id:"keyvaluestoresetvaluekey-value-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.setValue(key, value, [options])")),(0,o.kt)("p",null,"Saves or deletes a record in the key-value store. The function returns a promise that resolves once the record has been saved or deleted."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,o.kt)("p",null,"Beware that the key can be at most 256 characters long and only contain the following characters: ",(0,o.kt)("inlineCode",{parentName:"p"},"a-zA-Z0-9!-_.'()")),(0,o.kt)("p",null,"By default, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is converted to JSON and stored with the ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json; charset=utf-8")," MIME content type. To store the value with another\ncontent type, pass it in the options as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore('my-text-store');\nawait store.setValue('RESULTS', 'my text data', { contentType: 'text/plain' });\n")),(0,o.kt)("p",null,"If you set custom content type, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," must be either a string or ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", otherwise an error will be thrown."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),", the record is deleted instead. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()")," function succeeds regardless whether the record existed or not."),(0,o.kt)("p",null,"To retrieve a value from the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"IMPORTANT:")," Always make sure to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()"),", otherwise the actor process might finish before the value is\nstored!"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStoreValueTypes"))," - Record data, which can be one of the following values:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,o.kt)("li",{parentName:"ul"},"If no ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,o.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,o.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"drop"}),(0,o.kt)("h2",{id:"keyvaluestoredrop"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.drop()")),(0,o.kt)("p",null,"Removes the key-value store either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getpublicurl"}),(0,o.kt)("h2",{id:"keyvaluestoregetpublicurlkey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getPublicUrl(key)")),(0,o.kt)("p",null,"Returns a URL for the given key that may be used to publicly access the value in the remote key-value store."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"foreachkey"}),(0,o.kt)("h2",{id:"keyvaluestoreforeachkeyiteratee-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.forEachKey(iteratee, [options])")),(0,o.kt)("p",null,"Iterates over key-value store keys, yielding each in turn to an ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with three arguments:\n",(0,o.kt)("inlineCode",{parentName:"p"},"(key, index, info)"),", where ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," is the record key, ",(0,o.kt)("inlineCode",{parentName:"p"},"index")," is a zero-based index of the key in the current iteration (regardless of\n",(0,o.kt)("inlineCode",{parentName:"p"},"options.exclusiveStartKey"),") and ",(0,o.kt)("inlineCode",{parentName:"p"},"info")," is an object that contains a single property ",(0,o.kt)("inlineCode",{parentName:"p"},"size")," indicating size of the record in bytes."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,o.kt)("inlineCode",{parentName:"p"},"forEachKey")," function throws the error."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyValueStore = await Apify.openKeyValueStore();\nawait keyValueStore.forEachKey(async (key, index, info) => {\n console.log(`Key at ${index}: ${key} has size ${info.size}`);\n});\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-consumer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyConsumer"))," - A function that is called for every key in the key-value store."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"forEachKey()")," parameters are passed via an options object with the following keys:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[exclusiveStartKey]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - All keys up to this one (including) are skipped from the result.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(a),c=r,m=d["".concat(p,".").concat(c)]||d[c]||k[c]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[d]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id_old:"version-1.3-key-value-store",title:"KeyValueStore",id:"key-value-store"},p=void 0,s={unversionedId:"api/key-value-store",id:"version-1.3/api/key-value-store",title:"KeyValueStore",description:"The KeyValueStore class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data",source:"@site/versioned_docs/version-1.3/api/KeyValueStore.md",sourceDirName:"api",slug:"/api/key-value-store",permalink:"/sdk/js/docs/1.3/api/key-value-store",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/KeyValueStore.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-key-value-store",title:"KeyValueStore",id:"key-value-store"},sidebar:"version-1.3/docs",previous:{title:"Dataset",permalink:"/sdk/js/docs/1.3/api/dataset"},next:{title:"AutoscaledPool",permalink:"/sdk/js/docs/1.3/api/autoscaled-pool"}},u={},d=[{value:"keyValueStore.getValue(key)",id:"keyvaluestoregetvaluekey",level:2},{value:"keyValueStore.setValue(key, value, [options])",id:"keyvaluestoresetvaluekey-value-options",level:2},{value:"keyValueStore.drop()",id:"keyvaluestoredrop",level:2},{value:"keyValueStore.getPublicUrl(key)",id:"keyvaluestoregetpublicurlkey",level:2},{value:"keyValueStore.forEachKey(iteratee, [options])",id:"keyvaluestoreforeachkeyiteratee-options",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(c,(0,n.Z)({},k,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyvaluestore"}),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data\nrecord is represented by a unique key and associated with a MIME content type. Key-value stores are ideal for saving screenshots, actor inputs and\noutputs, web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Do not instantiate this class directly, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function instead."),(0,o.kt)("p",null,"Each actor run is associated with a default key-value store, which is created exclusively for the run. By convention, the actor input and output are\nstored into the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically, input and output are JSON files, although it can\nbe any other format. To access the default key-value store directly, you can use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," convenience functions."),(0,o.kt)("p",null,"To access the input, you can also use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getinput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," convenience function."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," stores its data either on local disk or in the Apify cloud, depending on whether the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," or ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variables are set."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{INDEX}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key-value store has ID: ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"If the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable is set but\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," not, the data is stored in the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/key-value-store",target:"_blank",rel:"noopener"},"Apify Key-value store")," cloud storage. Note that you can force usage of the cloud storage also by\npassing the ",(0,o.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function, even if the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," variable is set."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store.\nconst input = await Apify.getInput();\n// Get some value from the default key-value store.\nconst otherValue = await Apify.getValue('my-key');\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write a record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read a record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Drop (delete) the store\nawait store.drop();\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getvalue"}),(0,o.kt)("h2",{id:"keyvaluestoregetvaluekey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getValue(key)")),(0,o.kt)("p",null,"Gets a value from the key-value store."),(0,o.kt)("p",null,"The function returns a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to the record value, whose JavaScript type depends on the MIME content type of the record. Records with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json")," content type are automatically parsed and returned as a JavaScript object. Similarly, records with ",(0,o.kt)("inlineCode",{parentName:"p"},"text/plain")," content types\nare returned as a string. For all other content types, the value is returned as a raw ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer"))," instance."),(0,o.kt)("p",null,"If the record does not exist, the function resolves to ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),"."),(0,o.kt)("p",null,"To save or delete a value in the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst buffer = await store.getValue('screenshot1.png');\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise"))," - Returns a promise that resolves to an object, string or\n",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setvalue"}),(0,o.kt)("h2",{id:"keyvaluestoresetvaluekey-value-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.setValue(key, value, [options])")),(0,o.kt)("p",null,"Saves or deletes a record in the key-value store. The function returns a promise that resolves once the record has been saved or deleted."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,o.kt)("p",null,"Beware that the key can be at most 256 characters long and only contain the following characters: ",(0,o.kt)("inlineCode",{parentName:"p"},"a-zA-Z0-9!-_.'()")),(0,o.kt)("p",null,"By default, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is converted to JSON and stored with the ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json; charset=utf-8")," MIME content type. To store the value with another\ncontent type, pass it in the options as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore('my-text-store');\nawait store.setValue('RESULTS', 'my text data', { contentType: 'text/plain' });\n")),(0,o.kt)("p",null,"If you set custom content type, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," must be either a string or ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", otherwise an error will be thrown."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),", the record is deleted instead. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()")," function succeeds regardless whether the record existed or not."),(0,o.kt)("p",null,"To retrieve a value from the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"IMPORTANT:")," Always make sure to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()"),", otherwise the actor process might finish before the value is\nstored!"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStoreValueTypes"))," - Record data, which can be one of the following values:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,o.kt)("li",{parentName:"ul"},"If no ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,o.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,o.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"drop"}),(0,o.kt)("h2",{id:"keyvaluestoredrop"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.drop()")),(0,o.kt)("p",null,"Removes the key-value store either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getpublicurl"}),(0,o.kt)("h2",{id:"keyvaluestoregetpublicurlkey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getPublicUrl(key)")),(0,o.kt)("p",null,"Returns a URL for the given key that may be used to publicly access the value in the remote key-value store."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"foreachkey"}),(0,o.kt)("h2",{id:"keyvaluestoreforeachkeyiteratee-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.forEachKey(iteratee, [options])")),(0,o.kt)("p",null,"Iterates over key-value store keys, yielding each in turn to an ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with three arguments:\n",(0,o.kt)("inlineCode",{parentName:"p"},"(key, index, info)"),", where ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," is the record key, ",(0,o.kt)("inlineCode",{parentName:"p"},"index")," is a zero-based index of the key in the current iteration (regardless of\n",(0,o.kt)("inlineCode",{parentName:"p"},"options.exclusiveStartKey"),") and ",(0,o.kt)("inlineCode",{parentName:"p"},"info")," is an object that contains a single property ",(0,o.kt)("inlineCode",{parentName:"p"},"size")," indicating size of the record in bytes."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,o.kt)("inlineCode",{parentName:"p"},"forEachKey")," function throws the error."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyValueStore = await Apify.openKeyValueStore();\nawait keyValueStore.forEachKey(async (key, index, info) => {\n console.log(`Key at ${index}: ${key} has size ${info.size}`);\n});\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-consumer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyConsumer"))," - A function that is called for every key in the key-value store."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"forEachKey()")," parameters are passed via an options object with the following keys:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[exclusiveStartKey]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - All keys up to this one (including) are skipped from the result.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(a),c=r,m=d["".concat(p,".").concat(c)]||d[c]||k[c]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[d]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.d(t,{Z:()=>l});var a=n(67294),o=n(88746),r=n(6141),i=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(o.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(o.default,{to:"/api/"+d+t},n)}},5035:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a,o=n(87462),r=n(63366),i=(n(67294),n(3905)),l=n(68889),s=["components"],p={id:"environment-variables",title:"Environment Variables"},d=void 0,u={unversionedId:"guides/environment-variables",id:"version-3.0/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-3.0/guides/environment_variables.mdx",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/3.0/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/environment_variables.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/3.0/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/3.0/guides/proxy-management"}},c={},m=[{value:"Important env vars",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],y=(a="CrawleeApiLink",function(e){return console.warn("Component "+a+" was not imported, exported, or provided by MDXProvider as global scope"),(0,i.kt)("div",e)}),f={toc:m},h="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(h,(0,o.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,i.kt)("h2",{id:"important-env-vars"},"Important env vars"),(0,i.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,i.kt)("h3",{id:"apify_local_storage_dir"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("p",null,"Defines the path to a local directory where ",(0,i.kt)(l.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")),", ",(0,i.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")),", and ",(0,i.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," store their data. Typically, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage"),". If omitted, you should define the ",(0,i.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable instead."),(0,i.kt)("h3",{id:"apify_token"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,i.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,i.kt)("th",{parentName:"tr",align:null},"API"),(0,i.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"none OR ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"no"),(0,i.kt)("td",{parentName:"tr",align:null},"local")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,i.kt)("p",null,"When using both ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Actor.openDataset('my-local-data');\nconst remoteDataset = await Actor.openDataset('my-remote-data', { forceCloud: true });\n")),(0,i.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars"),(0,i.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,i.kt)("h3",{id:"apify_headless"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,i.kt)("p",null,"If set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the"),(0,i.kt)(l.Z,{to:"apify/class/Actor#launchPuppeteer",mdxType:"ApiLink"},"`Actor.launchPuppeteer()`")," function. But having this setting in an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging, and only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers are launched in headful mode, i.e. with windows.",(0,i.kt)("h3",{id:"apify_log_level"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,i.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,i.kt)(y,{to:"core/class/Log",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")),"\nnamespace for logging utilities."),(0,i.kt)("h3",{id:"apify_memory_mbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,i.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,i.kt)(y,{to:"core/class/AutoscaledPool",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i.e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,i.kt)("h3",{id:"apify_proxy_password"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,i.kt)("p",null,"Optional password to ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>y});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,y=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.d(t,{Z:()=>l});var a=n(67294),o=n(88746),r=n(6141),i=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(o.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(o.default,{to:"/api/"+d+t},n)}},5035:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a,o=n(87462),r=n(63366),i=(n(67294),n(3905)),l=n(68889),s=["components"],p={id:"environment-variables",title:"Environment Variables"},d=void 0,u={unversionedId:"guides/environment-variables",id:"version-3.0/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-3.0/guides/environment_variables.mdx",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/3.0/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/environment_variables.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/3.0/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/3.0/guides/proxy-management"}},c={},m=[{value:"Important env vars",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],y=(a="CrawleeApiLink",function(e){return console.warn("Component "+a+" was not imported, exported, or provided by MDXProvider as global scope"),(0,i.kt)("div",e)}),f={toc:m},h="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(h,(0,o.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,i.kt)("h2",{id:"important-env-vars"},"Important env vars"),(0,i.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,i.kt)("h3",{id:"apify_local_storage_dir"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("p",null,"Defines the path to a local directory where ",(0,i.kt)(l.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")),", ",(0,i.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")),", and ",(0,i.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," store their data. Typically, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage"),". If omitted, you should define the ",(0,i.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable instead."),(0,i.kt)("h3",{id:"apify_token"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,i.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,i.kt)("th",{parentName:"tr",align:null},"API"),(0,i.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"none OR ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"no"),(0,i.kt)("td",{parentName:"tr",align:null},"local")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,i.kt)("p",null,"When using both ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Actor.openDataset('my-local-data');\nconst remoteDataset = await Actor.openDataset('my-remote-data', { forceCloud: true });\n")),(0,i.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars"),(0,i.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,i.kt)("h3",{id:"apify_headless"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,i.kt)("p",null,"If set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the"),(0,i.kt)(l.Z,{to:"apify/class/Actor#launchPuppeteer",mdxType:"ApiLink"},"`Actor.launchPuppeteer()`")," function. But having this setting in an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging, and only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers are launched in headful mode, i.e. with windows.",(0,i.kt)("h3",{id:"apify_log_level"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,i.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,i.kt)(y,{to:"core/class/Log",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")),"\nnamespace for logging utilities."),(0,i.kt)("h3",{id:"apify_memory_mbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,i.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,i.kt)(y,{to:"core/class/AutoscaledPool",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i.e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,i.kt)("h3",{id:"apify_proxy_password"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,i.kt)("p",null,"Optional password to ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>y});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,y=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),l=["components"],i={id:"webhook-run",title:"WebhookRun"},p=void 0,d={unversionedId:"typedefs/webhook-run",id:"version-2.3/typedefs/webhook-run",title:"WebhookRun",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/WebhookRun.md",sourceDirName:"typedefs",slug:"/typedefs/webhook-run",permalink:"/sdk/js/docs/2.3/typedefs/webhook-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/WebhookRun.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"webhook-run",title:"WebhookRun"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"userId",id:"userid",level:3},{value:"isAdHoc",id:"isadhoc",level:3},{value:"eventTypes",id:"eventtypes",level:3},{value:"condition",id:"condition",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"doNotRetry",id:"donotretry",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3},{value:"lastDispatch",id:"lastdispatch",level:3},{value:"stats",id:"stats",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,l);return(0,a.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"webhookrun"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"isadhoc"},(0,a.kt)("inlineCode",{parentName:"h3"},"isAdHoc")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"condition"},(0,a.kt)("inlineCode",{parentName:"h3"},"condition")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"donotretry"},(0,a.kt)("inlineCode",{parentName:"h3"},"doNotRetry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lastdispatch"},(0,a.kt)("inlineCode",{parentName:"h3"},"lastDispatch")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stats"},(0,a.kt)("inlineCode",{parentName:"h3"},"stats")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),k=o,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||a;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,l=new Array(a);l[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),l=["components"],i={id:"webhook-run",title:"WebhookRun"},p=void 0,d={unversionedId:"typedefs/webhook-run",id:"version-2.3/typedefs/webhook-run",title:"WebhookRun",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/WebhookRun.md",sourceDirName:"typedefs",slug:"/typedefs/webhook-run",permalink:"/sdk/js/docs/2.3/typedefs/webhook-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/WebhookRun.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"webhook-run",title:"WebhookRun"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"userId",id:"userid",level:3},{value:"isAdHoc",id:"isadhoc",level:3},{value:"eventTypes",id:"eventtypes",level:3},{value:"condition",id:"condition",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"doNotRetry",id:"donotretry",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3},{value:"lastDispatch",id:"lastdispatch",level:3},{value:"stats",id:"stats",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,l);return(0,a.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"webhookrun"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"isadhoc"},(0,a.kt)("inlineCode",{parentName:"h3"},"isAdHoc")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"condition"},(0,a.kt)("inlineCode",{parentName:"h3"},"condition")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"donotretry"},(0,a.kt)("inlineCode",{parentName:"h3"},"doNotRetry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lastdispatch"},(0,a.kt)("inlineCode",{parentName:"h3"},"lastDispatch")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stats"},(0,a.kt)("inlineCode",{parentName:"h3"},"stats")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),k=o,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||a;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,l=new Array(a);l[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,l[1]=i;for(var d=2;d{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>u,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],i={id_old:"version-1.3-data-storage",title:"Data Storage",id:"data-storage"},l=void 0,u={unversionedId:"guides/data-storage",id:"version-1.3/guides/data-storage",title:"Data Storage",description:"The Apify SDK has several data storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-1.3/guides/data_storage.md",sourceDirName:"guides",slug:"/guides/data-storage",permalink:"/sdk/js/docs/1.3/guides/data-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/data_storage.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-data-storage",title:"Data Storage",id:"data-storage"}},p={},d=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2},{value:"Request queue",id:"request-queue",level:2}],c={toc:d},h="wrapper";function f(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(h,(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several data storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Apify.getInput();\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/examples/screenshots",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify app. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then\nrecursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to\ncrawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/{STATE}/{NUMBER}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable. Each request in the queue is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{STATE}")," is either\n",(0,o.kt)("inlineCode",{parentName:"p"},"handled")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"pending"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"{NUMBER}")," is an integer indicating the position of the request in the queue."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst queue = await Apify.openRequestQueue();\n\n// Open a named request queue\nconst queueWithName = await Apify.openRequestQueue('some-name');\n\n// Enqueue few requests\nawait queue.addRequest({ url: 'http://example.com/aaa' });\nawait queue.addRequest({ url: 'http://example.com/bbb' });\nawait queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });\n\n// Get requests from queue\nconst request1 = await queue.fetchNextRequest();\nconst request2 = await queue.fetchNextRequest();\nconst request3 = await queue.fetchNextRequest();\n\n// Mark a request as handled\nawait queue.markRequestHandled(request1);\n\n// If processing fails then reclaim the request back to the queue, so that it's crawled again\nawait queue.reclaimRequest(request2);\n")),(0,o.kt)("p",null,"To see how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."))}f.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>f});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),u=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(a),h=r,f=d["".concat(l,".").concat(h)]||d[h]||c[h]||o;return a?n.createElement(f,s(s({ref:t},p),{},{components:a})):n.createElement(f,s({ref:t},p))}));function f(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:r,s[1]=i;for(var u=2;u{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>u,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],i={id_old:"version-1.3-data-storage",title:"Data Storage",id:"data-storage"},l=void 0,u={unversionedId:"guides/data-storage",id:"version-1.3/guides/data-storage",title:"Data Storage",description:"The Apify SDK has several data storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-1.3/guides/data_storage.md",sourceDirName:"guides",slug:"/guides/data-storage",permalink:"/sdk/js/docs/1.3/guides/data-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/data_storage.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-data-storage",title:"Data Storage",id:"data-storage"}},p={},d=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2},{value:"Request queue",id:"request-queue",level:2}],c={toc:d},h="wrapper";function f(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(h,(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several data storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Apify.getInput();\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/examples/screenshots",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify app. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then\nrecursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to\ncrawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/{STATE}/{NUMBER}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable. Each request in the queue is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{STATE}")," is either\n",(0,o.kt)("inlineCode",{parentName:"p"},"handled")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"pending"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"{NUMBER}")," is an integer indicating the position of the request in the queue."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst queue = await Apify.openRequestQueue();\n\n// Open a named request queue\nconst queueWithName = await Apify.openRequestQueue('some-name');\n\n// Enqueue few requests\nawait queue.addRequest({ url: 'http://example.com/aaa' });\nawait queue.addRequest({ url: 'http://example.com/bbb' });\nawait queue.addRequest({ url: 'http://example.com/foo/bar' }, { forefront: true });\n\n// Get requests from queue\nconst request1 = await queue.fetchNextRequest();\nconst request2 = await queue.fetchNextRequest();\nconst request3 = await queue.fetchNextRequest();\n\n// Mark a request as handled\nawait queue.markRequestHandled(request1);\n\n// If processing fails then reclaim the request back to the queue, so that it's crawled again\nawait queue.reclaimRequest(request2);\n")),(0,o.kt)("p",null,"To see how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."))}f.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>f});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),u=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(a),h=r,f=d["".concat(l,".").concat(h)]||d[h]||c[h]||o;return a?n.createElement(f,s(s({ref:t},p),{},{components:a})):n.createElement(f,s({ref:t},p))}));function f(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:r,s[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>y,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var r=n(87462),s=n(63366),a=(n(67294),n(3905)),i=["components"],o={id_old:"version-1.3-request-list-state",title:"RequestListState",id:"request-list-state"},l=void 0,p={unversionedId:"typedefs/request-list-state",id:"version-1.3/typedefs/request-list-state",title:"RequestListState",description:"Represents state of a RequestList. It can be used to resume a RequestList which has been previously",source:"@site/versioned_docs/version-1.3/typedefs/RequestListState.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-state",permalink:"/sdk/js/docs/1.3/typedefs/request-list-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListState.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-list-state",title:"RequestListState",id:"request-list-state"},sidebar:"version-1.3/docs",previous:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/1.3/typedefs/queue-operation-info"},next:{title:"SessionState",permalink:"/sdk/js/docs/1.3/typedefs/session-state"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"nextIndex",id:"nextindex",level:3},{value:"nextUniqueKey",id:"nextuniquekey",level:3},{value:"inProgress",id:"inprogress",level:3}],c={toc:d},f="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestliststate"}),(0,a.kt)("p",null,"Represents state of a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be used to resume a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))," which has been previously\nprocessed. You can obtain the state by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list#getstate",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList.getState()"))," and receive an object with the following\nstructure:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true\n },\n}\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"nextindex"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextIndex")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nextuniquekey"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextUniqueKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Key of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"inprogress"},(0,a.kt)("inlineCode",{parentName:"h3"},"inProgress")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"An object mapping request keys to a boolean value respresenting whether they are being processed at the moment."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var r=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,s=e.mdxType,a=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),f=s,y=d["".concat(l,".").concat(f)]||d[f]||c[f]||a;return n?r.createElement(y,i(i({ref:t},u),{},{components:n})):r.createElement(y,i({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=n.length,i=new Array(a);i[0]=f;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:s,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>y,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var r=n(87462),s=n(63366),a=(n(67294),n(3905)),i=["components"],o={id_old:"version-1.3-request-list-state",title:"RequestListState",id:"request-list-state"},l=void 0,p={unversionedId:"typedefs/request-list-state",id:"version-1.3/typedefs/request-list-state",title:"RequestListState",description:"Represents state of a RequestList. It can be used to resume a RequestList which has been previously",source:"@site/versioned_docs/version-1.3/typedefs/RequestListState.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-state",permalink:"/sdk/js/docs/1.3/typedefs/request-list-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListState.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-list-state",title:"RequestListState",id:"request-list-state"},sidebar:"version-1.3/docs",previous:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/1.3/typedefs/queue-operation-info"},next:{title:"SessionState",permalink:"/sdk/js/docs/1.3/typedefs/session-state"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"nextIndex",id:"nextindex",level:3},{value:"nextUniqueKey",id:"nextuniquekey",level:3},{value:"inProgress",id:"inprogress",level:3}],c={toc:d},f="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestliststate"}),(0,a.kt)("p",null,"Represents state of a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be used to resume a ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))," which has been previously\nprocessed. You can obtain the state by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list#getstate",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList.getState()"))," and receive an object with the following\nstructure:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true\n },\n}\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"nextindex"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextIndex")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nextuniquekey"},(0,a.kt)("inlineCode",{parentName:"h3"},"nextUniqueKey")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Key of the next request to be processed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"inprogress"},(0,a.kt)("inlineCode",{parentName:"h3"},"inProgress")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"An object mapping request keys to a boolean value respresenting whether they are being processed at the moment."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var r=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,s=e.mdxType,a=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),f=s,y=d["".concat(l,".").concat(f)]||d[f]||c[f]||a;return n?r.createElement(y,i(i({ref:t},u),{},{components:n})):r.createElement(y,i({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=n.length,i=new Array(a);i[0]=f;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:s,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),i=["components"],o={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},p=void 0,s={unversionedId:"examples/crawl-multiple-urls",id:"version-2.3/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-2.3/examples/crawl_multiple_urls.md",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/2.3/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_multiple_urls.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"version-2.3/docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/2.3/examples/crawl-relative-links"}},c={},u=[],m={toc:u},w="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,i);return(0,l.kt)(w,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},w=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(n),w=a,f=u["".concat(p,".").concat(w)]||u[w]||m[w]||l;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=w;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),i=["components"],o={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},p=void 0,s={unversionedId:"examples/crawl-multiple-urls",id:"version-2.3/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-2.3/examples/crawl_multiple_urls.md",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/2.3/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_multiple_urls.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"version-2.3/docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/2.3/examples/crawl-relative-links"}},c={},u=[],m={toc:u},w="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,i);return(0,l.kt)(w,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},w=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(n),w=a,f=u["".concat(p,".").concat(w)]||u[w]||m[w]||l;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=w;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),o=["components"],i={id:"request-storage",title:"Request Storage"},u=void 0,l={unversionedId:"guides/request-storage",id:"version-2.3/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-2.3/guides/request_storage.md",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/2.3/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/request_storage.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"version-2.3/docs",previous:{title:"Getting Started",permalink:"/sdk/js/docs/2.3/guides/getting-started"},next:{title:"Result Storage",permalink:"/sdk/js/docs/2.3/guides/result-storage"}},p={},d=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],c={toc:d},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,s.kt)(h,(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,s.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,s.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Related links")),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,s.kt)("h2",{id:"request-queue"},"Request queue"),(0,s.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,s.kt)("p",null,"Each actor run is associated with a ",(0,s.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,s.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,s.kt)("p",null,"Note that ",(0,s.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,s.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await Apify.openRequestQueue();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,s.kt)("h2",{id:"request-list"},"Request list"),(0,s.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,s.kt)("a",{parentName:"p",href:"../guides/results-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,s.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-list",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,s.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,s.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,s.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,s.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,s.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await Apify.openRequestQueue();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var u=a.createContext({}),l=function(e){var t=a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=n,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||s;return r?a.createElement(m,o(o({ref:t},p),{},{components:r})):a.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,o=new Array(s);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:n,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>u,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),o=["components"],i={id:"request-storage",title:"Request Storage"},u=void 0,l={unversionedId:"guides/request-storage",id:"version-2.3/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-2.3/guides/request_storage.md",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/2.3/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/request_storage.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"version-2.3/docs",previous:{title:"Getting Started",permalink:"/sdk/js/docs/2.3/guides/getting-started"},next:{title:"Result Storage",permalink:"/sdk/js/docs/2.3/guides/result-storage"}},p={},d=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],c={toc:d},h="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,o);return(0,s.kt)(h,(0,a.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,s.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory and prints a warning."),(0,s.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Related links")),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify app")),(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,s.kt)("h2",{id:"request-queue"},"Request queue"),(0,s.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,s.kt)("p",null,"Each actor run is associated with a ",(0,s.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,s.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,s.kt)("p",null,"Note that ",(0,s.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,s.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,s.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await Apify.openRequestQueue();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,s.kt)("h2",{id:"request-list"},"Request list"),(0,s.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,s.kt)("a",{parentName:"p",href:"../guides/results-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,s.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,s.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-list",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,s.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,s.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,s.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,s.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,s.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,s.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,s.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,s.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await Apify.openRequestList('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await Apify.openRequestQueue();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new Apify.PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Apify.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var u=a.createContext({}),l=function(e){var t=a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=n,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||s;return r?a.createElement(m,o(o({ref:t},p),{},{components:r})):a.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,o=new Array(s);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:n,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),i=["components"],o={id:"request",title:"Request"},s=void 0,p={unversionedId:"api/request",id:"version-2.3/api/request",title:"Request",description:"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The Request object also stores information",source:"@site/versioned_docs/version-2.3/api/Request.md",sourceDirName:"api",slug:"/api/request",permalink:"/sdk/js/docs/2.3/api/request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Request.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request",title:"Request"},sidebar:"version-2.3/docs",previous:{title:"SystemStatus",permalink:"/sdk/js/docs/2.3/api/system-status"},next:{title:"RequestList",permalink:"/sdk/js/docs/2.3/api/request-list"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"url",id:"url",level:3},{value:"loadedUrl",id:"loadedurl",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"noRetry",id:"noretry",level:3},{value:"retryCount",id:"retrycount",level:3},{value:"errorMessages",id:"errormessages",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"handledAt",id:"handledat",level:3},{value:"new Request(options)",id:"new-requestoptions",level:2},{value:"request.headers",id:"requestheaders",level:2},{value:"request.userData",id:"requestuserdata",level:2},{value:"request.pushErrorMessage(errorOrMessage, [options])",id:"requestpusherrormessageerrorormessage-options",level:2}],m={toc:d},c="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,i);return(0,l.kt)(c,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"request"}),(0,l.kt)("p",null,"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," object also stores information\nabout errors that occurred during processing of the request."),(0,l.kt)("p",null,"Each ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," instance has the ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property, which can be either specified manually in the constructor or generated automatically from the\nURL. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same web resource. This behavior applies to all Apify SDK classes, such\nas ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"Example use:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = new Apify.Request({\n url: 'http://www.example.com',\n headers: { Accept: 'application/json' },\n});\n\n...\n\nrequest.userData.foo = 'bar';\nrequest.pushErrorMessage(new Error('Request failed!'));\n\n...\n\nconst foo = request.userData.foo;\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Request ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"url"},(0,l.kt)("inlineCode",{parentName:"h3"},"url")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL of the web page to crawl."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"loadedurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"loadedUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"An actually loaded URL after redirects, if present. HTTP redirects are guaranteed to be included."),(0,l.kt)("p",null,"When using ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),", meta tag and JavaScript redirects may,\nor may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but\ndelayed redirects will not."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"uniquekey"},(0,l.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"method"},(0,l.kt)("inlineCode",{parentName:"h3"},"method")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"HTTP method, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"GET")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"POST"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"payload"},(0,l.kt)("inlineCode",{parentName:"h3"},"payload")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,l.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"noretry"},(0,l.kt)("inlineCode",{parentName:"h3"},"noRetry")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," value indicates that the request will not be automatically retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"retrycount"},(0,l.kt)("inlineCode",{parentName:"h3"},"retryCount")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Indicates the number of times the crawling of the request has been retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"errormessages"},(0,l.kt)("inlineCode",{parentName:"h3"},"errorMessages")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Array")),(0,l.kt)("p",null,"An array of error messages from request processing."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"headers"},(0,l.kt)("inlineCode",{parentName:"h3"},"headers")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Object with HTTP headers. Key is header name, value is the value."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"userdata"},(0,l.kt)("inlineCode",{parentName:"h3"},"userData")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Custom user data assigned to the request."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"handledat"},(0,l.kt)("inlineCode",{parentName:"h3"},"handledAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Indicates the time when the request has been processed. Is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if the request has not been crawled yet."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"request"}),(0,l.kt)("h2",{id:"new-requestoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Request(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,l.kt)("inlineCode",{parentName:"li"},"Request")," parameters including the URL, HTTP method and headers, and others.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"headers"}),(0,l.kt)("h2",{id:"requestheaders"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.headers")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"userdata"}),(0,l.kt)("h2",{id:"requestuserdata"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.userData")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pusherrormessage"}),(0,l.kt)("h2",{id:"requestpusherrormessageerrorormessage-options"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.pushErrorMessage(errorOrMessage, [options])")),(0,l.kt)("p",null,"Stores information about an error that occurred during processing of this request."),(0,l.kt)("p",null,"You should always use Error instances when throwing errors in JavaScript."),(0,l.kt)("p",null,"Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs\na type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any\ndebugging rather difficult."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"errorOrMessage")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Error")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - Error object or error message to be stored in the request."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[omitStack]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,l.kt)("code",null," = false")," - Only push the error message without stack trace when true.")))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(r),c=a,k=d["".concat(s,".").concat(c)]||d[c]||m[c]||l;return r?n.createElement(k,i(i({ref:t},u),{},{components:r})):n.createElement(k,i({ref:t},u))}));function k(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,i=new Array(l);i[0]=c;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[d]="string"==typeof e?e:a,i[1]=o;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],i={id:"request",title:"Request"},s=void 0,p={unversionedId:"api/request",id:"version-2.3/api/request",title:"Request",description:"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The Request object also stores information",source:"@site/versioned_docs/version-2.3/api/Request.md",sourceDirName:"api",slug:"/api/request",permalink:"/sdk/js/docs/2.3/api/request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Request.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request",title:"Request"},sidebar:"version-2.3/docs",previous:{title:"SystemStatus",permalink:"/sdk/js/docs/2.3/api/system-status"},next:{title:"RequestList",permalink:"/sdk/js/docs/2.3/api/request-list"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"url",id:"url",level:3},{value:"loadedUrl",id:"loadedurl",level:3},{value:"uniqueKey",id:"uniquekey",level:3},{value:"method",id:"method",level:3},{value:"payload",id:"payload",level:3},{value:"noRetry",id:"noretry",level:3},{value:"retryCount",id:"retrycount",level:3},{value:"errorMessages",id:"errormessages",level:3},{value:"headers",id:"headers",level:3},{value:"userData",id:"userdata",level:3},{value:"handledAt",id:"handledat",level:3},{value:"new Request(options)",id:"new-requestoptions",level:2},{value:"request.headers",id:"requestheaders",level:2},{value:"request.userData",id:"requestuserdata",level:2},{value:"request.pushErrorMessage(errorOrMessage, [options])",id:"requestpusherrormessageerrorormessage-options",level:2}],m={toc:d},c="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(c,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"request"}),(0,l.kt)("p",null,"Represents a URL to be crawled, optionally including HTTP method, headers, payload and other metadata. The ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," object also stores information\nabout errors that occurred during processing of the request."),(0,l.kt)("p",null,"Each ",(0,l.kt)("inlineCode",{parentName:"p"},"Request")," instance has the ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property, which can be either specified manually in the constructor or generated automatically from the\nURL. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same web resource. This behavior applies to all Apify SDK classes, such\nas ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"Example use:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = new Apify.Request({\n url: 'http://www.example.com',\n headers: { Accept: 'application/json' },\n});\n\n...\n\nrequest.userData.foo = 'bar';\nrequest.pushErrorMessage(new Error('Request failed!'));\n\n...\n\nconst foo = request.userData.foo;\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Request ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"url"},(0,l.kt)("inlineCode",{parentName:"h3"},"url")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL of the web page to crawl."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"loadedurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"loadedUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"An actually loaded URL after redirects, if present. HTTP redirects are guaranteed to be included."),(0,l.kt)("p",null,"When using ",(0,l.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),", meta tag and JavaScript redirects may,\nor may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but\ndelayed redirects will not."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"uniquekey"},(0,l.kt)("inlineCode",{parentName:"h3"},"uniqueKey")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"A unique key identifying the request. Two requests with the same ",(0,l.kt)("inlineCode",{parentName:"p"},"uniqueKey")," are considered as pointing to the same URL."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"method"},(0,l.kt)("inlineCode",{parentName:"h3"},"method")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"HTTP method, e.g. ",(0,l.kt)("inlineCode",{parentName:"p"},"GET")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"POST"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"payload"},(0,l.kt)("inlineCode",{parentName:"h3"},"payload")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"Buffer")),(0,l.kt)("p",null,"HTTP request payload, e.g. for POST requests."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"noretry"},(0,l.kt)("inlineCode",{parentName:"h3"},"noRetry")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," value indicates that the request will not be automatically retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"retrycount"},(0,l.kt)("inlineCode",{parentName:"h3"},"retryCount")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Indicates the number of times the crawling of the request has been retried on error."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"errormessages"},(0,l.kt)("inlineCode",{parentName:"h3"},"errorMessages")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Array")),(0,l.kt)("p",null,"An array of error messages from request processing."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"headers"},(0,l.kt)("inlineCode",{parentName:"h3"},"headers")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Object with HTTP headers. Key is header name, value is the value."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"userdata"},(0,l.kt)("inlineCode",{parentName:"h3"},"userData")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Custom user data assigned to the request."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"handledat"},(0,l.kt)("inlineCode",{parentName:"h3"},"handledAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Indicates the time when the request has been processed. Is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if the request has not been crawled yet."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"request"}),(0,l.kt)("h2",{id:"new-requestoptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Request(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - ",(0,l.kt)("inlineCode",{parentName:"li"},"Request")," parameters including the URL, HTTP method and headers, and others.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"headers"}),(0,l.kt)("h2",{id:"requestheaders"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.headers")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"userdata"}),(0,l.kt)("h2",{id:"requestuserdata"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.userData")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pusherrormessage"}),(0,l.kt)("h2",{id:"requestpusherrormessageerrorormessage-options"},(0,l.kt)("inlineCode",{parentName:"h2"},"request.pushErrorMessage(errorOrMessage, [options])")),(0,l.kt)("p",null,"Stores information about an error that occurred during processing of this request."),(0,l.kt)("p",null,"You should always use Error instances when throwing errors in JavaScript."),(0,l.kt)("p",null,"Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs\na type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any\ndebugging rather difficult."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"errorOrMessage")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"Error")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - Error object or error message to be stored in the request."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"object"),(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[omitStack]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,l.kt)("code",null," = false")," - Only push the error message without stack trace when true.")))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(r),c=a,k=d["".concat(s,".").concat(c)]||d[c]||m[c]||l;return r?n.createElement(k,o(o({ref:t},u),{},{components:r})):n.createElement(k,o({ref:t},u))}));function k(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=c;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id_old:"version-1.3-quick-start",title:"Quick Start",id:"quick-start"},p=void 0,s={unversionedId:"guides/quick-start",id:"version-1.3/guides/quick-start",title:"Quick Start",description:"This short tutorial will set you up to start using Apify SDK in a minute or two.",source:"@site/versioned_docs/version-1.3/guides/quick_start.md",sourceDirName:"guides",slug:"/guides/quick-start",permalink:"/sdk/js/docs/1.3/guides/quick-start",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/quick_start.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-quick-start",title:"Quick Start",id:"quick-start"},sidebar:"version-1.3/docs",previous:{title:"Motivation",permalink:"/sdk/js/docs/1.3/guides/motivation"},next:{title:"Apify Platform",permalink:"/sdk/js/docs/1.3/guides/apify-platform"}},u={},c=[{value:"Local stand-alone usage",id:"local-stand-alone-usage",level:2},{value:"Local usage with Apify command-line interface (CLI)",id:"local-usage-with-apify-command-line-interface-cli",level:2},{value:"Usage on the Apify platform",id:"usage-on-the-apify-platform",level:2}],d={toc:c},f="wrapper";function m(e){var t=e.components,i=(0,r.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This short tutorial will set you up to start using Apify SDK in a minute or two.\nIf you want to learn more, proceed to the ",(0,o.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started"),"\ntutorial that will take you step by step through creating your first scraper."),(0,o.kt)("h2",{id:"local-stand-alone-usage"},"Local stand-alone usage"),(0,o.kt)("p",null,"Apify SDK requires ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/en/",target:"_blank",rel:"noopener"},"Node.js")," 10.17 or later, with the exception of Node.js 11.\nAdd Apify SDK to any Node.js project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Neither ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," nor ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," are bundled with the SDK to reduce install size and allow greater\nflexibility. That's why we install it with NPM. You can choose one, both, or neither.")),(0,o.kt)("p",null,"Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of the Apify SDK,\n",(0,o.kt)("a",{parentName:"p",href:"../examples/crawl-multiple-urls",target:null,rel:null},"see the Examples section of the documentation"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main is a helper function, you don't need to use it.\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n // Choose the first URL to open.\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n // Extract HTML title of the page.\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To read more about what pseudo-URL is, check the ",(0,o.kt)("a",{parentName:"p",href:"getting_started#introduction-to-pseudo-urls",target:null,rel:null},"getting-started"),".")),(0,o.kt)("p",null,"When you run the example, you should see Apify SDK automating a Chrome browser."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Chrome Scrape",src:a(91966).Z,width:"705",height:"529"})),(0,o.kt)("p",null,"By default, Apify SDK stores data to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory. You can override this behavior by setting either the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. For details, see ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables",target:null,rel:null},"Environment variables"),", ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"Request storage")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"Result storage"),"."),(0,o.kt)("h2",{id:"local-usage-with-apify-command-line-interface-cli"},"Local usage with Apify command-line interface (CLI)"),(0,o.kt)("p",null,"To avoid the need to set the environment variables manually, to create a boilerplate of your project, and to enable pushing and running your code on\nthe ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can use the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify command-line interface (CLI)")," tool."),(0,o.kt)("p",null,"Install the CLI by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm -g install apify-cli\n")),(0,o.kt)("p",null,"Now create a boilerplate of your new web crawling project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - just pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world"),"\nwith a Node.js project files. You can run the project as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("p",null,"By default, the crawling data will be stored in a local directory at ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". For example, the input JSON file for the actor is expected to\nbe in the default key-value store in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/key_value_stores/default/INPUT.json"),"."),(0,o.kt)("p",null,"Now you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify login\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-the-apify-platform"},"Usage on the Apify platform"),(0,o.kt)("p",null,"You can also develop your web scraping project in an online code editor directly on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),".\nYou'll need to have an Apify Account. Go to the ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("i",null,"Create new"),"\nand then go to the ",(0,o.kt)("i",null,"Source")," tab and start writing your code or paste one of the examples from the Examples section."),(0,o.kt)("p",null,"For more information, view the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/quick-start",target:"_blank",rel:"noopener"},"Apify actors quick start guide"),"."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),f=r,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{a.d(t,{Z:()=>n});const n=a.p+"assets/images/chrome_scrape-a64af551de8be5fe1ced2182dc0a8dcc.gif"}}]); \ No newline at end of file diff --git a/assets/js/9120eacc.31353dad.js b/assets/js/9120eacc.31353dad.js new file mode 100644 index 0000000000..9dba98dd17 --- /dev/null +++ b/assets/js/9120eacc.31353dad.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8178],{95556:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id_old:"version-1.3-quick-start",title:"Quick Start",id:"quick-start"},p=void 0,s={unversionedId:"guides/quick-start",id:"version-1.3/guides/quick-start",title:"Quick Start",description:"This short tutorial will set you up to start using Apify SDK in a minute or two.",source:"@site/versioned_docs/version-1.3/guides/quick_start.md",sourceDirName:"guides",slug:"/guides/quick-start",permalink:"/sdk/js/docs/1.3/guides/quick-start",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/quick_start.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-quick-start",title:"Quick Start",id:"quick-start"},sidebar:"version-1.3/docs",previous:{title:"Motivation",permalink:"/sdk/js/docs/1.3/guides/motivation"},next:{title:"Apify Platform",permalink:"/sdk/js/docs/1.3/guides/apify-platform"}},u={},c=[{value:"Local stand-alone usage",id:"local-stand-alone-usage",level:2},{value:"Local usage with Apify command-line interface (CLI)",id:"local-usage-with-apify-command-line-interface-cli",level:2},{value:"Usage on the Apify platform",id:"usage-on-the-apify-platform",level:2}],d={toc:c},f="wrapper";function m(e){var t=e.components,i=(0,r.Z)(e,l);return(0,o.kt)(f,(0,n.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This short tutorial will set you up to start using Apify SDK in a minute or two.\nIf you want to learn more, proceed to the ",(0,o.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started"),"\ntutorial that will take you step by step through creating your first scraper."),(0,o.kt)("h2",{id:"local-stand-alone-usage"},"Local stand-alone usage"),(0,o.kt)("p",null,"Apify SDK requires ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/en/",target:"_blank",rel:"noopener"},"Node.js")," 10.17 or later, with the exception of Node.js 11.\nAdd Apify SDK to any Node.js project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Neither ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," nor ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," are bundled with the SDK to reduce install size and allow greater\nflexibility. That's why we install it with NPM. You can choose one, both, or neither.")),(0,o.kt)("p",null,"Run the following example to perform a recursive crawl of a website using Playwright. For more examples showcasing various features of the Apify SDK,\n",(0,o.kt)("a",{parentName:"p",href:"../examples/crawl-multiple-urls",target:null,rel:null},"see the Examples section of the documentation"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main is a helper function, you don't need to use it.\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n // Choose the first URL to open.\n await requestQueue.addRequest({ url: 'https://www.iana.org/' });\n\n const crawler = new Apify.PlaywrightCrawler({\n requestQueue,\n handlePageFunction: async ({ request, page }) => {\n // Extract HTML title of the page.\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n // Add URLs that match the provided pattern.\n await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To read more about what pseudo-URL is, check the ",(0,o.kt)("a",{parentName:"p",href:"getting_started#introduction-to-pseudo-urls",target:null,rel:null},"getting-started"),".")),(0,o.kt)("p",null,"When you run the example, you should see Apify SDK automating a Chrome browser."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Chrome Scrape",src:a(91966).Z,width:"705",height:"529"})),(0,o.kt)("p",null,"By default, Apify SDK stores data to ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage")," in the current working directory. You can override this behavior by setting either the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. For details, see ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables",target:null,rel:null},"Environment variables"),", ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"Request storage")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"Result storage"),"."),(0,o.kt)("h2",{id:"local-usage-with-apify-command-line-interface-cli"},"Local usage with Apify command-line interface (CLI)"),(0,o.kt)("p",null,"To avoid the need to set the environment variables manually, to create a boilerplate of your project, and to enable pushing and running your code on\nthe ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can use the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify command-line interface (CLI)")," tool."),(0,o.kt)("p",null,"Install the CLI by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"npm -g install apify-cli\n")),(0,o.kt)("p",null,"Now create a boilerplate of your new web crawling project by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-hello-world\n")),(0,o.kt)("p",null,'The CLI will prompt you to select a project boilerplate template - just pick "Hello world". The tool will create a directory called ',(0,o.kt)("inlineCode",{parentName:"p"},"my-hello-world"),"\nwith a Node.js project files. You can run the project as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-hello-world\napify run\n")),(0,o.kt)("p",null,"By default, the crawling data will be stored in a local directory at ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage"),". For example, the input JSON file for the actor is expected to\nbe in the default key-value store in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/key_value_stores/default/INPUT.json"),"."),(0,o.kt)("p",null,"Now you can easily deploy your code to the Apify platform by running:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify login\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"apify push\n")),(0,o.kt)("p",null,"Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/cli",target:"_blank",rel:"noopener"},"Apify Actor")," documentation."),(0,o.kt)("h2",{id:"usage-on-the-apify-platform"},"Usage on the Apify platform"),(0,o.kt)("p",null,"You can also develop your web scraping project in an online code editor directly on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),".\nYou'll need to have an Apify Account. Go to the ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/actors",target:"_blank",rel:"noopener"},"Actors")," page in the app, click ",(0,o.kt)("i",null,"Create new"),"\nand then go to the ",(0,o.kt)("i",null,"Source")," tab and start writing your code or paste one of the examples from the Examples section."),(0,o.kt)("p",null,"For more information, view the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/quick-start",target:"_blank",rel:"noopener"},"Apify actors quick start guide"),"."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),f=r,m=c["".concat(p,".").concat(f)]||c[f]||d[f]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{a.d(t,{Z:()=>n});const n=a.p+"assets/images/chrome_scrape-a64af551de8be5fe1ced2182dc0a8dcc.gif"}}]); \ No newline at end of file diff --git a/assets/js/9140c03f.6301a92a.js b/assets/js/9140c03f.6301a92a.js deleted file mode 100644 index c48fcd0298..0000000000 --- a/assets/js/9140c03f.6301a92a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6814],{79192:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),p=["components"],i={id_old:"version-1.3-puppeteer-pool-options",title:"PuppeteerPoolOptions",id:"puppeteer-pool-options"},l=void 0,s={unversionedId:"typedefs/puppeteer-pool-options",id:"version-1.3/typedefs/puppeteer-pool-options",title:"PuppeteerPoolOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-pool-options",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerPoolOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-pool-options",title:"PuppeteerPoolOptions",id:"puppeteer-pool-options"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"maxOpenPagesPerInstance",id:"maxopenpagesperinstance",level:3},{value:"retireInstanceAfterRequestCount",id:"retireinstanceafterrequestcount",level:3},{value:"puppeteerOperationTimeoutSecs",id:"puppeteeroperationtimeoutsecs",level:3},{value:"instanceKillerIntervalSecs",id:"instancekillerintervalsecs",level:3},{value:"killInstanceAfterSecs",id:"killinstanceaftersecs",level:3},{value:"launchPuppeteerFunction",id:"launchpuppeteerfunction",level:3},{value:"launchPuppeteerOptions",id:"launchpuppeteeroptions",level:3},{value:"recycleDiskCache",id:"recyclediskcache",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerpooloptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"maxopenpagesperinstance"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxOpenPagesPerInstance")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 50")),(0,a.kt)("p",null,"Maximum number of open pages (i.e. tabs) per browser. When this limit is reached, new pages are loaded in a new browser instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"retireinstanceafterrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"retireInstanceAfterRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 100")),(0,a.kt)("p",null,"Maximum number of requests that can be processed by a single browser instance. After the limit is reached, the browser is retired and new requests are\nhandled by a new browser instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"puppeteeroperationtimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"puppeteerOperationTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 15")),(0,a.kt)("p",null,"All browser management operations such as launching a new browser, opening a new page or closing a page will timeout after the set number of seconds\nand the connected browser will be retired."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"instancekillerintervalsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"instanceKillerIntervalSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Indicates how often are the open Puppeteer instances checked whether they can be closed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"killinstanceaftersecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"killInstanceAfterSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 300")),(0,a.kt)("p",null,"When Puppeteer instance reaches the ",(0,a.kt)("inlineCode",{parentName:"p"},"retireInstanceAfterRequestCount")," limit then it is considered retired and no more tabs will be opened. After the\nlast tab is closed the whole browser is closed too. This parameter defines a time limit between the last tab was opened and before the browser is\nclosed even if there are pending open tabs."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchpuppeteerfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/launch-puppeteer-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerFunction"))),(0,a.kt)("p",null,"Overrides the default function to launch a new Puppeteer instance. It must return a promise resolving to\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browser",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Browser"))," instance."),(0,a.kt)("p",null,"The function receives one parameter that includes launch options, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," and other options generated by the ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," instance. You\ncan extend or update this options object, but you must not ignore it."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Correct:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"async function launchPuppeteerFunction(options) {\n const newOpts = {\n ...options,\n foo: 'bar',\n };\n\n // do some other things\n\n return Apify.launchPuppeteer(newOpts);\n}\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Incorrect:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"async function launchPuppeteerFunction() {\n const opts = {\n foo: 'bar',\n };\n // Because we ignored the options, correct parameters\n // will not make it to the browser. Eg. this prevents\n // proxyConfiguration from working correctly.\n return Apify.launchPuppeteer(opts);\n}\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchpuppeteeroptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/launch-puppeteer-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerOptions"))),(0,a.kt)("p",null,"Options used by ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," to start new Puppeteer instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"recyclediskcache"},(0,a.kt)("inlineCode",{parentName:"h3"},"recycleDiskCache")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"Enables recycling of disk cache directories by Chrome instances. When a browser instance is closed, its disk cache directory is not deleted but it's\nused by a newly opened browser instance. This is useful to reduce amount of data that needs to be downloaded to speed up crawling and reduce proxy\nusage. Note that the new browser starts with empty cookies, local storage etc. so this setting doesn't affect anonymity of your crawler."),(0,a.kt)("p",null,"Beware that the disk cache directories can consume a lot of disk space. To limit the space consumed, you can pass the ",(0,a.kt)("inlineCode",{parentName:"p"},"--disk-cache-size=X")," argument\nto ",(0,a.kt)("inlineCode",{parentName:"p"},"launchPuppeteer")," ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", where ",(0,a.kt)("inlineCode",{parentName:"p"},"X")," is the approximate maximum number of bytes for disk cache."),(0,a.kt)("p",null,"Do not use the ",(0,a.kt)("inlineCode",{parentName:"p"},"recycleDiskCache")," setting together with ",(0,a.kt)("inlineCode",{parentName:"p"},"--disk-cache-dir")," argument in ",(0,a.kt)("inlineCode",{parentName:"p"},"launchPuppeteer")," ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", the behavior is undefined."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useincognitopages"},(0,a.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context, which means that they will not share cookies or cache and\ntheir resources will not be throttled by one another."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,a.kt)("p",null,"A pool of Session instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided and\nrotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(n),h=o,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||a;return n?r.createElement(m,p(p({ref:t},c),{},{components:n})):r.createElement(m,p({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,p=new Array(a);p[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),p=["components"],i={id_old:"version-1.3-puppeteer-pool-options",title:"PuppeteerPoolOptions",id:"puppeteer-pool-options"},l=void 0,s={unversionedId:"typedefs/puppeteer-pool-options",id:"version-1.3/typedefs/puppeteer-pool-options",title:"PuppeteerPoolOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-pool-options",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerPoolOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-pool-options",title:"PuppeteerPoolOptions",id:"puppeteer-pool-options"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"maxOpenPagesPerInstance",id:"maxopenpagesperinstance",level:3},{value:"retireInstanceAfterRequestCount",id:"retireinstanceafterrequestcount",level:3},{value:"puppeteerOperationTimeoutSecs",id:"puppeteeroperationtimeoutsecs",level:3},{value:"instanceKillerIntervalSecs",id:"instancekillerintervalsecs",level:3},{value:"killInstanceAfterSecs",id:"killinstanceaftersecs",level:3},{value:"launchPuppeteerFunction",id:"launchpuppeteerfunction",level:3},{value:"launchPuppeteerOptions",id:"launchpuppeteeroptions",level:3},{value:"recycleDiskCache",id:"recyclediskcache",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"puppeteerpooloptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"maxopenpagesperinstance"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxOpenPagesPerInstance")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 50")),(0,a.kt)("p",null,"Maximum number of open pages (i.e. tabs) per browser. When this limit is reached, new pages are loaded in a new browser instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"retireinstanceafterrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"retireInstanceAfterRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 100")),(0,a.kt)("p",null,"Maximum number of requests that can be processed by a single browser instance. After the limit is reached, the browser is retired and new requests are\nhandled by a new browser instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"puppeteeroperationtimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"puppeteerOperationTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 15")),(0,a.kt)("p",null,"All browser management operations such as launching a new browser, opening a new page or closing a page will timeout after the set number of seconds\nand the connected browser will be retired."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"instancekillerintervalsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"instanceKillerIntervalSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Indicates how often are the open Puppeteer instances checked whether they can be closed."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"killinstanceaftersecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"killInstanceAfterSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 300")),(0,a.kt)("p",null,"When Puppeteer instance reaches the ",(0,a.kt)("inlineCode",{parentName:"p"},"retireInstanceAfterRequestCount")," limit then it is considered retired and no more tabs will be opened. After the\nlast tab is closed the whole browser is closed too. This parameter defines a time limit between the last tab was opened and before the browser is\nclosed even if there are pending open tabs."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchpuppeteerfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/launch-puppeteer-function",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerFunction"))),(0,a.kt)("p",null,"Overrides the default function to launch a new Puppeteer instance. It must return a promise resolving to\n",(0,a.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browser",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"Browser"))," instance."),(0,a.kt)("p",null,"The function receives one parameter that includes launch options, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," and other options generated by the ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," instance. You\ncan extend or update this options object, but you must not ignore it."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Correct:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"async function launchPuppeteerFunction(options) {\n const newOpts = {\n ...options,\n foo: 'bar',\n };\n\n // do some other things\n\n return Apify.launchPuppeteer(newOpts);\n}\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Incorrect:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"async function launchPuppeteerFunction() {\n const opts = {\n foo: 'bar',\n };\n // Because we ignored the options, correct parameters\n // will not make it to the browser. Eg. this prevents\n // proxyConfiguration from working correctly.\n return Apify.launchPuppeteer(opts);\n}\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"launchpuppeteeroptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/launch-puppeteer-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchPuppeteerOptions"))),(0,a.kt)("p",null,"Options used by ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," to start new Puppeteer instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"recyclediskcache"},(0,a.kt)("inlineCode",{parentName:"h3"},"recycleDiskCache")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"Enables recycling of disk cache directories by Chrome instances. When a browser instance is closed, its disk cache directory is not deleted but it's\nused by a newly opened browser instance. This is useful to reduce amount of data that needs to be downloaded to speed up crawling and reduce proxy\nusage. Note that the new browser starts with empty cookies, local storage etc. so this setting doesn't affect anonymity of your crawler."),(0,a.kt)("p",null,"Beware that the disk cache directories can consume a lot of disk space. To limit the space consumed, you can pass the ",(0,a.kt)("inlineCode",{parentName:"p"},"--disk-cache-size=X")," argument\nto ",(0,a.kt)("inlineCode",{parentName:"p"},"launchPuppeteer")," ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", where ",(0,a.kt)("inlineCode",{parentName:"p"},"X")," is the approximate maximum number of bytes for disk cache."),(0,a.kt)("p",null,"Do not use the ",(0,a.kt)("inlineCode",{parentName:"p"},"recycleDiskCache")," setting together with ",(0,a.kt)("inlineCode",{parentName:"p"},"--disk-cache-dir")," argument in ",(0,a.kt)("inlineCode",{parentName:"p"},"launchPuppeteer")," ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", the behavior is undefined."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useincognitopages"},(0,a.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context, which means that they will not share cookies or cache and\ntheir resources will not be throttled by one another."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,a.kt)("p",null,"A pool of Session instances."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided and\nrotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(n),h=o,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||a;return n?r.createElement(m,p(p({ref:t},c),{},{components:n})):r.createElement(m,p({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,p=new Array(a);p[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),a=["components"],i={id:"memory-info",title:"MemoryInfo"},l=void 0,p={unversionedId:"typedefs/memory-info",id:"version-2.3/typedefs/memory-info",title:"MemoryInfo",description:"Describes memory usage of an Actor.",source:"@site/versioned_docs/version-2.3/typedefs/MemoryInfo.md",sourceDirName:"typedefs",slug:"/typedefs/memory-info",permalink:"/sdk/js/docs/2.3/typedefs/memory-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/MemoryInfo.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"memory-info",title:"MemoryInfo"},sidebar:"version-2.3/docs",previous:{title:"DatasetContent",permalink:"/sdk/js/docs/2.3/typedefs/dataset-content"},next:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/2.3/typedefs/queue-operation-info"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"totalBytes",id:"totalbytes",level:3},{value:"freeBytes",id:"freebytes",level:3},{value:"usedBytes",id:"usedbytes",level:3},{value:"mainProcessBytes",id:"mainprocessbytes",level:3},{value:"childProcessesBytes",id:"childprocessesbytes",level:3}],m={toc:d},u="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,a);return(0,s.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"memoryinfo"}),(0,s.kt)("p",null,"Describes memory usage of an Actor."),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"totalbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"totalBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Total memory available in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"freebytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"freeBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of free memory in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usedbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"usedBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used (= totalBytes - freeBytes)"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"mainprocessbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"mainProcessBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used the current Node.js process"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"childprocessesbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"childProcessesBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used by child processes of the current Node.js process"),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),u=o,y=d["".concat(l,".").concat(u)]||d[u]||m[u]||s;return r?n.createElement(y,a(a({ref:t},c),{},{components:r})):n.createElement(y,a({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:o,a[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),a=["components"],i={id:"memory-info",title:"MemoryInfo"},l=void 0,p={unversionedId:"typedefs/memory-info",id:"version-2.3/typedefs/memory-info",title:"MemoryInfo",description:"Describes memory usage of an Actor.",source:"@site/versioned_docs/version-2.3/typedefs/MemoryInfo.md",sourceDirName:"typedefs",slug:"/typedefs/memory-info",permalink:"/sdk/js/docs/2.3/typedefs/memory-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/MemoryInfo.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"memory-info",title:"MemoryInfo"},sidebar:"version-2.3/docs",previous:{title:"DatasetContent",permalink:"/sdk/js/docs/2.3/typedefs/dataset-content"},next:{title:"QueueOperationInfo",permalink:"/sdk/js/docs/2.3/typedefs/queue-operation-info"}},c={},d=[{value:"Properties",id:"properties",level:2},{value:"totalBytes",id:"totalbytes",level:3},{value:"freeBytes",id:"freebytes",level:3},{value:"usedBytes",id:"usedbytes",level:3},{value:"mainProcessBytes",id:"mainprocessbytes",level:3},{value:"childProcessesBytes",id:"childprocessesbytes",level:3}],m={toc:d},u="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,a);return(0,s.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"memoryinfo"}),(0,s.kt)("p",null,"Describes memory usage of an Actor."),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"totalbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"totalBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Total memory available in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"freebytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"freeBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of free memory in the system or container"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usedbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"usedBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used (= totalBytes - freeBytes)"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"mainprocessbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"mainProcessBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used the current Node.js process"),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"childprocessesbytes"},(0,s.kt)("inlineCode",{parentName:"h3"},"childProcessesBytes")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")),(0,s.kt)("p",null,"Amount of memory used by child processes of the current Node.js process"),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),u=o,y=d["".concat(l,".").concat(u)]||d[u]||m[u]||s;return r?n.createElement(y,a(a({ref:t},c),{},{components:r})):n.createElement(y,a({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:o,a[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id:"puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam"},l=void 0,c={unversionedId:"typedefs/puppeteer-handle-page-function-param",id:"version-2.3/typedefs/puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page-function-param",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePageFunctionParam.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"},next:{title:"DatasetConsumer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-consumer"}},u={},s=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:s},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepagefunctionparam"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"page"},(0,p.kt)("inlineCode",{parentName:"h3"},"page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),s=c(r),f=a,m=s["".concat(l,".").concat(f)]||s[f]||d[f]||p;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id:"puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam"},l=void 0,c={unversionedId:"typedefs/puppeteer-handle-page-function-param",id:"version-2.3/typedefs/puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerHandlePageFunctionParam.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-handle-page-function-param",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePageFunctionParam.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-handle-page-function-param",title:"PuppeteerHandlePageFunctionParam"},sidebar:"version-2.3/docs",previous:{title:"PuppeteerHandlePage",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"},next:{title:"DatasetConsumer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-consumer"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"crawler",id:"crawler",level:3}],s={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerhandlepagefunctionparam"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"page"},(0,p.kt)("inlineCode",{parentName:"h3"},"page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||s[f]||p;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id:"dataset-reducer",title:"DatasetReducer"},p=void 0,l={unversionedId:"typedefs/dataset-reducer",id:"version-2.3/typedefs/dataset-reducer",title:"DatasetReducer",description:"User-function used in the Dataset.reduce() API.",source:"@site/versioned_docs/version-2.3/typedefs/DatasetReducer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-reducer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-reducer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetReducer.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"dataset-reducer",title:"DatasetReducer"},sidebar:"version-2.3/docs",previous:{title:"DatasetMapper",permalink:"/sdk/js/docs/2.3/typedefs/dataset-mapper"},next:{title:"KeyConsumer",permalink:"/sdk/js/docs/2.3/typedefs/key-consumer"}},c={},d=[],u={toc:d},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetreducer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.reduce()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Previous state of the reduction."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[d]="string"==typeof e?e:a,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id:"dataset-reducer",title:"DatasetReducer"},p=void 0,l={unversionedId:"typedefs/dataset-reducer",id:"version-2.3/typedefs/dataset-reducer",title:"DatasetReducer",description:"User-function used in the Dataset.reduce() API.",source:"@site/versioned_docs/version-2.3/typedefs/DatasetReducer.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-reducer",permalink:"/sdk/js/docs/2.3/typedefs/dataset-reducer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetReducer.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"dataset-reducer",title:"DatasetReducer"},sidebar:"version-2.3/docs",previous:{title:"DatasetMapper",permalink:"/sdk/js/docs/2.3/typedefs/dataset-mapper"},next:{title:"KeyConsumer",permalink:"/sdk/js/docs/2.3/typedefs/key-consumer"}},c={},d=[],u={toc:d},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetreducer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.reduce()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Previous state of the reduction."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[d]="string"==typeof e?e:a,i[1]=s;for(var l=2;l{n.d(t,{Z:()=>c});var a=n(67294),r=n(88746),o=n(6141),l=n(6832);const c=function(e){var t=e.to,n=e.children,c=(0,o.E)(),s=c.version,i=c.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":i&&(d=""),a.createElement(r.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>c,T:()=>l});var a=n(67294),r=n(88746),o="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return a.createElement(r.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},n)},c=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:o+"/"+t},n)}},19556:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>b,contentTitle:()=>m,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>h});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),l=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\n// Create and navigate new page\nconsole.log('Open target page');\nconst page = await browser.newPage();\nawait page.goto('https://github.com/search/advanced');\n\n// Fill form fields and select desired search options\nconsole.log('Fill in search form');\nawait page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\nawait page.type('#search_from', 'apify');\nawait page.type('#search_date', '>2015');\nawait page.select('select#search_language', 'JavaScript');\n\n// Submit the form and wait for full load of next page\nconsole.log('Submit search form');\nawait Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n]);\n\n// Obtain and print list of search results\nconst results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n})));\n\nconsole.log('Results:', results);\n\n// Store data in default dataset\nawait Actor.pushData(results);\n\n// Close browser\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E"};var i,d=["components"],p={id:"forms",title:"Forms"},m=void 0,u={unversionedId:"examples/forms",id:"examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to",source:"@site/../docs/examples/forms.mdx",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/next/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/forms.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/next/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/next/examples/map-and-reduce"}},b={},h=[],f=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),y={toc:h},g="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,d);return(0,o.kt)(g,(0,a.Z)({},y,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," to\nautomatically fill and submit a search form to look up repositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and language of the repository, then submits the form\nand prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(f,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),i=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(s.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),p=i(n),u=r,b=p["".concat(s,".").concat(u)]||p[u]||m[u]||o;return n?a.createElement(b,l(l({ref:t},d),{},{components:n})):a.createElement(b,l({ref:t},d))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:r,l[1]=c;for(var i=2;i{n.d(t,{Z:()=>c});var a=n(67294),r=n(88746),o=n(6141),l=n(6832);const c=function(e){var t=e.to,n=e.children,c=(0,o.E)(),s=c.version,i=c.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":i&&(d=""),a.createElement(r.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>c,T:()=>l});var a=n(67294),r=n(88746),o="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return a.createElement(r.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},n)},c=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:o+"/"+t},n)}},19556:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>b,contentTitle:()=>m,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>h});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),l=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\n// Create and navigate new page\nconsole.log('Open target page');\nconst page = await browser.newPage();\nawait page.goto('https://github.com/search/advanced');\n\n// Fill form fields and select desired search options\nconsole.log('Fill in search form');\nawait page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\nawait page.type('#search_from', 'apify');\nawait page.type('#search_date', '>2015');\nawait page.select('select#search_language', 'JavaScript');\n\n// Submit the form and wait for full load of next page\nconsole.log('Submit search form');\nawait Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n]);\n\n// Obtain and print list of search results\nconst results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n})));\n\nconsole.log('Results:', results);\n\n// Store data in default dataset\nawait Actor.pushData(results);\n\n// Close browser\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E"};var i,d=["components"],p={id:"forms",title:"Forms"},m=void 0,u={unversionedId:"examples/forms",id:"examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to",source:"@site/../docs/examples/forms.mdx",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/next/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/forms.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/next/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/next/examples/map-and-reduce"}},b={},h=[],f=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),y={toc:h},g="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,d);return(0,o.kt)(g,(0,a.Z)({},y,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," to\nautomatically fill and submit a search form to look up repositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and language of the repository, then submits the form\nand prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(f,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),i=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=i(e.components);return a.createElement(s.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),p=i(n),u=r,b=p["".concat(s,".").concat(u)]||p[u]||m[u]||o;return n?a.createElement(b,l(l({ref:t},d),{},{components:n})):a.createElement(b,l({ref:t},d))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:r,l[1]=c;for(var i=2;i{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"dataset-content",title:"DatasetContent"},s=void 0,p={unversionedId:"typedefs/dataset-content",id:"version-2.3/typedefs/dataset-content",title:"DatasetContent",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/DatasetContent.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-content",permalink:"/sdk/js/docs/2.3/typedefs/dataset-content",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetContent.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"dataset-content",title:"DatasetContent"},sidebar:"version-2.3/docs",previous:{title:"ApifyEnv",permalink:"/sdk/js/docs/2.3/typedefs/apify-env"},next:{title:"MemoryInfo",permalink:"/sdk/js/docs/2.3/typedefs/memory-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"items",id:"items",level:3},{value:"total",id:"total",level:3},{value:"offset",id:"offset",level:3},{value:"count",id:"count",level:3},{value:"limit",id:"limit",level:3}],u={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"datasetcontent"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"items"},(0,a.kt)("inlineCode",{parentName:"h3"},"items")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Dataset entries based on chosen format parameter."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"total"},(0,a.kt)("inlineCode",{parentName:"h3"},"total")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Total count of entries in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"offset"},(0,a.kt)("inlineCode",{parentName:"h3"},"offset")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the first returned entry in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"count"},(0,a.kt)("inlineCode",{parentName:"h3"},"count")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Count of dataset entries returned in this set."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},(0,a.kt)("inlineCode",{parentName:"h3"},"limit")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of dataset entries requested."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),f=o,m=c["".concat(s,".").concat(f)]||c[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id:"dataset-content",title:"DatasetContent"},s=void 0,p={unversionedId:"typedefs/dataset-content",id:"version-2.3/typedefs/dataset-content",title:"DatasetContent",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/DatasetContent.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-content",permalink:"/sdk/js/docs/2.3/typedefs/dataset-content",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetContent.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"dataset-content",title:"DatasetContent"},sidebar:"version-2.3/docs",previous:{title:"ApifyEnv",permalink:"/sdk/js/docs/2.3/typedefs/apify-env"},next:{title:"MemoryInfo",permalink:"/sdk/js/docs/2.3/typedefs/memory-info"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"items",id:"items",level:3},{value:"total",id:"total",level:3},{value:"offset",id:"offset",level:3},{value:"count",id:"count",level:3},{value:"limit",id:"limit",level:3}],u={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"datasetcontent"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"items"},(0,a.kt)("inlineCode",{parentName:"h3"},"items")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array")),(0,a.kt)("p",null,"Dataset entries based on chosen format parameter."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"total"},(0,a.kt)("inlineCode",{parentName:"h3"},"total")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Total count of entries in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"offset"},(0,a.kt)("inlineCode",{parentName:"h3"},"offset")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Position of the first returned entry in the dataset."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"count"},(0,a.kt)("inlineCode",{parentName:"h3"},"count")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Count of dataset entries returned in this set."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},(0,a.kt)("inlineCode",{parentName:"h3"},"limit")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of dataset entries requested."),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),f=o,m=c["".concat(s,".").concat(f)]||c[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},d),{},{components:n})):r.createElement(m,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id:"motivation",title:"Motivation"},p=void 0,l={unversionedId:"guides/motivation",id:"version-2.3/guides/motivation",title:"Motivation",description:"Thanks to tools like Playwright, Puppeteer or",source:"@site/versioned_docs/version-2.3/guides/motivation.md",sourceDirName:"guides",slug:"/guides/motivation",permalink:"/sdk/js/docs/2.3/guides/motivation",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/motivation.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"motivation",title:"Motivation"},sidebar:"version-2.3/docs",next:{title:"Quick Start",permalink:"/sdk/js/docs/2.3/guides/quick-start"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Thanks to tools like ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),", ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," or\n",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio"),", it is easy to write Node.js code to extract data from web pages. But\neventually things will get complicated. For example, when you try to:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Perform a deep crawl of an entire website using a persistent queue of URLs."),(0,a.kt)("li",{parentName:"ul"},"Run your scraping code on a list of 100k URLs in a CSV file, without losing any data when your code crashes."),(0,a.kt)("li",{parentName:"ul"},"Rotate proxies to hide your browser origin and keep user-like sessions."),(0,a.kt)("li",{parentName:"ul"},"Disable browser fingerprinting protections used by websites.")),(0,a.kt)("p",null,"Python has ",(0,a.kt)("a",{parentName:"p",href:"https://scrapy.org/",target:"_blank",rel:"noopener"},"Scrapy")," for these tasks, but there was no such library for ",(0,a.kt)("strong",{parentName:"p"},"JavaScript, the language of\nthe web"),". The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a\nbrowser."),(0,a.kt)("p",null,"The goal of the Apify SDK is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't\nreinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing\ncommonalities."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id:"motivation",title:"Motivation"},p=void 0,l={unversionedId:"guides/motivation",id:"version-2.3/guides/motivation",title:"Motivation",description:"Thanks to tools like Playwright, Puppeteer or",source:"@site/versioned_docs/version-2.3/guides/motivation.md",sourceDirName:"guides",slug:"/guides/motivation",permalink:"/sdk/js/docs/2.3/guides/motivation",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/motivation.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"motivation",title:"Motivation"},sidebar:"version-2.3/docs",next:{title:"Quick Start",permalink:"/sdk/js/docs/2.3/guides/quick-start"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Thanks to tools like ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),", ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," or\n",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio"),", it is easy to write Node.js code to extract data from web pages. But\neventually things will get complicated. For example, when you try to:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Perform a deep crawl of an entire website using a persistent queue of URLs."),(0,a.kt)("li",{parentName:"ul"},"Run your scraping code on a list of 100k URLs in a CSV file, without losing any data when your code crashes."),(0,a.kt)("li",{parentName:"ul"},"Rotate proxies to hide your browser origin and keep user-like sessions."),(0,a.kt)("li",{parentName:"ul"},"Disable browser fingerprinting protections used by websites.")),(0,a.kt)("p",null,"Python has ",(0,a.kt)("a",{parentName:"p",href:"https://scrapy.org/",target:"_blank",rel:"noopener"},"Scrapy")," for these tasks, but there was no such library for ",(0,a.kt)("strong",{parentName:"p"},"JavaScript, the language of\nthe web"),". The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a\nbrowser."),(0,a.kt)("p",null,"The goal of the Apify SDK is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't\nreinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing\ncommonalities."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>w,frontMatter:()=>o,metadata:()=>l,toc:()=>u});var a=n(87462),r=n(63366),p=(n(67294),n(3905)),s=["components"],o={id:"capture-screenshot",title:"Capture a screenshot"},i=void 0,l={unversionedId:"examples/capture-screenshot",id:"version-2.3/examples/capture-screenshot",title:"Capture a screenshot",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-2.3/examples/capture_screenshot.md",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/2.3/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/capture_screenshot.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot"},sidebar:"version-2.3/docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/2.3/examples/call-actor"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/2.3/examples/cheerio-crawler"}},c={},u=[],m={toc:u},h="wrapper";function w(e){var t=e.components,n=(0,r.Z)(e,s);return(0,p.kt)(h,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("p",null,"This example captures a screenshot of a web page using ",(0,p.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,p.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n const screenshot = await page.screenshot();\n // Save the screenshot to the default key-value store\n await Apify.setValue('my-key', screenshot, { contentType: 'image/png' });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,p.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Apify.setValue(key, screenshot, { contentType: 'image/png' });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key, saveHtml: false });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,p.kt)("p",null,"In both examples using ",(0,p.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,p.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page.\nThis variable is used as the key when saving each screenshot into a key-value store."))}w.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>w});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),l=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,p=e.originalType,i=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=l(n),h=r,w=u["".concat(i,".").concat(h)]||u[h]||m[h]||p;return n?a.createElement(w,s(s({ref:t},c),{},{components:n})):a.createElement(w,s({ref:t},c))}));function w(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var p=n.length,s=new Array(p);s[0]=h;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[u]="string"==typeof e?e:r,s[1]=o;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>w,frontMatter:()=>o,metadata:()=>l,toc:()=>u});var a=n(87462),r=n(63366),p=(n(67294),n(3905)),s=["components"],o={id:"capture-screenshot",title:"Capture a screenshot"},i=void 0,l={unversionedId:"examples/capture-screenshot",id:"version-2.3/examples/capture-screenshot",title:"Capture a screenshot",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-2.3/examples/capture_screenshot.md",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/2.3/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/capture_screenshot.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"capture-screenshot",title:"Capture a screenshot"},sidebar:"version-2.3/docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/2.3/examples/call-actor"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/2.3/examples/cheerio-crawler"}},c={},u=[],m={toc:u},h="wrapper";function w(e){var t=e.components,n=(0,r.Z)(e,s);return(0,p.kt)(h,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("p",null,"This example captures a screenshot of a web page using ",(0,p.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,p.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n const screenshot = await page.screenshot();\n // Save the screenshot to the default key-value store\n await Apify.setValue('my-key', screenshot, { contentType: 'image/png' });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,p.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Apify.setValue(key, screenshot, { contentType: 'image/png' });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,p.kt)("p",null,"\\\nUsing ",(0,p.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key, saveHtml: false });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,p.kt)("p",null,"In both examples using ",(0,p.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,p.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page.\nThis variable is used as the key when saving each screenshot into a key-value store."))}w.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>w});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),l=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,p=e.originalType,i=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=l(n),h=r,w=u["".concat(i,".").concat(h)]||u[h]||m[h]||p;return n?a.createElement(w,s(s({ref:t},c),{},{components:n})):a.createElement(w,s({ref:t},c))}));function w(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var p=n.length,s=new Array(p);s[0]=h;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[u]="string"==typeof e?e:r,s[1]=o;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-system-status-options",title:"SystemStatusOptions",id:"system-status-options"},l=void 0,p={unversionedId:"typedefs/system-status-options",id:"version-1.3/typedefs/system-status-options",title:"SystemStatusOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SystemStatusOptions.md",sourceDirName:"typedefs",slug:"/typedefs/system-status-options",permalink:"/sdk/js/docs/1.3/typedefs/system-status-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemStatusOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-system-status-options",title:"SystemStatusOptions",id:"system-status-options"},sidebar:"version-1.3/docs",previous:{title:"StealthOptions",permalink:"/sdk/js/docs/1.3/typedefs/stealth-options"},next:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page"}},d={},m=[{value:"Properties",id:"properties",level:2},{value:"currentHistorySecs",id:"currenthistorysecs",level:3},{value:"maxMemoryOverloadedRatio",id:"maxmemoryoverloadedratio",level:3},{value:"maxEventLoopOverloadedRatio",id:"maxeventloopoverloadedratio",level:3},{value:"maxCpuOverloadedRatio",id:"maxcpuoverloadedratio",level:3},{value:"maxClientOverloadedRatio",id:"maxclientoverloadedratio",level:3},{value:"snapshotter",id:"snapshotter",level:3}],u={toc:m},c="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(c,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"systemstatusoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"currenthistorysecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"currentHistorySecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 5")),(0,a.kt)("p",null,"Defines max age of snapshots used in the ",(0,a.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," measurement."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxmemoryoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxMemoryOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.2")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxeventloopoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxEventLoopOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.6")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxcpuoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxCpuOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.4")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxclientoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxClientOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.3")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"snapshotter"},(0,a.kt)("inlineCode",{parentName:"h3"},"snapshotter")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Snapshotter")," instance to be queried for ",(0,a.kt)("inlineCode",{parentName:"p"},"SystemStatus"),"."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(r),c=o,y=m["".concat(l,".").concat(c)]||m[c]||u[c]||a;return r?n.createElement(y,s(s({ref:t},d),{},{components:r})):n.createElement(y,s({ref:t},d))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=c;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[m]="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-system-status-options",title:"SystemStatusOptions",id:"system-status-options"},l=void 0,p={unversionedId:"typedefs/system-status-options",id:"version-1.3/typedefs/system-status-options",title:"SystemStatusOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SystemStatusOptions.md",sourceDirName:"typedefs",slug:"/typedefs/system-status-options",permalink:"/sdk/js/docs/1.3/typedefs/system-status-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemStatusOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-system-status-options",title:"SystemStatusOptions",id:"system-status-options"},sidebar:"version-1.3/docs",previous:{title:"StealthOptions",permalink:"/sdk/js/docs/1.3/typedefs/stealth-options"},next:{title:"CheerioHandlePage",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-handle-page"}},d={},m=[{value:"Properties",id:"properties",level:2},{value:"currentHistorySecs",id:"currenthistorysecs",level:3},{value:"maxMemoryOverloadedRatio",id:"maxmemoryoverloadedratio",level:3},{value:"maxEventLoopOverloadedRatio",id:"maxeventloopoverloadedratio",level:3},{value:"maxCpuOverloadedRatio",id:"maxcpuoverloadedratio",level:3},{value:"maxClientOverloadedRatio",id:"maxclientoverloadedratio",level:3},{value:"snapshotter",id:"snapshotter",level:3}],u={toc:m},c="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(c,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"systemstatusoptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"currenthistorysecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"currentHistorySecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 5")),(0,a.kt)("p",null,"Defines max age of snapshots used in the ",(0,a.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," measurement."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxmemoryoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxMemoryOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.2")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxeventloopoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxEventLoopOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.6")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxcpuoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxCpuOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.4")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxclientoverloadedratio"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxClientOverloadedRatio")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 0.3")),(0,a.kt)("p",null,"Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"snapshotter"},(0,a.kt)("inlineCode",{parentName:"h3"},"snapshotter")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"Snapshotter")," instance to be queried for ",(0,a.kt)("inlineCode",{parentName:"p"},"SystemStatus"),"."),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(r),c=o,y=m["".concat(l,".").concat(c)]||m[c]||u[c]||a;return r?n.createElement(y,s(s({ref:t},d),{},{components:r})):n.createElement(y,s({ref:t},d))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=c;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[m]="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>l,toc:()=>d});var n=r(87462),o=r(63366),i=(r(67294),r(3905)),p=["components"],a={id_old:"version-1.3-compiled-script-function",title:"CompiledScriptFunction",id:"compiled-script-function"},c=void 0,l={unversionedId:"typedefs/compiled-script-function",id:"version-1.3/typedefs/compiled-script-function",title:"CompiledScriptFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/CompiledScriptFunction.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-function",permalink:"/sdk/js/docs/1.3/typedefs/compiled-script-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-compiled-script-function",title:"CompiledScriptFunction",id:"compiled-script-function"}},s={},d=[],u={toc:d},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,i.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"compiledscriptfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"params")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/compiled-script-params",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptParams")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=a(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return r?n.createElement(f,p(p({ref:t},s),{},{components:r})):n.createElement(f,p({ref:t},s))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,p=new Array(i);p[0]=m;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[d]="string"==typeof e?e:o,p[1]=a;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>l,toc:()=>d});var n=r(87462),o=r(63366),i=(r(67294),r(3905)),p=["components"],a={id_old:"version-1.3-compiled-script-function",title:"CompiledScriptFunction",id:"compiled-script-function"},c=void 0,l={unversionedId:"typedefs/compiled-script-function",id:"version-1.3/typedefs/compiled-script-function",title:"CompiledScriptFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/CompiledScriptFunction.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-function",permalink:"/sdk/js/docs/1.3/typedefs/compiled-script-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-compiled-script-function",title:"CompiledScriptFunction",id:"compiled-script-function"}},s={},d=[],u={toc:d},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,i.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"compiledscriptfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"params")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/compiled-script-params",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptParams")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=a(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return r?n.createElement(f,p(p({ref:t},s),{},{components:r})):n.createElement(f,p({ref:t},s))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,p=new Array(i);p[0]=m;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[d]="string"==typeof e?e:o,p[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>m});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-2.3.0-apify",title:"Apify",id:"apify"},p=void 0,s={unversionedId:"api/apify",id:"version-2.3/api/apify",title:"Apify",description:"The following section describes all functions and properties provided by the apify package, except individual classes and namespaces that have their",source:"@site/versioned_docs/version-2.3/api/Apify.md",sourceDirName:"api",slug:"/api/apify",permalink:"/sdk/js/docs/2.3/api/apify",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Apify.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-apify",title:"Apify",id:"apify"},sidebar:"version-2.3/docs",previous:{title:"Use stealth mode",permalink:"/sdk/js/docs/2.3/examples/use-stealth-mode"},next:{title:"Configuration",permalink:"/sdk/js/docs/2.3/api/configuration"}},u={},m=[{value:"Apify Class",id:"apify-class",level:2},{value:"Apify.addWebhook(options)",id:"apifyaddwebhookoptions",level:2},{value:"Apify.call(actId, [input], [options])",id:"apifycallactid-input-options",level:2},{value:"Apify.callTask(taskId, [input], [options])",id:"apifycalltasktaskid-input-options",level:2},{value:"Apify.createProxyConfiguration([proxyConfigurationOptions])",id:"apifycreateproxyconfigurationproxyconfigurationoptions",level:2},{value:"Apify.events",id:"apifyevents",level:2},{value:"Apify.getEnv()",id:"apifygetenv",level:2},{value:"Apify.getInput()",id:"apifygetinput",level:2},{value:"Apify.getMemoryInfo()",id:"apifygetmemoryinfo",level:2},{value:"Apify.getValue(key)",id:"apifygetvaluekey",level:2},{value:"Apify.isAtHome()",id:"apifyisathome",level:2},{value:"Apify.launchPlaywright([launchContext])",id:"apifylaunchplaywrightlaunchcontext",level:2},{value:"Apify.launchPuppeteer([launchContext])",id:"apifylaunchpuppeteerlaunchcontext",level:2},{value:"Apify.main(userFunc)",id:"apifymainuserfunc",level:2},{value:"Apify.metamorph(targetActorId, [input], [options])",id:"apifymetamorphtargetactorid-input-options",level:2},{value:"Apify.newClient([options])",id:"apifynewclientoptions",level:2},{value:"Apify.openDataset([datasetIdOrName], [options])",id:"apifyopendatasetdatasetidorname-options",level:2},{value:"Apify.openKeyValueStore([storeIdOrName], [options])",id:"apifyopenkeyvaluestorestoreidorname-options",level:2},{value:"Apify.openRequestList(listName, sources, [options])",id:"apifyopenrequestlistlistname-sources-options",level:2},{value:"Apify.openRequestQueue([queueIdOrName], [options])",id:"apifyopenrequestqueuequeueidorname-options",level:2},{value:"Apify.openSessionPool(sessionPoolOptions)",id:"apifyopensessionpoolsessionpooloptions",level:2},{value:"Apify.pushData(item)",id:"apifypushdataitem",level:2},{value:"Apify.setValue(key, value, [options])",id:"apifysetvaluekey-value-options",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,i.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"apify"}),(0,i.kt)("p",null,"The following section describes all functions and properties provided by the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify")," package, except individual classes and namespaces that have their\nseparate, detailed, documentation pages accessible from the left sidebar. To learn how Apify SDK works, we suggest following the\n",(0,i.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started")," tutorial."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Important:")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The following functions: ",(0,i.kt)("inlineCode",{parentName:"p"},"addWebhook"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"call"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"newClient")," invoke features of the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," and\nrequire your scripts to be authenticated. See the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#logging-into-apify-platform-from-apify-sdk",target:null,rel:null},"authentication guide")," for\ninstructions.")),(0,i.kt)("h2",{id:"apify-class"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify")," Class"),(0,i.kt)("p",null,"As opposed to those helper functions, there is an alternative approach using ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," class (a named export). It has mostly the same API, but the\nmethods on ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," instance will use the configuration provided in the constructor. Environment variables will have precedence over this\nconfiguration."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n\n// the token will be passed to the `call` method automatically\nconst run = await sdk.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Another example shows how the default dataset name can be changed:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ defaultDatasetId: 'custom-name' });\nawait sdk.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify'); // use default export to get the helper functions\n\nconst dataset = await Apify.openDataset('custom-name');\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," for details about what can be configured and what are the default values."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addwebhook"}),(0,i.kt)("h2",{id:"apifyaddwebhookoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.addWebhook(options)")),(0,i.kt)("p",null,"Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed. For more information\nabout Apify actor webhooks, please see the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,"Note that webhooks are only supported for actors running on the Apify platform. In local environment, the function will print a warning and have no\neffect."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"eventTypes")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/event-types",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"EventTypes"))," - Array of event types, which you can set for actor run, see the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/events#actor-run",target:"_blank",rel:"noopener"},"actor run events")," in the Apify doc."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestUrl")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - URL which will be requested using HTTP POST request, when actor run will reach the set event type."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[payloadTemplate]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Payload template is a JSON-like string that describes the structure of the webhook POST request payload.\nIt uses JSON syntax, extended with a double curly braces syntax for injecting variables ",(0,i.kt)("inlineCode",{parentName:"li"},"{{variable}}"),". Those variables are resolved at the\ntime of the webhook's dispatch, and a list of available variables with their descriptions is available in the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"Apify webhook documentation"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"payloadTemplate")," is omitted, the default payload template is used\n(",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/actions#payload-template",target:"_blank",rel:"noopener"},"view docs"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[idempotencyKey]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Idempotency key enables you to ensure that a webhook will not be added multiple times in case of an actor\nrestart or other situation that would cause the ",(0,i.kt)("inlineCode",{parentName:"li"},"addWebhook()")," function to be called again. We suggest using the actor run ID as the\nidempotency key. You can get the run ID by calling ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#getenv",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/webhook-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(WebhookRun|undefined)>"))," - The return value is the Webhook object. For more information, see the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook",target:"_blank",rel:"noopener"},"Get webhook")," API endpoint."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"call"}),(0,i.kt)("h2",{id:"apifycallactid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.call(actId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the actor to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run fails, the function throws the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"If you want to run an actor task rather than an actor, please use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.callTask()"))," function instead."),(0,i.kt)("p",null,"For more information about actors, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"call()")," function invokes the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Run actor")," and several other\nAPI endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"actId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/actor-name")," or actor ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor run. If not provided, the run uses memory of\nthe default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor run to finish, in seconds. If the limit is reached, the returned promise is\nresolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[fetchOutput]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"false")," then the function does not fetch output of the actor."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[disableBodyParser]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function will not attempt to parse the actor's output and will\nreturn it in a raw ",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"calltask"}),(0,i.kt)("h2",{id:"apifycalltasktaskid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.callTask(taskId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor task on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the task to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run failed, the function fails with ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"Note that an actor task is a saved input configuration and options for an actor. If you want to run an actor directly rather than an actor task,\nplease use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function instead."),(0,i.kt)("p",null,"For more information about actor tasks, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/tasks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.callTask('bob/some-task');\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask()")," function calls the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actor-tasks/run-collection/run-task",target:"_blank",rel:"noopener"},"Run task")," and several\nother API endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"taskId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/task-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/task-name")," or task ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input overrides for the actor task. If it is an object, it will be stringified to JSON and its content type\nset to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Provided input will be merged with actor task input."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor task run. If not provided, the run uses memory\nof the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor task run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor task run to finish, in seconds. If the limit is reached, the returned promise\nis resolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor task to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"createproxyconfiguration"}),(0,i.kt)("h2",{id:"apifycreateproxyconfigurationproxyconfigurationoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.createProxyConfiguration([proxyConfigurationOptions])")),(0,i.kt)("p",null,"Creates a proxy configuration and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that is\nalready initialized."),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\n// Returns initialized proxy configuration class\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify proxy groups\n countryCode: 'US'\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("p",null,"For compatibility with existing Actor Input UI (Input Schema), this function returns ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," when the following object is passed as\n",(0,i.kt)("inlineCode",{parentName:"p"},"proxyConfigurationOptions"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{ useApifyProxy: false }\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[proxyConfigurationOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(ProxyConfiguration|undefined)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"events"}),(0,i.kt)("h2",{id:"apifyevents"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.events")),(0,i.kt)("p",null,"Gets an instance of a Node.js' ",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/events.html#events_class_eventemitter",target:"_blank",rel:"noopener"},"EventEmitter")," class that emits various events from the\nSDK or the Apify platform. The event emitter is initialized by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.events.on('cpuInfo', data => {\n if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');\n});\n")),(0,i.kt)("p",null,"The following events are emitted:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"cpuInfo"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isCpuOverloaded": Boolean }')," The event is emitted approximately every second and it indicates whether the actor is using the\nmaximum of available CPU resources. If that's the case, the actor should not add more workload. For example, this event is used by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"migrating"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"void")," Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon. You can use it to\npersist the state of the actor and gracefully stop your in-progress tasks, so that they are not interrupted by the migration. For example, this is\nused by the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"aborting"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"void")," When a user aborts an actor run on the Apify platform, they can choose to abort gracefully to allow the actor some time before\ngetting killed. This graceful abort emits the ",(0,i.kt)("inlineCode",{parentName:"li"},"aborting")," event which the SDK uses to gracefully stop running crawls and you can use it to do your\nown cleanup as well."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"persistState"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isMigrating": Boolean }')," Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is\ntime to persist their state, in order to avoid repeating all work when the actor restarts. This event is automatically emitted together with the\n",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event, in which case the ",(0,i.kt)("inlineCode",{parentName:"li"},"isMigrating")," flag is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),". Otherwise the flag is ",(0,i.kt)("inlineCode",{parentName:"li"},"false"),". Note that the ",(0,i.kt)("inlineCode",{parentName:"li"},"persistState")," event is\nprovided merely for user convenience, you can achieve the same effect using ",(0,i.kt)("inlineCode",{parentName:"li"},"setInterval()")," and listening for the ",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getenv"}),(0,i.kt)("h2",{id:"apifygetenv"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getEnv()")),(0,i.kt)("p",null,"Returns a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))," object which contains information parsed from all the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables."),(0,i.kt)("p",null,"For the list of the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables, see ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#environment-variables",target:"_blank",rel:"noopener"},"Actor documentation"),". If some of\nthe variables are not defined or are invalid, the corresponding value in the resulting object will be null."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getinput"}),(0,i.kt)("h2",{id:"apifygetinput"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getInput()")),(0,i.kt)("p",null,"Gets the actor input value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"keyValueStore.getValue('INPUT')")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.getValue('INPUT');\n")),(0,i.kt)("p",null,"Note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"getInput()")," function does not cache the value read from the key-value store. If you need to use the input multiple times in your actor,\nit is far more efficient to read it once and store it locally."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getmemoryinfo"}),(0,i.kt)("h2",{id:"apifygetmemoryinfo"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getMemoryInfo()")),(0,i.kt)("p",null,"Returns memory statistics of the process and the system, see ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"MemoryInfo")),"."),(0,i.kt)("p",null,"If the process runs inside of Docker, the ",(0,i.kt)("inlineCode",{parentName:"p"},"getMemoryInfo")," gets container memory limits, otherwise it gets system memory limits."),(0,i.kt)("p",null,"Beware that the function is quite inefficient because it spawns a new process. Therefore you shouldn't call it too often, like more than once per\nsecond."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getvalue"}),(0,i.kt)("h2",{id:"apifygetvaluekey"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getValue(key)")),(0,i.kt)("p",null,"Gets a value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const value = await Apify.getValue('my-key');\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst value = await store.getValue('my-key');\n")),(0,i.kt)("p",null,"To store the value to the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isathome"}),(0,i.kt)("h2",{id:"apifyisathome"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.isAtHome()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," when code is running on Apify platform and ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," otherwise (for example locally)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchplaywright"}),(0,i.kt)("h2",{id:"apifylaunchplaywrightlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPlaywright([launchContext])")),(0,i.kt)("p",null,"Launches headless browsers using Playwright pre-configured to work within the Apify platform. The function has the same return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"browserType.launch()"),". See ",(0,i.kt)("a",{href:"https://playwright.dev/docs/api/class-browsertype",target:"_blank"}," Playwright documentation")," for more\ndetails."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPlaywright()")," function alters the following Playwright options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"launchOptions")," in a proper format. The proxy URL must define a port number and have one\nof the following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPlaywright")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/playwright",target:"_blank",rel:"noopener"},"Playwright")," NPM package installed in your project. When running\non the Apify Platform, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-*")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," - Optional settings passed to ",(0,i.kt)("inlineCode",{parentName:"li"},"browserType.launch()"),". In\naddition to ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions",target:"_blank",rel:"noopener"},"Playwright's options")," the object may\ncontain our own ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," that enable additional features.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchpuppeteer"}),(0,i.kt)("h2",{id:"apifylaunchpuppeteerlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPuppeteer([launchContext])")),(0,i.kt)("p",null,"Launches headless Chrome using Puppeteer pre-configured to work within the Apify platform. The function has the same argument and the return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"puppeteer.launch()"),". See ",(0,i.kt)("a",{href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions",target:"_blank"}," Puppeteer\ndocumentation")," for more details."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPuppeteer()")," function alters the following Puppeteer options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"args")," as ",(0,i.kt)("inlineCode",{parentName:"li"},"--proxy-server=XXX"),". The proxy URL must define a port number and have one of\nthe following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPuppeteer")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/puppeteer",target:"_blank",rel:"noopener"},"puppeteer")," NPM package installed in your project. When running on\nthe Apify cloud, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-chrome")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,"For an example of usage, see the ",(0,i.kt)("a",{parentName:"p",href:"../examples/synchronous-run",target:null,rel:null},"Synchronous run Example")," or the\n",(0,i.kt)("a",{parentName:"p",href:"../examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer proxy Example")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLauncher")," parameters are passed via an\nlaunchContext object. If you want to pass custom ",(0,i.kt)("inlineCode",{parentName:"li"},"puppeteer.launch(options)")," options you can use the ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLaunchContext.launchOptions"),"\nproperty.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"main"}),(0,i.kt)("h2",{id:"apifymainuserfunc"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.main(userFunc)")),(0,i.kt)("p",null,"Runs the main user function that performs the job of the actor and terminates the process when the user function finishes."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"The ",(0,i.kt)("inlineCode",{parentName:"strong"},"Apify.main()")," function is optional")," and is provided merely for your convenience. It is mainly useful when you're running your code as an actor\non the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),". However, if you want to use Apify SDK tools directly inside your existing projects, e.g. running in\nan ",(0,i.kt)("a",{parentName:"p",href:"https://expressjs.com/",target:"_blank",rel:"noopener"},"Express")," server, on ",(0,i.kt)("a",{parentName:"p",href:"https://cloud.google.com/functions",target:"_blank",rel:"noopener"},"Google Cloud functions")," or\n",(0,i.kt)("a",{parentName:"p",href:"https://aws.amazon.com/lambda/",target:"_blank",rel:"noopener"},"AWS Lambda"),", it's better to avoid it since the function terminates the main process when it finishes!"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.main()")," function performs the following actions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"When running on the Apify platform (i.e. ",(0,i.kt)("code",null,"APIFY_IS_AT_HOME")," environment variable is set), it sets up a connection to listen for\nplatform events. For example, to get a notification about an imminent migration to another server. See ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events"))," for\ndetails."),(0,i.kt)("li",{parentName:"ul"},"It checks that either ",(0,i.kt)("code",null,"APIFY_TOKEN")," or ",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," environment variable is defined. If not, the functions sets",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," to ",(0,i.kt)("code",null,"./apify_storage")," inside the current working directory. This is to simplify running code examples."),(0,i.kt)("li",{parentName:"ul"},"It invokes the user function passed as the ",(0,i.kt)("code",null,"userFunc")," parameter."),(0,i.kt)("li",{parentName:"ul"},"If the user function returned a promise, waits for it to resolve."),(0,i.kt)("li",{parentName:"ul"},"If the user function throws an exception or some other error is encountered, prints error details to console so that they are stored to the log."),(0,i.kt)("li",{parentName:"ul"},"Exits the Node.js process, with zero exit code on success and non-zero on errors.")),(0,i.kt)("p",null,"The user function can be synchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(() => {\n // My synchronous function that returns immediately\n console.log('Hello world from actor!');\n});\n")),(0,i.kt)("p",null,"If the user function returns a promise, it is considered asynchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const { requestAsBrowser } = require('some-request-library');\n\nApify.main(() => {\n // My asynchronous function that returns a promise\n return request('http://www.example.com').then(html => {\n console.log(html);\n });\n});\n")),(0,i.kt)("p",null,"To simplify your code, you can take advantage of the ",(0,i.kt)("inlineCode",{parentName:"p"},"async"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = require('some-request-library');\n\nApify.main(async () => {\n // My asynchronous function\n const html = await request('http://www.example.com');\n console.log(html);\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"userFunc")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/user-func",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"UserFunc"))," - User function to be executed. If it returns a promise, the promise will be awaited. The user\nfunction is called with no arguments.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"metamorph"}),(0,i.kt)("h2",{id:"apifymetamorphtargetactorid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.metamorph(targetActorId, [input], [options])")),(0,i.kt)("p",null,"Transforms this actor run to an actor run of a given actor. The system stops the current container and starts the new container instead. All the\ndefault storages are preserved and the new input is stored under the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT-METAMORPH-1")," key in the same default key-value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"targetActorId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Either ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name")," or actor ID of an actor to which we want to metamorph."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the target actor build to metamorph into (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses\nbuild tag or number from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),").")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newclient"}),(0,i.kt)("h2",{id:"apifynewclientoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.newClient([options])")),(0,i.kt)("p",null,"Returns a new instance of the Apify API client. The ",(0,i.kt)("inlineCode",{parentName:"p"},"ApifyClient")," class is provided by the"),(0,i.kt)("a",{href:"https://www.npmjs.com/package/apify-client",target:"_blank"},"apify-client")," NPM package, and it is automatically configured using the `APIFY_API_BASE_URL`, and `APIFY_TOKEN` environment variables. You can override the token via the available options. That's useful if you want to use the client as a different Apify user than the SDK internals are using.",(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string"))))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opendataset"}),(0,i.kt)("h2",{id:"apifyopendatasetdatasetidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openDataset([datasetIdOrName], [options])")),(0,i.kt)("p",null,"Opens a dataset and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. The\nactual data is stored either on the local filesystem or in the cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[datasetIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the dataset to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default dataset\nassociated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[config]")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," - SDK configuration instance, defaults to the static register")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openkeyvaluestore"}),(0,i.kt)("h2",{id:"apifyopenkeyvaluestorestoreidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openKeyValueStore([storeIdOrName], [options])")),(0,i.kt)("p",null,"Opens a key-value store and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,"Key-value stores are used to store records or files, along with their MIME content type. The records are stored and retrieved using a unique key. The\nactual data is stored either on a local filesystem or in the Apify cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[storeIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the key-value store to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default\nkey-value store associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[config]")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," - SDK configuration instance, defaults to the static register")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestlist"}),(0,i.kt)("h2",{id:"apifyopenrequestlistlistname-sources-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestList(listName, sources, [options])")),(0,i.kt)("p",null,"Opens a request list and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that is already initialized."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," represents a list of URLs to crawl, which is always stored in memory. To enable picking up where left off after a\nprocess restart, the request list sources are persisted to the key-value store at initialization of the list. Then, while crawling, a small state\nobject is regularly persisted to keep track of the crawling status."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sources = ['https://www.example.com', 'https://www.google.com', 'https://www.bing.com'];\n\nconst requestList = await Apify.openRequestList('my-name', sources);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"listName")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," - Name of the request list to be opened. Setting a name enables the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to be persisted in the\nkey-value store. This is useful in case of a restart or migration. Since ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is only stored in memory, a restart or migration wipes it\nclean. Setting a name will enable the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to survive those situations and continue where it left off."),(0,i.kt)("p",{parentName:"li"},"The name will be used as a prefix in key-value store, producing keys such as ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_STATE")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_SOURCES"),"."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),", the list will not be persisted and will only be stored in memory. Process restart will then cause the list to be crawled again from the\nbeginning. We suggest always using a name.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"sources")),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|string)>"))," - An array of sources of URLs for the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," initializes. This is a measure to\nprevent memory leaks in situations when millions of sources are added."))),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," to download the\nsource URLs from a given remote location. The URLs will be parsed from the received response. In this case you can limit the URLs using ",(0,i.kt)("inlineCode",{parentName:"p"},"regex"),"\nparameter containing regular expression pattern for URLs to be included."),(0,i.kt)("p",null,"For details, see the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - The ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," options. Note that the\n",(0,i.kt)("inlineCode",{parentName:"li"},"listName")," parameter supersedes the ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persiststatekey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistStateKey"))," and\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey"))," options and the ",(0,i.kt)("inlineCode",{parentName:"li"},"sources")," parameter supersedes the\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," option.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestqueue"}),(0,i.kt)("h2",{id:"apifyopenrequestqueuequeueidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestQueue([queueIdOrName], [options])")),(0,i.kt)("p",null,"Opens a request queue and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud. The queue is\nused for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports\nboth breadth-first and depth-first crawling orders."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[queueIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the request queue to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default request\nqueue associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opensessionpool"}),(0,i.kt)("h2",{id:"apifyopensessionpoolsessionpooloptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openSessionPool(sessionPoolOptions)")),(0,i.kt)("p",null,"Opens a SessionPool and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that is already initialized."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionPoolOptions")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"pushdata"}),(0,i.kt)("h2",{id:"apifypushdataitem"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.pushData(item)")),(0,i.kt)("p",null,"Stores an object or an array of objects to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," of the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset();\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,i.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data are stored!"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object or array of objects containing data to be stored in the default dataset. The objects must be serializable to JSON\nand the JSON representation of each object must be smaller than 9MB.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"setvalue"}),(0,i.kt)("h2",{id:"apifysetvaluekey-value-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.setValue(key, value, [options])")),(0,i.kt)("p",null,"Stores or deletes a value in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"To get a value from the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," - Record data, which can be one of the following values:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,i.kt)("li",{parentName:"ul"},"If no ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(n),k=r,c=m["".concat(p,".").concat(k)]||m[k]||d[k]||i;return n?a.createElement(c,o(o({ref:t},u),{},{components:n})):a.createElement(c,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:r,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>m});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-2.3.0-apify",title:"Apify",id:"apify"},p=void 0,s={unversionedId:"api/apify",id:"version-2.3/api/apify",title:"Apify",description:"The following section describes all functions and properties provided by the apify package, except individual classes and namespaces that have their",source:"@site/versioned_docs/version-2.3/api/Apify.md",sourceDirName:"api",slug:"/api/apify",permalink:"/sdk/js/docs/2.3/api/apify",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Apify.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-apify",title:"Apify",id:"apify"},sidebar:"version-2.3/docs",previous:{title:"Use stealth mode",permalink:"/sdk/js/docs/2.3/examples/use-stealth-mode"},next:{title:"Configuration",permalink:"/sdk/js/docs/2.3/api/configuration"}},u={},m=[{value:"Apify Class",id:"apify-class",level:2},{value:"Apify.addWebhook(options)",id:"apifyaddwebhookoptions",level:2},{value:"Apify.call(actId, [input], [options])",id:"apifycallactid-input-options",level:2},{value:"Apify.callTask(taskId, [input], [options])",id:"apifycalltasktaskid-input-options",level:2},{value:"Apify.createProxyConfiguration([proxyConfigurationOptions])",id:"apifycreateproxyconfigurationproxyconfigurationoptions",level:2},{value:"Apify.events",id:"apifyevents",level:2},{value:"Apify.getEnv()",id:"apifygetenv",level:2},{value:"Apify.getInput()",id:"apifygetinput",level:2},{value:"Apify.getMemoryInfo()",id:"apifygetmemoryinfo",level:2},{value:"Apify.getValue(key)",id:"apifygetvaluekey",level:2},{value:"Apify.isAtHome()",id:"apifyisathome",level:2},{value:"Apify.launchPlaywright([launchContext])",id:"apifylaunchplaywrightlaunchcontext",level:2},{value:"Apify.launchPuppeteer([launchContext])",id:"apifylaunchpuppeteerlaunchcontext",level:2},{value:"Apify.main(userFunc)",id:"apifymainuserfunc",level:2},{value:"Apify.metamorph(targetActorId, [input], [options])",id:"apifymetamorphtargetactorid-input-options",level:2},{value:"Apify.newClient([options])",id:"apifynewclientoptions",level:2},{value:"Apify.openDataset([datasetIdOrName], [options])",id:"apifyopendatasetdatasetidorname-options",level:2},{value:"Apify.openKeyValueStore([storeIdOrName], [options])",id:"apifyopenkeyvaluestorestoreidorname-options",level:2},{value:"Apify.openRequestList(listName, sources, [options])",id:"apifyopenrequestlistlistname-sources-options",level:2},{value:"Apify.openRequestQueue([queueIdOrName], [options])",id:"apifyopenrequestqueuequeueidorname-options",level:2},{value:"Apify.openSessionPool(sessionPoolOptions)",id:"apifyopensessionpoolsessionpooloptions",level:2},{value:"Apify.pushData(item)",id:"apifypushdataitem",level:2},{value:"Apify.setValue(key, value, [options])",id:"apifysetvaluekey-value-options",level:2}],d={toc:m},k="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,i.kt)(k,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"apify"}),(0,i.kt)("p",null,"The following section describes all functions and properties provided by the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify")," package, except individual classes and namespaces that have their\nseparate, detailed, documentation pages accessible from the left sidebar. To learn how Apify SDK works, we suggest following the\n",(0,i.kt)("a",{parentName:"p",href:"../guides/getting-started",target:null,rel:null},"Getting Started")," tutorial."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Important:")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The following functions: ",(0,i.kt)("inlineCode",{parentName:"p"},"addWebhook"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"call"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"newClient")," invoke features of the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," and\nrequire your scripts to be authenticated. See the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#logging-into-apify-platform-from-apify-sdk",target:null,rel:null},"authentication guide")," for\ninstructions.")),(0,i.kt)("h2",{id:"apify-class"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify")," Class"),(0,i.kt)("p",null,"As opposed to those helper functions, there is an alternative approach using ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," class (a named export). It has mostly the same API, but the\nmethods on ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify")," instance will use the configuration provided in the constructor. Environment variables will have precedence over this\nconfiguration."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ token: '123' });\nconsole.log(sdk.config.get('token')); // '123'\n\n// the token will be passed to the `call` method automatically\nconst run = await sdk.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Another example shows how the default dataset name can be changed:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { Apify } = require('apify'); // use named export to get the class\n\nconst sdk = new Apify({ defaultDatasetId: 'custom-name' });\nawait sdk.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify'); // use default export to get the helper functions\n\nconst dataset = await Apify.openDataset('custom-name');\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"See ",(0,i.kt)("a",{parentName:"p",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," for details about what can be configured and what are the default values."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addwebhook"}),(0,i.kt)("h2",{id:"apifyaddwebhookoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.addWebhook(options)")),(0,i.kt)("p",null,"Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed. For more information\nabout Apify actor webhooks, please see the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,"Note that webhooks are only supported for actors running on the Apify platform. In local environment, the function will print a warning and have no\neffect."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"eventTypes")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/event-types",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"EventTypes"))," - Array of event types, which you can set for actor run, see the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/events#actor-run",target:"_blank",rel:"noopener"},"actor run events")," in the Apify doc."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestUrl")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - URL which will be requested using HTTP POST request, when actor run will reach the set event type."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[payloadTemplate]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Payload template is a JSON-like string that describes the structure of the webhook POST request payload.\nIt uses JSON syntax, extended with a double curly braces syntax for injecting variables ",(0,i.kt)("inlineCode",{parentName:"li"},"{{variable}}"),". Those variables are resolved at the\ntime of the webhook's dispatch, and a list of available variables with their descriptions is available in the\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"Apify webhook documentation"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"payloadTemplate")," is omitted, the default payload template is used\n(",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/actions#payload-template",target:"_blank",rel:"noopener"},"view docs"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[idempotencyKey]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Idempotency key enables you to ensure that a webhook will not be added multiple times in case of an actor\nrestart or other situation that would cause the ",(0,i.kt)("inlineCode",{parentName:"li"},"addWebhook()")," function to be called again. We suggest using the actor run ID as the\nidempotency key. You can get the run ID by calling ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#getenv",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/webhook-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(WebhookRun|undefined)>"))," - The return value is the Webhook object. For more information, see the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook",target:"_blank",rel:"noopener"},"Get webhook")," API endpoint."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"call"}),(0,i.kt)("h2",{id:"apifycallactid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.call(actId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the actor to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run fails, the function throws the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"If you want to run an actor task rather than an actor, please use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.callTask()"))," function instead."),(0,i.kt)("p",null,"For more information about actors, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.call('apify/hello-world', { myInput: 123 });\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"call()")," function invokes the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Run actor")," and several other\nAPI endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"actId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/actor-name")," or actor ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor run. If not provided, the run uses memory of\nthe default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor run to finish, in seconds. If the limit is reached, the returned promise is\nresolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[fetchOutput]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"false")," then the function does not fetch output of the actor."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[disableBodyParser]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function will not attempt to parse the actor's output and will\nreturn it in a raw ",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"calltask"}),(0,i.kt)("h2",{id:"apifycalltasktaskid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.callTask(taskId, [input], [options])")),(0,i.kt)("p",null,"Runs an actor task on the Apify platform using the current user account (determined by the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable), waits for the task to\nfinish and fetches its output."),(0,i.kt)("p",null,"By passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitSecs")," option you can reduce the maximum amount of time to wait for the run to finish. If the value is less than or equal to zero,\nthe function returns immediately after the run is started."),(0,i.kt)("p",null,"The result of the function is an ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ActorRun"))," object that contains details about the actor run and its output (if any). If the\nactor run failed, the function fails with ",(0,i.kt)("a",{parentName:"p",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," exception."),(0,i.kt)("p",null,"Note that an actor task is a saved input configuration and options for an actor. If you want to run an actor directly rather than an actor task,\nplease use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," function instead."),(0,i.kt)("p",null,"For more information about actor tasks, read the ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/tasks",target:"_blank",rel:"noopener"},"documentation"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const run = await Apify.callTask('bob/some-task');\nconsole.log(`Received message: ${run.output.body.message}`);\n")),(0,i.kt)("p",null,"Internally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"callTask()")," function calls the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actor-tasks/run-collection/run-task",target:"_blank",rel:"noopener"},"Run task")," and several\nother API endpoints to obtain the output."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Throws"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"../api/apify-call-error",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyCallError"))," If the run did not succeed, e.g. if it failed or timed out.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"taskId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Allowed formats are ",(0,i.kt)("inlineCode",{parentName:"li"},"username/task-name"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"userId/task-name")," or task ID."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input overrides for the actor task. If it is an object, it will be stringified to JSON and its content type\nset to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Provided input will be merged with actor task input."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - User API token that is used to run the actor. By default, it is taken from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_TOKEN")," environment variable."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[memoryMbytes]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Memory in megabytes which will be allocated for the new actor task run. If not provided, the run uses memory\nof the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Timeout for the actor task run in seconds. Zero value means there is no timeout. If not provided, the run uses\ntimeout of the default actor run configuration."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the actor build to run (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses build tag or\nnumber from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),")."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," - Maximum time to wait for the actor task run to finish, in seconds. If the limit is reached, the returned promise\nis resolved to a run object that will have status ",(0,i.kt)("inlineCode",{parentName:"li"},"READY")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"RUNNING")," and it will not contain the actor run output. If ",(0,i.kt)("inlineCode",{parentName:"li"},"waitSecs")," is null or\nundefined, the function waits for the actor task to finish (default behavior)."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[webhooks]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/adhoc-webhook",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array"))," - Specifies optional webhooks associated with the actor run, which can be\nused to receive a notification e.g. when the actor finished or failed, see\n",(0,i.kt)("a",{parentName:"li",href:"https://docs.apify.com/webhooks/ad-hoc-webhooks",target:"_blank",rel:"noopener"},"ad hook webhooks documentation")," for detailed description.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/actor-run",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"createproxyconfiguration"}),(0,i.kt)("h2",{id:"apifycreateproxyconfigurationproxyconfigurationoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.createProxyConfiguration([proxyConfigurationOptions])")),(0,i.kt)("p",null,"Creates a proxy configuration and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that is\nalready initialized."),(0,i.kt)("p",null,"Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking your crawlers based\non IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for\nall connections."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"\n// Returns initialized proxy configuration class\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify proxy groups\n countryCode: 'US'\n});\n\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n const usedProxyUrl = proxyInfo.url; // Getting the proxy URL\n }\n})\n\n")),(0,i.kt)("p",null,"For compatibility with existing Actor Input UI (Input Schema), this function returns ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined")," when the following object is passed as\n",(0,i.kt)("inlineCode",{parentName:"p"},"proxyConfigurationOptions"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{ useApifyProxy: false }\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[proxyConfigurationOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise<(ProxyConfiguration|undefined)>"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"events"}),(0,i.kt)("h2",{id:"apifyevents"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.events")),(0,i.kt)("p",null,"Gets an instance of a Node.js' ",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/events.html#events_class_eventemitter",target:"_blank",rel:"noopener"},"EventEmitter")," class that emits various events from the\nSDK or the Apify platform. The event emitter is initialized by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.events.on('cpuInfo', data => {\n if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');\n});\n")),(0,i.kt)("p",null,"The following events are emitted:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"cpuInfo"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isCpuOverloaded": Boolean }')," The event is emitted approximately every second and it indicates whether the actor is using the\nmaximum of available CPU resources. If that's the case, the actor should not add more workload. For example, this event is used by the\n",(0,i.kt)("a",{parentName:"li",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"migrating"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"void")," Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon. You can use it to\npersist the state of the actor and gracefully stop your in-progress tasks, so that they are not interrupted by the migration. For example, this is\nused by the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"aborting"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"void")," When a user aborts an actor run on the Apify platform, they can choose to abort gracefully to allow the actor some time before\ngetting killed. This graceful abort emits the ",(0,i.kt)("inlineCode",{parentName:"li"},"aborting")," event which the SDK uses to gracefully stop running crawls and you can use it to do your\nown cleanup as well."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"persistState"),": ",(0,i.kt)("inlineCode",{parentName:"li"},'{ "isMigrating": Boolean }')," Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is\ntime to persist their state, in order to avoid repeating all work when the actor restarts. This event is automatically emitted together with the\n",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event, in which case the ",(0,i.kt)("inlineCode",{parentName:"li"},"isMigrating")," flag is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),". Otherwise the flag is ",(0,i.kt)("inlineCode",{parentName:"li"},"false"),". Note that the ",(0,i.kt)("inlineCode",{parentName:"li"},"persistState")," event is\nprovided merely for user convenience, you can achieve the same effect using ",(0,i.kt)("inlineCode",{parentName:"li"},"setInterval()")," and listening for the ",(0,i.kt)("inlineCode",{parentName:"li"},"migrating")," event.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getenv"}),(0,i.kt)("h2",{id:"apifygetenv"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getEnv()")),(0,i.kt)("p",null,"Returns a new ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))," object which contains information parsed from all the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables."),(0,i.kt)("p",null,"For the list of the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environment variables, see ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#environment-variables",target:"_blank",rel:"noopener"},"Actor documentation"),". If some of\nthe variables are not defined or are invalid, the corresponding value in the resulting object will be null."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/apify-env",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyEnv"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getinput"}),(0,i.kt)("h2",{id:"apifygetinput"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getInput()")),(0,i.kt)("p",null,"Gets the actor input value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"keyValueStore.getValue('INPUT')")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.getValue('INPUT');\n")),(0,i.kt)("p",null,"Note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"getInput()")," function does not cache the value read from the key-value store. If you need to use the input multiple times in your actor,\nit is far more efficient to read it once and store it locally."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getmemoryinfo"}),(0,i.kt)("h2",{id:"apifygetmemoryinfo"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getMemoryInfo()")),(0,i.kt)("p",null,"Returns memory statistics of the process and the system, see ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"MemoryInfo")),"."),(0,i.kt)("p",null,"If the process runs inside of Docker, the ",(0,i.kt)("inlineCode",{parentName:"p"},"getMemoryInfo")," gets container memory limits, otherwise it gets system memory limits."),(0,i.kt)("p",null,"Beware that the function is quite inefficient because it spawns a new process. Therefore you shouldn't call it too often, like more than once per\nsecond."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/memory-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getvalue"}),(0,i.kt)("h2",{id:"apifygetvaluekey"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.getValue(key)")),(0,i.kt)("p",null,"Gets a value from the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const value = await Apify.getValue('my-key');\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst value = await store.getValue('my-key');\n")),(0,i.kt)("p",null,"To store the value to the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Object|string|Buffer|null)>")," - Returns a promise that resolves to an object, string or\n",(0,i.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record, or ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," if the record is missing."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"isathome"}),(0,i.kt)("h2",{id:"apifyisathome"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.isAtHome()")),(0,i.kt)("p",null,"Returns ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," when code is running on Apify platform and ",(0,i.kt)("inlineCode",{parentName:"p"},"false")," otherwise (for example locally)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchplaywright"}),(0,i.kt)("h2",{id:"apifylaunchplaywrightlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPlaywright([launchContext])")),(0,i.kt)("p",null,"Launches headless browsers using Playwright pre-configured to work within the Apify platform. The function has the same return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"browserType.launch()"),". See ",(0,i.kt)("a",{href:"https://playwright.dev/docs/api/class-browsertype",target:"_blank"}," Playwright documentation")," for more\ndetails."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPlaywright()")," function alters the following Playwright options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"launchOptions")," in a proper format. The proxy URL must define a port number and have one\nof the following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPlaywright")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/playwright",target:"_blank",rel:"noopener"},"Playwright")," NPM package installed in your project. When running\non the Apify Platform, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-*")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," - Optional settings passed to ",(0,i.kt)("inlineCode",{parentName:"li"},"browserType.launch()"),". In\naddition to ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions",target:"_blank",rel:"noopener"},"Playwright's options")," the object may\ncontain our own ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))," that enable additional features.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"launchpuppeteer"}),(0,i.kt)("h2",{id:"apifylaunchpuppeteerlaunchcontext"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.launchPuppeteer([launchContext])")),(0,i.kt)("p",null,"Launches headless Chrome using Puppeteer pre-configured to work within the Apify platform. The function has the same argument and the return value as\n",(0,i.kt)("inlineCode",{parentName:"p"},"puppeteer.launch()"),". See ",(0,i.kt)("a",{href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions",target:"_blank"}," Puppeteer\ndocumentation")," for more details."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"launchPuppeteer()")," function alters the following Puppeteer options:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Passes the setting from the ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS")," environment variable to the ",(0,i.kt)("inlineCode",{parentName:"li"},"headless")," option, unless it was already defined by the caller or\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_XVFB")," environment variable is set to ",(0,i.kt)("inlineCode",{parentName:"li"},"1"),". Note that Apify Actor cloud platform automatically sets ",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_HEADLESS=1")," to all running actors."),(0,i.kt)("li",{parentName:"ul"},"Takes the ",(0,i.kt)("inlineCode",{parentName:"li"},"proxyUrl")," option, validates it and adds it to ",(0,i.kt)("inlineCode",{parentName:"li"},"args")," as ",(0,i.kt)("inlineCode",{parentName:"li"},"--proxy-server=XXX"),". The proxy URL must define a port number and have one of\nthe following schemes: ",(0,i.kt)("inlineCode",{parentName:"li"},"http://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"https://"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"socks4://")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"socks5://"),". If the proxy is HTTP (i.e. has the ",(0,i.kt)("inlineCode",{parentName:"li"},"http://")," scheme) and contains\nusername or password, the ",(0,i.kt)("inlineCode",{parentName:"li"},"launchPuppeteer")," functions sets up an anonymous proxy HTTP to make the proxy work with headless Chrome. For more\ninformation, read the",(0,i.kt)("a",{href:"https://blog.apify.com/how-to-make-headless-chrome-and-puppeteer-use-a-proxy-server-with-authentication-249a21a79212",target:"_blank"},"blog post about proxy-chain library"),".")),(0,i.kt)("p",null,"To use this function, you need to have the ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/puppeteer",target:"_blank",rel:"noopener"},"puppeteer")," NPM package installed in your project. When running on\nthe Apify cloud, you can achieve that simply by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify/actor-node-chrome")," base Docker image for your actor - see\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build#base-images",target:"_blank",rel:"noopener"},"Apify Actor documentation")," for details."),(0,i.kt)("p",null,"For an example of usage, see the ",(0,i.kt)("a",{parentName:"p",href:"../examples/synchronous-run",target:null,rel:null},"Synchronous run Example")," or the\n",(0,i.kt)("a",{parentName:"p",href:"../examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer proxy Example")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[launchContext]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-launch-context",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerLaunchContext"))," - All ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLauncher")," parameters are passed via an\nlaunchContext object. If you want to pass custom ",(0,i.kt)("inlineCode",{parentName:"li"},"puppeteer.launch(options)")," options you can use the ",(0,i.kt)("inlineCode",{parentName:"li"},"PuppeteerLaunchContext.launchOptions"),"\nproperty.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")," - Promise that resolves to Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"Browser")," instance."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"main"}),(0,i.kt)("h2",{id:"apifymainuserfunc"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.main(userFunc)")),(0,i.kt)("p",null,"Runs the main user function that performs the job of the actor and terminates the process when the user function finishes."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"The ",(0,i.kt)("inlineCode",{parentName:"strong"},"Apify.main()")," function is optional")," and is provided merely for your convenience. It is mainly useful when you're running your code as an actor\non the ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"Apify platform"),". However, if you want to use Apify SDK tools directly inside your existing projects, e.g. running in\nan ",(0,i.kt)("a",{parentName:"p",href:"https://expressjs.com/",target:"_blank",rel:"noopener"},"Express")," server, on ",(0,i.kt)("a",{parentName:"p",href:"https://cloud.google.com/functions",target:"_blank",rel:"noopener"},"Google Cloud functions")," or\n",(0,i.kt)("a",{parentName:"p",href:"https://aws.amazon.com/lambda/",target:"_blank",rel:"noopener"},"AWS Lambda"),", it's better to avoid it since the function terminates the main process when it finishes!"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.main()")," function performs the following actions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"When running on the Apify platform (i.e. ",(0,i.kt)("code",null,"APIFY_IS_AT_HOME")," environment variable is set), it sets up a connection to listen for\nplatform events. For example, to get a notification about an imminent migration to another server. See ",(0,i.kt)("a",{parentName:"li",href:"../api/apify#events",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.events"))," for\ndetails."),(0,i.kt)("li",{parentName:"ul"},"It checks that either ",(0,i.kt)("code",null,"APIFY_TOKEN")," or ",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," environment variable is defined. If not, the functions sets",(0,i.kt)("code",null,"APIFY_LOCAL_STORAGE_DIR")," to ",(0,i.kt)("code",null,"./apify_storage")," inside the current working directory. This is to simplify running code examples."),(0,i.kt)("li",{parentName:"ul"},"It invokes the user function passed as the ",(0,i.kt)("code",null,"userFunc")," parameter."),(0,i.kt)("li",{parentName:"ul"},"If the user function returned a promise, waits for it to resolve."),(0,i.kt)("li",{parentName:"ul"},"If the user function throws an exception or some other error is encountered, prints error details to console so that they are stored to the log."),(0,i.kt)("li",{parentName:"ul"},"Exits the Node.js process, with zero exit code on success and non-zero on errors.")),(0,i.kt)("p",null,"The user function can be synchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"Apify.main(() => {\n // My synchronous function that returns immediately\n console.log('Hello world from actor!');\n});\n")),(0,i.kt)("p",null,"If the user function returns a promise, it is considered asynchronous:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const { requestAsBrowser } = require('some-request-library');\n\nApify.main(() => {\n // My asynchronous function that returns a promise\n return request('http://www.example.com').then(html => {\n console.log(html);\n });\n});\n")),(0,i.kt)("p",null,"To simplify your code, you can take advantage of the ",(0,i.kt)("inlineCode",{parentName:"p"},"async"),"/",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const request = require('some-request-library');\n\nApify.main(async () => {\n // My asynchronous function\n const html = await request('http://www.example.com');\n console.log(html);\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"userFunc")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/user-func",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"UserFunc"))," - User function to be executed. If it returns a promise, the promise will be awaited. The user\nfunction is called with no arguments.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"metamorph"}),(0,i.kt)("h2",{id:"apifymetamorphtargetactorid-input-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.metamorph(targetActorId, [input], [options])")),(0,i.kt)("p",null,"Transforms this actor run to an actor run of a given actor. The system stops the current container and starts the new container instead. All the\ndefault storages are preserved and the new input is stored under the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT-METAMORPH-1")," key in the same default key-value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"targetActorId")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Either ",(0,i.kt)("inlineCode",{parentName:"li"},"username/actor-name")," or actor ID of an actor to which we want to metamorph."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[input]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Input for the actor. If it is an object, it will be stringified to JSON and its content type set to\n",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". Otherwise the ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," parameter must be provided."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object with the settings below:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Content type for the ",(0,i.kt)("inlineCode",{parentName:"li"},"input"),". If not specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," is expected to be an object that will be stringified\nto JSON and content type set to ",(0,i.kt)("inlineCode",{parentName:"li"},"application/json; charset=utf-8"),". If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, then ",(0,i.kt)("inlineCode",{parentName:"li"},"input")," must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or\n",(0,i.kt)("inlineCode",{parentName:"li"},"Buffer"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[build]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Tag or number of the target actor build to metamorph into (e.g. ",(0,i.kt)("inlineCode",{parentName:"li"},"beta")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"1.2.345"),"). If not provided, the run uses\nbuild tag or number from the default actor run configuration (typically ",(0,i.kt)("inlineCode",{parentName:"li"},"latest"),").")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"newclient"}),(0,i.kt)("h2",{id:"apifynewclientoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.newClient([options])")),(0,i.kt)("p",null,"Returns a new instance of the Apify API client. The ",(0,i.kt)("inlineCode",{parentName:"p"},"ApifyClient")," class is provided by the"),(0,i.kt)("a",{href:"https://www.npmjs.com/package/apify-client",target:"_blank"},"apify-client")," NPM package, and it is automatically configured using the `APIFY_API_BASE_URL`, and `APIFY_TOKEN` environment variables. You can override the token via the available options. That's useful if you want to use the client as a different Apify user than the SDK internals are using.",(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[token]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxRetries]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[minDelayBetweenRetriesMillis]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string"))))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"ApifyClient"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opendataset"}),(0,i.kt)("h2",{id:"apifyopendatasetdatasetidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openDataset([datasetIdOrName], [options])")),(0,i.kt)("p",null,"Opens a dataset and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. The\nactual data is stored either on the local filesystem or in the cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[datasetIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the dataset to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default dataset\nassociated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[config]")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," - SDK configuration instance, defaults to the static register")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openkeyvaluestore"}),(0,i.kt)("h2",{id:"apifyopenkeyvaluestorestoreidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openKeyValueStore([storeIdOrName], [options])")),(0,i.kt)("p",null,"Opens a key-value store and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,"Key-value stores are used to store records or files, along with their MIME content type. The records are stored and retrieved using a unique key. The\nactual data is stored either on a local filesystem or in the Apify cloud."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[storeIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the key-value store to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default\nkey-value store associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[config]")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/configuration",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Configuration"))," - SDK configuration instance, defaults to the static register")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestlist"}),(0,i.kt)("h2",{id:"apifyopenrequestlistlistname-sources-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestList(listName, sources, [options])")),(0,i.kt)("p",null,"Opens a request list and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that is already initialized."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," represents a list of URLs to crawl, which is always stored in memory. To enable picking up where left off after a\nprocess restart, the request list sources are persisted to the key-value store at initialization of the list. Then, while crawling, a small state\nobject is regularly persisted to keep track of the crawling status."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sources = ['https://www.example.com', 'https://www.google.com', 'https://www.bing.com'];\n\nconst requestList = await Apify.openRequestList('my-name', sources);\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"listName")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," - Name of the request list to be opened. Setting a name enables the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to be persisted in the\nkey-value store. This is useful in case of a restart or migration. Since ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is only stored in memory, a restart or migration wipes it\nclean. Setting a name will enable the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"'s state to survive those situations and continue where it left off."),(0,i.kt)("p",{parentName:"li"},"The name will be used as a prefix in key-value store, producing keys such as ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_STATE")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"NAME-REQUEST_LIST_SOURCES"),"."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"null"),", the list will not be persisted and will only be stored in memory. Process restart will then cause the list to be crawled again from the\nbeginning. We suggest always using a name.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"sources")),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|string)>"))," - An array of sources of URLs for the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," initializes. This is a measure to\nprevent memory leaks in situations when millions of sources are added."))),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," to download the\nsource URLs from a given remote location. The URLs will be parsed from the received response. In this case you can limit the URLs using ",(0,i.kt)("inlineCode",{parentName:"p"},"regex"),"\nparameter containing regular expression pattern for URLs to be included."),(0,i.kt)("p",null,"For details, see the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions"))," - The ",(0,i.kt)("a",{parentName:"li",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," options. Note that the\n",(0,i.kt)("inlineCode",{parentName:"li"},"listName")," parameter supersedes the ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persiststatekey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistStateKey"))," and\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey"))," options and the ",(0,i.kt)("inlineCode",{parentName:"li"},"sources")," parameter supersedes the\n",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," option.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"openrequestqueue"}),(0,i.kt)("h2",{id:"apifyopenrequestqueuequeueidorname-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openRequestQueue([queueIdOrName], [options])")),(0,i.kt)("p",null,"Opens a request queue and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud. The queue is\nused for deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports\nboth breadth-first and depth-first crawling orders."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[queueIdOrName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - ID or name of the request queue to be opened. If ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined"),", the function returns the default request\nqueue associated with the actor run."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[forceCloud]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If set to ",(0,i.kt)("inlineCode",{parentName:"li"},"true")," then the function uses cloud storage usage even if the\n",(0,i.kt)("inlineCode",{parentName:"li"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set. This way it is possible to combine local and cloud storage.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"opensessionpool"}),(0,i.kt)("h2",{id:"apifyopensessionpoolsessionpooloptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.openSessionPool(sessionPoolOptions)")),(0,i.kt)("p",null,"Opens a SessionPool and returns a promise resolving to an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that is already initialized."),(0,i.kt)("p",null,"For more details and code examples, see the ",(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"sessionPoolOptions")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"pushdata"}),(0,i.kt)("h2",{id:"apifypushdataitem"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.pushData(item)")),(0,i.kt)("p",null,"Stores an object or an array of objects to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset"))," of the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset();\nawait dataset.pushData({ myValue: 123 });\n")),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset.pushData()"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,i.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data are stored!"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object")," - Object or array of objects containing data to be stored in the default dataset. The objects must be serializable to JSON\nand the JSON representation of each object must be smaller than 9MB.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"setvalue"}),(0,i.kt)("h2",{id:"apifysetvaluekey-value-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"Apify.setValue(key, value, [options])")),(0,i.kt)("p",null,"Stores or deletes a value in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," associated with the current actor run."),(0,i.kt)("p",null,"This is just a convenient shortcut for ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()")),". For example, calling the following code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"is equivalent to:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,i.kt)("p",null,"To get a value from the default key-value store, you can use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," function."),(0,i.kt)("p",null,"For more information, see ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Unique record key."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," - Record data, which can be one of the following values:",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,i.kt)("li",{parentName:"ul"},"If no ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,i.kt)("li",{parentName:"ul"},"If ",(0,i.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,i.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=s(n),k=r,c=m["".concat(p,".").concat(k)]||m[k]||d[k]||i;return n?a.createElement(c,o(o({ref:t},u),{},{components:n})):a.createElement(c,o({ref:t},u))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[m]="string"==typeof e?e:r,o[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"forms",title:"Forms"},l=void 0,p={unversionedId:"examples/forms",id:"version-2.3/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler",source:"@site/versioned_docs/version-2.3/examples/forms.md",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/2.3/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/forms.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"version-2.3/docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/2.3/examples/map-and-reduce"}},c={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,s);return(0,o.kt)(d,(0,a.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"\nto automatically fill and submit a search form to look up repositories on\n",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and\nlanguage of the repository, then submits the form and prints out the results.\nFinally, the results are saved either on the Apify platform to the default\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset")),"\nor on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch the web browser.\n const browser = await Apify.launchPuppeteer();\n\n // Create and navigate new page\n console.log('Open target page');\n const page = await browser.newPage();\n await page.goto('https://github.com/search/advanced');\n\n // Fill form fields and select desired search options\n console.log('Fill in search form');\n await page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\n await page.type('#search_from', 'apify');\n await page.type('#search_date', '>2015');\n await page.select('select#search_language', 'JavaScript');\n\n // Submit the form and wait for full load of next page\n console.log('Submit search form');\n await Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n ]);\n\n // Obtain and print list of search results\n const results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n })));\n console.log('Results:', results);\n\n // Store data in default dataset\n await Apify.pushData(results);\n\n // Close browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),p=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||o;return r?a.createElement(f,s(s({ref:t},c),{},{components:r})):a.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>f,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),s=["components"],i={id:"forms",title:"Forms"},l=void 0,p={unversionedId:"examples/forms",id:"version-2.3/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler",source:"@site/versioned_docs/version-2.3/examples/forms.md",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/2.3/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/forms.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"version-2.3/docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/2.3/examples/map-and-reduce"}},c={},u=[],m={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,s);return(0,o.kt)(d,(0,a.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"\nto automatically fill and submit a search form to look up repositories on\n",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and\nlanguage of the repository, then submits the form and prints out the results.\nFinally, the results are saved either on the Apify platform to the default\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"dataset")),"\nor on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch the web browser.\n const browser = await Apify.launchPuppeteer();\n\n // Create and navigate new page\n console.log('Open target page');\n const page = await browser.newPage();\n await page.goto('https://github.com/search/advanced');\n\n // Fill form fields and select desired search options\n console.log('Fill in search form');\n await page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\n await page.type('#search_from', 'apify');\n await page.type('#search_date', '>2015');\n await page.select('select#search_language', 'JavaScript');\n\n // Submit the form and wait for full load of next page\n console.log('Submit search form');\n await Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n ]);\n\n // Obtain and print list of search results\n const results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n })));\n console.log('Results:', results);\n\n // Store data in default dataset\n await Apify.pushData(results);\n\n // Close browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),p=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||o;return r?a.createElement(f,s(s({ref:t},c),{},{components:r})):a.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id:"key-value-store",title:"KeyValueStore"},p=void 0,s={unversionedId:"api/key-value-store",id:"version-2.3/api/key-value-store",title:"KeyValueStore",description:"The KeyValueStore class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data",source:"@site/versioned_docs/version-2.3/api/KeyValueStore.md",sourceDirName:"api",slug:"/api/key-value-store",permalink:"/sdk/js/docs/2.3/api/key-value-store",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/KeyValueStore.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"key-value-store",title:"KeyValueStore"},sidebar:"version-2.3/docs",previous:{title:"Dataset",permalink:"/sdk/js/docs/2.3/api/dataset"},next:{title:"AutoscaledPool",permalink:"/sdk/js/docs/2.3/api/autoscaled-pool"}},u={},d=[{value:"keyValueStore.getValue(key)",id:"keyvaluestoregetvaluekey",level:2},{value:"keyValueStore.setValue(key, value, [options])",id:"keyvaluestoresetvaluekey-value-options",level:2},{value:"keyValueStore.drop()",id:"keyvaluestoredrop",level:2},{value:"keyValueStore.getPublicUrl(key)",id:"keyvaluestoregetpublicurlkey",level:2},{value:"keyValueStore.forEachKey(iteratee, [options])",id:"keyvaluestoreforeachkeyiteratee-options",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(c,(0,n.Z)({},k,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyvaluestore"}),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data\nrecord is represented by a unique key and associated with a MIME content type. Key-value stores are ideal for saving screenshots, actor inputs and\noutputs, web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Do not instantiate this class directly, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function instead."),(0,o.kt)("p",null,"Each actor run is associated with a default key-value store, which is created exclusively for the run. By convention, the actor input and output are\nstored into the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically, input and output are JSON files, although it can\nbe any other format. To access the default key-value store directly, you can use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," convenience functions."),(0,o.kt)("p",null,"To access the input, you can also use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getinput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," convenience function."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," stores its data either on local disk or in the Apify cloud, depending on whether the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," or ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variables are set."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{INDEX}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key-value store has ID: ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"If the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable is set but\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," not, the data is stored in the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/key-value-store",target:"_blank",rel:"noopener"},"Apify Key-value store")," cloud storage. Note that you can force usage of the cloud storage also by\npassing the ",(0,o.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function, even if the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," variable is set."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store.\nconst input = await Apify.getInput();\n// Get some value from the default key-value store.\nconst otherValue = await Apify.getValue('my-key');\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write a record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read a record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Drop (delete) the store\nawait store.drop();\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getvalue"}),(0,o.kt)("h2",{id:"keyvaluestoregetvaluekey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getValue(key)")),(0,o.kt)("p",null,"Gets a value from the key-value store."),(0,o.kt)("p",null,"The function returns a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to the record value, whose JavaScript type depends on the MIME content type of the record. Records with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json")," content type are automatically parsed and returned as a JavaScript object. Similarly, records with ",(0,o.kt)("inlineCode",{parentName:"p"},"text/plain")," content types\nare returned as a string. For all other content types, the value is returned as a raw ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer"))," instance."),(0,o.kt)("p",null,"If the record does not exist, the function resolves to ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),"."),(0,o.kt)("p",null,"To save or delete a value in the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst buffer = await store.getValue('screenshot1.png');\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise"))," - Returns a promise that resolves to an object, string or\n",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setvalue"}),(0,o.kt)("h2",{id:"keyvaluestoresetvaluekey-value-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.setValue(key, value, [options])")),(0,o.kt)("p",null,"Saves or deletes a record in the key-value store. The function returns a promise that resolves once the record has been saved or deleted."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,o.kt)("p",null,"Beware that the key can be at most 256 characters long and only contain the following characters: ",(0,o.kt)("inlineCode",{parentName:"p"},"a-zA-Z0-9!-_.'()")),(0,o.kt)("p",null,"By default, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is converted to JSON and stored with the ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json; charset=utf-8")," MIME content type. To store the value with another\ncontent type, pass it in the options as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore('my-text-store');\nawait store.setValue('RESULTS', 'my text data', { contentType: 'text/plain' });\n")),(0,o.kt)("p",null,"If you set custom content type, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," must be either a string or ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", otherwise an error will be thrown."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),", the record is deleted instead. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()")," function succeeds regardless whether the record existed or not."),(0,o.kt)("p",null,"To retrieve a value from the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"IMPORTANT:")," Always make sure to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()"),", otherwise the actor process might finish before the value is\nstored!"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStoreValueTypes"))," - Record data, which can be one of the following values:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,o.kt)("li",{parentName:"ul"},"If no ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,o.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,o.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"drop"}),(0,o.kt)("h2",{id:"keyvaluestoredrop"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.drop()")),(0,o.kt)("p",null,"Removes the key-value store either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getpublicurl"}),(0,o.kt)("h2",{id:"keyvaluestoregetpublicurlkey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getPublicUrl(key)")),(0,o.kt)("p",null,"Returns a URL for the given key that may be used to publicly access the value in the remote key-value store."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"foreachkey"}),(0,o.kt)("h2",{id:"keyvaluestoreforeachkeyiteratee-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.forEachKey(iteratee, [options])")),(0,o.kt)("p",null,"Iterates over key-value store keys, yielding each in turn to an ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with three arguments:\n",(0,o.kt)("inlineCode",{parentName:"p"},"(key, index, info)"),", where ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," is the record key, ",(0,o.kt)("inlineCode",{parentName:"p"},"index")," is a zero-based index of the key in the current iteration (regardless of\n",(0,o.kt)("inlineCode",{parentName:"p"},"options.exclusiveStartKey"),") and ",(0,o.kt)("inlineCode",{parentName:"p"},"info")," is an object that contains a single property ",(0,o.kt)("inlineCode",{parentName:"p"},"size")," indicating size of the record in bytes."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,o.kt)("inlineCode",{parentName:"p"},"forEachKey")," function throws the error."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyValueStore = await Apify.openKeyValueStore();\nawait keyValueStore.forEachKey(async (key, index, info) => {\n console.log(`Key at ${index}: ${key} has size ${info.size}`);\n});\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-consumer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyConsumer"))," - A function that is called for every key in the key-value store."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"forEachKey()")," parameters are passed via an options object with the following keys:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[exclusiveStartKey]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - All keys up to this one (including) are skipped from the result.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(a),c=r,m=d["".concat(p,".").concat(c)]||d[c]||k[c]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[d]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),l=["components"],i={id:"key-value-store",title:"KeyValueStore"},p=void 0,s={unversionedId:"api/key-value-store",id:"version-2.3/api/key-value-store",title:"KeyValueStore",description:"The KeyValueStore class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data",source:"@site/versioned_docs/version-2.3/api/KeyValueStore.md",sourceDirName:"api",slug:"/api/key-value-store",permalink:"/sdk/js/docs/2.3/api/key-value-store",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/KeyValueStore.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"key-value-store",title:"KeyValueStore"},sidebar:"version-2.3/docs",previous:{title:"Dataset",permalink:"/sdk/js/docs/2.3/api/dataset"},next:{title:"AutoscaledPool",permalink:"/sdk/js/docs/2.3/api/autoscaled-pool"}},u={},d=[{value:"keyValueStore.getValue(key)",id:"keyvaluestoregetvaluekey",level:2},{value:"keyValueStore.setValue(key, value, [options])",id:"keyvaluestoresetvaluekey-value-options",level:2},{value:"keyValueStore.drop()",id:"keyvaluestoredrop",level:2},{value:"keyValueStore.getPublicUrl(key)",id:"keyvaluestoregetpublicurlkey",level:2},{value:"keyValueStore.forEachKey(iteratee, [options])",id:"keyvaluestoreforeachkeyiteratee-options",level:2}],k={toc:d},c="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,l);return(0,o.kt)(c,(0,n.Z)({},k,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyvaluestore"}),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," class represents a key-value store, a simple data storage that is used for saving and reading data records or files. Each data\nrecord is represented by a unique key and associated with a MIME content type. Key-value stores are ideal for saving screenshots, actor inputs and\noutputs, web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Do not instantiate this class directly, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function instead."),(0,o.kt)("p",null,"Each actor run is associated with a default key-value store, which is created exclusively for the run. By convention, the actor input and output are\nstored into the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically, input and output are JSON files, although it can\nbe any other format. To access the default key-value store directly, you can use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()"))," convenience functions."),(0,o.kt)("p",null,"To access the input, you can also use the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getinput",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," convenience function."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," stores its data either on local disk or in the Apify cloud, depending on whether the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," or ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN")),"\nenvironment variables are set."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{INDEX}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key-value store has ID: ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"If the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable is set but\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," not, the data is stored in the\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/key-value-store",target:"_blank",rel:"noopener"},"Apify Key-value store")," cloud storage. Note that you can force usage of the cloud storage also by\npassing the ",(0,o.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#openkeyvaluestore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openKeyValueStore()"))," function, even if the\n",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_local_storage_dir",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_LOCAL_STORAGE_DIR"))," variable is set."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store.\nconst input = await Apify.getInput();\n// Get some value from the default key-value store.\nconst otherValue = await Apify.getValue('my-key');\n\n// Write actor output to the default key-value store.\nawait Apify.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Apify.openKeyValueStore('some-name');\n\n// Write a record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read a record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Drop (delete) the store\nawait store.drop();\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getvalue"}),(0,o.kt)("h2",{id:"keyvaluestoregetvaluekey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getValue(key)")),(0,o.kt)("p",null,"Gets a value from the key-value store."),(0,o.kt)("p",null,"The function returns a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," that resolves to the record value, whose JavaScript type depends on the MIME content type of the record. Records with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json")," content type are automatically parsed and returned as a JavaScript object. Similarly, records with ",(0,o.kt)("inlineCode",{parentName:"p"},"text/plain")," content types\nare returned as a string. For all other content types, the value is returned as a raw ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer"))," instance."),(0,o.kt)("p",null,"If the record does not exist, the function resolves to ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),"."),(0,o.kt)("p",null,"To save or delete a value in the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#setvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.setValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nconst buffer = await store.getValue('screenshot1.png');\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise"))," - Returns a promise that resolves to an object, string or\n",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", depending on the MIME content type of the record."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setvalue"}),(0,o.kt)("h2",{id:"keyvaluestoresetvaluekey-value-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.setValue(key, value, [options])")),(0,o.kt)("p",null,"Saves or deletes a record in the key-value store. The function returns a promise that resolves once the record has been saved or deleted."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore();\nawait store.setValue('OUTPUT', { foo: 'bar' });\n")),(0,o.kt)("p",null,"Beware that the key can be at most 256 characters long and only contain the following characters: ",(0,o.kt)("inlineCode",{parentName:"p"},"a-zA-Z0-9!-_.'()")),(0,o.kt)("p",null,"By default, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is converted to JSON and stored with the ",(0,o.kt)("inlineCode",{parentName:"p"},"application/json; charset=utf-8")," MIME content type. To store the value with another\ncontent type, pass it in the options as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const store = await Apify.openKeyValueStore('my-text-store');\nawait store.setValue('RESULTS', 'my text data', { contentType: 'text/plain' });\n")),(0,o.kt)("p",null,"If you set custom content type, ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," must be either a string or ",(0,o.kt)("a",{parentName:"p",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),", otherwise an error will be thrown."),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"value")," is ",(0,o.kt)("inlineCode",{parentName:"p"},"null"),", the record is deleted instead. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()")," function succeeds regardless whether the record existed or not."),(0,o.kt)("p",null,"To retrieve a value from the key-value store, use the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#getvalue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.getValue()"))," function."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"IMPORTANT:")," Always make sure to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,o.kt)("inlineCode",{parentName:"p"},"setValue()"),", otherwise the actor process might finish before the value is\nstored!"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Unique key of the record. It can be at most 256 characters long and only consist of the following characters: ",(0,o.kt)("inlineCode",{parentName:"li"},"a"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"z"),",\n",(0,o.kt)("inlineCode",{parentName:"li"},"A"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"Z"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"0"),"-",(0,o.kt)("inlineCode",{parentName:"li"},"9")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"!-_.'()")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-value-store-value-types",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStoreValueTypes"))," - Record data, which can be one of the following values:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"null"),", the record in the key-value store is deleted."),(0,o.kt)("li",{parentName:"ul"},"If no ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is specified, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," can be any JavaScript object and it will be stringified to JSON."),(0,o.kt)("li",{parentName:"ul"},"If ",(0,o.kt)("inlineCode",{parentName:"li"},"options.contentType")," is set, ",(0,o.kt)("inlineCode",{parentName:"li"},"value")," is taken as is and it must be a ",(0,o.kt)("inlineCode",{parentName:"li"},"String")," or ",(0,o.kt)("a",{parentName:"li",href:"https://nodejs.org/api/buffer.html",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Buffer")),". For any\nother value an error will be thrown."))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[contentType]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a custom MIME content type of the record.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"drop"}),(0,o.kt)("h2",{id:"keyvaluestoredrop"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.drop()")),(0,o.kt)("p",null,"Removes the key-value store either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getpublicurl"}),(0,o.kt)("h2",{id:"keyvaluestoregetpublicurlkey"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.getPublicUrl(key)")),(0,o.kt)("p",null,"Returns a URL for the given key that may be used to publicly access the value in the remote key-value store."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"foreachkey"}),(0,o.kt)("h2",{id:"keyvaluestoreforeachkeyiteratee-options"},(0,o.kt)("inlineCode",{parentName:"h2"},"keyValueStore.forEachKey(iteratee, [options])")),(0,o.kt)("p",null,"Iterates over key-value store keys, yielding each in turn to an ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with three arguments:\n",(0,o.kt)("inlineCode",{parentName:"p"},"(key, index, info)"),", where ",(0,o.kt)("inlineCode",{parentName:"p"},"key")," is the record key, ",(0,o.kt)("inlineCode",{parentName:"p"},"index")," is a zero-based index of the key in the current iteration (regardless of\n",(0,o.kt)("inlineCode",{parentName:"p"},"options.exclusiveStartKey"),") and ",(0,o.kt)("inlineCode",{parentName:"p"},"info")," is an object that contains a single property ",(0,o.kt)("inlineCode",{parentName:"p"},"size")," indicating size of the record in bytes."),(0,o.kt)("p",null,"If the ",(0,o.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,o.kt)("inlineCode",{parentName:"p"},"forEachKey")," function throws the error."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyValueStore = await Apify.openKeyValueStore();\nawait keyValueStore.forEachKey(async (key, index, info) => {\n console.log(`Key at ${index}: ${key} has size ${info.size}`);\n});\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/key-consumer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyConsumer"))," - A function that is called for every key in the key-value store."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"forEachKey()")," parameters are passed via an options object with the following keys:",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[exclusiveStartKey]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - All keys up to this one (including) are skipped from the result.")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d="mdxType",k={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(a),c=r,m=d["".concat(p,".").concat(c)]||d[c]||k[c]||o;return a?n.createElement(m,l(l({ref:t},u),{},{components:a})):n.createElement(m,l({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[d]="string"==typeof e?e:r,l[1]=i;for(var s=2;s{o.d(n,{Z:()=>i});var t=o(67294),s=o(88746),r=o(6141),a=o(6832);const i=function(e){var n=e.to,o=e.children,i=(0,r.E)(),l=i.version,c=i.isLast;if((0,a.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(s.default,{to:"/api/"+n},o);var u=l+"/";return"current"===l?u="next/":c&&(u=""),t.createElement(s.default,{to:"/api/"+u+n},o)}},26569:(e,n,o)=>{o.d(n,{B:()=>i,T:()=>a});var t=o(67294),s=o(88746),r="https://crawlee.dev",a=function(e){var n=e.to,o=e.children,a=e.version;return t.createElement(s.default,{href:r+"/api"+(a?"/"+a:"")+"/"+n},o)},i=function(e){var n=e.to,o=e.children;return t.createElement(s.default,{href:r+"/"+n},o)}},85002:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>d,contentTitle:()=>u,default:()=>h,frontMatter:()=>c,metadata:()=>p,toc:()=>m});var t,s=o(87462),r=o(63366),a=(o(67294),o(3905)),i=(o(68889),o(26569)),l=["components"],c={id:"session-management",title:"Session Management"},u=void 0,p={unversionedId:"guides/session-management",id:"version-3.1/guides/session-management",title:"Session Management",description:"​SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-3.1/guides/session_management.mdx",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/session_management.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/guides/type-script-actor"}},d={},m=[],g=(t="Crawlee",function(e){return console.warn("Component "+t+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:m},y="wrapper";function h(e){var n=e.components,o=(0,r.Z)(e,l);return(0,a.kt)(y,(0,s.Z)({},f,o,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"\u200b",(0,a.kt)(g,{to:"core/class/SessionPool",mdxType:"Crawlee"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,a.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,a.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"PuppeteerCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"CheerioCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"BasicCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"}," const { gotScraping } = require('got-scraping');\n const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await gotScraping(requestOptions);\n } catch (e) {\n if (e === \"SomeNetworkError\") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n }\n});\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example solo usage")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"Actor.main(async () => {\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await SessionPool.open(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,a.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}h.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>u,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),c=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},u=function(e){var n=c(e.components);return t.createElement(l.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(o),m=s,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},u),{},{components:o})):t.createElement(g,a({ref:n},u))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{o.d(n,{Z:()=>i});var t=o(67294),s=o(88746),r=o(6141),a=o(6832);const i=function(e){var n=e.to,o=e.children,i=(0,r.E)(),l=i.version,c=i.isLast;if((0,a.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(s.default,{to:"/api/"+n},o);var u=l+"/";return"current"===l?u="next/":c&&(u=""),t.createElement(s.default,{to:"/api/"+u+n},o)}},26569:(e,n,o)=>{o.d(n,{B:()=>i,T:()=>a});var t=o(67294),s=o(88746),r="https://crawlee.dev",a=function(e){var n=e.to,o=e.children,a=e.version;return t.createElement(s.default,{href:r+"/api"+(a?"/"+a:"")+"/"+n},o)},i=function(e){var n=e.to,o=e.children;return t.createElement(s.default,{href:r+"/"+n},o)}},85002:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>d,contentTitle:()=>u,default:()=>h,frontMatter:()=>c,metadata:()=>p,toc:()=>m});var t,s=o(87462),r=o(63366),a=(o(67294),o(3905)),i=(o(68889),o(26569)),l=["components"],c={id:"session-management",title:"Session Management"},u=void 0,p={unversionedId:"guides/session-management",id:"version-3.1/guides/session-management",title:"Session Management",description:"​SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.",source:"@site/versioned_docs/version-3.1/guides/session_management.mdx",sourceDirName:"guides",slug:"/guides/session-management",permalink:"/sdk/js/docs/guides/session-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/session_management.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"session-management",title:"Session Management"},sidebar:"docs",previous:{title:"Proxy Management",permalink:"/sdk/js/docs/guides/proxy-management"},next:{title:"TypeScript Actors",permalink:"/sdk/js/docs/guides/type-script-actor"}},d={},m=[],g=(t="Crawlee",function(e){return console.warn("Component "+t+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:m},y="wrapper";function h(e){var n=e.components,o=(0,r.Z)(e,l);return(0,a.kt)(y,(0,s.Z)({},f,o,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"\u200b",(0,a.kt)(g,{to:"core/class/SessionPool",mdxType:"Crawlee"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK."),(0,a.kt)("p",null,"The main benefit of a Session pool is that you can filter out blocked or non-working proxies,\nso your actor does not retry requests over known blocked/non-working proxies.\nAnother benefit of using SessionPool is that you can store information tied tightly to an IP address,\nsuch as cookies, auth tokens, and particular headers. Having your cookies and other identificators used only with a specific IP will reduce the chance of being blocked.\nLast but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly,\nwhich should prevent burning out a small pool of available IPs."),(0,a.kt)("p",null,"Now let's take a look at how to use a Session pool."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"PuppeteerCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},'\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookies to page before navigation automatically.\n persistCookiesPerSession: true,\n handlePageFunction: async ({ request, page, session }) => {\n const title = await page.title();\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in puppeteer pool.\n }\n\n }\n});\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"CheerioCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},' const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new CheerioCrawler({\n requestQueue,\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n proxyConfiguration,\n // Activates the Session pool.\n useSessionPool: true,\n // Overrides default Session pool configuration.\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n // Set to true if you want the crawler to save cookies per session,\n // and set the cookie header to request automatically...\n persistCookiesPerSession: true,\n handlePageFunction: async ({request, $, session}) => {\n const title = $("title");\n\n if (title === "Blocked") {\n session.retire()\n } else if (title === "Not sure if blocked, might also be a connection error") {\n session.markBad();\n } else {\n // session.markGood() - this step is done automatically in BasicCrawler.\n }\n\n }\n });\n')),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage in ",(0,a.kt)(i.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"strong"},"BasicCrawler")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"}," const { gotScraping } = require('got-scraping');\n const proxyConfiguration = await Actor.createProxyConfiguration();\n\n const crawler = new BasicCrawler({\n requestQueue,\n // Allows access to proxyInfo object in handleRequestFunction\n proxyConfiguration,\n useSessionPool: true,\n sessionPoolOptions: {\n maxPoolSize: 100\n },\n handleRequestFunction: async ({request, session, proxyInfo }) => {\n // To use the proxy IP session rotation logic, you must turn the proxy usage on.\n const proxyUrl = proxyInfo.url;\n const requestOptions = {\n url: request.url,\n proxyUrl,\n throwHttpErrors: false,\n headers: {\n // If you want to use the cookieJar.\n // This way you get the Cookie headers string from session.\n Cookie: session.getCookieString(),\n }\n };\n let response;\n\n try {\n response = await gotScraping(requestOptions);\n } catch (e) {\n if (e === \"SomeNetworkError\") {\n // If a network error happens, such as timeout, socket hangup etc...\n // There is usually a chance that it was just bad luck and the proxy works.\n // No need to throw it away.\n session.markBad();\n }\n throw e;\n }\n\n // Automatically retires the session based on response HTTP status code.\n session.retireOnBlockedStatusCodes(response.statusCode);\n\n if (response.body.blocked) {\n // You are sure it is blocked.\n // This will throw away the session.\n session.retire();\n\n }\n\n // Everything is ok, you can get the data.\n // No need to call session.markGood -> BasicCrawler calls it for you.\n\n // If you want to use the CookieJar in session you need.\n session.setCookiesFromResponse(response);\n }\n});\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example solo usage")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"Actor.main(async () => {\n const sessionPoolOptions = {\n maxPoolSize: 100\n };\n const sessionPool = await SessionPool.open(sessionPoolOptions);\n\n // Get session\n const session = sessionPool.getSession();\n\n // Increase the errorScore.\n session.markBad();\n\n // Throw away the session\n session.retire();\n\n // Lower the errorScore and marks the session good.\n session.markGood();\n});\n")),(0,a.kt)("p",null,"These are the basics of configuring SessionPool.\nPlease, bear in mind that a Session pool needs time to find working IPs and build up the pool,\nso you will probably see a lot of errors until it becomes stabilized."))}h.isMDXComponent=!0},3905:(e,n,o)=>{o.d(n,{Zo:()=>u,kt:()=>g});var t=o(67294);function s(e,n,o){return n in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function r(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),o.push.apply(o,t)}return o}function a(e){for(var n=1;n=0||(s[o]=e[o]);return s}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(s[o]=e[o])}return s}var l=t.createContext({}),c=function(e){var n=t.useContext(l),o=n;return e&&(o="function"==typeof e?e(n):a(a({},n),e)),o},u=function(e){var n=c(e.components);return t.createElement(l.Provider,{value:n},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},m=t.forwardRef((function(e,n){var o=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=c(o),m=s,g=p["".concat(l,".").concat(m)]||p[m]||d[m]||r;return o?t.createElement(g,a(a({ref:n},u),{},{components:o})):t.createElement(g,a({ref:n},u))}));function g(e,n){var o=arguments,s=n&&n.mdxType;if("string"==typeof e||s){var r=o.length,a=new Array(r);a[0]=m;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i[p]="string"==typeof e?e:s,a[1]=i;for(var c=2;c{r.d(n,{Z:()=>s});var t=r(67294),o=r(88746),a=r(6141),i=r(6832);const s=function(e){var n=e.to,r=e.children,s=(0,a.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(o.default,{to:"/api/"+n},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),t.createElement(o.default,{to:"/api/"+c+n},r)}},26569:(e,n,r)=>{r.d(n,{B:()=>s,T:()=>i});var t=r(67294),o=r(88746),a="https://crawlee.dev",i=function(e){var n=e.to,r=e.children,i=e.version;return t.createElement(o.default,{href:a+"/api"+(i?"/"+i:"")+"/"+n},r)},s=function(e){var n=e.to,r=e.children;return t.createElement(o.default,{href:a+"/"+n},r)}},50269:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>y,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>u,toc:()=>f});var t=r(87462),o=r(63366),a=(r(67294),r(3905)),i=r(68889),s=r(26569),p=["components"],l={id:"proxy-management",title:"Proxy Management"},c=void 0,u={unversionedId:"guides/proxy-management",id:"guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/../docs/guides/proxy_management.mdx",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/next/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/proxy_management.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/next/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/next/guides/session-management"}},y={},f=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],d={toc:f},m="wrapper";function g(e){var n=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,t.Z)({},d,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," class. You create an instance using the ",(0,a.kt)(i.Z,{to:"apify/class/Actor#createProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"Actor.createProxyConfiguration()"))," function. See the ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions"))," for all the possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,a.kt)(s.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,"\u200b",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration#newUrl",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyConfiguration.newUrl()"))," allows you to pass a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair, and subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression of a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and ",(0,a.kt)(s.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," class for more information on how keeping a real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas Apify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await SessionPool.open({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst crawler = new PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember. ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyInfo",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}g.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},c=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||a;return r?t.createElement(d,i(i({ref:n},c),{},{components:r})):t.createElement(d,i({ref:n},c))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.d(n,{Z:()=>s});var t=r(67294),o=r(88746),a=r(6141),i=r(6832);const s=function(e){var n=e.to,r=e.children,s=(0,a.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return t.createElement(o.default,{to:"/api/"+n},r);var c=p+"/";return"current"===p?c="next/":l&&(c=""),t.createElement(o.default,{to:"/api/"+c+n},r)}},26569:(e,n,r)=>{r.d(n,{B:()=>s,T:()=>i});var t=r(67294),o=r(88746),a="https://crawlee.dev",i=function(e){var n=e.to,r=e.children,i=e.version;return t.createElement(o.default,{href:a+"/api"+(i?"/"+i:"")+"/"+n},r)},s=function(e){var n=e.to,r=e.children;return t.createElement(o.default,{href:a+"/"+n},r)}},50269:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>y,contentTitle:()=>c,default:()=>g,frontMatter:()=>l,metadata:()=>u,toc:()=>f});var t=r(87462),o=r(63366),a=(r(67294),r(3905)),i=r(68889),s=r(26569),p=["components"],l={id:"proxy-management",title:"Proxy Management"},c=void 0,u={unversionedId:"guides/proxy-management",id:"guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/../docs/guides/proxy_management.mdx",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/next/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/proxy_management.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/next/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/next/guides/session-management"}},y={},f=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],d={toc:f},m="wrapper";function g(e){var n=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,t.Z)({},d,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration"))," class. You create an instance using the ",(0,a.kt)(i.Z,{to:"apify/class/Actor#createProxyConfiguration",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"Actor.createProxyConfiguration()"))," function. See the ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions"))," for all the possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)(s.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,a.kt)(s.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,"\u200b",(0,a.kt)(i.Z,{to:"apify/class/ProxyConfiguration#newUrl",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyConfiguration.newUrl()"))," allows you to pass a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair, and subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression of a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and ",(0,a.kt)(s.T,{to:"core/class/SessionPool",mdxType:"CrawleeApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"SessionPool"))," class for more information on how keeping a real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas Apify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await SessionPool.open({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({ /* opts */ });\nconst crawler = new PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember. ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#proxyUrls",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.proxyUrls"))," and ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyConfigurationOptions#newUrlFunction",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfigurationOptions.newUrlFunction"))," enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Actor.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)(i.Z,{to:"apify/interface/ProxyInfo",mdxType:"ApiLink"},(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}g.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},c=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,d=u["".concat(p,".").concat(f)]||u[f]||y[f]||a;return r?t.createElement(d,i(i({ref:n},c),{},{components:r})):t.createElement(d,i({ref:n},c))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[u]="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>d,frontMatter:()=>l,metadata:()=>u,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],l={id:"key-value-store-value-types",title:"KeyValueStoreValueTypes"},p=void 0,u={unversionedId:"typedefs/key-value-store-value-types",id:"version-2.3/typedefs/key-value-store-value-types",title:"KeyValueStoreValueTypes",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/KeyValueStoreValueTypes.md",sourceDirName:"typedefs",slug:"/typedefs/key-value-store-value-types",permalink:"/sdk/js/docs/2.3/typedefs/key-value-store-value-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyValueStoreValueTypes.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"key-value-store-value-types",title:"KeyValueStoreValueTypes"}},i={},c=[],y={toc:c},f="wrapper";function d(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyvaluestorevaluetypes"}),(0,o.kt)("hr",null))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>i,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),u=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},i=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,i=l(e,["components","mdxType","originalType","parentName"]),c=u(r),f=a,d=c["".concat(p,".").concat(f)]||c[f]||y[f]||o;return r?n.createElement(d,s(s({ref:t},i),{},{components:r})):n.createElement(d,s({ref:t},i))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:a,s[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>d,frontMatter:()=>l,metadata:()=>u,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),s=["components"],l={id:"key-value-store-value-types",title:"KeyValueStoreValueTypes"},p=void 0,u={unversionedId:"typedefs/key-value-store-value-types",id:"version-2.3/typedefs/key-value-store-value-types",title:"KeyValueStoreValueTypes",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/KeyValueStoreValueTypes.md",sourceDirName:"typedefs",slug:"/typedefs/key-value-store-value-types",permalink:"/sdk/js/docs/2.3/typedefs/key-value-store-value-types",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyValueStoreValueTypes.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"key-value-store-value-types",title:"KeyValueStoreValueTypes"}},i={},c=[],y={toc:c},f="wrapper";function d(e){var t=e.components,r=(0,o.Z)(e,s);return(0,a.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"keyvaluestorevaluetypes"}),(0,a.kt)("hr",null))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>i,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),u=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},i=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,i=l(e,["components","mdxType","originalType","parentName"]),c=u(r),f=o,d=c["".concat(p,".").concat(f)]||c[f]||y[f]||a;return r?n.createElement(d,s(s({ref:t},i),{},{components:r})):n.createElement(d,s({ref:t},i))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[c]="string"==typeof e?e:o,s[1]=l;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>y,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-prepare-request-inputs",title:"PrepareRequestInputs",id:"prepare-request-inputs"},s=void 0,l={unversionedId:"typedefs/prepare-request-inputs",id:"version-1.3/typedefs/prepare-request-inputs",title:"PrepareRequestInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PrepareRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request-inputs",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequestInputs.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-prepare-request-inputs",title:"PrepareRequestInputs",id:"prepare-request-inputs"},sidebar:"version-1.3/docs",previous:{title:"PrepareRequest",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request"},next:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequestinputs"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"request"},(0,p.kt)("inlineCode",{parentName:"h3"},"request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"session"},(0,p.kt)("inlineCode",{parentName:"h3"},"session")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Session"))),(0,p.kt)("p",null,"The current session"),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyinfo"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,p.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,p.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,p.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,y=c["".concat(s,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(y,o(o({ref:t},u),{},{components:r})):n.createElement(y,o({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>y,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-prepare-request-inputs",title:"PrepareRequestInputs",id:"prepare-request-inputs"},s=void 0,l={unversionedId:"typedefs/prepare-request-inputs",id:"version-1.3/typedefs/prepare-request-inputs",title:"PrepareRequestInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PrepareRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request-inputs",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequestInputs.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-prepare-request-inputs",title:"PrepareRequestInputs",id:"prepare-request-inputs"},sidebar:"version-1.3/docs",previous:{title:"PrepareRequest",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request"},next:{title:"PlaywrightHandlePageFunction",permalink:"/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequestinputs"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"request"},(0,p.kt)("inlineCode",{parentName:"h3"},"request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"session"},(0,p.kt)("inlineCode",{parentName:"h3"},"session")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Session"))),(0,p.kt)("p",null,"The current session"),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyinfo"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,p.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,p.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"crawler"},(0,p.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,p.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,y=c["".concat(s,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(y,o(o({ref:t},u),{},{components:r})):n.createElement(y,o({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=["components"],s={id_old:"version-1.3-puppeteer-goto",title:"PuppeteerGoto",id:"puppeteer-goto"},i=void 0,l={unversionedId:"typedefs/puppeteer-goto",id:"version-1.3/typedefs/puppeteer-goto",title:"PuppeteerGoto",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerGoto.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-goto",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-goto",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGoto.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-goto",title:"PuppeteerGoto",id:"puppeteer-goto"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteergoto"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-goto-inputs",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerGotoInputs"))," - Arguments passed to this callback.")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise<(PuppeteerResponse|null)>")," - An instance of the Puppeteer ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"Response")),", which\nis the main resource response as returned by ",(0,p.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),"."),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(r),f=o,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(m,a(a({ref:t},u),{},{components:r})):n.createElement(m,a({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=["components"],s={id_old:"version-1.3-puppeteer-goto",title:"PuppeteerGoto",id:"puppeteer-goto"},i=void 0,l={unversionedId:"typedefs/puppeteer-goto",id:"version-1.3/typedefs/puppeteer-goto",title:"PuppeteerGoto",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerGoto.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-goto",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-goto",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGoto.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-goto",title:"PuppeteerGoto",id:"puppeteer-goto"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteergoto"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-goto-inputs",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PuppeteerGotoInputs"))," - Arguments passed to this callback.")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"Promise<(PuppeteerResponse|null)>")," - An instance of the Puppeteer ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-response",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"Response")),", which\nis the main resource response as returned by ",(0,p.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),"."),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(r),f=o,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(m,a(a({ref:t},u),{},{components:r})):n.createElement(m,a({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.d(t,{Z:()=>l});var a=n(67294),o=n(88746),r=n(6141),i=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(o.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(o.default,{to:"/api/"+d+t},n)}},77904:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a,o=n(87462),r=n(63366),i=(n(67294),n(3905)),l=n(68889),s=["components"],p={id:"environment-variables",title:"Environment Variables"},d=void 0,u={unversionedId:"guides/environment-variables",id:"version-3.1/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-3.1/guides/environment_variables.mdx",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/environment_variables.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/guides/proxy-management"}},c={},m=[{value:"Important env vars",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],y=(a="CrawleeApiLink",function(e){return console.warn("Component "+a+" was not imported, exported, or provided by MDXProvider as global scope"),(0,i.kt)("div",e)}),f={toc:m},h="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(h,(0,o.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,i.kt)("h2",{id:"important-env-vars"},"Important env vars"),(0,i.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,i.kt)("h3",{id:"apify_local_storage_dir"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("p",null,"Defines the path to a local directory where ",(0,i.kt)(l.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")),", ",(0,i.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")),", and ",(0,i.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," store their data. Typically, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage"),". If omitted, you should define the ",(0,i.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable instead."),(0,i.kt)("h3",{id:"apify_token"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,i.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,i.kt)("th",{parentName:"tr",align:null},"API"),(0,i.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"none OR ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"no"),(0,i.kt)("td",{parentName:"tr",align:null},"local")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,i.kt)("p",null,"When using both ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Actor.openDataset('my-local-data');\nconst remoteDataset = await Actor.openDataset('my-remote-data', { forceCloud: true });\n")),(0,i.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars"),(0,i.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,i.kt)("h3",{id:"apify_headless"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,i.kt)("p",null,"If set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the"),(0,i.kt)(l.Z,{to:"apify/class/Actor#launchPuppeteer",mdxType:"ApiLink"},"`Actor.launchPuppeteer()`")," function. But having this setting in an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging, and only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers are launched in headful mode, i.e. with windows.",(0,i.kt)("h3",{id:"apify_log_level"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,i.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,i.kt)(y,{to:"core/class/Log",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")),"\nnamespace for logging utilities."),(0,i.kt)("h3",{id:"apify_memory_mbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,i.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,i.kt)(y,{to:"core/class/AutoscaledPool",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i.e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,i.kt)("h3",{id:"apify_proxy_password"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,i.kt)("p",null,"Optional password to ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>y});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,y=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.d(t,{Z:()=>l});var a=n(67294),o=n(88746),r=n(6141),i=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(o.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(o.default,{to:"/api/"+d+t},n)}},77904:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a,o=n(87462),r=n(63366),i=(n(67294),n(3905)),l=n(68889),s=["components"],p={id:"environment-variables",title:"Environment Variables"},d=void 0,u={unversionedId:"guides/environment-variables",id:"version-3.1/guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/versioned_docs/version-3.1/guides/environment_variables.mdx",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/environment_variables.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/guides/proxy-management"}},c={},m=[{value:"Important env vars",id:"important-env-vars",level:2},{value:"APIFY_LOCAL_STORAGE_DIR",id:"apify_local_storage_dir",level:3},{value:"APIFY_TOKEN",id:"apify_token",level:3},{value:"Combinations of APIFY_LOCAL_STORAGE_DIR and APIFY_TOKEN",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars",id:"convenience-env-vars",level:2},{value:"APIFY_HEADLESS",id:"apify_headless",level:3},{value:"APIFY_LOG_LEVEL",id:"apify_log_level",level:3},{value:"APIFY_MEMORY_MBYTES",id:"apify_memory_mbytes",level:3},{value:"APIFY_PROXY_PASSWORD",id:"apify_proxy_password",level:3}],y=(a="CrawleeApiLink",function(e){return console.warn("Component "+a+" was not imported, exported, or provided by MDXProvider as global scope"),(0,i.kt)("div",e)}),f={toc:m},h="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(h,(0,o.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,i.kt)("h2",{id:"important-env-vars"},"Important env vars"),(0,i.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,i.kt)("h3",{id:"apify_local_storage_dir"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("p",null,"Defines the path to a local directory where ",(0,i.kt)(l.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")),", ",(0,i.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")),", and ",(0,i.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," store their data. Typically, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage"),". If omitted, you should define the ",(0,i.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable instead."),(0,i.kt)("h3",{id:"apify_token"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,i.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,i.kt)("th",{parentName:"tr",align:null},"API"),(0,i.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"none OR ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"no"),(0,i.kt)("td",{parentName:"tr",align:null},"local")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,i.kt)("p",null,"When using both ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Actor.openDataset('my-local-data');\nconst remoteDataset = await Actor.openDataset('my-remote-data', { forceCloud: true });\n")),(0,i.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars"),(0,i.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,i.kt)("h3",{id:"apify_headless"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,i.kt)("p",null,"If set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the"),(0,i.kt)(l.Z,{to:"apify/class/Actor#launchPuppeteer",mdxType:"ApiLink"},"`Actor.launchPuppeteer()`")," function. But having this setting in an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging, and only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers are launched in headful mode, i.e. with windows.",(0,i.kt)("h3",{id:"apify_log_level"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,i.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,i.kt)(y,{to:"core/class/Log",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")),"\nnamespace for logging utilities."),(0,i.kt)("h3",{id:"apify_memory_mbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,i.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,i.kt)(y,{to:"core/class/AutoscaledPool",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i.e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,i.kt)("h3",{id:"apify_proxy_password"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,i.kt)("p",null,"Optional password to ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>y});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,y=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>v,frontMatter:()=>s,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=r(14563);const i="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst input = await Actor.getInput();\nconsole.log(input);\n\nawait Actor.exit();\n";var c=["components"],s={id:"accept-user-input",title:"Accept user input"},l=void 0,u={unversionedId:"examples/accept-user-input",id:"version-3.1/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-3.1/examples/accept_user_input.mdx",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/accept_user_input.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"docs",previous:{title:"Examples",permalink:"/sdk/js/docs/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/examples/add-data-to-dataset"}},d={},m=[],f={toc:m},y="wrapper";function v(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(y,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}v.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>v,frontMatter:()=>c,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=r(14563);const i="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst input = await Actor.getInput();\nconsole.log(input);\n\nawait Actor.exit();\n";var s=["components"],c={id:"accept-user-input",title:"Accept user input"},l=void 0,u={unversionedId:"examples/accept-user-input",id:"version-3.1/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-3.1/examples/accept_user_input.mdx",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/accept_user_input.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"docs",previous:{title:"Examples",permalink:"/sdk/js/docs/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/examples/add-data-to-dataset"}},d={},m=[],f={toc:m},y="wrapper";function v(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(y,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}v.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),i=["components"],o={id_old:"version-2.3.0-basic-crawler",title:"Basic crawler",id:"basic-crawler"},l=void 0,c={unversionedId:"examples/basic-crawler",id:"version-2.3/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the",source:"@site/versioned_docs/version-2.3/examples/basic_crawler.md",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/2.3/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/basic_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-basic-crawler",title:"Basic crawler",id:"basic-crawler"},sidebar:"version-2.3/docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/2.3/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/2.3/examples/call-actor"}},p={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,s.kt)(f,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the\n",(0,s.kt)("a",{parentName:"p",href:"/docs/api/basic-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full\nfeatured crawlers like ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/cheerio-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," or\n",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/playwright-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,s.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/utils#requestasbrowser",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()")),"\nconvenience function and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create and initialize an instance of the RequestList class that contains\n // a list of URLs to crawl. Here we use just a few hard-coded URLs.\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n ]);\n\n // Create a BasicCrawler - the simplest crawler that enables\n // users to implement the crawling logic themselves.\n const crawler = new Apify.BasicCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // This function will be called for each URL to crawl.\n handleRequestFunction: async ({ request }) => {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils requestAsBrowser\n const { body } = await Apify.utils.requestAsBrowser({ url });\n\n // Store the HTML and URL to the default dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),c=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(r),f=n,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||s;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,i=new Array(s);i[0]=f;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[u]="string"==typeof e?e:n,i[1]=o;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),i=["components"],l={id_old:"version-2.3.0-basic-crawler",title:"Basic crawler",id:"basic-crawler"},o=void 0,c={unversionedId:"examples/basic-crawler",id:"version-2.3/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the",source:"@site/versioned_docs/version-2.3/examples/basic_crawler.md",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/2.3/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/basic_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-basic-crawler",title:"Basic crawler",id:"basic-crawler"},sidebar:"version-2.3/docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/2.3/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/2.3/examples/call-actor"}},p={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,s.kt)(f,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the\n",(0,s.kt)("a",{parentName:"p",href:"/docs/api/basic-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full\nfeatured crawlers like ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/cheerio-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," or\n",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/playwright-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,s.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/utils#requestasbrowser",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()")),"\nconvenience function and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create and initialize an instance of the RequestList class that contains\n // a list of URLs to crawl. Here we use just a few hard-coded URLs.\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n ]);\n\n // Create a BasicCrawler - the simplest crawler that enables\n // users to implement the crawling logic themselves.\n const crawler = new Apify.BasicCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // This function will be called for each URL to crawl.\n handleRequestFunction: async ({ request }) => {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils requestAsBrowser\n const { body } = await Apify.utils.requestAsBrowser({ url });\n\n // Store the HTML and URL to the default dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=a.createContext({}),c=function(e){var t=a.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(o.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,o=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(r),f=n,m=u["".concat(o,".").concat(f)]||u[f]||d[f]||s;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,i=new Array(s);i[0]=f;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>s,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var a=n(87462),l=n(63366),o=(n(67294),n(3905)),i=["components"],r={id:"log",title:"utils.log"},s=void 0,p={unversionedId:"api/log",id:"version-2.3/api/log",title:"utils.log",description:"The log instance enables level aware logging of messages and we advise to use it instead of console.log() and its aliases in most development",source:"@site/versioned_docs/version-2.3/api/log.md",sourceDirName:"api",slug:"/api/log",permalink:"/sdk/js/docs/2.3/api/log",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/log.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"log",title:"utils.log"},sidebar:"version-2.3/docs",previous:{title:"utils",permalink:"/sdk/js/docs/2.3/api/utils"},next:{title:"utils.playwright",permalink:"/sdk/js/docs/2.3/api/playwright"}},g={},d=[{value:"log.LEVELS",id:"loglevels",level:2},{value:"log.setLevel(level)",id:"logsetlevellevel",level:2},{value:"log.getLevel()",id:"loggetlevel",level:2},{value:"log.setOptions(options)",id:"logsetoptionsoptions",level:2},{value:"log.child([options])",id:"logchildoptions",level:2},{value:"log.getOptions()",id:"loggetoptions",level:2},{value:"log.debug(message, [data])",id:"logdebugmessage-data",level:2},{value:"log.info(message, [data])",id:"loginfomessage-data",level:2},{value:"log.warning(message, [data])",id:"logwarningmessage-data",level:2},{value:"log.error(message, [data])",id:"logerrormessage-data",level:2},{value:"log.exception(exception, [message], [data])",id:"logexceptionexception-message-data",level:2}],m={toc:d},u="wrapper";function k(e){var t=e.components,n=(0,l.Z)(e,i);return(0,o.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"log"}),(0,o.kt)("p",null,"The log instance enables level aware logging of messages and we advise to use it instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"console.log()")," and its aliases in most development\nscenarios."),(0,o.kt)("p",null,"A very useful use case for ",(0,o.kt)("inlineCode",{parentName:"p"},"log")," is using ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug")," liberally throughout the codebase to get useful logging messages only when appropriate log level\nis set and keeping the console tidy in production environments."),(0,o.kt)("p",null,"The available logging levels are, in this order: ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"OFF")," and can be referenced from the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constant, such\nas ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.ERROR"),"."),(0,o.kt)("p",null,"To log messages to the system console, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.level(message)")," invocation, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug('this is a debug message')"),"."),(0,o.kt)("p",null,"To prevent writing of messages above a certain log level to the console, simply set the appropriate level. The default log level is ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", which\nmeans that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages will not be printed, unless enabled."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst { log } = Apify.utils;\n\nlog.info('Information message', { someData: 123 }); // prints message\nlog.debug('Debug message', { debugData: 'hello' }); // doesn't print anything\n\nlog.setLevel(log.LEVELS.DEBUG);\nlog.debug('Debug message'); // prints message\n\nlog.setLevel(log.LEVELS.ERROR);\nlog.debug('Debug message'); // doesn't print anything\nlog.info('Info message'); // doesn't print anything\n\nlog.error('Error message', { errorDetails: 'This is bad!' }); // prints message\ntry {\n throw new Error('Not good!');\n} catch (e) {\n log.exception(e, 'Exception occurred', { errorDetails: 'This is really bad!' }); // prints message\n}\n\nlog.setOptions({ prefix: 'My actor' });\nlog.info('I am running!'); // prints \"My actor: I am running\"\n\nconst childLog = log.child({ prefix: 'Crawler' });\nlog.info('I am crawling!'); // prints \"My actor:Crawler: I am crawling\"\n")),(0,o.kt)("p",null,"Another very useful way of setting the log level is by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," environment variable, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". This way,\nno code changes are necessary to turn on your debug messages and start debugging right away."),(0,o.kt)("p",null,"To add timestamps to your logs, you can override the default logger settings:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"log.setOptions({\n logger: new log.LoggerText({ skipTime: false }),\n});\n")),(0,o.kt)("p",null,"You can customize your logging further by extending or replacing the default logger instances with your own implementations."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"levels"}),(0,o.kt)("h2",{id:"loglevels"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.LEVELS")),(0,o.kt)("p",null,"Map of available log levels that's useful for easy setting of appropriate log levels. Each log level is represented internally by a number. Eg.\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.DEBUG === 5"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setlevel"}),(0,o.kt)("h2",{id:"logsetlevellevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setLevel(level)")),(0,o.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants such as"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"log.setLevel(log.LEVELS.DEBUG);\n")),(0,o.kt)("p",null,"Default log level is INFO."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"level")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getlevel"}),(0,o.kt)("h2",{id:"loggetlevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getLevel()")),(0,o.kt)("p",null,"Returns the currently selected logging level. This is useful for checking whether a message will actually be printed to the console before one\nactually performs a resource intensive operation to construct the message, such as querying a DB for some metadata that need to be added. If the log\nlevel is not high enough at the moment, it doesn't make sense to execute the query."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setoptions"}),(0,o.kt)("h2",{id:"logsetoptionsoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setOptions(options)")),(0,o.kt)("p",null,"Configures logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions")))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"child"}),(0,o.kt)("h2",{id:"logchildoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.child([options])")),(0,o.kt)("p",null,"Creates a new instance of logger that inherits settings from a parent logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))," - Supports the same options as the ",(0,o.kt)("inlineCode",{parentName:"li"},"setOptions()")," method.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getoptions"}),(0,o.kt)("h2",{id:"loggetoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getOptions()")),(0,o.kt)("p",null,"Returns the logger configuration."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"debug"}),(0,o.kt)("h2",{id:"logdebugmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.debug(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," message. By default, it will not be written to the console. To see ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages in the console, set the log level to ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," either\nusing the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.setLevel(log.LEVELS.DEBUG)")," method or using the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". Data are stringified and appended to the\nmessage."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"info"}),(0,o.kt)("h2",{id:"loginfomessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.info(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," message. ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," is the default log level so info messages will be always logged, unless the log level is changed. Data are stringified\nand appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"warning"}),(0,o.kt)("h2",{id:"logwarningmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.warning(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," level message. Data are stringified and appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"error"}),(0,o.kt)("h2",{id:"logerrormessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.error(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," message. Use this method to log error messages that are not directly connected to an exception. For logging exceptions, use the\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.exception")," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"exception"}),(0,o.kt)("h2",{id:"logexceptionexception-message-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.exception(exception, [message], [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," level message with a nicely formatted exception. Note that the exception is the first parameter here and an additional message is only\noptional."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"exception")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Error")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>k});var a=n(67294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},g=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,g=r(e,["components","mdxType","originalType","parentName"]),d=p(n),u=l,k=d["".concat(s,".").concat(u)]||d[u]||m[u]||o;return n?a.createElement(k,i(i({ref:t},g),{},{components:n})):a.createElement(k,i({ref:t},g))}));function k(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=n.length,i=new Array(o);i[0]=u;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[d]="string"==typeof e?e:l,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>s,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var a=n(87462),l=n(63366),o=(n(67294),n(3905)),i=["components"],r={id:"log",title:"utils.log"},s=void 0,p={unversionedId:"api/log",id:"version-2.3/api/log",title:"utils.log",description:"The log instance enables level aware logging of messages and we advise to use it instead of console.log() and its aliases in most development",source:"@site/versioned_docs/version-2.3/api/log.md",sourceDirName:"api",slug:"/api/log",permalink:"/sdk/js/docs/2.3/api/log",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/log.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"log",title:"utils.log"},sidebar:"version-2.3/docs",previous:{title:"utils",permalink:"/sdk/js/docs/2.3/api/utils"},next:{title:"utils.playwright",permalink:"/sdk/js/docs/2.3/api/playwright"}},g={},d=[{value:"log.LEVELS",id:"loglevels",level:2},{value:"log.setLevel(level)",id:"logsetlevellevel",level:2},{value:"log.getLevel()",id:"loggetlevel",level:2},{value:"log.setOptions(options)",id:"logsetoptionsoptions",level:2},{value:"log.child([options])",id:"logchildoptions",level:2},{value:"log.getOptions()",id:"loggetoptions",level:2},{value:"log.debug(message, [data])",id:"logdebugmessage-data",level:2},{value:"log.info(message, [data])",id:"loginfomessage-data",level:2},{value:"log.warning(message, [data])",id:"logwarningmessage-data",level:2},{value:"log.error(message, [data])",id:"logerrormessage-data",level:2},{value:"log.exception(exception, [message], [data])",id:"logexceptionexception-message-data",level:2}],m={toc:d},u="wrapper";function k(e){var t=e.components,n=(0,l.Z)(e,i);return(0,o.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"log"}),(0,o.kt)("p",null,"The log instance enables level aware logging of messages and we advise to use it instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"console.log()")," and its aliases in most development\nscenarios."),(0,o.kt)("p",null,"A very useful use case for ",(0,o.kt)("inlineCode",{parentName:"p"},"log")," is using ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug")," liberally throughout the codebase to get useful logging messages only when appropriate log level\nis set and keeping the console tidy in production environments."),(0,o.kt)("p",null,"The available logging levels are, in this order: ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"OFF")," and can be referenced from the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constant, such\nas ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.ERROR"),"."),(0,o.kt)("p",null,"To log messages to the system console, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.level(message)")," invocation, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug('this is a debug message')"),"."),(0,o.kt)("p",null,"To prevent writing of messages above a certain log level to the console, simply set the appropriate level. The default log level is ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", which\nmeans that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages will not be printed, unless enabled."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst { log } = Apify.utils;\n\nlog.info('Information message', { someData: 123 }); // prints message\nlog.debug('Debug message', { debugData: 'hello' }); // doesn't print anything\n\nlog.setLevel(log.LEVELS.DEBUG);\nlog.debug('Debug message'); // prints message\n\nlog.setLevel(log.LEVELS.ERROR);\nlog.debug('Debug message'); // doesn't print anything\nlog.info('Info message'); // doesn't print anything\n\nlog.error('Error message', { errorDetails: 'This is bad!' }); // prints message\ntry {\n throw new Error('Not good!');\n} catch (e) {\n log.exception(e, 'Exception occurred', { errorDetails: 'This is really bad!' }); // prints message\n}\n\nlog.setOptions({ prefix: 'My actor' });\nlog.info('I am running!'); // prints \"My actor: I am running\"\n\nconst childLog = log.child({ prefix: 'Crawler' });\nlog.info('I am crawling!'); // prints \"My actor:Crawler: I am crawling\"\n")),(0,o.kt)("p",null,"Another very useful way of setting the log level is by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," environment variable, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". This way,\nno code changes are necessary to turn on your debug messages and start debugging right away."),(0,o.kt)("p",null,"To add timestamps to your logs, you can override the default logger settings:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"log.setOptions({\n logger: new log.LoggerText({ skipTime: false }),\n});\n")),(0,o.kt)("p",null,"You can customize your logging further by extending or replacing the default logger instances with your own implementations."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"levels"}),(0,o.kt)("h2",{id:"loglevels"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.LEVELS")),(0,o.kt)("p",null,"Map of available log levels that's useful for easy setting of appropriate log levels. Each log level is represented internally by a number. Eg.\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.DEBUG === 5"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setlevel"}),(0,o.kt)("h2",{id:"logsetlevellevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setLevel(level)")),(0,o.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants such as"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"log.setLevel(log.LEVELS.DEBUG);\n")),(0,o.kt)("p",null,"Default log level is INFO."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"level")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getlevel"}),(0,o.kt)("h2",{id:"loggetlevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getLevel()")),(0,o.kt)("p",null,"Returns the currently selected logging level. This is useful for checking whether a message will actually be printed to the console before one\nactually performs a resource intensive operation to construct the message, such as querying a DB for some metadata that need to be added. If the log\nlevel is not high enough at the moment, it doesn't make sense to execute the query."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setoptions"}),(0,o.kt)("h2",{id:"logsetoptionsoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setOptions(options)")),(0,o.kt)("p",null,"Configures logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions")))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"child"}),(0,o.kt)("h2",{id:"logchildoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.child([options])")),(0,o.kt)("p",null,"Creates a new instance of logger that inherits settings from a parent logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))," - Supports the same options as the ",(0,o.kt)("inlineCode",{parentName:"li"},"setOptions()")," method.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getoptions"}),(0,o.kt)("h2",{id:"loggetoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getOptions()")),(0,o.kt)("p",null,"Returns the logger configuration."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"debug"}),(0,o.kt)("h2",{id:"logdebugmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.debug(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," message. By default, it will not be written to the console. To see ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages in the console, set the log level to ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," either\nusing the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.setLevel(log.LEVELS.DEBUG)")," method or using the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". Data are stringified and appended to the\nmessage."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"info"}),(0,o.kt)("h2",{id:"loginfomessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.info(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," message. ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," is the default log level so info messages will be always logged, unless the log level is changed. Data are stringified\nand appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"warning"}),(0,o.kt)("h2",{id:"logwarningmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.warning(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," level message. Data are stringified and appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"error"}),(0,o.kt)("h2",{id:"logerrormessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.error(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," message. Use this method to log error messages that are not directly connected to an exception. For logging exceptions, use the\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.exception")," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"exception"}),(0,o.kt)("h2",{id:"logexceptionexception-message-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.exception(exception, [message], [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," level message with a nicely formatted exception. Note that the exception is the first parameter here and an additional message is only\noptional."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"exception")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Error")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>k});var a=n(67294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},g=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,g=r(e,["components","mdxType","originalType","parentName"]),d=p(n),u=l,k=d["".concat(s,".").concat(u)]||d[u]||m[u]||o;return n?a.createElement(k,i(i({ref:t},g),{},{components:n})):a.createElement(k,i({ref:t},g))}));function k(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=n.length,i=new Array(o);i[0]=u;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[d]="string"==typeof e?e:l,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),l=["components"],p={id_old:"version-2.3.0-puppeteer",title:"utils.puppeteer",id:"puppeteer"},o=void 0,s={unversionedId:"api/puppeteer",id:"version-2.3/api/puppeteer",title:"utils.puppeteer",description:"A namespace that contains various utilities for Puppeteer - the headless Chrome Node API.",source:"@site/versioned_docs/version-2.3/api/puppeteer.md",sourceDirName:"api",slug:"/api/puppeteer",permalink:"/sdk/js/docs/2.3/api/puppeteer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/puppeteer.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer",title:"utils.puppeteer",id:"puppeteer"},sidebar:"version-2.3/docs",previous:{title:"utils.playwright",permalink:"/sdk/js/docs/2.3/api/playwright"},next:{title:"utils.social",permalink:"/sdk/js/docs/2.3/api/social"}},u={},d=[{value:"puppeteer.addInterceptRequestHandler",id:"puppeteeraddinterceptrequesthandler",level:2},{value:"puppeteer.removeInterceptRequestHandler",id:"puppeteerremoveinterceptrequesthandler",level:2},{value:"puppeteer.gotoExtended",id:"puppeteergotoextended",level:2},{value:"puppeteer.infiniteScroll",id:"puppeteerinfinitescroll",level:2},{value:"puppeteer.saveSnapshot",id:"puppeteersavesnapshot",level:2},{value:"puppeteer.enqueueLinksByClickingElements(options)",id:"puppeteerenqueuelinksbyclickingelementsoptions",level:2},{value:"puppeteer.injectFile(page, filePath, [options])",id:"puppeteerinjectfilepage-filepath-options",level:2},{value:"puppeteer.injectJQuery(page)",id:"puppeteerinjectjquerypage",level:2},{value:"puppeteer.injectUnderscore(page)",id:"puppeteerinjectunderscorepage",level:2},{value:"puppeteer.blockRequests(page, [options])",id:"puppeteerblockrequestspage-options",level:2},{value:"puppeteer.cacheResponses(page, cache, responseUrlRules)",id:"puppeteercacheresponsespage-cache-responseurlrules",level:2},{value:"puppeteer.compileScript(scriptString, context)",id:"puppeteercompilescriptscriptstring-context",level:2}],c={toc:d},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,i.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"puppeteer"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { puppeteer } = Apify.utils;\n\n// Open https://www.example.com in Puppeteer\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('https://www.example.com');\n\n// Inject jQuery into a page\nawait puppeteer.injectJQuery(page);\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteeraddinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.addInterceptRequestHandler")),(0,i.kt)("p",null,"Adds request interception handler in similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"page.on('request', handler);")," but in addition to that supports multiple parallel handlers."),(0,i.kt)("p",null,"All the handlers are executed sequentially in the order as they were added. Each of the handlers must call one of ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),",\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()"),". In addition to that any of the handlers may modify the request object (method, postData, headers) by\npassing its overrides to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),". If multiple handlers modify same property then the last one wins. Headers are merged separately so you\ncan override only a value of specific header."),(0,i.kt)("p",null,"If one the handlers calls ",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()")," then request is not propagated further to any of the remaining handlers."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Replace images with placeholder.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'image') {\n return request.respond({\n statusCode: 200,\n contentType: 'image/jpeg',\n body: placeholderImageBuffer,\n });\n }\n return request.continue();\n});\n\n// Abort all the scripts.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'script') return request.abort();\n return request.continue();\n});\n\n// Change requests to post.\nawait addInterceptRequestHandler(page, request => {\n return request.continue({\n method: 'POST',\n });\n});\n\nawait page.goto('http://example.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"removeinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteerremoveinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.removeInterceptRequestHandler")),(0,i.kt)("p",null,"Removes request interception handler for given page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"puppeteergotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.gotoExtended")),(0,i.kt)("p",null,"Extended version of Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload. URL,\nmethod, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"infinitescroll"}),(0,i.kt)("h2",{id:"puppeteerinfinitescroll"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.infiniteScroll")),(0,i.kt)("p",null,"Scrolls to the bottom of a page, or until it times out. Loads dynamic content when it hits the bottom of a page, and then continues scrolling."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 0")," - How many seconds to scroll for. If 0, will scroll until bottom of page."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 4")," - How many seconds to wait for no new content to load before exit."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[scrollDownAndUp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If true, it will scroll up a bit after each scroll down. This is required on some\nwebsites for the scroll to work."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[buttonSelector]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Optionally checks and clicks a button if it appears while scrolling. This is required on some websites for\nthe scroll to work."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[stopScrollCallback]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"function")," - This function is called after every scroll and stops the scrolling process if it returns ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),". The\nfunction can be ",(0,i.kt)("inlineCode",{parentName:"li"},"async"),".")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"savesnapshot"}),(0,i.kt)("h2",{id:"puppeteersavesnapshot"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.saveSnapshot")),(0,i.kt)("p",null,"Saves a full screenshot and HTML of the current page into a Key-Value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[key]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"SNAPSHOT",'"')," - Key under which the screenshot and HTML will be saved. ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg")," will be appended\nfor screenshot and ",(0,i.kt)("inlineCode",{parentName:"li"},".html")," for HTML."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[screenshotQuality]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 50")," - The quality of the image, between 0-100. Higher quality images have bigger size and\nrequire more storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveScreenshot]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full screenshot of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key"),"\nappended by ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveHtml]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full HTML of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key")," appended by\n",(0,i.kt)("inlineCode",{parentName:"li"},".html"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[keyValueStoreName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," ",(0,i.kt)("code",null," = null")," - Name or id of the Key-Value store where snapshot is saved. By default it\nis saved to default Key-Value store.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"enqueuelinksbyclickingelements"}),(0,i.kt)("h2",{id:"puppeteerenqueuelinksbyclickingelementsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.enqueueLinksByClickingElements(options)")),(0,i.kt)("p",null,"The function finds elements matching a specific CSS selector in a Puppeteer page, clicks all those elements using a mouse move and a left mouse button\nclick and intercepts all the navigation requests that are subsequently produced by the page. The intercepted requests, including their methods,\nheaders and payloads are then enqueued to a provided ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". This is useful to crawl JavaScript heavy pages where\nlinks are not available in ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers. If you're looking to find URLs in ",(0,i.kt)("inlineCode",{parentName:"p"},"href"),"\nattributes of the page, see ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,i.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": To be able to do this, this function uses various mutations on the page, such as changing the Z-index of elements being clicked and\ntheir visibility. Therefore, it is recommended to only use this function as the last operation in the page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"USING HEADFUL BROWSER"),": When using a headful browser, this function will only be able to click elements in the focused tab, effectively limiting\nconcurrency to 1. In headless mode, full concurrency can be achieved."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"PERFORMANCE"),": Clicking elements with a mouse and intercepting requests is not a low level operation that takes nanoseconds. It's not very CPU\nintensive, but it takes time. We strongly recommend limiting the scope of the clicking as much as possible by using a specific selector that targets\nonly the elements that you assume or know will produce a navigation. You can certainly click everything by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"*")," selector, but be prepared to\nwait minutes to get results on a large and complex page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.enqueueLinksByClickingElements({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: [\n 'https://www.example.com/handbags/[.*]'\n 'https://www.example.com/purses/[.*]'\n ],\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," parameters are passed via an options object with the following keys:"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"selector")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - A CSS selector matching elements to be clicked on. Unlike in ",(0,i.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),",\nthere is no default value. This is to prevent suboptimal use of this function by using it too broadly."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp|Object)>")," - An array of ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to be\nenqueued, or an array of strings or RegExps or plain Objects from which the ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,i.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,i.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,i.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,i.kt)("p",{parentName:"li"},"For example: by adding ",(0,i.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey: true")," to the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," object, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," will be computed from a combination of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"method"),"\nand ",(0,i.kt)("inlineCode",{parentName:"p"},"payload")," which enables crawling of websites that navigate using form submits (POST requests)."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.useExtendedUniqueKey = true;\n return request;\n };\n}\n")),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 1")," - Clicking in the page triggers various asynchronous operations that lead to new URLs\nbeing shown by the browser. It could be a simple JavaScript redirect or opening of a new tab in the browser. These events often happen only\nsome time after the actual click. Requests typically take milliseconds while new tabs open in hundreds of milliseconds.")),(0,i.kt)("p",{parentName:"li"},"To be able to capture all those events, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," function repeatedly waits for the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitForPageIdleSecs"),". By\nrepeatedly we mean that whenever a relevant event is triggered, the timer is restarted. As long as new events keep coming, the function will not\nreturn, unless the below ",(0,i.kt)("inlineCode",{parentName:"p"},"maxWaitForPageIdleSecs")," timeout is reached."),(0,i.kt)("p",{parentName:"li"},"You may want to reduce this for example when you're sure that your clicks do not open new tabs, or increase when you're not getting all the\nexpected URLs."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxWaitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 5")," - This is the maximum period for which the function will keep tracking events, even\nif more events keep coming. Its purpose is to prevent a deadlock in the page by periodic events, often unrelated to the clicking itself. See\n",(0,i.kt)("inlineCode",{parentName:"li"},"waitForPageIdleSecs")," above for an explanation.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectfile"}),(0,i.kt)("h2",{id:"puppeteerinjectfilepage-filepath-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectFile(page, filePath, [options])")),(0,i.kt)("p",null,"Injects a JavaScript file into a Puppeteer page. Unlike Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"addScriptTag")," function, this function works on pages with arbitrary Cross-Origin\nResource Sharing (CORS) policies."),(0,i.kt)("p",null,"File contents are cached for up to 10 files to limit file system access."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"filePath")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - File path"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[surviveNavigations]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," - Enables the injected script to survive page navigations and reloads without need to be re-injected\nmanually. This does not mean, however, that internal state will be preserved. Just that it will be automatically re-injected on each\nnavigation before any other scripts get the chance to execute.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectjquery"}),(0,i.kt)("h2",{id:"puppeteerinjectjquerypage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectJQuery(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery")," library into a Puppeteer page. jQuery is often useful for various web scraping and crawling tasks. For\nexample, it can help extract text from HTML elements using CSS selectors."),(0,i.kt)("p",null,"Beware that the injected jQuery object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window.$")," variable and thus it might cause conflicts with other libraries included by the\npage that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected jQuery will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectJQuery(page);\nconst title = await page.evaluate(() => {\n return $('head title').text();\n});\n")),(0,i.kt)("p",null,"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"injectJQuery()")," does not affect the Puppeteer's ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-pageselector",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"page.$()"))," function in any\nway."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectunderscore"}),(0,i.kt)("h2",{id:"puppeteerinjectunderscorepage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectUnderscore(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://underscorejs.org/",target:"_blank",rel:"noopener"},"Underscore")," library into a Puppeteer page."),(0,i.kt)("p",null,"Beware that the injected Underscore object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window._")," variable and thus it might cause conflicts with libraries included by the\npage that use the same variable name. This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected Underscore will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectUnderscore(page);\nconst escapedHtml = await page.evaluate(() => {\n return _.escape('

Hello

');\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page",target:"_blank",rel:"noopener"},"Page")," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"blockrequests"}),(0,i.kt)("h2",{id:"puppeteerblockrequestspage-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.blockRequests(page, [options])")),(0,i.kt)("p",null,"Forces the Puppeteer browser tab to block loading URLs that match a provided pattern. This is useful to speed up crawling of websites, since it\nreduces the amount of data that needs to be downloaded from the web, but it may break some websites or unexpectedly prevent loading of resources."),(0,i.kt)("p",null,"By default, the function will block all URLs including the following patterns:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'[".css", ".jpg", ".jpeg", ".png", ".svg", ".gif", ".woff", ".pdf", ".zip"]\n')),(0,i.kt)("p",null,"If you want to extend this list further, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"extraUrlPatterns")," option, which will keep blocking the default patterns, as well as add your custom\nones. If you would like to block only specific patterns, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"urlPatterns")," option, which will override the defaults and block only URLs with your\ncustom patterns."),(0,i.kt)("p",null,"This function does not use Puppeteer's request interception and therefore does not interfere with browser cache. It's also faster than blocking\nrequests using interception, because the blocking happens directly in the browser without the round-trip to Node.js, but it does not provide the extra\nbenefits of request interception."),(0,i.kt)("p",null,"The function will never block main document loads and their respective redirects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\n\n// Block all requests to URLs that include `adsbygoogle.js` and also all defaults.\nawait Apify.utils.puppeteer.blockRequests(page, {\n extraUrlPatterns: ['adsbygoogle.js'],\n});\n\nawait page.goto('https://cnn.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - The patterns of URLs to block from being loaded by the browser. Only ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," can be used as a wildcard. It\nis also automatically added to the beginning and end of the pattern. This limitation is enforced by the DevTools protocol. ",(0,i.kt)("inlineCode",{parentName:"li"},".png")," is the same\nas ",(0,i.kt)("inlineCode",{parentName:"li"},"*.png*"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[extraUrlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - If you just want to append to the default blocked patterns, use this property.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"cacheresponses"}),(0,i.kt)("h2",{id:"puppeteercacheresponsespage-cache-responseurlrules"},(0,i.kt)("del",{parentName:"h2"},(0,i.kt)("inlineCode",{parentName:"del"},"puppeteer.cacheResponses(page, cache, responseUrlRules)"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("em",{parentName:"strong"},"Deprecated"))),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using this function entirely disables browser cache which resolves in sub-optimal performance. Until this\nresolves, we suggest just relying on the in-browser cache unless absolutely necessary."),(0,i.kt)("p",null,"Enables caching of intercepted responses into a provided object. Automatically enables request interception in Puppeteer. ",(0,i.kt)("em",{parentName:"p"},"IMPORTANT"),": Caching\nresponses stores them to memory, so too loose rules could cause memory leaks for longer running crawlers. This issue should be resolved or atleast\nmitigated in future iterations of this feature."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"cache")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Object in which responses are stored"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"responseUrlRules")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp)>")," - List of rules that are used to check if the response should be cached. String rules are\ncompared as page.url().includes(rule) while RegExp rules are evaluated as rule.test(page.url()).")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"compilescript"}),(0,i.kt)("h2",{id:"puppeteercompilescriptscriptstring-context"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.compileScript(scriptString, context)")),(0,i.kt)("p",null,"Compiles a Puppeteer script into an async function that may be executed at any time by providing it with the following object:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n page: Page,\n request: Request,\n}\n")),(0,i.kt)("p",null,"Where ",(0,i.kt)("inlineCode",{parentName:"p"},"page")," is a Puppeteer ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," is a ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,i.kt)("p",null,"The function is compiled by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter as the function's body, so any limitations to function bodies apply. Return value of\nthe compiled function is the return value of the function body = the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter."),(0,i.kt)("p",null,"As a security measure, no globals such as ",(0,i.kt)("inlineCode",{parentName:"p"},"process")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"require")," are accessible from within the function body. Note that the function does not provide\na safe sandbox and even though globals are not easily accessible, malicious code may still execute in the main process via prototype manipulation.\nTherefore you should only use this function to execute sanitized or safe code."),(0,i.kt)("p",null,"Custom context may also be provided using the ",(0,i.kt)("inlineCode",{parentName:"p"},"context")," parameter. To improve security, make sure to only pass the really necessary objects to the\ncontext. Preferably making secured copies beforehand."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"scriptString")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/compiled-script-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptFunction"))),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,k=d["".concat(o,".").concat(m)]||d[m]||c[m]||i;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:r,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>k,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var a=n(87462),r=n(63366),i=(n(67294),n(3905)),l=["components"],p={id_old:"version-2.3.0-puppeteer",title:"utils.puppeteer",id:"puppeteer"},o=void 0,s={unversionedId:"api/puppeteer",id:"version-2.3/api/puppeteer",title:"utils.puppeteer",description:"A namespace that contains various utilities for Puppeteer - the headless Chrome Node API.",source:"@site/versioned_docs/version-2.3/api/puppeteer.md",sourceDirName:"api",slug:"/api/puppeteer",permalink:"/sdk/js/docs/2.3/api/puppeteer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/puppeteer.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer",title:"utils.puppeteer",id:"puppeteer"},sidebar:"version-2.3/docs",previous:{title:"utils.playwright",permalink:"/sdk/js/docs/2.3/api/playwright"},next:{title:"utils.social",permalink:"/sdk/js/docs/2.3/api/social"}},u={},d=[{value:"puppeteer.addInterceptRequestHandler",id:"puppeteeraddinterceptrequesthandler",level:2},{value:"puppeteer.removeInterceptRequestHandler",id:"puppeteerremoveinterceptrequesthandler",level:2},{value:"puppeteer.gotoExtended",id:"puppeteergotoextended",level:2},{value:"puppeteer.infiniteScroll",id:"puppeteerinfinitescroll",level:2},{value:"puppeteer.saveSnapshot",id:"puppeteersavesnapshot",level:2},{value:"puppeteer.enqueueLinksByClickingElements(options)",id:"puppeteerenqueuelinksbyclickingelementsoptions",level:2},{value:"puppeteer.injectFile(page, filePath, [options])",id:"puppeteerinjectfilepage-filepath-options",level:2},{value:"puppeteer.injectJQuery(page)",id:"puppeteerinjectjquerypage",level:2},{value:"puppeteer.injectUnderscore(page)",id:"puppeteerinjectunderscorepage",level:2},{value:"puppeteer.blockRequests(page, [options])",id:"puppeteerblockrequestspage-options",level:2},{value:"puppeteer.cacheResponses(page, cache, responseUrlRules)",id:"puppeteercacheresponsespage-cache-responseurlrules",level:2},{value:"puppeteer.compileScript(scriptString, context)",id:"puppeteercompilescriptscriptstring-context",level:2}],c={toc:d},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,l);return(0,i.kt)(m,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"puppeteer"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { puppeteer } = Apify.utils;\n\n// Open https://www.example.com in Puppeteer\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('https://www.example.com');\n\n// Inject jQuery into a page\nawait puppeteer.injectJQuery(page);\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteeraddinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.addInterceptRequestHandler")),(0,i.kt)("p",null,"Adds request interception handler in similar to ",(0,i.kt)("inlineCode",{parentName:"p"},"page.on('request', handler);")," but in addition to that supports multiple parallel handlers."),(0,i.kt)("p",null,"All the handlers are executed sequentially in the order as they were added. Each of the handlers must call one of ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),",\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()"),". In addition to that any of the handlers may modify the request object (method, postData, headers) by\npassing its overrides to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.continue()"),". If multiple handlers modify same property then the last one wins. Headers are merged separately so you\ncan override only a value of specific header."),(0,i.kt)("p",null,"If one the handlers calls ",(0,i.kt)("inlineCode",{parentName:"p"},"request.abort()")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"request.respond()")," then request is not propagated further to any of the remaining handlers."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Replace images with placeholder.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'image') {\n return request.respond({\n statusCode: 200,\n contentType: 'image/jpeg',\n body: placeholderImageBuffer,\n });\n }\n return request.continue();\n});\n\n// Abort all the scripts.\nawait addInterceptRequestHandler(page, request => {\n if (request.resourceType() === 'script') return request.abort();\n return request.continue();\n});\n\n// Change requests to post.\nawait addInterceptRequestHandler(page, request => {\n return request.continue({\n method: 'POST',\n });\n});\n\nawait page.goto('http://example.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"removeinterceptrequesthandler"}),(0,i.kt)("h2",{id:"puppeteerremoveinterceptrequesthandler"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.removeInterceptRequestHandler")),(0,i.kt)("p",null,"Removes request interception handler for given page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"handler")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/intercept-handler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"InterceptHandler"))," - Request interception handler.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"puppeteergotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.gotoExtended")),(0,i.kt)("p",null,"Extended version of Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload. URL,\nmethod, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"infinitescroll"}),(0,i.kt)("h2",{id:"puppeteerinfinitescroll"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.infiniteScroll")),(0,i.kt)("p",null,"Scrolls to the bottom of a page, or until it times out. Loads dynamic content when it hits the bottom of a page, and then continues scrolling."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 0")," - How many seconds to scroll for. If 0, will scroll until bottom of page."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 4")," - How many seconds to wait for no new content to load before exit."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[scrollDownAndUp]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = false")," - If true, it will scroll up a bit after each scroll down. This is required on some\nwebsites for the scroll to work."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[buttonSelector]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - Optionally checks and clicks a button if it appears while scrolling. This is required on some websites for\nthe scroll to work."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[stopScrollCallback]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"function")," - This function is called after every scroll and stops the scrolling process if it returns ",(0,i.kt)("inlineCode",{parentName:"li"},"true"),". The\nfunction can be ",(0,i.kt)("inlineCode",{parentName:"li"},"async"),".")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"savesnapshot"}),(0,i.kt)("h2",{id:"puppeteersavesnapshot"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.saveSnapshot")),(0,i.kt)("p",null,"Saves a full screenshot and HTML of the current page into a Key-Value store."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[key]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," ",(0,i.kt)("code",null," = ",'"',"SNAPSHOT",'"')," - Key under which the screenshot and HTML will be saved. ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg")," will be appended\nfor screenshot and ",(0,i.kt)("inlineCode",{parentName:"li"},".html")," for HTML."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[screenshotQuality]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 50")," - The quality of the image, between 0-100. Higher quality images have bigger size and\nrequire more storage."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveScreenshot]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full screenshot of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key"),"\nappended by ",(0,i.kt)("inlineCode",{parentName:"li"},".jpg"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[saveHtml]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,i.kt)("code",null," = true")," - If true, it will save a full HTML of the current page as a record with ",(0,i.kt)("inlineCode",{parentName:"li"},"key")," appended by\n",(0,i.kt)("inlineCode",{parentName:"li"},".html"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[keyValueStoreName]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"li"},"null")," ",(0,i.kt)("code",null," = null")," - Name or id of the Key-Value store where snapshot is saved. By default it\nis saved to default Key-Value store.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"enqueuelinksbyclickingelements"}),(0,i.kt)("h2",{id:"puppeteerenqueuelinksbyclickingelementsoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.enqueueLinksByClickingElements(options)")),(0,i.kt)("p",null,"The function finds elements matching a specific CSS selector in a Puppeteer page, clicks all those elements using a mouse move and a left mouse button\nclick and intercepts all the navigation requests that are subsequently produced by the page. The intercepted requests, including their methods,\nheaders and payloads are then enqueued to a provided ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". This is useful to crawl JavaScript heavy pages where\nlinks are not available in ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," elements, but rather navigations are triggered in click handlers. If you're looking to find URLs in ",(0,i.kt)("inlineCode",{parentName:"p"},"href"),"\nattributes of the page, see ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),"."),(0,i.kt)("p",null,"Optionally, the function allows you to filter the target links' URLs using an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," objects and override settings\nof the enqueued ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT"),": To be able to do this, this function uses various mutations on the page, such as changing the Z-index of elements being clicked and\ntheir visibility. Therefore, it is recommended to only use this function as the last operation in the page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"USING HEADFUL BROWSER"),": When using a headful browser, this function will only be able to click elements in the focused tab, effectively limiting\nconcurrency to 1. In headless mode, full concurrency can be achieved."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"PERFORMANCE"),": Clicking elements with a mouse and intercepting requests is not a low level operation that takes nanoseconds. It's not very CPU\nintensive, but it takes time. We strongly recommend limiting the scope of the clicking as much as possible by using a specific selector that targets\nonly the elements that you assume or know will produce a navigation. You can certainly click everything by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"*")," selector, but be prepared to\nwait minutes to get results on a large and complex page."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.enqueueLinksByClickingElements({\n page,\n requestQueue,\n selector: 'a.product-detail',\n pseudoUrls: [\n 'https://www.example.com/handbags/[.*]'\n 'https://www.example.com/purses/[.*]'\n ],\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,i.kt)("inlineCode",{parentName:"p"},"object")," - All ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," parameters are passed via an options object with the following keys:"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"requestQueue")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - A request queue to which the URLs will be enqueued."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"selector")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - A CSS selector matching elements to be clicked on. Unlike in ",(0,i.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()")),",\nthere is no default value. This is to prevent suboptimal use of this function by using it too broadly."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[pseudoUrls]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp|Object)>")," - An array of ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s matching the URLs to be\nenqueued, or an array of strings or RegExps or plain Objects from which the ",(0,i.kt)("a",{parentName:"li",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl")),"s can be constructed.")),(0,i.kt)("p",{parentName:"li"},"The plain objects must include at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"purl")," property, which holds the pseudo-URL string or RegExp. All remaining keys will be used as the\n",(0,i.kt)("inlineCode",{parentName:"p"},"requestTemplate")," argument of the ",(0,i.kt)("a",{parentName:"p",href:"../api/pseudo-url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PseudoUrl"))," constructor, which lets you specify special properties for the enqueued\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",{parentName:"li"},"If ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," is an empty array, ",(0,i.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"undefined"),", then the function enqueues all links found on the page."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[transformRequestFunction]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/request-transform",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestTransform"))," - Just before a new ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," is\nconstructed and enqueued to the ",(0,i.kt)("a",{parentName:"li",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),", this function can be used to remove it or modify its contents such as\n",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"payload")," or, most importantly ",(0,i.kt)("inlineCode",{parentName:"li"},"uniqueKey"),". This is useful when you need to enqueue multiple ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests")," to the queue that share\nthe same URL, but differ in methods or payloads, or to dynamically update or create ",(0,i.kt)("inlineCode",{parentName:"li"},"userData"),".")),(0,i.kt)("p",{parentName:"li"},"For example: by adding ",(0,i.kt)("inlineCode",{parentName:"p"},"useExtendedUniqueKey: true")," to the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," object, ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," will be computed from a combination of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"method"),"\nand ",(0,i.kt)("inlineCode",{parentName:"p"},"payload")," which enables crawling of websites that navigate using form submits (POST requests)."),(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n transformRequestFunction: request => {\n request.userData.foo = 'bar';\n request.useExtendedUniqueKey = true;\n return request;\n };\n}\n")),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[waitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 1")," - Clicking in the page triggers various asynchronous operations that lead to new URLs\nbeing shown by the browser. It could be a simple JavaScript redirect or opening of a new tab in the browser. These events often happen only\nsome time after the actual click. Requests typically take milliseconds while new tabs open in hundreds of milliseconds.")),(0,i.kt)("p",{parentName:"li"},"To be able to capture all those events, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinksByClickingElements()")," function repeatedly waits for the ",(0,i.kt)("inlineCode",{parentName:"p"},"waitForPageIdleSecs"),". By\nrepeatedly we mean that whenever a relevant event is triggered, the timer is restarted. As long as new events keep coming, the function will not\nreturn, unless the below ",(0,i.kt)("inlineCode",{parentName:"p"},"maxWaitForPageIdleSecs")," timeout is reached."),(0,i.kt)("p",{parentName:"li"},"You may want to reduce this for example when you're sure that your clicks do not open new tabs, or increase when you're not getting all the\nexpected URLs."),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[maxWaitForPageIdleSecs]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"number")," ",(0,i.kt)("code",null," = 5")," - This is the maximum period for which the function will keep tracking events, even\nif more events keep coming. Its purpose is to prevent a deadlock in the page by periodic events, often unrelated to the clicking itself. See\n",(0,i.kt)("inlineCode",{parentName:"li"},"waitForPageIdleSecs")," above for an explanation.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise>"))," - Promise that resolves to an array of\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/queue-operation-info",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"QueueOperationInfo"))," objects."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectfile"}),(0,i.kt)("h2",{id:"puppeteerinjectfilepage-filepath-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectFile(page, filePath, [options])")),(0,i.kt)("p",null,"Injects a JavaScript file into a Puppeteer page. Unlike Puppeteer's ",(0,i.kt)("inlineCode",{parentName:"p"},"addScriptTag")," function, this function works on pages with arbitrary Cross-Origin\nResource Sharing (CORS) policies."),(0,i.kt)("p",null,"File contents are cached for up to 10 files to limit file system access."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"filePath")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - File path"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[surviveNavigations]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," - Enables the injected script to survive page navigations and reloads without need to be re-injected\nmanually. This does not mean, however, that internal state will be preserved. Just that it will be automatically re-injected on each\nnavigation before any other scripts get the chance to execute.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectjquery"}),(0,i.kt)("h2",{id:"puppeteerinjectjquerypage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectJQuery(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery")," library into a Puppeteer page. jQuery is often useful for various web scraping and crawling tasks. For\nexample, it can help extract text from HTML elements using CSS selectors."),(0,i.kt)("p",null,"Beware that the injected jQuery object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window.$")," variable and thus it might cause conflicts with other libraries included by the\npage that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected jQuery will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectJQuery(page);\nconst title = await page.evaluate(() => {\n return $('head title').text();\n});\n")),(0,i.kt)("p",null,"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"injectJQuery()")," does not affect the Puppeteer's ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-pageselector",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"page.$()"))," function in any\nway."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectunderscore"}),(0,i.kt)("h2",{id:"puppeteerinjectunderscorepage"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.injectUnderscore(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://underscorejs.org/",target:"_blank",rel:"noopener"},"Underscore")," library into a Puppeteer page."),(0,i.kt)("p",null,"Beware that the injected Underscore object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window._")," variable and thus it might cause conflicts with libraries included by the\npage that use the same variable name. This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected Underscore will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.puppeteer.injectUnderscore(page);\nconst escapedHtml = await page.evaluate(() => {\n return _.escape('

Hello

');\n});\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page",target:"_blank",rel:"noopener"},"Page")," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"blockrequests"}),(0,i.kt)("h2",{id:"puppeteerblockrequestspage-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.blockRequests(page, [options])")),(0,i.kt)("p",null,"Forces the Puppeteer browser tab to block loading URLs that match a provided pattern. This is useful to speed up crawling of websites, since it\nreduces the amount of data that needs to be downloaded from the web, but it may break some websites or unexpectedly prevent loading of resources."),(0,i.kt)("p",null,"By default, the function will block all URLs including the following patterns:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'[".css", ".jpg", ".jpeg", ".png", ".svg", ".gif", ".woff", ".pdf", ".zip"]\n')),(0,i.kt)("p",null,"If you want to extend this list further, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"extraUrlPatterns")," option, which will keep blocking the default patterns, as well as add your custom\nones. If you would like to block only specific patterns, use the ",(0,i.kt)("inlineCode",{parentName:"p"},"urlPatterns")," option, which will override the defaults and block only URLs with your\ncustom patterns."),(0,i.kt)("p",null,"This function does not use Puppeteer's request interception and therefore does not interfere with browser cache. It's also faster than blocking\nrequests using interception, because the blocking happens directly in the browser without the round-trip to Node.js, but it does not provide the extra\nbenefits of request interception."),(0,i.kt)("p",null,"The function will never block main document loads and their respective redirects."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\n\n// Block all requests to URLs that include `adsbygoogle.js` and also all defaults.\nawait Apify.utils.puppeteer.blockRequests(page, {\n extraUrlPatterns: ['adsbygoogle.js'],\n});\n\nawait page.goto('https://cnn.com');\n")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[urlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - The patterns of URLs to block from being loaded by the browser. Only ",(0,i.kt)("inlineCode",{parentName:"li"},"*")," can be used as a wildcard. It\nis also automatically added to the beginning and end of the pattern. This limitation is enforced by the DevTools protocol. ",(0,i.kt)("inlineCode",{parentName:"li"},".png")," is the same\nas ",(0,i.kt)("inlineCode",{parentName:"li"},"*.png*"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[extraUrlPatterns]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array")," - If you just want to append to the default blocked patterns, use this property.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"cacheresponses"}),(0,i.kt)("h2",{id:"puppeteercacheresponsespage-cache-responseurlrules"},(0,i.kt)("del",{parentName:"h2"},(0,i.kt)("inlineCode",{parentName:"del"},"puppeteer.cacheResponses(page, cache, responseUrlRules)"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("em",{parentName:"strong"},"Deprecated"))),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Puppeteer using this function entirely disables browser cache which resolves in sub-optimal performance. Until this\nresolves, we suggest just relying on the in-browser cache unless absolutely necessary."),(0,i.kt)("p",null,"Enables caching of intercepted responses into a provided object. Automatically enables request interception in Puppeteer. ",(0,i.kt)("em",{parentName:"p"},"IMPORTANT"),": Caching\nresponses stores them to memory, so too loose rules could cause memory leaks for longer running crawlers. This issue should be resolved or atleast\nmitigated in future iterations of this feature."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Puppeteer ",(0,i.kt)("a",{parentName:"li",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"cache")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object")," - Object in which responses are stored"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"responseUrlRules")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Array<(string|RegExp)>")," - List of rules that are used to check if the response should be cached. String rules are\ncompared as page.url().includes(rule) while RegExp rules are evaluated as rule.test(page.url()).")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"compilescript"}),(0,i.kt)("h2",{id:"puppeteercompilescriptscriptstring-context"},(0,i.kt)("inlineCode",{parentName:"h2"},"puppeteer.compileScript(scriptString, context)")),(0,i.kt)("p",null,"Compiles a Puppeteer script into an async function that may be executed at any time by providing it with the following object:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n page: Page,\n request: Request,\n}\n")),(0,i.kt)("p",null,"Where ",(0,i.kt)("inlineCode",{parentName:"p"},"page")," is a Puppeteer ",(0,i.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," is a ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,i.kt)("p",null,"The function is compiled by using the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter as the function's body, so any limitations to function bodies apply. Return value of\nthe compiled function is the return value of the function body = the ",(0,i.kt)("inlineCode",{parentName:"p"},"scriptString")," parameter."),(0,i.kt)("p",null,"As a security measure, no globals such as ",(0,i.kt)("inlineCode",{parentName:"p"},"process")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"require")," are accessible from within the function body. Note that the function does not provide\na safe sandbox and even though globals are not easily accessible, malicious code may still execute in the main process via prototype manipulation.\nTherefore you should only use this function to execute sanitized or safe code."),(0,i.kt)("p",null,"Custom context may also be provided using the ",(0,i.kt)("inlineCode",{parentName:"p"},"context")," parameter. To improve security, make sure to only pass the really necessary objects to the\ncontext. Preferably making secured copies beforehand."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"scriptString")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Object"))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../typedefs/compiled-script-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptFunction"))),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),s=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,k=d["".concat(o,".").concat(m)]||d[m]||c[m]||i;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p[d]="string"==typeof e?e:r,l[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),p=["components"],o={id_old:"version-2.3.0-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},i=void 0,s={unversionedId:"api/puppeteer-crawler",id:"version-2.3/api/puppeteer-crawler",title:"PuppeteerCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chrome with Puppeteer. The",source:"@site/versioned_docs/version-2.3/api/PuppeteerCrawler.md",sourceDirName:"api",slug:"/api/puppeteer-crawler",permalink:"/sdk/js/docs/2.3/api/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PuppeteerCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/2.3/api/playwright-crawler"},next:{title:"Statistics",permalink:"/sdk/js/docs/2.3/api/statistics"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"browserPool",id:"browserpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new PuppeteerCrawler(options)",id:"new-puppeteercrawleroptions",level:2},{value:"puppeteerCrawler.optionsShape",id:"puppeteercrawleroptionsshape",level:2}],d={toc:c},m="wrapper";function h(e){var t=e.components,r=(0,n.Z)(e,p);return(0,l.kt)(m,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chrome with ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),". The\nURLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," uses headless Chrome to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Puppeteer instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Puppeteer.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("h2",{id:"new-puppeteercrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PuppeteerCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"puppeteercrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"puppeteerCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function p(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=s(r),m=n,h=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return r?a.createElement(h,p(p({ref:t},u),{},{components:r})):a.createElement(h,p({ref:t},u))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,p=new Array(l);p[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[c]="string"==typeof e?e:n,p[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),p=["components"],o={id_old:"version-2.3.0-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},i=void 0,s={unversionedId:"api/puppeteer-crawler",id:"version-2.3/api/puppeteer-crawler",title:"PuppeteerCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chrome with Puppeteer. The",source:"@site/versioned_docs/version-2.3/api/PuppeteerCrawler.md",sourceDirName:"api",slug:"/api/puppeteer-crawler",permalink:"/sdk/js/docs/2.3/api/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PuppeteerCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/2.3/api/playwright-crawler"},next:{title:"Statistics",permalink:"/sdk/js/docs/2.3/api/statistics"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"browserPool",id:"browserpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new PuppeteerCrawler(options)",id:"new-puppeteercrawleroptions",level:2},{value:"puppeteerCrawler.optionsShape",id:"puppeteercrawleroptionsshape",level:2}],d={toc:c},m="wrapper";function h(e){var t=e.components,r=(0,n.Z)(e,p);return(0,l.kt)(m,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chrome with ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),". The\nURLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," uses headless Chrome to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Puppeteer instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Puppeteer.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("h2",{id:"new-puppeteercrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PuppeteerCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"puppeteercrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"puppeteerCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function p(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=s(r),m=n,h=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return r?a.createElement(h,p(p({ref:t},u),{},{components:r})):a.createElement(h,p({ref:t},u))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,p=new Array(l);p[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[c]="string"==typeof e?e:n,p[1]=o;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var o=n(87462),a=n(63366),r=(n(67294),n(3905)),i=["components"],l={id:"autoscaled-pool-options",title:"AutoscaledPoolOptions"},s=void 0,p={unversionedId:"typedefs/autoscaled-pool-options",id:"version-2.3/typedefs/autoscaled-pool-options",title:"AutoscaledPoolOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/AutoscaledPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/autoscaled-pool-options",permalink:"/sdk/js/docs/2.3/typedefs/autoscaled-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AutoscaledPoolOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"autoscaled-pool-options",title:"AutoscaledPoolOptions"},sidebar:"version-2.3/docs",previous:{title:"utils.social",permalink:"/sdk/js/docs/2.3/api/social"},next:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/basic-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"runTaskFunction",id:"runtaskfunction",level:3},{value:"isTaskReadyFunction",id:"istaskreadyfunction",level:3},{value:"isFinishedFunction",id:"isfinishedfunction",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"desiredConcurrency",id:"desiredconcurrency",level:3},{value:"desiredConcurrencyRatio",id:"desiredconcurrencyratio",level:3},{value:"scaleUpStepRatio",id:"scaleupstepratio",level:3},{value:"scaleDownStepRatio",id:"scaledownstepratio",level:3},{value:"maybeRunIntervalSecs",id:"mayberunintervalsecs",level:3},{value:"loggingIntervalSecs",id:"loggingintervalsecs",level:3},{value:"autoscaleIntervalSecs",id:"autoscaleintervalsecs",level:3},{value:"taskTimeoutSecs",id:"tasktimeoutsecs",level:3},{value:"snapshotterOptions",id:"snapshotteroptions",level:3},{value:"systemStatusOptions",id:"systemstatusoptions",level:3}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"autoscaledpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"runtaskfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"runTaskFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that performs an asynchronous resource-intensive task. The function must either be labeled ",(0,r.kt)("inlineCode",{parentName:"p"},"async")," or return a promise."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"istaskreadyfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isTaskReadyFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that indicates whether ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," should be called. This function is called every time there is free capacity for a new task and it\nshould indicate whether it should start a new task or not by resolving to either ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),". Besides its obvious use, it is also useful for\ntask throttling to save resources."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isfinishedfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isFinishedFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that is called only when there are no tasks to be processed. If it resolves to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," then the pool's run finishes. Being called only when\nthere are no tasks being processed means that as long as ",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction()")," keeps resolving to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction()")," will never be\ncalled. To abort a run, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()"))," method."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"The minimum number of tasks running in parallel."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"The maximum number of tasks running in parallel."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"The desired number of tasks that should be running parallel on the start of the pool, if there is a large enough supply of them. By default, it is\n",(0,r.kt)("inlineCode",{parentName:"p"},"minConcurrency"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrencyratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrencyRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.95")),(0,r.kt)("p",null,"Minimum level of desired concurrency to reach before more scaling up is allowed."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaleupstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleUpStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaledownstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleDownStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"mayberunintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"maybeRunIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.5")),(0,r.kt)("p",null,"Indicates how often the pool should call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction()")," to start a new task, in seconds. This has no effect on starting new tasks immediately\nafter a task completes."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"loggingintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"loggingIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Specifies a period in which the instance logs its state, in seconds. Set to ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," to disable periodic logging."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaleintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaleIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 10")),(0,r.kt)("p",null,"Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1\nmight have a severe impact on performance. We suggest using a value from 5 to 20."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tasktimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"taskTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0")),(0,r.kt)("p",null,"Timeout in which the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," needs to finish, given in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"snapshotteroptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"snapshotterOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," constructor. This is useful for fine-tuning the snapshot intervals and history."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"systemStatusOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," constructor. This is useful for fine-tuning the system status reports. If a\ncustom snapshotter is set in the options, it will be used by the pool."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||r;return n?o.createElement(k,i(i({ref:t},u),{},{components:n})):o.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var o=n(87462),a=n(63366),r=(n(67294),n(3905)),i=["components"],l={id:"autoscaled-pool-options",title:"AutoscaledPoolOptions"},s=void 0,p={unversionedId:"typedefs/autoscaled-pool-options",id:"version-2.3/typedefs/autoscaled-pool-options",title:"AutoscaledPoolOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/AutoscaledPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/autoscaled-pool-options",permalink:"/sdk/js/docs/2.3/typedefs/autoscaled-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AutoscaledPoolOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"autoscaled-pool-options",title:"AutoscaledPoolOptions"},sidebar:"version-2.3/docs",previous:{title:"utils.social",permalink:"/sdk/js/docs/2.3/api/social"},next:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/basic-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"runTaskFunction",id:"runtaskfunction",level:3},{value:"isTaskReadyFunction",id:"istaskreadyfunction",level:3},{value:"isFinishedFunction",id:"isfinishedfunction",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"desiredConcurrency",id:"desiredconcurrency",level:3},{value:"desiredConcurrencyRatio",id:"desiredconcurrencyratio",level:3},{value:"scaleUpStepRatio",id:"scaleupstepratio",level:3},{value:"scaleDownStepRatio",id:"scaledownstepratio",level:3},{value:"maybeRunIntervalSecs",id:"mayberunintervalsecs",level:3},{value:"loggingIntervalSecs",id:"loggingintervalsecs",level:3},{value:"autoscaleIntervalSecs",id:"autoscaleintervalsecs",level:3},{value:"taskTimeoutSecs",id:"tasktimeoutsecs",level:3},{value:"snapshotterOptions",id:"snapshotteroptions",level:3},{value:"systemStatusOptions",id:"systemstatusoptions",level:3}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"autoscaledpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"runtaskfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"runTaskFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that performs an asynchronous resource-intensive task. The function must either be labeled ",(0,r.kt)("inlineCode",{parentName:"p"},"async")," or return a promise."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"istaskreadyfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isTaskReadyFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that indicates whether ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," should be called. This function is called every time there is free capacity for a new task and it\nshould indicate whether it should start a new task or not by resolving to either ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),". Besides its obvious use, it is also useful for\ntask throttling to save resources."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isfinishedfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"isFinishedFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"function")),(0,r.kt)("p",null,"A function that is called only when there are no tasks to be processed. If it resolves to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," then the pool's run finishes. Being called only when\nthere are no tasks being processed means that as long as ",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction()")," keeps resolving to ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction()")," will never be\ncalled. To abort a run, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()"))," method."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"The minimum number of tasks running in parallel."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"The maximum number of tasks running in parallel."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"The desired number of tasks that should be running parallel on the start of the pool, if there is a large enough supply of them. By default, it is\n",(0,r.kt)("inlineCode",{parentName:"p"},"minConcurrency"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"desiredconcurrencyratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"desiredConcurrencyRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.95")),(0,r.kt)("p",null,"Minimum level of desired concurrency to reach before more scaling up is allowed."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaleupstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleUpStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scaledownstepratio"},(0,r.kt)("inlineCode",{parentName:"h3"},"scaleDownStepRatio")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.05")),(0,r.kt)("p",null,"Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"mayberunintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"maybeRunIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0.5")),(0,r.kt)("p",null,"Indicates how often the pool should call the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction()")," to start a new task, in seconds. This has no effect on starting new tasks immediately\nafter a task completes."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"loggingintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"loggingIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Specifies a period in which the instance logs its state, in seconds. Set to ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," to disable periodic logging."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaleintervalsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaleIntervalSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 10")),(0,r.kt)("p",null,"Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1\nmight have a severe impact on performance. We suggest using a value from 5 to 20."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tasktimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"taskTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 0")),(0,r.kt)("p",null,"Timeout in which the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," needs to finish, given in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"snapshotteroptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"snapshotterOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," constructor. This is useful for fine-tuning the snapshot intervals and history."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"systemStatusOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))),(0,r.kt)("p",null,"Options to be passed down to the ",(0,r.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," constructor. This is useful for fine-tuning the system status reports. If a\ncustom snapshotter is set in the options, it will be used by the pool."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,k=c["".concat(s,".").concat(m)]||c[m]||d[m]||r;return n?o.createElement(k,i(i({ref:t},u),{},{components:n})):o.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>f,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var r=t(87462),a=t(63366),o=(t(67294),t(3905)),s=["components"],l={id_old:"version-1.3-handle-broken-links",title:"Handle broken links",id:"handle-broken-links"},i=void 0,c={unversionedId:"examples/handle-broken-links",id:"version-1.3/examples/handle-broken-links",title:"Handle broken links",description:"This example uses the handleFailedRequestFunction function to log failed requests. In a real-world project, you might choose to keep track of these",source:"@site/versioned_docs/version-1.3/examples/handle_broken_links.md",sourceDirName:"examples",slug:"/examples/handle-broken-links",permalink:"/sdk/js/docs/1.3/examples/handle-broken-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/handle_broken_links.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-handle-broken-links",title:"Handle broken links",id:"handle-broken-links"},sidebar:"version-1.3/docs",previous:{title:"Forms",permalink:"/sdk/js/docs/1.3/examples/forms"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/1.3/examples/map-and-reduce"}},p={},u=[],d={toc:u},m="wrapper";function f(e){var n=e.components,t=(0,a.Z)(e,s);return(0,o.kt)(m,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," function to log failed requests. In a real-world project, you might choose to keep track of these\nfailed requests by ",(0,o.kt)("a",{parentName:"p",href:"add-data-to-dataset",target:null,rel:null},"saving them to a dataset"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('my-list', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each successful request\n const handleRequestFunction = async ({ request }) => {\n if (request.url === 'http://www.example.com/page-3') {\n throw new Error('Request function failed.');\n } else {\n console.log(`[success] ${request.url}`);\n }\n };\n // Function called for each failed request\n const handleFailedRequestFunction = async ({ request, error }) => {\n console.log(`[failed] ${request.url} with error: ${error}`);\n };\n // Create a BasicCrawler\n const crawler = new Apify.BasicCrawler({\n requestList,\n handleRequestFunction,\n handleFailedRequestFunction,\n maxRequestRetries: 1,\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),c=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=c(e.components);return r.createElement(i.Provider,{value:n},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(t),m=a,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||o;return t?r.createElement(f,s(s({ref:n},p),{},{components:t})):r.createElement(f,s({ref:n},p))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=m;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l[u]="string"==typeof e?e:a,s[1]=l;for(var c=2;c{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>f,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var r=t(87462),a=t(63366),o=(t(67294),t(3905)),s=["components"],l={id_old:"version-1.3-handle-broken-links",title:"Handle broken links",id:"handle-broken-links"},i=void 0,c={unversionedId:"examples/handle-broken-links",id:"version-1.3/examples/handle-broken-links",title:"Handle broken links",description:"This example uses the handleFailedRequestFunction function to log failed requests. In a real-world project, you might choose to keep track of these",source:"@site/versioned_docs/version-1.3/examples/handle_broken_links.md",sourceDirName:"examples",slug:"/examples/handle-broken-links",permalink:"/sdk/js/docs/1.3/examples/handle-broken-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/handle_broken_links.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-handle-broken-links",title:"Handle broken links",id:"handle-broken-links"},sidebar:"version-1.3/docs",previous:{title:"Forms",permalink:"/sdk/js/docs/1.3/examples/forms"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/1.3/examples/map-and-reduce"}},p={},u=[],d={toc:u},m="wrapper";function f(e){var n=e.components,t=(0,a.Z)(e,s);return(0,o.kt)(m,(0,r.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example uses the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," function to log failed requests. In a real-world project, you might choose to keep track of these\nfailed requests by ",(0,o.kt)("a",{parentName:"p",href:"add-data-to-dataset",target:null,rel:null},"saving them to a dataset"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('my-list', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each successful request\n const handleRequestFunction = async ({ request }) => {\n if (request.url === 'http://www.example.com/page-3') {\n throw new Error('Request function failed.');\n } else {\n console.log(`[success] ${request.url}`);\n }\n };\n // Function called for each failed request\n const handleFailedRequestFunction = async ({ request, error }) => {\n console.log(`[failed] ${request.url} with error: ${error}`);\n };\n // Create a BasicCrawler\n const crawler = new Apify.BasicCrawler({\n requestList,\n handleRequestFunction,\n handleFailedRequestFunction,\n maxRequestRetries: 1,\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=r.createContext({}),c=function(e){var n=r.useContext(i),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},p=function(e){var n=c(e.components);return r.createElement(i.Provider,{value:n},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(t),m=a,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||o;return t?r.createElement(f,s(s({ref:n},p),{},{components:t})):r.createElement(f,s({ref:n},p))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=m;var l={};for(var i in n)hasOwnProperty.call(n,i)&&(l[i]=n[i]);l.originalType=e,l[u]="string"==typeof e?e:a,s[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>f,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),l=["components"],s={id:"crawl-relative-links",title:"Crawl a website with relative links"},o=void 0,u={unversionedId:"examples/crawl-relative-links",id:"version-2.3/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may",source:"@site/versioned_docs/version-2.3/examples/crawl_relative_links.md",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/2.3/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_relative_links.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"version-2.3/docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/2.3/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/2.3/examples/crawl-single-url"}},p={},c=[],d={toc:c},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,l);return(0,i.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"If a website uses relative links, ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," may\nhave trouble following them.\nThis is why it is important to set the ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl")," property within ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl, // <-------------- important to set the base url here\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var o=n.createContext({}),u=function(e){var t=n.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(o.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=u(r),m=a,f=c["".concat(o,".").concat(m)]||c[m]||d[m]||i;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=m;var s={};for(var o in t)hasOwnProperty.call(t,o)&&(s[o]=t[o]);s.originalType=e,s[c]="string"==typeof e?e:a,l[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>f,frontMatter:()=>o,metadata:()=>u,toc:()=>c});var n=r(87462),a=r(63366),i=(r(67294),r(3905)),l=["components"],o={id:"crawl-relative-links",title:"Crawl a website with relative links"},s=void 0,u={unversionedId:"examples/crawl-relative-links",id:"version-2.3/examples/crawl-relative-links",title:"Crawl a website with relative links",description:"If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may",source:"@site/versioned_docs/version-2.3/examples/crawl_relative_links.md",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/2.3/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_relative_links.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"version-2.3/docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/2.3/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/2.3/examples/crawl-single-url"}},p={},c=[],d={toc:c},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,l);return(0,i.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"If a website uses relative links, ",(0,i.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," may\nhave trouble following them.\nThis is why it is important to set the ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl")," property within ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.enqueueLinks()")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestQueue\n const requestQueue = await Apify.openRequestQueue();\n // Define the starting URL\n await requestQueue.addRequest({ url: 'https://apify.com/' });\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n baseUrl: request.loadedUrl, // <-------------- important to set the base url here\n });\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n });\n // Run the crawler\n await crawler.run();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),u=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=u(r),m=a,f=c["".concat(s,".").concat(m)]||c[m]||d[m]||i;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=m;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o[c]="string"==typeof e?e:a,l[1]=o;for(var u=2;u{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>w,frontMatter:()=>p,metadata:()=>l,toc:()=>u});var r=n(87462),a=n(63366),s=(n(67294),n(3905)),o=["components"],p={id_old:"version-1.3-capture-screenshot",title:"Capture a screenshot",id:"capture-screenshot"},i=void 0,l={unversionedId:"examples/capture-screenshot",id:"version-1.3/examples/capture-screenshot",title:"Capture a screenshot",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-1.3/examples/capture_screenshot.md",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/1.3/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/capture_screenshot.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-capture-screenshot",title:"Capture a screenshot",id:"capture-screenshot"},sidebar:"version-1.3/docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/1.3/examples/call-actor"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/1.3/examples/cheerio-crawler"}},c={},u=[],m={toc:u},h="wrapper";function w(e){var t=e.components,n=(0,a.Z)(e,o);return(0,s.kt)(h,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("p",null,"This example captures a screenshot of a web page using ",(0,s.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,s.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n const screenshot = await page.screenshot();\n // Save the screenshot to the default key-value store\n await Apify.setValue('my-key', screenshot, { contentType: 'image/png' });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,s.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,s.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Apify.setValue(key, screenshot, { contentType: 'image/png' });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key, saveHtml: false });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"In both examples using ",(0,s.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,s.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}w.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>w});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),l=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,w=u["".concat(i,".").concat(h)]||u[h]||m[h]||s;return n?r.createElement(w,o(o({ref:t},c),{},{components:n})):r.createElement(w,o({ref:t},c))}));function w(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=h;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[u]="string"==typeof e?e:a,o[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>w,frontMatter:()=>o,metadata:()=>l,toc:()=>u});var r=n(87462),a=n(63366),s=(n(67294),n(3905)),p=["components"],o={id_old:"version-1.3-capture-screenshot",title:"Capture a screenshot",id:"capture-screenshot"},i=void 0,l={unversionedId:"examples/capture-screenshot",id:"version-1.3/examples/capture-screenshot",title:"Capture a screenshot",description:"To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.",source:"@site/versioned_docs/version-1.3/examples/capture_screenshot.md",sourceDirName:"examples",slug:"/examples/capture-screenshot",permalink:"/sdk/js/docs/1.3/examples/capture-screenshot",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/capture_screenshot.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-capture-screenshot",title:"Capture a screenshot",id:"capture-screenshot"},sidebar:"version-1.3/docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/1.3/examples/call-actor"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/1.3/examples/cheerio-crawler"}},c={},u=[],m={toc:u},h="wrapper";function w(e){var t=e.components,n=(0,a.Z)(e,p);return(0,s.kt)(h,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("p",null,"This example captures a screenshot of a web page using ",(0,s.kt)("inlineCode",{parentName:"p"},"Puppeteer"),". It would look almost exactly the same with ",(0,s.kt)("inlineCode",{parentName:"p"},"Playwright"),"."),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n const screenshot = await page.screenshot();\n // Save the screenshot to the default key-value store\n await Apify.setValue('my-key', screenshot, { contentType: 'image/png' });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const url = 'http://www.example.com/';\n // Start a browser\n const browser = await Apify.launchPuppeteer();\n // Open new tab in the browser\n const page = await browser.newPage();\n // Navigate to the URL\n await page.goto(url);\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key: 'my-key', saveHtml: false });\n // Close Puppeteer\n await browser.close();\n});\n")),(0,s.kt)("p",null,"This example captures a screenshot of multiple web pages when using ",(0,s.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Capture the screenshot with Puppeteer\n const screenshot = await page.screenshot();\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Save the screenshot to the default key-value store\n await Apify.setValue(key, screenshot, { contentType: 'image/png' });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"\\\nUsing ",(0,s.kt)("inlineCode",{parentName:"p"},"Apify.utils.puppeteer.saveSnapshot()"),":"),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n // Convert the URL into a valid key\n const key = request.url.replace(/[:/]/g, '_');\n // Capture the screenshot\n await Apify.utils.puppeteer.saveSnapshot(page, { key, saveHtml: false });\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,s.kt)("p",null,"In both examples using ",(0,s.kt)("inlineCode",{parentName:"p"},"page.screenshot()"),", a ",(0,s.kt)("inlineCode",{parentName:"p"},"key")," variable is created based on the URL of the web page. This variable is used as the key when saving\neach screenshot into a key-value store."))}w.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>w});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),l=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=l(n),h=a,w=u["".concat(i,".").concat(h)]||u[h]||m[h]||s;return n?r.createElement(w,p(p({ref:t},c),{},{components:n})):r.createElement(w,p({ref:t},c))}));function w(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,p=new Array(s);p[0]=h;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[u]="string"==typeof e?e:a,p[1]=o;for(var l=2;l{r.d(t,{Z:()=>i});var n=r(67294),s=r(88746),a=r(6141),o=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,a.E)(),u=i.version,l=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(s.default,{to:"/api/"+t},r);var p=u+"/";return"current"===u?p="next/":l&&(p=""),n.createElement(s.default,{to:"/api/"+p+t},r)}},84446:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>d,toc:()=>h});var n,s=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(68889),u=["components"],l={id:"request-storage",title:"Request Storage"},p=void 0,d={unversionedId:"guides/request-storage",id:"version-3.1/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.1/guides/request_storage.mdx",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/request_storage.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/guides/apify-platform"},next:{title:"Result Storage",permalink:"/sdk/js/docs/guides/result-storage"}},c={},h=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],m=(n="CrawleeApiLink",function(e){return console.warn("Component "+n+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:h},q="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,u);return(0,o.kt)(q,(0,s.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await RequestQueue.open();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,o.kt)("h2",{id:"request-list"},"Request list"),(0,o.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,o.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,o.kt)(m,{to:"core/class/RequestList",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestList"))," class."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await RequestList.open('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,o.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,o.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,o.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,o.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,o.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await RequestList.open('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await RequestQueue.open();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,a=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=s,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||a;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=r.length,o=new Array(a);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:s,o[1]=i;for(var l=2;l{r.d(t,{Z:()=>i});var n=r(67294),s=r(88746),a=r(6141),o=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,a.E)(),u=i.version,l=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(s.default,{to:"/api/"+t},r);var p=u+"/";return"current"===u?p="next/":l&&(p=""),n.createElement(s.default,{to:"/api/"+p+t},r)}},84446:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>d,toc:()=>h});var n,s=r(87462),a=r(63366),o=(r(67294),r(3905)),i=r(68889),u=["components"],l={id:"request-storage",title:"Request Storage"},p=void 0,d={unversionedId:"guides/request-storage",id:"version-3.1/guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.1/guides/request_storage.mdx",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/request_storage.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/guides/apify-platform"},next:{title:"Result Storage",permalink:"/sdk/js/docs/guides/result-storage"}},c={},h=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],m=(n="CrawleeApiLink",function(e){return console.warn("Component "+n+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:h},q="wrapper";function g(e){var t=e.components,r=(0,a.Z)(e,u);return(0,o.kt)(q,(0,s.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await RequestQueue.open();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,o.kt)("h2",{id:"request-list"},"Request list"),(0,o.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,o.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,o.kt)(m,{to:"core/class/RequestList",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestList"))," class."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await RequestList.open('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,o.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,o.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,o.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,o.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,o.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await RequestList.open('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await RequestQueue.open();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,a=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),h=s,m=d["".concat(u,".").concat(h)]||d[h]||c[h]||a;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var a=r.length,o=new Array(a);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:s,o[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var a=r(87462),n=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-compiled-script-params",title:"CompiledScriptParams",id:"compiled-script-params"},s=void 0,c={unversionedId:"typedefs/compiled-script-params",id:"version-1.3/typedefs/compiled-script-params",title:"CompiledScriptParams",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CompiledScriptParams.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-params",permalink:"/sdk/js/docs/1.3/typedefs/compiled-script-params",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptParams.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-compiled-script-params",title:"CompiledScriptParams",id:"compiled-script-params"}},l={},d=[{value:"Properties",id:"properties",level:2},{value:"params.page",id:"paramspage",level:3},{value:"params.request",id:"paramsrequest",level:3}],m={toc:d},u="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,o);return(0,p.kt)(u,(0,a.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"compiledscriptparams"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"paramspage"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"paramsrequest"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),c=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,p=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(r),u=n,f=d["".concat(s,".").concat(u)]||d[u]||m[u]||p;return r?a.createElement(f,o(o({ref:t},l),{},{components:r})):a.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var p=r.length,o=new Array(p);o[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:n,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-compiled-script-params",title:"CompiledScriptParams",id:"compiled-script-params"},s=void 0,c={unversionedId:"typedefs/compiled-script-params",id:"version-1.3/typedefs/compiled-script-params",title:"CompiledScriptParams",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CompiledScriptParams.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-params",permalink:"/sdk/js/docs/1.3/typedefs/compiled-script-params",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptParams.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-compiled-script-params",title:"CompiledScriptParams",id:"compiled-script-params"}},l={},d=[{value:"Properties",id:"properties",level:2},{value:"params.page",id:"paramspage",level:3},{value:"params.request",id:"paramsrequest",level:3}],m={toc:d},u="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"compiledscriptparams"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"paramspage"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"paramsrequest"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(r),u=a,f=d["".concat(s,".").concat(u)]||d[u]||m[u]||p;return r?n.createElement(f,o(o({ref:t},l),{},{components:r})):n.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],p={id:"playwright-goto-options",title:"PlaywrightGotoOptions"},l=void 0,s={unversionedId:"typedefs/playwright-goto-options",id:"version-2.3/typedefs/playwright-goto-options",title:"PlaywrightGotoOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightGotoOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-goto-options",permalink:"/sdk/js/docs/2.3/typedefs/playwright-goto-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightGotoOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-goto-options",title:"PlaywrightGotoOptions"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"timeout",id:"timeout",level:3},{value:"waitUntil",id:"waituntil",level:3},{value:"referer",id:"referer",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrightgotooptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),m=o,f=u["".concat(l,".").concat(m)]||u[m]||c[m]||i;return n?r.createElement(f,a(a({ref:t},d),{},{components:n})):r.createElement(f,a({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,a[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],p={id:"playwright-goto-options",title:"PlaywrightGotoOptions"},l=void 0,s={unversionedId:"typedefs/playwright-goto-options",id:"version-2.3/typedefs/playwright-goto-options",title:"PlaywrightGotoOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightGotoOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-goto-options",permalink:"/sdk/js/docs/2.3/typedefs/playwright-goto-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightGotoOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-goto-options",title:"PlaywrightGotoOptions"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"timeout",id:"timeout",level:3},{value:"waitUntil",id:"waituntil",level:3},{value:"referer",id:"referer",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrightgotooptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),m=o,f=u["".concat(l,".").concat(m)]||u[m]||c[m]||i;return n?r.createElement(f,a(a({ref:t},d),{},{components:n})):r.createElement(f,a({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,a[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-handle-request-inputs",title:"HandleRequestInputs",id:"handle-request-inputs"},i=void 0,p={unversionedId:"typedefs/handle-request-inputs",id:"version-1.3/typedefs/handle-request-inputs",title:"HandleRequestInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/HandleRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request-inputs",permalink:"/sdk/js/docs/1.3/typedefs/handle-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequestInputs.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-handle-request-inputs",title:"HandleRequestInputs",id:"handle-request-inputs"},sidebar:"version-1.3/docs",previous:{title:"HandleRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-request"},next:{title:"PrepareRequest",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlerequestinputs"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"request"},(0,l.kt)("inlineCode",{parentName:"h3"},"request")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("p",null,"The original {Request} object. A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the\ncrawler. Note that this property is only initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to\nchange the concurrency settings on the fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by\ncalling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"session"},(0,l.kt)("inlineCode",{parentName:"h3"},"session")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session"))),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"crawler"},(0,l.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler"))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=p(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||l;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id_old:"version-1.3-handle-request-inputs",title:"HandleRequestInputs",id:"handle-request-inputs"},i=void 0,p={unversionedId:"typedefs/handle-request-inputs",id:"version-1.3/typedefs/handle-request-inputs",title:"HandleRequestInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/HandleRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request-inputs",permalink:"/sdk/js/docs/1.3/typedefs/handle-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequestInputs.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-handle-request-inputs",title:"HandleRequestInputs",id:"handle-request-inputs"},sidebar:"version-1.3/docs",previous:{title:"HandleRequest",permalink:"/sdk/js/docs/1.3/typedefs/handle-request"},next:{title:"PrepareRequest",permalink:"/sdk/js/docs/1.3/typedefs/prepare-request"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlerequestinputs"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"request"},(0,l.kt)("inlineCode",{parentName:"h3"},"request")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("p",null,"The original {Request} object. A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the\ncrawler. Note that this property is only initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to\nchange the concurrency settings on the fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by\ncalling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"session"},(0,l.kt)("inlineCode",{parentName:"h3"},"session")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session"))),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"crawler"},(0,l.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler"))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=p(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||l;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var o=n(87462),r=n(63366),l=(n(67294),n(3905)),a=["components"],i={id_old:"version-1.3-stealth-options",title:"StealthOptions",id:"stealth-options"},p=void 0,d={unversionedId:"typedefs/stealth-options",id:"version-1.3/typedefs/stealth-options",title:"StealthOptions",description:"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the stealth option",source:"@site/versioned_docs/version-1.3/typedefs/StealthOptions.md",sourceDirName:"typedefs",slug:"/typedefs/stealth-options",permalink:"/sdk/js/docs/1.3/typedefs/stealth-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StealthOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-stealth-options",title:"StealthOptions",id:"stealth-options"},sidebar:"version-1.3/docs",previous:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/1.3/typedefs/snapshotter-options"},next:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/1.3/typedefs/system-status-options"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"addPlugins",id:"addplugins",level:3},{value:"emulateWindowFrame",id:"emulatewindowframe",level:3},{value:"emulateWebGL",id:"emulatewebgl",level:3},{value:"emulateConsoleDebug",id:"emulateconsoledebug",level:3},{value:"addLanguage",id:"addlanguage",level:3},{value:"hideWebDriver",id:"hidewebdriver",level:3},{value:"hackPermissions",id:"hackpermissions",level:3},{value:"mockChrome",id:"mockchrome",level:3},{value:"mockChromeInIframe",id:"mockchromeiniframe",level:3},{value:"mockDeviceMemory",id:"mockdevicememory",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,a);return(0,l.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"stealthoptions"}),(0,l.kt)("p",null,"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the ",(0,l.kt)("inlineCode",{parentName:"p"},"stealth")," option\nis set to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"addplugins"},(0,l.kt)("inlineCode",{parentName:"h3"},"addPlugins")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"If plugins should be added to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewindowframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWindowFrame")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates window Iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewebgl"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWebGL")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates graphic card."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulateconsoledebug"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateConsoleDebug")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates console.debug to return null."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"addlanguage"},(0,l.kt)("inlineCode",{parentName:"h3"},"addLanguage")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds languages to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hidewebdriver"},(0,l.kt)("inlineCode",{parentName:"h3"},"hideWebDriver")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Hides the webdriver by changing the navigator proto."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hackpermissions"},(0,l.kt)("inlineCode",{parentName:"h3"},"hackPermissions")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Fakes interaction with permissions."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchrome"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChrome")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchromeiniframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChromeInIframe")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties inside the every newly created iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockdevicememory"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockDeviceMemory")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Sets device memory to other value than 0."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),d=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=d(e.components);return o.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=r,k=u["".concat(p,".").concat(m)]||u[m]||c[m]||l;return n?o.createElement(k,a(a({ref:t},s),{},{components:n})):o.createElement(k,a({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,a=new Array(l);a[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,a[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var o=n(87462),r=n(63366),l=(n(67294),n(3905)),a=["components"],i={id_old:"version-1.3-stealth-options",title:"StealthOptions",id:"stealth-options"},p=void 0,d={unversionedId:"typedefs/stealth-options",id:"version-1.3/typedefs/stealth-options",title:"StealthOptions",description:"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the stealth option",source:"@site/versioned_docs/version-1.3/typedefs/StealthOptions.md",sourceDirName:"typedefs",slug:"/typedefs/stealth-options",permalink:"/sdk/js/docs/1.3/typedefs/stealth-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StealthOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-stealth-options",title:"StealthOptions",id:"stealth-options"},sidebar:"version-1.3/docs",previous:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/1.3/typedefs/snapshotter-options"},next:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/1.3/typedefs/system-status-options"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"addPlugins",id:"addplugins",level:3},{value:"emulateWindowFrame",id:"emulatewindowframe",level:3},{value:"emulateWebGL",id:"emulatewebgl",level:3},{value:"emulateConsoleDebug",id:"emulateconsoledebug",level:3},{value:"addLanguage",id:"addlanguage",level:3},{value:"hideWebDriver",id:"hidewebdriver",level:3},{value:"hackPermissions",id:"hackpermissions",level:3},{value:"mockChrome",id:"mockchrome",level:3},{value:"mockChromeInIframe",id:"mockchromeiniframe",level:3},{value:"mockDeviceMemory",id:"mockdevicememory",level:3}],c={toc:u},m="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,a);return(0,l.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"stealthoptions"}),(0,l.kt)("p",null,"Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the ",(0,l.kt)("inlineCode",{parentName:"p"},"stealth")," option\nis set to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"addplugins"},(0,l.kt)("inlineCode",{parentName:"h3"},"addPlugins")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"If plugins should be added to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewindowframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWindowFrame")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates window Iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulatewebgl"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateWebGL")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates graphic card."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"emulateconsoledebug"},(0,l.kt)("inlineCode",{parentName:"h3"},"emulateConsoleDebug")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Emulates console.debug to return null."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"addlanguage"},(0,l.kt)("inlineCode",{parentName:"h3"},"addLanguage")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds languages to the navigator."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hidewebdriver"},(0,l.kt)("inlineCode",{parentName:"h3"},"hideWebDriver")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Hides the webdriver by changing the navigator proto."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"hackpermissions"},(0,l.kt)("inlineCode",{parentName:"h3"},"hackPermissions")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Fakes interaction with permissions."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchrome"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChrome")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockchromeiniframe"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockChromeInIframe")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Adds the chrome runtime properties inside the every newly created iframe."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"mockdevicememory"},(0,l.kt)("inlineCode",{parentName:"h3"},"mockDeviceMemory")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,l.kt)("code",null," = true")),(0,l.kt)("p",null,"Sets device memory to other value than 0."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=o.createContext({}),d=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=d(e.components);return o.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=r,k=u["".concat(p,".").concat(m)]||u[m]||c[m]||l;return n?o.createElement(k,a(a({ref:t},s),{},{components:n})):o.createElement(k,a({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,a=new Array(l);a[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,a[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>u,metadata:()=>d,toc:()=>s});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],u={id_old:"version-1.3-request-queue-info",title:"RequestQueueInfo",id:"request-queue-info"},l=void 0,d={unversionedId:"typedefs/request-queue-info",id:"version-1.3/typedefs/request-queue-info",title:"RequestQueueInfo",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/RequestQueueInfo.md",sourceDirName:"typedefs",slug:"/typedefs/request-queue-info",permalink:"/sdk/js/docs/1.3/typedefs/request-queue-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestQueueInfo.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-queue-info",title:"RequestQueueInfo",id:"request-queue-info"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"name",id:"name",level:3},{value:"userId",id:"userid",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"accessedAt",id:"accessedat",level:3},{value:"totalRequestCount",id:"totalrequestcount",level:3},{value:"handledRequestCount",id:"handledrequestcount",level:3},{value:"pendingRequestCount",id:"pendingrequestcount",level:3}],c={toc:s},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestqueueinfo"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"name"},(0,a.kt)("inlineCode",{parentName:"h3"},"name")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"accessedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"accessedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"totalrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"totalRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handledrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"handledRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"pendingrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"pendingRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=d(n),m=o,f=s["".concat(l,".").concat(m)]||s[m]||c[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var u={};for(var l in t)hasOwnProperty.call(t,l)&&(u[l]=t[l]);u.originalType=e,u[s]="string"==typeof e?e:o,i[1]=u;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>f,frontMatter:()=>u,metadata:()=>d,toc:()=>s});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],u={id_old:"version-1.3-request-queue-info",title:"RequestQueueInfo",id:"request-queue-info"},l=void 0,d={unversionedId:"typedefs/request-queue-info",id:"version-1.3/typedefs/request-queue-info",title:"RequestQueueInfo",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/RequestQueueInfo.md",sourceDirName:"typedefs",slug:"/typedefs/request-queue-info",permalink:"/sdk/js/docs/1.3/typedefs/request-queue-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestQueueInfo.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-queue-info",title:"RequestQueueInfo",id:"request-queue-info"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"name",id:"name",level:3},{value:"userId",id:"userid",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"accessedAt",id:"accessedat",level:3},{value:"totalRequestCount",id:"totalrequestcount",level:3},{value:"handledRequestCount",id:"handledrequestcount",level:3},{value:"pendingRequestCount",id:"pendingrequestcount",level:3}],c={toc:s},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(m,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"requestqueueinfo"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"name"},(0,a.kt)("inlineCode",{parentName:"h3"},"name")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"accessedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"accessedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Date")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"totalrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"totalRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handledrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"handledRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"pendingrequestcount"},(0,a.kt)("inlineCode",{parentName:"h3"},"pendingRequestCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),d=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(l.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=d(n),m=o,f=s["".concat(l,".").concat(m)]||s[m]||c[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var u={};for(var l in t)hasOwnProperty.call(t,l)&&(u[l]=t[l]);u.originalType=e,u[s]="string"==typeof e?e:o,i[1]=u;for(var d=2;d{n.r(s),n.d(s,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var o=n(87462),t=n(63366),i=(n(67294),n(3905)),a=["components"],l={id_old:"version-2.3.0-session-pool",title:"SessionPool",id:"session-pool"},r=void 0,p={unversionedId:"api/session-pool",id:"version-2.3/api/session-pool",title:"SessionPool",description:"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of Session instances, that are randomly",source:"@site/versioned_docs/version-2.3/api/SessionPool.md",sourceDirName:"api",slug:"/api/session-pool",permalink:"/sdk/js/docs/2.3/api/session-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SessionPool.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-session-pool",title:"SessionPool",id:"session-pool"},sidebar:"version-2.3/docs",previous:{title:"Session",permalink:"/sdk/js/docs/2.3/api/session"},next:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/2.3/api/proxy-configuration"}},u={},d=[{value:"sessionPool.sessions",id:"sessionpoolsessions",level:2},{value:"sessionPool.forceCloud",id:"sessionpoolforcecloud",level:2},{value:"sessionPool.usableSessionsCount",id:"sessionpoolusablesessionscount",level:2},{value:"sessionPool.retiredSessionsCount",id:"sessionpoolretiredsessionscount",level:2},{value:"sessionPool.initialize()",id:"sessionpoolinitialize",level:2},{value:"sessionPool.addSession([options])",id:"sessionpooladdsessionoptions",level:2},{value:"sessionPool.getSession([sessionId])",id:"sessionpoolgetsessionsessionid",level:2},{value:"sessionPool.getState()",id:"sessionpoolgetstate",level:2},{value:"sessionPool.persistState()",id:"sessionpoolpersiststate",level:2},{value:"sessionPool.teardown()",id:"sessionpoolteardown",level:2}],c={toc:d},m="wrapper";function k(e){var s=e.components,n=(0,t.Z)(e,a);return(0,i.kt)(m,(0,o.Z)({},c,n,{components:s,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"sessionpool"}),(0,i.kt)("p",null,"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of ",(0,i.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," instances, that are randomly\nrotated. When some session is marked as blocked, it is removed and new one is created instead (the pool never returns an unusable session). Learn more\nin the ",(0,i.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session management guide")),"."),(0,i.kt)("p",null,"You can create one by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,"Session pool is already integrated into crawlers, and it can significantly improve your scraper performance with just 2 lines of code."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.CheerioCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n // ...\n});\n")),(0,i.kt)("p",null,"You can configure the pool with many options. See the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")),". Session pool is by default persisted\nin default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". If you want to have one pool for all runs you have to specify\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options#persiststatekeyvaluestoreid",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions.persistStateKeyValueStoreId")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sessionPool = await Apify.openSessionPool({\n maxPoolSize: 25,\n sessionOptions: {\n maxAgeSecs: 10,\n maxUsageCount: 150, // for example when you know that the site blocks after 150 requests.\n },\n persistStateKeyValueStoreId: 'my-key-value-store-for-sessions',\n persistStateKey: 'my-session-pool',\n});\n\n// Get random session from the pool\nconst session1 = await sessionPool.getSession();\nconst session2 = await sessionPool.getSession();\nconst session3 = await sessionPool.getSession();\n\n// Now you can mark the session either failed or successful\n\n// Marks session as bad after unsuccessful usage -> it increases error count (soft retire)\nsession1.markBad();\n\n// Marks as successful.\nsession2.markGood();\n\n// Retires session -> session is removed from the pool\nsession3.retire();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"sessions"}),(0,i.kt)("h2",{id:"sessionpoolsessions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.sessions")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"forcecloud"}),(0,i.kt)("h2",{id:"sessionpoolforcecloud"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.forceCloud")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"usablesessionscount"}),(0,i.kt)("h2",{id:"sessionpoolusablesessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.usableSessionsCount")),(0,i.kt)("p",null,"Gets count of usable sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"retiredsessionscount"}),(0,i.kt)("h2",{id:"sessionpoolretiredsessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.retiredSessionsCount")),(0,i.kt)("p",null,"Gets count of retired sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"sessionpoolinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.initialize()")),(0,i.kt)("p",null,"Starts periodic state persistence and potentially loads SessionPool state from ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". It is called automatically\nby the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addsession"}),(0,i.kt)("h2",{id:"sessionpooladdsessionoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.addSession([options])")),(0,i.kt)("p",null,"Adds a new session to the session pool. The pool automatically creates sessions up to the maximum size of the pool, but this allows you to add more\nsessions once the max pool size is reached. This also allows you to add session with overridden session options (e.g. with specific session id)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," | ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionOptions"))," - The configuration options for the session being\nadded to the session pool.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getsession"}),(0,i.kt)("h2",{id:"sessionpoolgetsessionsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getSession([sessionId])")),(0,i.kt)("p",null,"Gets session. If there is space for new session, it creates and returns new session. If the session pool is full, it picks a session from the pool, If\nthe picked session is usable it is returned, otherwise it creates and returns a new one."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," - If provided, it returns the usable session with this id, ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined")," otherwise.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"sessionpoolgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"sessionpoolpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"teardown"}),(0,i.kt)("h2",{id:"sessionpoolteardown"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.teardown()")),(0,i.kt)("p",null,"Removes listener from ",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event. This function should be called after you are done with using the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance."),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,s,n)=>{n.d(s,{Zo:()=>u,kt:()=>k});var o=n(67294);function t(e,s,n){return s in e?Object.defineProperty(e,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[s]=n,e}function i(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var s=1;s=0||(t[n]=e[n]);return t}(e,s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var r=o.createContext({}),p=function(e){var s=o.useContext(r),n=s;return e&&(n="function"==typeof e?e(s):a(a({},s),e)),n},u=function(e){var s=p(e.components);return o.createElement(r.Provider,{value:s},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var s=e.children;return o.createElement(o.Fragment,{},s)}},m=o.forwardRef((function(e,s){var n=e.components,t=e.mdxType,i=e.originalType,r=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=t,k=d["".concat(r,".").concat(m)]||d[m]||c[m]||i;return n?o.createElement(k,a(a({ref:s},u),{},{components:n})):o.createElement(k,a({ref:s},u))}));function k(e,s){var n=arguments,t=s&&s.mdxType;if("string"==typeof e||t){var i=n.length,a=new Array(i);a[0]=m;var l={};for(var r in s)hasOwnProperty.call(s,r)&&(l[r]=s[r]);l.originalType=e,l[d]="string"==typeof e?e:t,a[1]=l;for(var p=2;p{n.r(s),n.d(s,{assets:()=>u,contentTitle:()=>r,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var o=n(87462),t=n(63366),i=(n(67294),n(3905)),a=["components"],l={id_old:"version-2.3.0-session-pool",title:"SessionPool",id:"session-pool"},r=void 0,p={unversionedId:"api/session-pool",id:"version-2.3/api/session-pool",title:"SessionPool",description:"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of Session instances, that are randomly",source:"@site/versioned_docs/version-2.3/api/SessionPool.md",sourceDirName:"api",slug:"/api/session-pool",permalink:"/sdk/js/docs/2.3/api/session-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SessionPool.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-session-pool",title:"SessionPool",id:"session-pool"},sidebar:"version-2.3/docs",previous:{title:"Session",permalink:"/sdk/js/docs/2.3/api/session"},next:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/2.3/api/proxy-configuration"}},u={},d=[{value:"sessionPool.sessions",id:"sessionpoolsessions",level:2},{value:"sessionPool.forceCloud",id:"sessionpoolforcecloud",level:2},{value:"sessionPool.usableSessionsCount",id:"sessionpoolusablesessionscount",level:2},{value:"sessionPool.retiredSessionsCount",id:"sessionpoolretiredsessionscount",level:2},{value:"sessionPool.initialize()",id:"sessionpoolinitialize",level:2},{value:"sessionPool.addSession([options])",id:"sessionpooladdsessionoptions",level:2},{value:"sessionPool.getSession([sessionId])",id:"sessionpoolgetsessionsessionid",level:2},{value:"sessionPool.getState()",id:"sessionpoolgetstate",level:2},{value:"sessionPool.persistState()",id:"sessionpoolpersiststate",level:2},{value:"sessionPool.teardown()",id:"sessionpoolteardown",level:2}],c={toc:d},m="wrapper";function k(e){var s=e.components,n=(0,t.Z)(e,a);return(0,i.kt)(m,(0,o.Z)({},c,n,{components:s,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"sessionpool"}),(0,i.kt)("p",null,"Handles the rotation, creation and persistence of user-like sessions. Creates a pool of ",(0,i.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," instances, that are randomly\nrotated. When some session is marked as blocked, it is removed and new one is created instead (the pool never returns an unusable session). Learn more\nin the ",(0,i.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session management guide")),"."),(0,i.kt)("p",null,"You can create one by calling the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,"Session pool is already integrated into crawlers, and it can significantly improve your scraper performance with just 2 lines of code."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.CheerioCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n // ...\n});\n")),(0,i.kt)("p",null,"You can configure the pool with many options. See the ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions")),". Session pool is by default persisted\nin default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". If you want to have one pool for all runs you have to specify\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options#persiststatekeyvaluestoreid",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions.persistStateKeyValueStoreId")),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advanced usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const sessionPool = await Apify.openSessionPool({\n maxPoolSize: 25,\n sessionOptions: {\n maxAgeSecs: 10,\n maxUsageCount: 150, // for example when you know that the site blocks after 150 requests.\n },\n persistStateKeyValueStoreId: 'my-key-value-store-for-sessions',\n persistStateKey: 'my-session-pool',\n});\n\n// Get random session from the pool\nconst session1 = await sessionPool.getSession();\nconst session2 = await sessionPool.getSession();\nconst session3 = await sessionPool.getSession();\n\n// Now you can mark the session either failed or successful\n\n// Marks session as bad after unsuccessful usage -> it increases error count (soft retire)\nsession1.markBad();\n\n// Marks as successful.\nsession2.markGood();\n\n// Retires session -> session is removed from the pool\nsession3.retire();\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"sessions"}),(0,i.kt)("h2",{id:"sessionpoolsessions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.sessions")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"forcecloud"}),(0,i.kt)("h2",{id:"sessionpoolforcecloud"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.forceCloud")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"usablesessionscount"}),(0,i.kt)("h2",{id:"sessionpoolusablesessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.usableSessionsCount")),(0,i.kt)("p",null,"Gets count of usable sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"retiredsessionscount"}),(0,i.kt)("h2",{id:"sessionpoolretiredsessionscount"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.retiredSessionsCount")),(0,i.kt)("p",null,"Gets count of retired sessions in the pool."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"initialize"}),(0,i.kt)("h2",{id:"sessionpoolinitialize"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.initialize()")),(0,i.kt)("p",null,"Starts periodic state persistence and potentially loads SessionPool state from ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". It is called automatically\nby the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#opensessionpool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.openSessionPool"))," function."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"addsession"}),(0,i.kt)("h2",{id:"sessionpooladdsessionoptions"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.addSession([options])")),(0,i.kt)("p",null,"Adds a new session to the session pool. The pool automatically creates sessions up to the maximum size of the pool, but this allows you to add more\nsessions once the max pool size is reached. This also allows you to add session with overridden session options (e.g. with specific session id)."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Session"))," | ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/session-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"SessionOptions"))," - The configuration options for the session being\nadded to the session pool.")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getsession"}),(0,i.kt)("h2",{id:"sessionpoolgetsessionsessionid"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getSession([sessionId])")),(0,i.kt)("p",null,"Gets session. If there is space for new session, it creates and returns new session. If the session pool is full, it picks a session from the pool, If\nthe picked session is usable it is returned, otherwise it creates and returns a new one."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[sessionId]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"String")," - If provided, it returns the usable session with this id, ",(0,i.kt)("inlineCode",{parentName:"li"},"undefined")," otherwise.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Promise"))),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"getstate"}),(0,i.kt)("h2",{id:"sessionpoolgetstate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.getState()")),(0,i.kt)("p",null,"Returns an object representing the internal state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance. Note that the object's fields can change in future releases."),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"persiststate"}),(0,i.kt)("h2",{id:"sessionpoolpersiststate"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.persistState()")),(0,i.kt)("p",null,"Persists the current state of the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," into the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),". The state is persisted automatically in\nregular intervals."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"teardown"}),(0,i.kt)("h2",{id:"sessionpoolteardown"},(0,i.kt)("inlineCode",{parentName:"h2"},"sessionPool.teardown()")),(0,i.kt)("p",null,"Removes listener from ",(0,i.kt)("inlineCode",{parentName:"p"},"persistState")," event. This function should be called after you are done with using the ",(0,i.kt)("inlineCode",{parentName:"p"},"SessionPool")," instance."),(0,i.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,s,n)=>{n.d(s,{Zo:()=>u,kt:()=>k});var o=n(67294);function t(e,s,n){return s in e?Object.defineProperty(e,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[s]=n,e}function i(e,s){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);s&&(o=o.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var s=1;s=0||(t[n]=e[n]);return t}(e,s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var r=o.createContext({}),p=function(e){var s=o.useContext(r),n=s;return e&&(n="function"==typeof e?e(s):a(a({},s),e)),n},u=function(e){var s=p(e.components);return o.createElement(r.Provider,{value:s},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var s=e.children;return o.createElement(o.Fragment,{},s)}},m=o.forwardRef((function(e,s){var n=e.components,t=e.mdxType,i=e.originalType,r=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=t,k=d["".concat(r,".").concat(m)]||d[m]||c[m]||i;return n?o.createElement(k,a(a({ref:s},u),{},{components:n})):o.createElement(k,a({ref:s},u))}));function k(e,s){var n=arguments,t=s&&s.mdxType;if("string"==typeof e||t){var i=n.length,a=new Array(i);a[0]=m;var l={};for(var r in s)hasOwnProperty.call(s,r)&&(l[r]=s[r]);l.originalType=e,l[d]="string"==typeof e?e:t,a[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-basic-crawler-options",title:"BasicCrawlerOptions",id:"basic-crawler-options"},s=void 0,p={unversionedId:"typedefs/basic-crawler-options",id:"version-1.3/typedefs/basic-crawler-options",title:"BasicCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/BasicCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/basic-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/basic-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BasicCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-basic-crawler-options",title:"BasicCrawlerOptions",id:"basic-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"},next:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handleRequestFunction",id:"handlerequestfunction",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"handleRequestTimeoutSecs",id:"handlerequesttimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},m="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"basiccrawleroptions"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"handlerequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleRequest"))),(0,o.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each URL to crawl."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance represents the URL to crawl."),(0,o.kt)("p",null,"The function must return a promise, which is then awaited by the crawler."),(0,o.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,o.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,o.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestlist"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,o.kt)("p",null,"Static list of URLs to be processed. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestqueue"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,o.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlerequesttimeoutsecs"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestTimeoutSecs")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 60")),(0,o.kt)("p",null,"Timeout in which the function passed as ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction")," needs to finish, in seconds."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlefailedrequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,o.kt)("p",null,"A function to handle requests that failed more than ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n error: Error,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,o.kt)("p",null,"See ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/basic_crawler.js#L11",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestretries"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 3")),(0,o.kt)("p",null,"Indicates how many times the request is retried if\n",(0,o.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," fails."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestspercrawl"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"autoscaledpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,o.kt)("p",null,"Custom options passed to the underlying ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,o.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,o.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,o.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"minconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1")),(0,o.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("p",null,(0,o.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1000")),(0,o.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usesessionpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = true")),(0,o.kt)("p",null,"Basic crawler will initialize the ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,o.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be than\navailable in the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"sessionpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,o.kt)("p",null,"The configuration options for ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return n?r.createElement(h,l(l({ref:t},u),{},{components:n})):r.createElement(h,l({ref:t},u))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-basic-crawler-options",title:"BasicCrawlerOptions",id:"basic-crawler-options"},s=void 0,p={unversionedId:"typedefs/basic-crawler-options",id:"version-1.3/typedefs/basic-crawler-options",title:"BasicCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/BasicCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/basic-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/basic-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BasicCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-basic-crawler-options",title:"BasicCrawlerOptions",id:"basic-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"},next:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"handleRequestFunction",id:"handlerequestfunction",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"handleRequestTimeoutSecs",id:"handlerequesttimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],d={toc:c},m="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"basiccrawleroptions"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"handlerequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleRequest"))),(0,o.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each URL to crawl."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance represents the URL to crawl."),(0,o.kt)("p",null,"The function must return a promise, which is then awaited by the crawler."),(0,o.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,o.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,o.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestlist"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,o.kt)("p",null,"Static list of URLs to be processed. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestqueue"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,o.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlerequesttimeoutsecs"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestTimeoutSecs")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 60")),(0,o.kt)("p",null,"Timeout in which the function passed as ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction")," needs to finish, in seconds."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlefailedrequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,o.kt)("p",null,"A function to handle requests that failed more than ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n error: Error,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,o.kt)("p",null,"See ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/basic_crawler.js#L11",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestretries"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 3")),(0,o.kt)("p",null,"Indicates how many times the request is retried if\n",(0,o.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," fails."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestspercrawl"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"autoscaledpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,o.kt)("p",null,"Custom options passed to the underlying ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,o.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,o.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,o.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"minconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1")),(0,o.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("p",null,(0,o.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1000")),(0,o.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usesessionpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = true")),(0,o.kt)("p",null,"Basic crawler will initialize the ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,o.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be than\navailable in the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"sessionpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,o.kt)("p",null,"The configuration options for ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return n?r.createElement(h,l(l({ref:t},u),{},{components:n})):r.createElement(h,l({ref:t},u))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.d(t,{Z:()=>o});var a=r(67294),n=r(88746),l=r(6141),c=r(6832);const o=function(e){var t=e.to,r=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(n.default,{to:"/api/"+t},r);var d=i+"/";return"current"===i?d="next/":s&&(d=""),a.createElement(n.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>o,T:()=>c});var a=r(67294),n=r(88746),l="https://crawlee.dev",c=function(e){var t=e.to,r=e.children,c=e.version;return a.createElement(n.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},r)},o=function(e){var t=e.to,r=e.children;return a.createElement(n.default,{href:l+"/"+t},r)}},82086:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>I,frontMatter:()=>d,metadata:()=>g,toc:()=>b});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),c=(r(14563),r(68889),r(26569));const o={code:"import { Actor } from 'apify';\nimport { BasicCrawler } from 'crawlee';\nimport { gotScraping } from 'got-scraping';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\n// Create a BasicCrawler - the simplest crawler that enables\n// users to implement the crawling logic themselves.\nconst crawler = new BasicCrawler({\n // This function will be called for each URL to crawl.\n async requestHandler({ request }) {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils gotScraping\n const { body } = await gotScraping({ url });\n\n // Store the HTML and URL to the default dataset.\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.\nawait crawler.run([\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n]);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM"};var i,s=["components"],d={id:"basic-crawler",title:"Basic crawler"},p=void 0,g={unversionedId:"examples/basic-crawler",id:"examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers",source:"@site/../docs/examples/basic_crawler.mdx",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/next/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/basic_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"basic-crawler",title:"Basic crawler"},sidebar:"docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/next/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/next/examples/call-actor"}},u={},b=[],m=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:b},w="wrapper";function I(e){var t=e.components,r=(0,n.Z)(e,s);return(0,l.kt)(w,(0,a.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the ",(0,l.kt)(c.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers\nlike ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," or ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"got-scraping")),"\nnpm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,l.kt)(m,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}I.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>b});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},d=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=s(r),u=n,b=p["".concat(i,".").concat(u)]||p[u]||g[u]||l;return r?a.createElement(b,c(c({ref:t},d),{},{components:r})):a.createElement(b,c({ref:t},d))}));function b(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[p]="string"==typeof e?e:n,c[1]=o;for(var s=2;s{r.d(t,{Z:()=>o});var a=r(67294),n=r(88746),l=r(6141),c=r(6832);const o=function(e){var t=e.to,r=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(n.default,{to:"/api/"+t},r);var d=i+"/";return"current"===i?d="next/":s&&(d=""),a.createElement(n.default,{to:"/api/"+d+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>o,T:()=>c});var a=r(67294),n=r(88746),l="https://crawlee.dev",c=function(e){var t=e.to,r=e.children,c=e.version;return a.createElement(n.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},r)},o=function(e){var t=e.to,r=e.children;return a.createElement(n.default,{href:l+"/"+t},r)}},82086:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>I,frontMatter:()=>d,metadata:()=>g,toc:()=>b});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),c=(r(14563),r(68889),r(26569));const o={code:"import { Actor } from 'apify';\nimport { BasicCrawler } from 'crawlee';\nimport { gotScraping } from 'got-scraping';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\n// Create a BasicCrawler - the simplest crawler that enables\n// users to implement the crawling logic themselves.\nconst crawler = new BasicCrawler({\n // This function will be called for each URL to crawl.\n async requestHandler({ request }) {\n const { url } = request;\n console.log(`Processing ${url}...`);\n\n // Fetch the page HTML via Apify utils gotScraping\n const { body } = await gotScraping({ url });\n\n // Store the HTML and URL to the default dataset.\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.\nawait crawler.run([\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n]);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM"};var i,s=["components"],d={id:"basic-crawler",title:"Basic crawler"},p=void 0,g={unversionedId:"examples/basic-crawler",id:"examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers",source:"@site/../docs/examples/basic_crawler.mdx",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/next/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/basic_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"basic-crawler",title:"Basic crawler"},sidebar:"docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/next/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/next/examples/call-actor"}},u={},b=[],m=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:b},w="wrapper";function I(e){var t=e.components,r=(0,n.Z)(e,s);return(0,l.kt)(w,(0,a.Z)({},h,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the ",(0,l.kt)(c.T,{to:"basic-crawler/class/BasicCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers\nlike ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," or ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,l.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"got-scraping")),"\nnpm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,l.kt)(m,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}I.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>b});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function c(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},d=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),p=s(r),u=n,b=p["".concat(i,".").concat(u)]||p[u]||g[u]||l;return r?a.createElement(b,c(c({ref:t},d),{},{components:r})):a.createElement(b,c({ref:t},d))}));function b(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[p]="string"==typeof e?e:n,c[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",s={unversionedId:"readme/introduction",id:"version-2.3/readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/versioned_docs/version-2.3/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/2.3/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/introduction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},l={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(r),f=a,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",s={unversionedId:"readme/introduction",id:"version-3.0/readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/versioned_docs/version-3.0/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/3.0/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/introduction.md",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},l={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(r),f=a,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",s={unversionedId:"readme/introduction",id:"version-2.3/readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/versioned_docs/version-2.3/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/2.3/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/introduction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},l={},d=[],f={toc:d},u="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(r),u=a,m=d["".concat(c,".").concat(u)]||d[u]||f[u]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"playwright-launch-context",title:"PlaywrightLaunchContext"},p=void 0,s={unversionedId:"typedefs/playwright-launch-context",id:"version-2.3/typedefs/playwright-launch-context",title:"PlaywrightLaunchContext",description:"Apify extends the launch options of Playwright. You can use any of the Playwright compatible",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-launch-context",permalink:"/sdk/js/docs/2.3/typedefs/playwright-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightLaunchContext.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-launch-context",title:"PlaywrightLaunchContext"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/playwright-crawler-options"},next:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"userAgent",id:"useragent",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"userDataDir",id:"userdatadir",level:3},{value:"launcher",id:"launcher",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrightlaunchcontext"}),(0,o.kt)("p",null,"Apify extends the launch options of Playwright. You can use any of the Playwright compatible\n",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype#browsertypelaunchoptions",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,o.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Playwright options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"launchoptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"LaunchOptions")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"browserType.launch")," ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype#browser-type-launch",target:"_blank",rel:"noopener"},"options")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyurl"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,o.kt)("p",null,"Example: ",(0,o.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useragent"},(0,o.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,o.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usechrome"},(0,o.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useincognitopages"},(0,o.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their\nresources will not be throttled by one another."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userdatadir"},(0,o.kt)("inlineCode",{parentName:"h3"},"userDataDir")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"Sets the ",(0,o.kt)("a",{parentName:"p",href:"https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md",target:"_blank",rel:"noopener"},"User Data Directory")," path. The user data directory contains\nprofile data such as history, bookmarks, and cookies, as well as other per-installation local state. If not specified, a temporary directory is used\ninstead."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"launcher"},(0,o.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"By default this function uses ",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").chromium'),". If you want to use a different browser you can pass it by this property as e.g.\n",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").firefox')),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(n),h=a,m=u["".concat(p,".").concat(h)]||u[h]||d[h]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"playwright-launch-context",title:"PlaywrightLaunchContext"},p=void 0,s={unversionedId:"typedefs/playwright-launch-context",id:"version-2.3/typedefs/playwright-launch-context",title:"PlaywrightLaunchContext",description:"Apify extends the launch options of Playwright. You can use any of the Playwright compatible",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-launch-context",permalink:"/sdk/js/docs/2.3/typedefs/playwright-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightLaunchContext.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-launch-context",title:"PlaywrightLaunchContext"},sidebar:"version-2.3/docs",previous:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/playwright-crawler-options"},next:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"}},c={},u=[{value:"Properties",id:"properties",level:2},{value:"launchOptions",id:"launchoptions",level:3},{value:"proxyUrl",id:"proxyurl",level:3},{value:"userAgent",id:"useragent",level:3},{value:"useChrome",id:"usechrome",level:3},{value:"useIncognitoPages",id:"useincognitopages",level:3},{value:"userDataDir",id:"userdatadir",level:3},{value:"launcher",id:"launcher",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"playwrightlaunchcontext"}),(0,o.kt)("p",null,"Apify extends the launch options of Playwright. You can use any of the Playwright compatible\n",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype#browsertypelaunchoptions",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,o.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Playwright options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"launchoptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"LaunchOptions")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"browserType.launch")," ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-browsertype#browser-type-launch",target:"_blank",rel:"noopener"},"options")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyurl"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,o.kt)("p",null,"Example: ",(0,o.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useragent"},(0,o.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,o.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usechrome"},(0,o.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled\nChromium. The path to Chrome executable is taken from the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical\nGoogle Chrome executable location specific for the operating system."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"useincognitopages"},(0,o.kt)("inlineCode",{parentName:"h3"},"useIncognitoPages")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = false")),(0,o.kt)("p",null,"With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their\nresources will not be throttled by one another."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userdatadir"},(0,o.kt)("inlineCode",{parentName:"h3"},"userDataDir")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"Sets the ",(0,o.kt)("a",{parentName:"p",href:"https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md",target:"_blank",rel:"noopener"},"User Data Directory")," path. The user data directory contains\nprofile data such as history, bookmarks, and cookies, as well as other per-installation local state. If not specified, a temporary directory is used\ninstead."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"launcher"},(0,o.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"*")),(0,o.kt)("p",null,"By default this function uses ",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").chromium'),". If you want to use a different browser you can pass it by this property as e.g.\n",(0,o.kt)("inlineCode",{parentName:"p"},'require("playwright").firefox')),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=s(n),h=a,m=u["".concat(p,".").concat(h)]||u[h]||d[h]||o;return n?r.createElement(m,l(l({ref:t},c),{},{components:n})):r.createElement(m,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-actor-run",title:"ActorRun",id:"actor-run"},p=void 0,u={unversionedId:"typedefs/actor-run",id:"version-1.3/typedefs/actor-run",title:"ActorRun",description:"Represents information about an actor run, as returned by the Apify.call() or Apify.callTask()",source:"@site/versioned_docs/version-1.3/typedefs/ActorRun.md",sourceDirName:"typedefs",slug:"/typedefs/actor-run",permalink:"/sdk/js/docs/1.3/typedefs/actor-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ActorRun.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-actor-run",title:"ActorRun",id:"actor-run"},sidebar:"version-1.3/docs",previous:{title:"RequestTransform",permalink:"/sdk/js/docs/1.3/typedefs/request-transform"},next:{title:"ApifyCallError",permalink:"/sdk/js/docs/1.3/api/apify-call-error"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"actId",id:"actid",level:3},{value:"startedAt",id:"startedat",level:3},{value:"finishedAt",id:"finishedat",level:3},{value:"status",id:"status",level:3},{value:"meta",id:"meta",level:3},{value:"stats",id:"stats",level:3},{value:"options",id:"options",level:3},{value:"buildId",id:"buildid",level:3},{value:"buildNumber",id:"buildnumber",level:3},{value:"exitCode",id:"exitcode",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"defaultRequestQueueId",id:"defaultrequestqueueid",level:3},{value:"containerUrl",id:"containerurl",level:3},{value:"output",id:"output",level:3}],c={toc:s},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,l.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"actorrun"}),(0,l.kt)("p",null,"Represents information about an actor run, as returned by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.callTask()")),"\nfunction. The object is almost equivalent to the JSON response of the\n",(0,l.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Actor run")," Apify API endpoint and extended with certain fields. For more\ndetails, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run",target:"_blank",rel:"noopener"},"Runs.")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor run ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"actid"},(0,l.kt)("inlineCode",{parentName:"h3"},"actId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"startedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run started"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"finishedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"finishedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run finished. Contains ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," for running actors."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"status"},(0,l.kt)("inlineCode",{parentName:"h3"},"status")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Status of the run. For possible values, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#lifecycle",target:"_blank",rel:"noopener"},"Run lifecycle")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"meta"},(0,l.kt)("inlineCode",{parentName:"h3"},"meta")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run meta-data. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "origin": "API",\n "clientIp": "1.2.3.4",\n "userAgent": "ApifyClient/0.2.13 (Linux; Node/v8.11.3)"\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"An object containing various actor run statistics. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "inputBodyLen": 22,\n "restartCount": 0,\n "workersUsed": 1,\n}\n')),(0,l.kt)("p",null,"Beware that object fields might change in future releases."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"options"},(0,l.kt)("inlineCode",{parentName:"h3"},"options")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run options. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "build": "latest",\n "waitSecs": 0,\n "memoryMbytes": 256,\n "diskMbytes": 512\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildid"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the actor build used for the run. For details, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build",target:"_blank",rel:"noopener"},"Builds")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildnumber"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildNumber")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Number of the actor build used for the run. For example, ",(0,l.kt)("inlineCode",{parentName:"p"},"0.0.10"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"exitcode"},(0,l.kt)("inlineCode",{parentName:"h3"},"exitCode")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Exit code of the actor run process. It's ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if actor is still running."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default key-value store associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultdatasetid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default dataset associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Dataset"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultrequestqueueid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultRequestQueueId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default request queue associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"containerurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"containerUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL on which the web server running inside actor run's Docker container can be accessed. For more details, see\n",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#container-web-server",target:"_blank",rel:"noopener"},"Container web server")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"output"},(0,l.kt)("inlineCode",{parentName:"h3"},"output")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")),(0,l.kt)("p",null,"Contains output of the actor run. The value is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," in case the actor is still running, or if you pass ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," to the ",(0,l.kt)("inlineCode",{parentName:"p"},"fetchOutput"),"\noption of ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()")),"."),(0,l.kt)("p",null,"For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "contentType": "application/json; charset=utf-8",\n "body": {\n "message": "Hello world!"\n }\n}\n')),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),s=u(n),k=a,m=s["".concat(p,".").concat(k)]||s[k]||c[k]||l;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-actor-run",title:"ActorRun",id:"actor-run"},p=void 0,u={unversionedId:"typedefs/actor-run",id:"version-1.3/typedefs/actor-run",title:"ActorRun",description:"Represents information about an actor run, as returned by the Apify.call() or Apify.callTask()",source:"@site/versioned_docs/version-1.3/typedefs/ActorRun.md",sourceDirName:"typedefs",slug:"/typedefs/actor-run",permalink:"/sdk/js/docs/1.3/typedefs/actor-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ActorRun.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-actor-run",title:"ActorRun",id:"actor-run"},sidebar:"version-1.3/docs",previous:{title:"RequestTransform",permalink:"/sdk/js/docs/1.3/typedefs/request-transform"},next:{title:"ApifyCallError",permalink:"/sdk/js/docs/1.3/api/apify-call-error"}},d={},s=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"actId",id:"actid",level:3},{value:"startedAt",id:"startedat",level:3},{value:"finishedAt",id:"finishedat",level:3},{value:"status",id:"status",level:3},{value:"meta",id:"meta",level:3},{value:"stats",id:"stats",level:3},{value:"options",id:"options",level:3},{value:"buildId",id:"buildid",level:3},{value:"buildNumber",id:"buildnumber",level:3},{value:"exitCode",id:"exitcode",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"defaultRequestQueueId",id:"defaultrequestqueueid",level:3},{value:"containerUrl",id:"containerurl",level:3},{value:"output",id:"output",level:3}],c={toc:s},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,l.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"actorrun"}),(0,l.kt)("p",null,"Represents information about an actor run, as returned by the ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," or ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#calltask",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.callTask()")),"\nfunction. The object is almost equivalent to the JSON response of the\n",(0,l.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Actor run")," Apify API endpoint and extended with certain fields. For more\ndetails, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run",target:"_blank",rel:"noopener"},"Runs.")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"id"},(0,l.kt)("inlineCode",{parentName:"h3"},"id")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor run ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"actid"},(0,l.kt)("inlineCode",{parentName:"h3"},"actId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Actor ID"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"startedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run started"),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"finishedat"},(0,l.kt)("inlineCode",{parentName:"h3"},"finishedAt")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Date")),(0,l.kt)("p",null,"Time when the actor run finished. Contains ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," for running actors."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"status"},(0,l.kt)("inlineCode",{parentName:"h3"},"status")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Status of the run. For possible values, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#lifecycle",target:"_blank",rel:"noopener"},"Run lifecycle")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"meta"},(0,l.kt)("inlineCode",{parentName:"h3"},"meta")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run meta-data. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "origin": "API",\n "clientIp": "1.2.3.4",\n "userAgent": "ApifyClient/0.2.13 (Linux; Node/v8.11.3)"\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"An object containing various actor run statistics. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "inputBodyLen": 22,\n "restartCount": 0,\n "workersUsed": 1,\n}\n')),(0,l.kt)("p",null,"Beware that object fields might change in future releases."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"options"},(0,l.kt)("inlineCode",{parentName:"h3"},"options")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")),(0,l.kt)("p",null,"Actor run options. For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "build": "latest",\n "waitSecs": 0,\n "memoryMbytes": 256,\n "diskMbytes": 512\n}\n')),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildid"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the actor build used for the run. For details, see ",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/build",target:"_blank",rel:"noopener"},"Builds")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"buildnumber"},(0,l.kt)("inlineCode",{parentName:"h3"},"buildNumber")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"Number of the actor build used for the run. For example, ",(0,l.kt)("inlineCode",{parentName:"p"},"0.0.10"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"exitcode"},(0,l.kt)("inlineCode",{parentName:"h3"},"exitCode")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("p",null,"Exit code of the actor run process. It's ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," if actor is still running."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default key-value store associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultdatasetid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default dataset associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Dataset"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"defaultrequestqueueid"},(0,l.kt)("inlineCode",{parentName:"h3"},"defaultRequestQueueId")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"ID of the default request queue associated with the actor run. See ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," for details."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"containerurl"},(0,l.kt)("inlineCode",{parentName:"h3"},"containerUrl")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"string")),(0,l.kt)("p",null,"URL on which the web server running inside actor run's Docker container can be accessed. For more details, see\n",(0,l.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#container-web-server",target:"_blank",rel:"noopener"},"Container web server")," in Apify actor documentation."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"output"},(0,l.kt)("inlineCode",{parentName:"h3"},"output")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"Object")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," | ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")),(0,l.kt)("p",null,"Contains output of the actor run. The value is ",(0,l.kt)("inlineCode",{parentName:"p"},"null")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," in case the actor is still running, or if you pass ",(0,l.kt)("inlineCode",{parentName:"p"},"false")," to the ",(0,l.kt)("inlineCode",{parentName:"p"},"fetchOutput"),"\noption of ",(0,l.kt)("a",{parentName:"p",href:"../api/apify#call",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.call()")),"."),(0,l.kt)("p",null,"For example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},'{\n "contentType": "application/json; charset=utf-8",\n "body": {\n "message": "Hello world!"\n }\n}\n')),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),u=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=u(e.components);return r.createElement(p.Provider,{value:t},e.children)},s="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),s=u(n),k=a,m=s["".concat(p,".").concat(k)]||s[k]||c[k]||l;return n?r.createElement(m,o(o({ref:t},d),{},{components:n})):r.createElement(m,o({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[s]="string"==typeof e?e:a,o[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-apify-env",title:"ApifyEnv",id:"apify-env"},p=void 0,d={unversionedId:"typedefs/apify-env",id:"version-1.3/typedefs/apify-env",title:"ApifyEnv",description:"Parsed representation of the APIFY_XXX environmental variables. This object is returned by the Apify.getEnv() function.",source:"@site/versioned_docs/version-1.3/typedefs/ApifyEnv.md",sourceDirName:"typedefs",slug:"/typedefs/apify-env",permalink:"/sdk/js/docs/1.3/typedefs/apify-env",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ApifyEnv.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-apify-env",title:"ApifyEnv",id:"apify-env"},sidebar:"version-1.3/docs",previous:{title:"ApifyCallError",permalink:"/sdk/js/docs/1.3/api/apify-call-error"},next:{title:"DatasetContent",permalink:"/sdk/js/docs/1.3/typedefs/dataset-content"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"actorId",id:"actorid",level:3},{value:"actorRunId",id:"actorrunid",level:3},{value:"actorTaskId",id:"actortaskid",level:3},{value:"userId",id:"userid",level:3},{value:"token",id:"token",level:3},{value:"startedAt",id:"startedat",level:3},{value:"timeoutAt",id:"timeoutat",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"memoryMbytes",id:"memorymbytes",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"apifyenv"}),(0,o.kt)("p",null,"Parsed representation of the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environmental variables. This object is returned by the ",(0,o.kt)("a",{parentName:"p",href:"../api/apify#getenv",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"actorid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor (APIFY_ACTOR_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"actorrunid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorRunId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor run (APIFY_ACTOR_RUN_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"actortaskid"},(0,o.kt)("inlineCode",{parentName:"h3"},"actorTaskId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the actor task (APIFY_ACTOR_TASK_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userid"},(0,o.kt)("inlineCode",{parentName:"h3"},"userId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"token"},(0,o.kt)("inlineCode",{parentName:"h3"},"token")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"startedat"},(0,o.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Date when the actor was started (APIFY_STARTED_AT)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"timeoutat"},(0,o.kt)("inlineCode",{parentName:"h3"},"timeoutAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Date when the actor will time out (APIFY_TIMEOUT_AT)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,o.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"defaultdatasetid"},(0,o.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)"),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"memorymbytes"},(0,o.kt)("inlineCode",{parentName:"h3"},"memoryMbytes")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," | ",(0,o.kt)("inlineCode",{parentName:"p"},"null")),(0,o.kt)("p",null,"Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)"),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=d(n),k=a,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||o;return n?r.createElement(m,i(i({ref:t},s),{},{components:n})):r.createElement(m,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>u});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=["components"],l={id_old:"version-1.3-apify-env",title:"ApifyEnv",id:"apify-env"},p=void 0,d={unversionedId:"typedefs/apify-env",id:"version-1.3/typedefs/apify-env",title:"ApifyEnv",description:"Parsed representation of the APIFY_XXX environmental variables. This object is returned by the Apify.getEnv() function.",source:"@site/versioned_docs/version-1.3/typedefs/ApifyEnv.md",sourceDirName:"typedefs",slug:"/typedefs/apify-env",permalink:"/sdk/js/docs/1.3/typedefs/apify-env",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ApifyEnv.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-apify-env",title:"ApifyEnv",id:"apify-env"},sidebar:"version-1.3/docs",previous:{title:"ApifyCallError",permalink:"/sdk/js/docs/1.3/api/apify-call-error"},next:{title:"DatasetContent",permalink:"/sdk/js/docs/1.3/typedefs/dataset-content"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"actorId",id:"actorid",level:3},{value:"actorRunId",id:"actorrunid",level:3},{value:"actorTaskId",id:"actortaskid",level:3},{value:"userId",id:"userid",level:3},{value:"token",id:"token",level:3},{value:"startedAt",id:"startedat",level:3},{value:"timeoutAt",id:"timeoutat",level:3},{value:"defaultKeyValueStoreId",id:"defaultkeyvaluestoreid",level:3},{value:"defaultDatasetId",id:"defaultdatasetid",level:3},{value:"memoryMbytes",id:"memorymbytes",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"apifyenv"}),(0,i.kt)("p",null,"Parsed representation of the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_XXX")," environmental variables. This object is returned by the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getenv",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getEnv()"))," function."),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"actorid"},(0,i.kt)("inlineCode",{parentName:"h3"},"actorId")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"ID of the actor (APIFY_ACTOR_ID)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"actorrunid"},(0,i.kt)("inlineCode",{parentName:"h3"},"actorRunId")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"ID of the actor run (APIFY_ACTOR_RUN_ID)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"actortaskid"},(0,i.kt)("inlineCode",{parentName:"h3"},"actorTaskId")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"ID of the actor task (APIFY_ACTOR_TASK_ID)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"userid"},(0,i.kt)("inlineCode",{parentName:"h3"},"userId")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"token"},(0,i.kt)("inlineCode",{parentName:"h3"},"token")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"startedat"},(0,i.kt)("inlineCode",{parentName:"h3"},"startedAt")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"Date when the actor was started (APIFY_STARTED_AT)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"timeoutat"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeoutAt")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Date")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"Date when the actor will time out (APIFY_TIMEOUT_AT)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"defaultkeyvaluestoreid"},(0,i.kt)("inlineCode",{parentName:"h3"},"defaultKeyValueStoreId")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"defaultdatasetid"},(0,i.kt)("inlineCode",{parentName:"h3"},"defaultDatasetId")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"memorymbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"memoryMbytes")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," | ",(0,i.kt)("inlineCode",{parentName:"p"},"null")),(0,i.kt)("p",null,"Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)"),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=d(n),k=a,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||i;return n?r.createElement(m,o(o({ref:t},s),{},{components:n})):r.createElement(m,o({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=k;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var d=2;d{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-apify-platform",title:"Apify Platform",id:"apify-platform"},p=void 0,s={unversionedId:"guides/apify-platform",id:"version-1.3/guides/apify-platform",title:"Apify Platform",description:"Apify is a platform built to serve large-scale and high-performance web scraping",source:"@site/versioned_docs/version-1.3/guides/apify_platform.md",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/1.3/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/apify_platform.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-apify-platform",title:"Apify Platform",id:"apify-platform"},sidebar:"version-1.3/docs",previous:{title:"Quick Start",permalink:"/sdk/js/docs/1.3/guides/quick-start"},next:{title:"Getting Started",permalink:"/sdk/js/docs/1.3/guides/getting-started"}},c={},u=[{value:"Logging into Apify platform from Apify SDK",id:"logging-into-apify-platform-from-apify-sdk",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2}],f={toc:u},m="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"../guides/proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and you should definitely sign up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Apify SDK is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Note that we do not test Apify SDK in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-apify-sdk"},"Logging into Apify platform from Apify SDK"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from the SDK, you must provide\ncredentials - ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"your API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures of the SDK, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"npm install -g apify-cli\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify login -t YOUR_API_TOKEN\n")),(0,o.kt)("p",null,"In your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify run -p\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"If you prefer not to use Apify CLI, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. It is automatically inferred from your token by the SDK, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://my.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,y=u["".concat(p,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(y,i(i({ref:t},c),{},{components:r})):n.createElement(y,i({ref:t},c))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-apify-platform",title:"Apify Platform",id:"apify-platform"},p=void 0,s={unversionedId:"guides/apify-platform",id:"version-1.3/guides/apify-platform",title:"Apify Platform",description:"Apify is a platform built to serve large-scale and high-performance web scraping",source:"@site/versioned_docs/version-1.3/guides/apify_platform.md",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/1.3/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/apify_platform.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-apify-platform",title:"Apify Platform",id:"apify-platform"},sidebar:"version-1.3/docs",previous:{title:"Quick Start",permalink:"/sdk/js/docs/1.3/guides/quick-start"},next:{title:"Getting Started",permalink:"/sdk/js/docs/1.3/guides/getting-started"}},c={},u=[{value:"Logging into Apify platform from Apify SDK",id:"logging-into-apify-platform-from-apify-sdk",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2}],f={toc:u},m="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"../guides/proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and you should definitely sign up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Apify SDK is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Note that we do not test Apify SDK in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-apify-sdk"},"Logging into Apify platform from Apify SDK"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from the SDK, you must provide\ncredentials - ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"your API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures of the SDK, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"npm install -g apify-cli\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify login -t YOUR_API_TOKEN\n")),(0,o.kt)("p",null,"In your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify run -p\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"If you prefer not to use Apify CLI, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. It is automatically inferred from your token by the SDK, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://my.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify app")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,y=u["".concat(p,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(y,i(i({ref:t},c),{},{components:r})):n.createElement(y,i({ref:t},c))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>c,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],c={id:"abort-function",title:"AbortFunction"},p=void 0,s={unversionedId:"typedefs/abort-function",id:"version-2.3/typedefs/abort-function",title:"AbortFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/AbortFunction.md",sourceDirName:"typedefs",slug:"/typedefs/abort-function",permalink:"/sdk/js/docs/2.3/typedefs/abort-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AbortFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"abort-function",title:"AbortFunction"}},l={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"abortfunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(n),d=o,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:o,i[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>c,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],c={id:"abort-function",title:"AbortFunction"},p=void 0,s={unversionedId:"typedefs/abort-function",id:"version-2.3/typedefs/abort-function",title:"AbortFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/AbortFunction.md",sourceDirName:"typedefs",slug:"/typedefs/abort-function",permalink:"/sdk/js/docs/2.3/typedefs/abort-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AbortFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"abort-function",title:"AbortFunction"}},l={},u=[],f={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(d,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"abortfunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"response")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"IncomingMessage"))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(n),d=o,m=u["".concat(p,".").concat(d)]||u[d]||f[d]||a;return n?r.createElement(m,i(i({ref:t},l),{},{components:n})):r.createElement(m,i({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c[u]="string"==typeof e?e:o,i[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,l={unversionedId:"readme/support",id:"version-3.1/readme/support",title:"support",description:"Support",source:"@site/versioned_docs/version-3.1/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/support.md",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),p=["components"],i={},s=void 0,l={unversionedId:"readme/support",id:"version-3.1/readme/support",title:"support",description:"Support",source:"@site/versioned_docs/version-3.1/readme/support.md",sourceDirName:"readme",slug:"/readme/support",permalink:"/sdk/js/docs/readme/support",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/support.md",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Support",id:"support",level:2},{value:"Contributing",id:"contributing",level:2},{value:"License",id:"license",level:2},{value:"Acknowledgments",id:"acknowledgments",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"support"},"Support"),(0,a.kt)("p",null,"If you find any bug or issue with the Apify SDK, please ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"submit an issue on GitHub"),".\nFor questions, you can ask on ",(0,a.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/tagged/apify",target:"_blank",rel:"noopener"},"Stack Overflow")," or contact ",(0,a.kt)("a",{parentName:"p",href:"mailto:support@apify.com",target:"_blank",rel:"noopener"},"support@apify.com")),(0,a.kt)("h2",{id:"contributing"},"Contributing"),(0,a.kt)("p",null,"Your code contributions are welcome and you'll be praised to eternity!\nIf you have any ideas for improvements, either submit an issue or create a pull request.\nFor contribution guidelines and the code of conduct,\nsee ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md",target:"_blank",rel:"noopener"},"CONTRIBUTING.md"),"."),(0,a.kt)("h2",{id:"license"},"License"),(0,a.kt)("p",null,"This project is licensed under the Apache License 2.0 -\nsee the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/LICENSE.md",target:"_blank",rel:"noopener"},"LICENSE.md")," file for details."),(0,a.kt)("h2",{id:"acknowledgments"},"Acknowledgments"),(0,a.kt)("p",null,"Many thanks to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/~jbalsas",target:"_blank",rel:"noopener"},"Chema Balsas")," for giving up the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify")," package name\non NPM and renaming his project to ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/jsdocify",target:"_blank",rel:"noopener"},"jsdocify"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,p(p({ref:t},c),{},{components:r})):n.createElement(f,p({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,p[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>b,frontMatter:()=>s,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=r(14563);const i="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst input = await Actor.getInput();\nconsole.log(input);\n\nawait Actor.exit();\n";var c=["components"],s={id:"accept-user-input",title:"Accept user input"},l=void 0,u={unversionedId:"examples/accept-user-input",id:"examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/../docs/examples/accept_user_input.mdx",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/next/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/accept_user_input.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"docs",previous:{title:"Examples",permalink:"/sdk/js/docs/next/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/next/examples/add-data-to-dataset"}},d={},m=[],f={toc:m},y="wrapper";function b(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(y,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}b.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>b,frontMatter:()=>s,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=r(14563);const c="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst input = await Actor.getInput();\nconsole.log(input);\n\nawait Actor.exit();\n";var i=["components"],s={id:"accept-user-input",title:"Accept user input"},l=void 0,u={unversionedId:"examples/accept-user-input",id:"examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/../docs/examples/accept_user_input.mdx",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/next/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/accept_user_input.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"docs",previous:{title:"Examples",permalink:"/sdk/js/docs/next/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/next/examples/add-data-to-dataset"}},d={},m=[],f={toc:m},y="wrapper";function b(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(y,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},c),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}b.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c[u]="string"==typeof e?e:a,p[1]=c;for(var s=2;s{n.d(t,{Z:()=>l});var a=n(67294),i=n(88746),r=n(6141),o=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(i.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(i.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>l,T:()=>o});var a=n(67294),i=n(88746),r="https://crawlee.dev",o=function(e){var t=e.to,n=e.children,o=e.version;return a.createElement(i.default,{href:r+"/api"+(o?"/"+o:"")+"/"+t},n)},l=function(e){var t=e.to,n=e.children;return a.createElement(i.default,{href:r+"/"+t},n)}},59798:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=(n(68889),n(26569)),l=["components"],s={id:"upgrading-to-v3",title:"Upgrading to v3"},p=void 0,d={unversionedId:"upgrading/upgrading-to-v3",id:"upgrading/upgrading-to-v3",title:"Upgrading to v3",description:"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.",source:"@site/../docs/upgrading/upgrading_v3.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v3",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v3",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v3.md",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v3",title:"Upgrading to v3"},sidebar:"docs",previous:{title:"Upgrading to v2",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v2"},next:{title:"Changelog",permalink:"/sdk/js/docs/next/changelog"}},u={},m=[{value:"Crawlee monorepo",id:"crawlee-monorepo",level:2},{value:"Installing Crawlee",id:"installing-crawlee",level:3},{value:"Full TypeScript support",id:"full-typescript-support",level:2},{value:"Docker build",id:"docker-build",level:3},{value:"Browser fingerprints",id:"browser-fingerprints",level:2},{value:"Session cookie method renames",id:"session-cookie-method-renames",level:2},{value:"Memory storage",id:"memory-storage",level:2},{value:"Purging of the default storage",id:"purging-of-the-default-storage",level:2},{value:"Renamed crawler options and interfaces",id:"renamed-crawler-options-and-interfaces",level:2},{value:"Context aware helpers",id:"context-aware-helpers",level:2},{value:"Enqueuing links",id:"enqueuing-links",level:3},{value:"Implicit RequestQueue instance",id:"implicit-requestqueue-instance",level:2},{value:"crawler.addRequests()",id:"crawleraddrequests",level:2},{value:"Less verbose error logging",id:"less-verbose-error-logging",level:2},{value:"Request.label shortcut",id:"requestlabel-shortcut",level:2},{value:"Removal of requestAsBrowser",id:"removal-of-requestasbrowser",level:2},{value:"How to use sendRequest()?",id:"how-to-use-sendrequest",level:3},{value:"Removed options",id:"removed-options",level:3},{value:"Renamed options",id:"renamed-options",level:3},{value:"payload",id:"payload",level:4},{value:"ignoreSslErrors",id:"ignoresslerrors",level:4},{value:"header-generator options",id:"header-generator-options",level:4},{value:"timeoutSecs",id:"timeoutsecs",level:4},{value:"throwOnHttpErrors",id:"throwonhttperrors",level:4},{value:"decodeBody",id:"decodebody",level:4},{value:"abortFunction",id:"abortfunction",level:4},{value:"Removal of browser pool plugin mixing",id:"removal-of-browser-pool-plugin-mixing",level:2},{value:"Handling requests outside of browser",id:"handling-requests-outside-of-browser",level:2},{value:"Logging",id:"logging",level:2},{value:"Auto-saved crawler state",id:"auto-saved-crawler-state",level:2},{value:"Apify SDK",id:"apify-sdk",level:2},{value:"Events",id:"events",level:3},{value:"Smaller/internal breaking changes",id:"smallerinternal-breaking-changes",level:2}],c={toc:m},k="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(k,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3."),(0,r.kt)("admonition",{title:"Crawlee vs Apify SDK v2",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Up until version 3 of ",(0,r.kt)("inlineCode",{parentName:"p"},"apify"),", the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/crawlee",target:"_blank",rel:"noopener"},"Crawlee"),", the new web-scraping library, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package on NPM"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/apify-sdk-js",target:"_blank",rel:"noopener"},"Apify SDK"),", helpers for the Apify platform, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"apify"))," package on NPM"))),(0,r.kt)("h2",{id:"crawlee-monorepo"},"Crawlee monorepo"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package consists of several smaller packages, released separately under ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee")," namespace:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/core"),": the base for all the crawler implementations, also contains things like ",(0,r.kt)("inlineCode",{parentName:"li"},"Request"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestQueue"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestList")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Dataset")," classes"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/basic"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BasicCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/http"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"HttpCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"DOMCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BrowserCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/memory-storage"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"@apify/storage-local")," alternative"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser-pool"),": previously ",(0,r.kt)("inlineCode",{parentName:"li"},"browser-pool")," package"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/utils"),": utility methods"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/types"),": holds TS interfaces mainly about the ",(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient"))),(0,r.kt)("h3",{id:"installing-crawlee"},"Installing Crawlee"),(0,r.kt)("p",null,"Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright")," if you plan on using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," - it already contains everything from the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/browser")," package, which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/basic"),", which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/core"),"."),(0,r.kt)("p",null,"If we don't care much about additional code being pulled in, we can just use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package, which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee\n")),(0,r.kt)("p",null,"Or if all we need is cheerio support, we can install only ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/cheerio"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @crawlee/cheerio\n")),(0,r.kt)("p",null,"When using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer"),", we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee playwright\n# or npm install @crawlee/playwright playwright\n")),(0,r.kt)("p",null,"Alternatively we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sometimes you might want to use some utility methods from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/utils"),", so you might want to install that as well. This package contains some utilities that were previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils"),". Browser related utilities can be also found in the crawler packages (e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright"),").")),(0,r.kt)("h2",{id:"full-typescript-support"},"Full TypeScript support"),(0,r.kt)("p",null,"Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," package. Don't forget to set the ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"target")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"ES2022")," or above to be able to use top level await."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," config has ",(0,r.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#noImplicitAny",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"noImplicitAny"))," enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="tsconfig.json"',title:'"tsconfig.json"'},'{\n "extends": "@apify/tsconfig",\n "compilerOptions": {\n "module": "ES2022",\n "target": "ES2022",\n "outDir": "dist",\n "lib": ["DOM"]\n },\n "include": [\n "./src/**/*"\n ]\n}\n')),(0,r.kt)("h3",{id:"docker-build"},"Docker build"),(0,r.kt)("p",null,"For ",(0,r.kt)("inlineCode",{parentName:"p"},"Dockerfile")," we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-dockerfile",metastring:'title="Dockerfile"',title:'"Dockerfile"'},'# using multistage build, as we need dev deps to build the TS source code\nFROM apify/actor-node:16 AS builder\n\n# copy all files, install all dependencies (including dev deps) and build the project\nCOPY . ./\nRUN npm install --include=dev \\\n && npm run build\n\n# create final image\nFROM apify/actor-node:16\n# copy only necessary files\nCOPY --from=builder /usr/src/app/package*.json ./\nCOPY --from=builder /usr/src/app/README.md ./\nCOPY --from=builder /usr/src/app/dist ./dist\nCOPY --from=builder /usr/src/app/apify.json ./apify.json\nCOPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json\n\n# install only prod deps\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --only=prod --no-optional --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# run compiled code\nCMD npm run start:prod\n')),(0,r.kt)("h2",{id:"browser-fingerprints"},"Browser fingerprints"),(0,r.kt)("p",null,"Previously we had a magical ",(0,r.kt)("inlineCode",{parentName:"p"},"stealth")," option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints."),(0,r.kt)("p",null,"In case we don't want to have dynamic fingerprints, we can disable this behaviour via ",(0,r.kt)("inlineCode",{parentName:"p"},"useFingerprints")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: false,\n },\n});\n")),(0,r.kt)("h2",{id:"session-cookie-method-renames"},"Session cookie method renames"),(0,r.kt)("p",null,"Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getPuppeteerCookies()")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setPuppeteerCookies()"),". Since this method could be used for any of our crawlers, not just ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),", the methods have been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getCookies()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setCookies()")," respectively. Otherwise, their usage is exactly the same!"),(0,r.kt)("h2",{id:"memory-storage"},"Memory storage"),(0,r.kt)("p",null,"When we store some data or intermediate state (like the one ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," holds), we now use ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/memory-storage")," by default. It is an alternative to the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", that stores the state inside memory (as opposed to SQLite database used by ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),"). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the ",(0,r.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file)."),(0,r.kt)("p",null,"When we want to run the crawler on Apify platform, we need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main"),", which will automatically switch the storage client to ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when on the Apify platform."),(0,r.kt)("p",null,"We can still use the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", to do it, first install it pass it to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," options:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local")," v2.1.0+ is required for Crawlee")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\nimport { ApifyStorageLocal } from '@apify/storage-local';\n\nconst storage = new ApifyStorageLocal(/* options like `enableWalMode` belong here */);\nawait Actor.init({ storage });\n")),(0,r.kt)("h2",{id:"purging-of-the-default-storage"},"Purging of the default storage"),(0,r.kt)("p",null,"Previously the state was preserved between local runs, and we had to use ",(0,r.kt)("inlineCode",{parentName:"p"},"--purge")," argument of the ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-cli"),". With Crawlee, this is now the default behaviour, we purge the storage automatically on ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init/main")," call. We can opt out of it via ",(0,r.kt)("inlineCode",{parentName:"p"},"purge: false")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," options."),(0,r.kt)("h2",{id:"renamed-crawler-options-and-interfaces"},"Renamed crawler options and interfaces"),(0,r.kt)("p",null,"Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"requestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"navigationTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleFailedRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"failedRequestHandler"))),(0,r.kt)("p",null,"We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CheerioHandlePageInputs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawlingContext"))),(0,r.kt)("h2",{id:"context-aware-helpers"},"Context aware helpers"),(0,r.kt)("p",null,"Some utilities previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils")," namespace are now moved to the crawling context and are ",(0,r.kt)("em",{parentName:"p"},"context aware"),". This means they have some parameters automatically filled in from the context, like the current ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," instance or current ",(0,r.kt)("inlineCode",{parentName:"p"},"Page")," object, or the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," bound to the crawler."),(0,r.kt)("h3",{id:"enqueuing-links"},"Enqueuing links"),(0,r.kt)("p",null,"One common helper that received more attention is the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks"),". As mentioned above, it is context aware - we no longer need pass in the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," arguments (or the cheerio handle ",(0,r.kt)("inlineCode",{parentName:"p"},"$"),"). In addition to that, it now offers 3 enqueuing strategies:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.All")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'all'"),"): Matches any URLs found"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameHostname")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-hostname'"),") Matches any URLs that have the same subdomain as the base URL (default)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameDomain")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-domain'"),") Matches any URLs that have the same domain name. For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://wow.an.example.com")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com")," will both be matched for a base url of ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com"),".")),(0,r.kt)("p",null,"This means we can even call ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain."),(0,r.kt)("p",null,"Moreover, we can specify patterns the URL should match via globs:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n async requestHandler({ enqueueLinks }) {\n await enqueueLinks({\n globs: ['https://crawlee.dev/*/*'],\n // we can also use `regexps` and `pseudoUrls` keys here\n });\n },\n});\n")),(0,r.kt)("h2",{id:"implicit-requestqueue-instance"},"Implicit ",(0,r.kt)("inlineCode",{parentName:"h2"},"RequestQueue")," instance"),(0,r.kt)("p",null,"All crawlers now have the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance automatically available via ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance manually, and we can just use ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.addRequests()")," method described underneath."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can still create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," explicitly, the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method will respect that and return the instance provided via crawler options.")),(0,r.kt)("h2",{id:"crawleraddrequests"},(0,r.kt)("inlineCode",{parentName:"h2"},"crawler.addRequests()")),(0,r.kt)("p",null,"We can now add multiple requests in batches. The newly added ",(0,r.kt)("inlineCode",{parentName:"p"},"addRequests")," method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// will resolve right after the initial batch of 1000 requests is added\nconst result = await crawler.addRequests([/* many requests, can be even millions */]);\n\n// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise\nawait result.waitForAllRequestsToBeAdded;\n")),(0,r.kt)("h2",{id:"less-verbose-error-logging"},"Less verbose error logging"),(0,r.kt)("p",null,"Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"CRAWLEE_VERBOSE_LOG")," env var."),(0,r.kt)("h2",{id:"requestlabel-shortcut"},(0,r.kt)("inlineCode",{parentName:"h2"},"Request.label")," shortcut"),(0,r.kt)("p",null,"Labeling requests used to work via the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData")," object. With Crawlee, we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.label")," shortcut. It is implemented as a ",(0,r.kt)("inlineCode",{parentName:"p"},"get/set")," pair, using the value from ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData"),". The support for this shortcut is also added to the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," options interface."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"async requestHandler({ request, enqueueLinks }) {\n if (request.label !== 'DETAIL') {\n await enqueueLinks({\n globs: ['...'],\n label: 'DETAIL',\n });\n }\n}\n")),(0,r.kt)("h2",{id:"removal-of-requestasbrowser"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h2"},"requestAsBrowser")),(0,r.kt)("p",null,"In v1 we replaced the underlying implementation of ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," to be just a proxy over calling ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," - our custom extension to ",(0,r.kt)("inlineCode",{parentName:"p"},"got")," that tries to mimic the real browsers as much as possible. With v3, we are removing the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser"),", encouraging the use of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," directly."),(0,r.kt)("p",null,"For easier migration, we also added ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()")," helper that allows processing the context bound ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," object through ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping")),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new BasicCrawler({\n async requestHandler({ sendRequest, log }) {\n // we can use the options parameter to override gotScraping options\n const res = await sendRequest({ responseType: 'json' });\n log.info('received body', res.body);\n },\n});\n")),(0,r.kt)("h3",{id:"how-to-use-sendrequest"},"How to use ",(0,r.kt)("inlineCode",{parentName:"h3"},"sendRequest()"),"?"),(0,r.kt)("p",null,"See ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/guides/got-scraping",target:"_blank",rel:"noopener"},"the Got Scraping guide"),"."),(0,r.kt)("h3",{id:"removed-options"},"Removed options"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option has been removed. It's permanently set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," in order to better mimic browsers' behavior."),(0,r.kt)("p",null,"Got Scraping automatically performs protocol negotiation, hence we removed the ",(0,r.kt)("inlineCode",{parentName:"p"},"useHttp2")," option. It's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!"),(0,r.kt)("h3",{id:"renamed-options"},"Renamed options"),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," approach, some of the options were named differently. Here's a list of renamed options:"),(0,r.kt)("h4",{id:"payload"},(0,r.kt)("inlineCode",{parentName:"h4"},"payload")),(0,r.kt)("p",null,"This options represents the body to send. It could be a ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"Buffer"),". However, there is no ",(0,r.kt)("inlineCode",{parentName:"p"},"payload")," option anymore. You need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"body")," instead. Or, if you wish to send JSON, ",(0,r.kt)("inlineCode",{parentName:"p"},"json"),". Here's an example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, payload: 'Hello, world!' });\nawait Apify.utils.requestAsBrowser({ \u2026, payload: Buffer.from('c0ffe', 'hex') });\nawait Apify.utils.requestAsBrowser({ \u2026, json: { hello: 'world' } });\n\n// After:\nawait gotScraping({ \u2026, body: 'Hello, world!' });\nawait gotScraping({ \u2026, body: Buffer.from('c0ffe', 'hex') });\nawait gotScraping({ \u2026, json: { hello: 'world' } });\n")),(0,r.kt)("h4",{id:"ignoresslerrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"ignoreSslErrors")),(0,r.kt)("p",null,"It has been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"https.rejectUnauthorized"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," for convenience. However, if you want to make sure the connection is secure, you can do the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, ignoreSslErrors: false });\n\n// After:\nawait gotScraping({ \u2026, https: { rejectUnauthorized: true } });\n")),(0,r.kt)("p",null,"Please note: the meanings are opposite! So we needed to invert the values as well."),(0,r.kt)("h4",{id:"header-generator-options"},(0,r.kt)("inlineCode",{parentName:"h4"},"header-generator")," options"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"useMobileVersion"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"languageCode")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"countryCode")," no longer exist. Instead, you need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," directly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n useMobileVersion: true,\n languageCode: 'en',\n countryCode: 'US',\n});\n\n// After:\nawait gotScraping({\n \u2026,\n headerGeneratorOptions: {\n devices: ['mobile'], // or ['desktop']\n locales: ['en-US'],\n },\n});\n")),(0,r.kt)("h4",{id:"timeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h4"},"timeoutSecs")),(0,r.kt)("p",null,"In order to set a timeout, use ",(0,r.kt)("inlineCode",{parentName:"p"},"timeout.request")," (which is ",(0,r.kt)("strong",{parentName:"p"},"milliseconds")," now)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n timeoutSecs: 30,\n});\n\n// After:\nawait gotScraping({\n \u2026,\n timeout: {\n request: 30 * 1000,\n },\n});\n")),(0,r.kt)("h4",{id:"throwonhttperrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"throwOnHttpErrors")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"throwOnHttpErrors")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"throwHttpErrors"),". This options throws on unsuccessful HTTP status codes, for example ",(0,r.kt)("inlineCode",{parentName:"p"},"404"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h4",{id:"decodebody"},(0,r.kt)("inlineCode",{parentName:"h4"},"decodeBody")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"decodeBody")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"decompress"),". This options decompresses the body. Defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - please do not change this or websites will break (unless you know what you're doing!)."),(0,r.kt)("h4",{id:"abortfunction"},(0,r.kt)("inlineCode",{parentName:"h4"},"abortFunction")),(0,r.kt)("p",null,"This function used to make the promise throw on specific responses, if it returned ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". However, it wasn't that useful."),(0,r.kt)("p",null,"You probably want to cancel the request instead, which you can do in the following way:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const promise = gotScraping(\u2026);\n\npromise.on('request', request => {\n // Please note this is not a Got Request instance, but a ClientRequest one.\n // https://nodejs.org/api/http.html#class-httpclientrequest\n\n if (request.protocol !== 'https:') {\n // Unsecure request, abort.\n promise.cancel();\n\n // If you set `isStream` to `true`, please use `stream.destroy()` instead.\n }\n});\n\nconst response = await promise;\n")),(0,r.kt)("h2",{id:"removal-of-browser-pool-plugin-mixing"},"Removal of browser pool plugin mixing"),(0,r.kt)("p",null,"Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type)."),(0,r.kt)("admonition",{title:"Confused?",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!")),(0,r.kt)("h2",{id:"handling-requests-outside-of-browser"},"Handling requests outside of browser"),(0,r.kt)("p",null,"One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.skipNavigation")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()"),"."),(0,r.kt)("p",null,"Take a look at how to achieve this by checking out the ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/examples/skip-navigation",target:"_blank",rel:"noopener"},"Skipping navigation for certain requests")," example!"),(0,r.kt)("h2",{id:"logging"},"Logging"),(0,r.kt)("p",null,"Crawlee exports the default ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance directly as a named export. We also have a scoped ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ log, request }) {\n log.info(`Opened ${request.loadedUrl}`);\n },\n});\n")),(0,r.kt)("h2",{id:"auto-saved-crawler-state"},"Auto-saved crawler state"),(0,r.kt)("p",null,"Every crawler instance now has ",(0,r.kt)("inlineCode",{parentName:"p"},"useState()")," method that will return a state object we can use. It will be automatically saved when ",(0,r.kt)("inlineCode",{parentName:"p"},"persistState")," event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ crawler }) {\n const state = await crawler.useState({ foo: [] as number[] });\n // just change the value, no need to care about saving it\n state.foo.push(123);\n },\n});\n")),(0,r.kt)("h2",{id:"apify-sdk"},"Apify SDK"),(0,r.kt)("p",null,"The Apify platform helpers can be now found in the Apify SDK (",(0,r.kt)("inlineCode",{parentName:"p"},"apify")," NPM package). It exports the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor")," class that offers following static helpers:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient")," shortcuts: ",(0,r.kt)("inlineCode",{parentName:"li"},"addWebhook()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"call()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"callTask()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"metamorph()")),(0,r.kt)("li",{parentName:"ul"},"helpers for running on Apify platform: ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"exit()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"fail()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"main()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"isAtHome()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"createProxyConfiguration()")),(0,r.kt)("li",{parentName:"ul"},"storage support: ",(0,r.kt)("inlineCode",{parentName:"li"},"getInput()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"getValue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openDataset()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openKeyValueStore()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openRequestQueue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"pushData()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"setValue()")),(0,r.kt)("li",{parentName:"ul"},"events support: ",(0,r.kt)("inlineCode",{parentName:"li"},"on()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"off()")),(0,r.kt)("li",{parentName:"ul"},"other utilities: ",(0,r.kt)("inlineCode",{parentName:"li"},"getEnv()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"newClient()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"reboot()"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," is now just a syntax sugar around calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," at the beginning and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.init();\n// your code\nawait Actor.exit('Crawling finished!');\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.main(async () => {\n // your code\n}, { statusMessage: 'Crawling finished!' });\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," will conditionally set the storage implementation of Crawlee to the ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," will handle the tear down and calls ",(0,r.kt)("inlineCode",{parentName:"p"},"process.exit()")," to ensure our process won't hang indefinitely for some reason."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"Apify SDK (v2) exports ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.events"),", which is an ",(0,r.kt)("inlineCode",{parentName:"p"},"EventEmitter")," instance. With Crawlee, the events are managed by ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," class instead. We can either access it via ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.eventManager")," getter, or use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.on")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.off")," shortcuts instead."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-diff"},"-Apify.events.on(...);\n+Actor.on(...);\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can also get the ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," instance via ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration.getEventManager()"),".")),(0,r.kt)("p",null,"In addition to the existing events, we now have an ",(0,r.kt)("inlineCode",{parentName:"p"},"exit")," event fired when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," (which is called at the end of ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main()"),"). This event allows you to gracefully shut down any resources when ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit")," is called."),(0,r.kt)("h2",{id:"smallerinternal-breaking-changes"},"Smaller/internal breaking changes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.call()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.actor(actorId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.callTask()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.metamorph()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).metamorph(input, options)"),", while also taking the ACTOR_RUN_ID inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.waitForRunToFinish()")," has been removed, use ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.waitForFinish()")," instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Actor.main/init")," purges the storage by default"),(0,r.kt)("li",{parentName:"ul"},"remove ",(0,r.kt)("inlineCode",{parentName:"li"},"purgeLocalStorage")," helper, move purging to the storage class directly",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient")," interface now has optional ",(0,r.kt)("inlineCode",{parentName:"li"},"purge")," method"),(0,r.kt)("li",{parentName:"ul"},"purging happens automatically via ",(0,r.kt)("inlineCode",{parentName:"li"},"Actor.init()")," (you can opt out via ",(0,r.kt)("inlineCode",{parentName:"li"},"purge: false")," in the options of ",(0,r.kt)("inlineCode",{parentName:"li"},"init/main")," methods)"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"QueueOperationInfo.request")," is no longer available"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.handledAt")," is now string date in ISO format"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.inProgress")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Request.reclaimed")," are now ",(0,r.kt)("inlineCode",{parentName:"li"},"Set"),"s instead of POJOs"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"injectUnderscore")," from puppeteer utils has been removed"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"APIFY_MEMORY_MBYTES")," is no longer taken into account, use ",(0,r.kt)("inlineCode",{parentName:"li"},"CRAWLEE_AVAILABLE_MEMORY_RATIO")," instead"),(0,r.kt)("li",{parentName:"ul"},"some ",(0,r.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," options are no longer available:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"cpuSnapshotIntervalSecs")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"memorySnapshotIntervalSecs")," has been replaced with top level ",(0,r.kt)("inlineCode",{parentName:"li"},"systemInfoIntervalMillis")," configuration"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"maxUsedCpuRatio")," has been moved to the top level configuration"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ProxyConfiguration.newUrlFunction")," can be async. ",(0,r.kt)("inlineCode",{parentName:"li"},".newUrl()")," and ",(0,r.kt)("inlineCode",{parentName:"li"},".newProxyInfo()")," now return promises."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"prepareRequestFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"postResponseFunction")," options are removed, use navigation hooks instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"gotoFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"gotoTimeoutSecs")," are removed"),(0,r.kt)("li",{parentName:"ul"},"removed compatibility fix for old/broken request queues with null ",(0,r.kt)("inlineCode",{parentName:"li"},"Request")," props"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintsOptions")," renamed to ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," (",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprints")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprint"),")."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," now accept ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintCacheSize")," (instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintPerProxyCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintPerProxyCacheSize"),", which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=i,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p{n.d(t,{Z:()=>l});var a=n(67294),i=n(88746),r=n(6141),o=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(i.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(i.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>l,T:()=>o});var a=n(67294),i=n(88746),r="https://crawlee.dev",o=function(e){var t=e.to,n=e.children,o=e.version;return a.createElement(i.default,{href:r+"/api"+(o?"/"+o:"")+"/"+t},n)},l=function(e){var t=e.to,n=e.children;return a.createElement(i.default,{href:r+"/"+t},n)}},59798:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=(n(68889),n(26569)),l=["components"],s={id:"upgrading-to-v3",title:"Upgrading to v3"},p=void 0,d={unversionedId:"upgrading/upgrading-to-v3",id:"upgrading/upgrading-to-v3",title:"Upgrading to v3",description:"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.",source:"@site/../docs/upgrading/upgrading_v3.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v3",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v3",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v3.md",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v3",title:"Upgrading to v3"},sidebar:"docs",previous:{title:"Upgrading to v2",permalink:"/sdk/js/docs/next/upgrading/upgrading-to-v2"},next:{title:"Changelog",permalink:"/sdk/js/docs/next/changelog"}},u={},m=[{value:"Crawlee monorepo",id:"crawlee-monorepo",level:2},{value:"Installing Crawlee",id:"installing-crawlee",level:3},{value:"Full TypeScript support",id:"full-typescript-support",level:2},{value:"Docker build",id:"docker-build",level:3},{value:"Browser fingerprints",id:"browser-fingerprints",level:2},{value:"Session cookie method renames",id:"session-cookie-method-renames",level:2},{value:"Memory storage",id:"memory-storage",level:2},{value:"Purging of the default storage",id:"purging-of-the-default-storage",level:2},{value:"Renamed crawler options and interfaces",id:"renamed-crawler-options-and-interfaces",level:2},{value:"Context aware helpers",id:"context-aware-helpers",level:2},{value:"Enqueuing links",id:"enqueuing-links",level:3},{value:"Implicit RequestQueue instance",id:"implicit-requestqueue-instance",level:2},{value:"crawler.addRequests()",id:"crawleraddrequests",level:2},{value:"Less verbose error logging",id:"less-verbose-error-logging",level:2},{value:"Request.label shortcut",id:"requestlabel-shortcut",level:2},{value:"Removal of requestAsBrowser",id:"removal-of-requestasbrowser",level:2},{value:"How to use sendRequest()?",id:"how-to-use-sendrequest",level:3},{value:"Removed options",id:"removed-options",level:3},{value:"Renamed options",id:"renamed-options",level:3},{value:"payload",id:"payload",level:4},{value:"ignoreSslErrors",id:"ignoresslerrors",level:4},{value:"header-generator options",id:"header-generator-options",level:4},{value:"timeoutSecs",id:"timeoutsecs",level:4},{value:"throwOnHttpErrors",id:"throwonhttperrors",level:4},{value:"decodeBody",id:"decodebody",level:4},{value:"abortFunction",id:"abortfunction",level:4},{value:"Removal of browser pool plugin mixing",id:"removal-of-browser-pool-plugin-mixing",level:2},{value:"Handling requests outside of browser",id:"handling-requests-outside-of-browser",level:2},{value:"Logging",id:"logging",level:2},{value:"Auto-saved crawler state",id:"auto-saved-crawler-state",level:2},{value:"Apify SDK",id:"apify-sdk",level:2},{value:"Events",id:"events",level:3},{value:"Smaller/internal breaking changes",id:"smallerinternal-breaking-changes",level:2}],c={toc:m},k="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(k,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3."),(0,r.kt)("admonition",{title:"Crawlee vs Apify SDK v2",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Up until version 3 of ",(0,r.kt)("inlineCode",{parentName:"p"},"apify"),", the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/crawlee",target:"_blank",rel:"noopener"},"Crawlee"),", the new web-scraping library, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package on NPM"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/apify-sdk-js",target:"_blank",rel:"noopener"},"Apify SDK"),", helpers for the Apify platform, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"apify"))," package on NPM"))),(0,r.kt)("h2",{id:"crawlee-monorepo"},"Crawlee monorepo"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package consists of several smaller packages, released separately under ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee")," namespace:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/core"),": the base for all the crawler implementations, also contains things like ",(0,r.kt)("inlineCode",{parentName:"li"},"Request"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestQueue"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestList")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Dataset")," classes"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/basic"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BasicCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/http"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"HttpCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"DOMCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BrowserCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/memory-storage"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"@apify/storage-local")," alternative"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser-pool"),": previously ",(0,r.kt)("inlineCode",{parentName:"li"},"browser-pool")," package"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/utils"),": utility methods"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/types"),": holds TS interfaces mainly about the ",(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient"))),(0,r.kt)("h3",{id:"installing-crawlee"},"Installing Crawlee"),(0,r.kt)("p",null,"Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright")," if you plan on using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," - it already contains everything from the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/browser")," package, which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/basic"),", which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/core"),"."),(0,r.kt)("p",null,"If we don't care much about additional code being pulled in, we can just use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package, which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee\n")),(0,r.kt)("p",null,"Or if all we need is cheerio support, we can install only ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/cheerio"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @crawlee/cheerio\n")),(0,r.kt)("p",null,"When using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer"),", we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee playwright\n# or npm install @crawlee/playwright playwright\n")),(0,r.kt)("p",null,"Alternatively we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sometimes you might want to use some utility methods from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/utils"),", so you might want to install that as well. This package contains some utilities that were previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils"),". Browser related utilities can be also found in the crawler packages (e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright"),").")),(0,r.kt)("h2",{id:"full-typescript-support"},"Full TypeScript support"),(0,r.kt)("p",null,"Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," package. Don't forget to set the ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"target")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"ES2022")," or above to be able to use top level await."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," config has ",(0,r.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#noImplicitAny",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"noImplicitAny"))," enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="tsconfig.json"',title:'"tsconfig.json"'},'{\n "extends": "@apify/tsconfig",\n "compilerOptions": {\n "module": "ES2022",\n "target": "ES2022",\n "outDir": "dist",\n "lib": ["DOM"]\n },\n "include": [\n "./src/**/*"\n ]\n}\n')),(0,r.kt)("h3",{id:"docker-build"},"Docker build"),(0,r.kt)("p",null,"For ",(0,r.kt)("inlineCode",{parentName:"p"},"Dockerfile")," we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-dockerfile",metastring:'title="Dockerfile"',title:'"Dockerfile"'},'# using multistage build, as we need dev deps to build the TS source code\nFROM apify/actor-node:16 AS builder\n\n# copy all files, install all dependencies (including dev deps) and build the project\nCOPY . ./\nRUN npm install --include=dev \\\n && npm run build\n\n# create final image\nFROM apify/actor-node:16\n# copy only necessary files\nCOPY --from=builder /usr/src/app/package*.json ./\nCOPY --from=builder /usr/src/app/README.md ./\nCOPY --from=builder /usr/src/app/dist ./dist\nCOPY --from=builder /usr/src/app/apify.json ./apify.json\nCOPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json\n\n# install only prod deps\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --only=prod --no-optional --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# run compiled code\nCMD npm run start:prod\n')),(0,r.kt)("h2",{id:"browser-fingerprints"},"Browser fingerprints"),(0,r.kt)("p",null,"Previously we had a magical ",(0,r.kt)("inlineCode",{parentName:"p"},"stealth")," option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints."),(0,r.kt)("p",null,"In case we don't want to have dynamic fingerprints, we can disable this behaviour via ",(0,r.kt)("inlineCode",{parentName:"p"},"useFingerprints")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: false,\n },\n});\n")),(0,r.kt)("h2",{id:"session-cookie-method-renames"},"Session cookie method renames"),(0,r.kt)("p",null,"Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getPuppeteerCookies()")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setPuppeteerCookies()"),". Since this method could be used for any of our crawlers, not just ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),", the methods have been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getCookies()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setCookies()")," respectively. Otherwise, their usage is exactly the same!"),(0,r.kt)("h2",{id:"memory-storage"},"Memory storage"),(0,r.kt)("p",null,"When we store some data or intermediate state (like the one ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," holds), we now use ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/memory-storage")," by default. It is an alternative to the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", that stores the state inside memory (as opposed to SQLite database used by ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),"). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the ",(0,r.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file)."),(0,r.kt)("p",null,"When we want to run the crawler on Apify platform, we need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main"),", which will automatically switch the storage client to ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when on the Apify platform."),(0,r.kt)("p",null,"We can still use the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", to do it, first install it pass it to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," options:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local")," v2.1.0+ is required for Crawlee")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\nimport { ApifyStorageLocal } from '@apify/storage-local';\n\nconst storage = new ApifyStorageLocal(/* options like `enableWalMode` belong here */);\nawait Actor.init({ storage });\n")),(0,r.kt)("h2",{id:"purging-of-the-default-storage"},"Purging of the default storage"),(0,r.kt)("p",null,"Previously the state was preserved between local runs, and we had to use ",(0,r.kt)("inlineCode",{parentName:"p"},"--purge")," argument of the ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-cli"),". With Crawlee, this is now the default behaviour, we purge the storage automatically on ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init/main")," call. We can opt out of it via ",(0,r.kt)("inlineCode",{parentName:"p"},"purge: false")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," options."),(0,r.kt)("h2",{id:"renamed-crawler-options-and-interfaces"},"Renamed crawler options and interfaces"),(0,r.kt)("p",null,"Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"requestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"navigationTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleFailedRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"failedRequestHandler"))),(0,r.kt)("p",null,"We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CheerioHandlePageInputs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawlingContext"))),(0,r.kt)("h2",{id:"context-aware-helpers"},"Context aware helpers"),(0,r.kt)("p",null,"Some utilities previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils")," namespace are now moved to the crawling context and are ",(0,r.kt)("em",{parentName:"p"},"context aware"),". This means they have some parameters automatically filled in from the context, like the current ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," instance or current ",(0,r.kt)("inlineCode",{parentName:"p"},"Page")," object, or the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," bound to the crawler."),(0,r.kt)("h3",{id:"enqueuing-links"},"Enqueuing links"),(0,r.kt)("p",null,"One common helper that received more attention is the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks"),". As mentioned above, it is context aware - we no longer need pass in the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," arguments (or the cheerio handle ",(0,r.kt)("inlineCode",{parentName:"p"},"$"),"). In addition to that, it now offers 3 enqueuing strategies:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.All")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'all'"),"): Matches any URLs found"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameHostname")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-hostname'"),") Matches any URLs that have the same subdomain as the base URL (default)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameDomain")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-domain'"),") Matches any URLs that have the same domain name. For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://wow.an.example.com")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com")," will both be matched for a base url of ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com"),".")),(0,r.kt)("p",null,"This means we can even call ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain."),(0,r.kt)("p",null,"Moreover, we can specify patterns the URL should match via globs:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n async requestHandler({ enqueueLinks }) {\n await enqueueLinks({\n globs: ['https://crawlee.dev/*/*'],\n // we can also use `regexps` and `pseudoUrls` keys here\n });\n },\n});\n")),(0,r.kt)("h2",{id:"implicit-requestqueue-instance"},"Implicit ",(0,r.kt)("inlineCode",{parentName:"h2"},"RequestQueue")," instance"),(0,r.kt)("p",null,"All crawlers now have the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance automatically available via ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance manually, and we can just use ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.addRequests()")," method described underneath."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can still create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," explicitly, the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method will respect that and return the instance provided via crawler options.")),(0,r.kt)("h2",{id:"crawleraddrequests"},(0,r.kt)("inlineCode",{parentName:"h2"},"crawler.addRequests()")),(0,r.kt)("p",null,"We can now add multiple requests in batches. The newly added ",(0,r.kt)("inlineCode",{parentName:"p"},"addRequests")," method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// will resolve right after the initial batch of 1000 requests is added\nconst result = await crawler.addRequests([/* many requests, can be even millions */]);\n\n// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise\nawait result.waitForAllRequestsToBeAdded;\n")),(0,r.kt)("h2",{id:"less-verbose-error-logging"},"Less verbose error logging"),(0,r.kt)("p",null,"Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"CRAWLEE_VERBOSE_LOG")," env var."),(0,r.kt)("h2",{id:"requestlabel-shortcut"},(0,r.kt)("inlineCode",{parentName:"h2"},"Request.label")," shortcut"),(0,r.kt)("p",null,"Labeling requests used to work via the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData")," object. With Crawlee, we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.label")," shortcut. It is implemented as a ",(0,r.kt)("inlineCode",{parentName:"p"},"get/set")," pair, using the value from ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData"),". The support for this shortcut is also added to the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," options interface."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"async requestHandler({ request, enqueueLinks }) {\n if (request.label !== 'DETAIL') {\n await enqueueLinks({\n globs: ['...'],\n label: 'DETAIL',\n });\n }\n}\n")),(0,r.kt)("h2",{id:"removal-of-requestasbrowser"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h2"},"requestAsBrowser")),(0,r.kt)("p",null,"In v1 we replaced the underlying implementation of ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," to be just a proxy over calling ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," - our custom extension to ",(0,r.kt)("inlineCode",{parentName:"p"},"got")," that tries to mimic the real browsers as much as possible. With v3, we are removing the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser"),", encouraging the use of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," directly."),(0,r.kt)("p",null,"For easier migration, we also added ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()")," helper that allows processing the context bound ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," object through ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping")),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new BasicCrawler({\n async requestHandler({ sendRequest, log }) {\n // we can use the options parameter to override gotScraping options\n const res = await sendRequest({ responseType: 'json' });\n log.info('received body', res.body);\n },\n});\n")),(0,r.kt)("h3",{id:"how-to-use-sendrequest"},"How to use ",(0,r.kt)("inlineCode",{parentName:"h3"},"sendRequest()"),"?"),(0,r.kt)("p",null,"See ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/guides/got-scraping",target:"_blank",rel:"noopener"},"the Got Scraping guide"),"."),(0,r.kt)("h3",{id:"removed-options"},"Removed options"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option has been removed. It's permanently set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," in order to better mimic browsers' behavior."),(0,r.kt)("p",null,"Got Scraping automatically performs protocol negotiation, hence we removed the ",(0,r.kt)("inlineCode",{parentName:"p"},"useHttp2")," option. It's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!"),(0,r.kt)("h3",{id:"renamed-options"},"Renamed options"),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," approach, some of the options were named differently. Here's a list of renamed options:"),(0,r.kt)("h4",{id:"payload"},(0,r.kt)("inlineCode",{parentName:"h4"},"payload")),(0,r.kt)("p",null,"This options represents the body to send. It could be a ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"Buffer"),". However, there is no ",(0,r.kt)("inlineCode",{parentName:"p"},"payload")," option anymore. You need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"body")," instead. Or, if you wish to send JSON, ",(0,r.kt)("inlineCode",{parentName:"p"},"json"),". Here's an example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, payload: 'Hello, world!' });\nawait Apify.utils.requestAsBrowser({ \u2026, payload: Buffer.from('c0ffe', 'hex') });\nawait Apify.utils.requestAsBrowser({ \u2026, json: { hello: 'world' } });\n\n// After:\nawait gotScraping({ \u2026, body: 'Hello, world!' });\nawait gotScraping({ \u2026, body: Buffer.from('c0ffe', 'hex') });\nawait gotScraping({ \u2026, json: { hello: 'world' } });\n")),(0,r.kt)("h4",{id:"ignoresslerrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"ignoreSslErrors")),(0,r.kt)("p",null,"It has been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"https.rejectUnauthorized"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," for convenience. However, if you want to make sure the connection is secure, you can do the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, ignoreSslErrors: false });\n\n// After:\nawait gotScraping({ \u2026, https: { rejectUnauthorized: true } });\n")),(0,r.kt)("p",null,"Please note: the meanings are opposite! So we needed to invert the values as well."),(0,r.kt)("h4",{id:"header-generator-options"},(0,r.kt)("inlineCode",{parentName:"h4"},"header-generator")," options"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"useMobileVersion"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"languageCode")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"countryCode")," no longer exist. Instead, you need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," directly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n useMobileVersion: true,\n languageCode: 'en',\n countryCode: 'US',\n});\n\n// After:\nawait gotScraping({\n \u2026,\n headerGeneratorOptions: {\n devices: ['mobile'], // or ['desktop']\n locales: ['en-US'],\n },\n});\n")),(0,r.kt)("h4",{id:"timeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h4"},"timeoutSecs")),(0,r.kt)("p",null,"In order to set a timeout, use ",(0,r.kt)("inlineCode",{parentName:"p"},"timeout.request")," (which is ",(0,r.kt)("strong",{parentName:"p"},"milliseconds")," now)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n timeoutSecs: 30,\n});\n\n// After:\nawait gotScraping({\n \u2026,\n timeout: {\n request: 30 * 1000,\n },\n});\n")),(0,r.kt)("h4",{id:"throwonhttperrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"throwOnHttpErrors")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"throwOnHttpErrors")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"throwHttpErrors"),". This options throws on unsuccessful HTTP status codes, for example ",(0,r.kt)("inlineCode",{parentName:"p"},"404"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h4",{id:"decodebody"},(0,r.kt)("inlineCode",{parentName:"h4"},"decodeBody")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"decodeBody")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"decompress"),". This options decompresses the body. Defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - please do not change this or websites will break (unless you know what you're doing!)."),(0,r.kt)("h4",{id:"abortfunction"},(0,r.kt)("inlineCode",{parentName:"h4"},"abortFunction")),(0,r.kt)("p",null,"This function used to make the promise throw on specific responses, if it returned ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". However, it wasn't that useful."),(0,r.kt)("p",null,"You probably want to cancel the request instead, which you can do in the following way:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const promise = gotScraping(\u2026);\n\npromise.on('request', request => {\n // Please note this is not a Got Request instance, but a ClientRequest one.\n // https://nodejs.org/api/http.html#class-httpclientrequest\n\n if (request.protocol !== 'https:') {\n // Unsecure request, abort.\n promise.cancel();\n\n // If you set `isStream` to `true`, please use `stream.destroy()` instead.\n }\n});\n\nconst response = await promise;\n")),(0,r.kt)("h2",{id:"removal-of-browser-pool-plugin-mixing"},"Removal of browser pool plugin mixing"),(0,r.kt)("p",null,"Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type)."),(0,r.kt)("admonition",{title:"Confused?",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!")),(0,r.kt)("h2",{id:"handling-requests-outside-of-browser"},"Handling requests outside of browser"),(0,r.kt)("p",null,"One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.skipNavigation")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()"),"."),(0,r.kt)("p",null,"Take a look at how to achieve this by checking out the ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/examples/skip-navigation",target:"_blank",rel:"noopener"},"Skipping navigation for certain requests")," example!"),(0,r.kt)("h2",{id:"logging"},"Logging"),(0,r.kt)("p",null,"Crawlee exports the default ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance directly as a named export. We also have a scoped ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ log, request }) {\n log.info(`Opened ${request.loadedUrl}`);\n },\n});\n")),(0,r.kt)("h2",{id:"auto-saved-crawler-state"},"Auto-saved crawler state"),(0,r.kt)("p",null,"Every crawler instance now has ",(0,r.kt)("inlineCode",{parentName:"p"},"useState()")," method that will return a state object we can use. It will be automatically saved when ",(0,r.kt)("inlineCode",{parentName:"p"},"persistState")," event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ crawler }) {\n const state = await crawler.useState({ foo: [] as number[] });\n // just change the value, no need to care about saving it\n state.foo.push(123);\n },\n});\n")),(0,r.kt)("h2",{id:"apify-sdk"},"Apify SDK"),(0,r.kt)("p",null,"The Apify platform helpers can be now found in the Apify SDK (",(0,r.kt)("inlineCode",{parentName:"p"},"apify")," NPM package). It exports the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor")," class that offers following static helpers:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient")," shortcuts: ",(0,r.kt)("inlineCode",{parentName:"li"},"addWebhook()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"call()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"callTask()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"metamorph()")),(0,r.kt)("li",{parentName:"ul"},"helpers for running on Apify platform: ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"exit()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"fail()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"main()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"isAtHome()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"createProxyConfiguration()")),(0,r.kt)("li",{parentName:"ul"},"storage support: ",(0,r.kt)("inlineCode",{parentName:"li"},"getInput()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"getValue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openDataset()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openKeyValueStore()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openRequestQueue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"pushData()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"setValue()")),(0,r.kt)("li",{parentName:"ul"},"events support: ",(0,r.kt)("inlineCode",{parentName:"li"},"on()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"off()")),(0,r.kt)("li",{parentName:"ul"},"other utilities: ",(0,r.kt)("inlineCode",{parentName:"li"},"getEnv()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"newClient()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"reboot()"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," is now just a syntax sugar around calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," at the beginning and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.init();\n// your code\nawait Actor.exit('Crawling finished!');\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.main(async () => {\n // your code\n}, { statusMessage: 'Crawling finished!' });\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," will conditionally set the storage implementation of Crawlee to the ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," will handle the tear down and calls ",(0,r.kt)("inlineCode",{parentName:"p"},"process.exit()")," to ensure our process won't hang indefinitely for some reason."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"Apify SDK (v2) exports ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.events"),", which is an ",(0,r.kt)("inlineCode",{parentName:"p"},"EventEmitter")," instance. With Crawlee, the events are managed by ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," class instead. We can either access it via ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.eventManager")," getter, or use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.on")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.off")," shortcuts instead."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-diff"},"-Apify.events.on(...);\n+Actor.on(...);\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can also get the ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," instance via ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration.getEventManager()"),".")),(0,r.kt)("p",null,"In addition to the existing events, we now have an ",(0,r.kt)("inlineCode",{parentName:"p"},"exit")," event fired when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," (which is called at the end of ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main()"),"). This event allows you to gracefully shut down any resources when ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit")," is called."),(0,r.kt)("h2",{id:"smallerinternal-breaking-changes"},"Smaller/internal breaking changes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.call()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.actor(actorId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.callTask()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.metamorph()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).metamorph(input, options)"),", while also taking the ACTOR_RUN_ID inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.waitForRunToFinish()")," has been removed, use ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.waitForFinish()")," instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Actor.main/init")," purges the storage by default"),(0,r.kt)("li",{parentName:"ul"},"remove ",(0,r.kt)("inlineCode",{parentName:"li"},"purgeLocalStorage")," helper, move purging to the storage class directly",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient")," interface now has optional ",(0,r.kt)("inlineCode",{parentName:"li"},"purge")," method"),(0,r.kt)("li",{parentName:"ul"},"purging happens automatically via ",(0,r.kt)("inlineCode",{parentName:"li"},"Actor.init()")," (you can opt out via ",(0,r.kt)("inlineCode",{parentName:"li"},"purge: false")," in the options of ",(0,r.kt)("inlineCode",{parentName:"li"},"init/main")," methods)"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"QueueOperationInfo.request")," is no longer available"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.handledAt")," is now string date in ISO format"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.inProgress")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Request.reclaimed")," are now ",(0,r.kt)("inlineCode",{parentName:"li"},"Set"),"s instead of POJOs"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"injectUnderscore")," from puppeteer utils has been removed"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"APIFY_MEMORY_MBYTES")," is no longer taken into account, use ",(0,r.kt)("inlineCode",{parentName:"li"},"CRAWLEE_AVAILABLE_MEMORY_RATIO")," instead"),(0,r.kt)("li",{parentName:"ul"},"some ",(0,r.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," options are no longer available:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"cpuSnapshotIntervalSecs")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"memorySnapshotIntervalSecs")," has been replaced with top level ",(0,r.kt)("inlineCode",{parentName:"li"},"systemInfoIntervalMillis")," configuration"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"maxUsedCpuRatio")," has been moved to the top level configuration"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ProxyConfiguration.newUrlFunction")," can be async. ",(0,r.kt)("inlineCode",{parentName:"li"},".newUrl()")," and ",(0,r.kt)("inlineCode",{parentName:"li"},".newProxyInfo()")," now return promises."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"prepareRequestFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"postResponseFunction")," options are removed, use navigation hooks instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"gotoFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"gotoTimeoutSecs")," are removed"),(0,r.kt)("li",{parentName:"ul"},"removed compatibility fix for old/broken request queues with null ",(0,r.kt)("inlineCode",{parentName:"li"},"Request")," props"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintsOptions")," renamed to ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," (",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprints")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprint"),")."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," now accept ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintCacheSize")," (instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintPerProxyCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintPerProxyCacheSize"),", which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=i,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id:"handle-request-inputs",title:"HandleRequestInputs"},i=void 0,p={unversionedId:"typedefs/handle-request-inputs",id:"version-2.3/typedefs/handle-request-inputs",title:"HandleRequestInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/HandleRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request-inputs",permalink:"/sdk/js/docs/2.3/typedefs/handle-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequestInputs.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"handle-request-inputs",title:"HandleRequestInputs"},sidebar:"version-2.3/docs",previous:{title:"HandleRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-request"},next:{title:"PrepareRequest",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlerequestinputs"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"request"},(0,l.kt)("inlineCode",{parentName:"h3"},"request")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("p",null,"The original {Request} object. A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the\ncrawler. Note that this property is only initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to\nchange the concurrency settings on the fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by\ncalling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"session"},(0,l.kt)("inlineCode",{parentName:"h3"},"session")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session"))),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"crawler"},(0,l.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler"))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=p(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||l;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id:"handle-request-inputs",title:"HandleRequestInputs"},i=void 0,p={unversionedId:"typedefs/handle-request-inputs",id:"version-2.3/typedefs/handle-request-inputs",title:"HandleRequestInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/HandleRequestInputs.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request-inputs",permalink:"/sdk/js/docs/2.3/typedefs/handle-request-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequestInputs.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"handle-request-inputs",title:"HandleRequestInputs"},sidebar:"version-2.3/docs",previous:{title:"HandleRequest",permalink:"/sdk/js/docs/2.3/typedefs/handle-request"},next:{title:"PrepareRequest",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"request",id:"request",level:3},{value:"session",id:"session",level:3},{value:"crawler",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"handlerequestinputs"}),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"request"},(0,l.kt)("inlineCode",{parentName:"h3"},"request")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("p",null,"The original {Request} object. A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the\ncrawler. Note that this property is only initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler.run()"))," function. You can use it to\nchange the concurrency settings on the fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by\ncalling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"session"},(0,l.kt)("inlineCode",{parentName:"h3"},"session")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session"))),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"crawler"},(0,l.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"BasicCrawler"))),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=p(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||l;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=["components"],l={},s=void 0,p={unversionedId:"readme/overview",id:"version-3.1/readme/overview",title:"overview",description:"Overview",source:"@site/versioned_docs/version-3.1/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/overview.md",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,o.kt)(d,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," - Serves as an alternative approach to the static helpers exported from the package.\nThis class can be used to control the current actor run and to interact with the actor's environment. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ApifyClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," - Allows user to interact with the Apify platform from code, control and schedule actors on the platform and access the result data stores.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," - Helper class encapsulating the configuration of the current actor run.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/PlatformEventManager",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlatformEventManager"))," - Event emitter for the platform and SDK events. Can be used to track actor run performance or serverless container migration.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," - Configures connection to a proxy server with the provided options. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for all connections. The proxy servers are managed by Apify Proxy.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/RequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,m=u["".concat(s,".").concat(d)]||u[d]||f[d]||o;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),i=["components"],l={},s=void 0,p={unversionedId:"readme/overview",id:"version-3.1/readme/overview",title:"overview",description:"Overview",source:"@site/versioned_docs/version-3.1/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/overview.md",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],f={toc:u},d="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,o.kt)(d,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Actor",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor"))," - Serves as an alternative approach to the static helpers exported from the package.\nThis class can be used to control the current actor run and to interact with the actor's environment. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ApifyClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ApifyClient"))," - Allows user to interact with the Apify platform from code, control and schedule actors on the platform and access the result data stores.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Configuration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Configuration"))," - Helper class encapsulating the configuration of the current actor run.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/PlatformEventManager",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlatformEventManager"))," - Event emitter for the platform and SDK events. Can be used to track actor run performance or serverless container migration.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/ProxyConfiguration",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," - Configures connection to a proxy server with the provided options. Setting proxy configuration in your crawlers automatically configures them to use the selected proxies for all connections. The proxy servers are managed by Apify Proxy.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/RequestQueue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/Dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/api/apify/class/KeyValueStore",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var s=a.createContext({}),p=function(e){var t=a.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),d=n,m=u["".concat(s,".").concat(d)]||u[d]||f[d]||o;return r?a.createElement(m,i(i({ref:t},c),{},{components:r})):a.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>k,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var o=n(87462),a=n(63366),l=(n(67294),n(3905)),r=["components"],s={id_old:"version-1.3-autoscaled-pool",title:"AutoscaledPool",id:"autoscaled-pool"},i=void 0,u={unversionedId:"api/autoscaled-pool",id:"version-1.3/api/autoscaled-pool",title:"AutoscaledPool",description:"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and",source:"@site/versioned_docs/version-1.3/api/AutoscaledPool.md",sourceDirName:"api",slug:"/api/autoscaled-pool",permalink:"/sdk/js/docs/1.3/api/autoscaled-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/AutoscaledPool.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-autoscaled-pool",title:"AutoscaledPool",id:"autoscaled-pool"},sidebar:"version-1.3/docs",previous:{title:"KeyValueStore",permalink:"/sdk/js/docs/1.3/api/key-value-store"},next:{title:"Session",permalink:"/sdk/js/docs/1.3/api/session"}},p={},c=[{value:"new AutoscaledPool(options)",id:"new-autoscaledpooloptions",level:2},{value:"autoscaledPool.log",id:"autoscaledpoollog",level:2},{value:"autoscaledPool.minConcurrency",id:"autoscaledpoolminconcurrency",level:2},{value:"autoscaledPool.minConcurrency",id:"autoscaledpoolminconcurrency-1",level:2},{value:"autoscaledPool.maxConcurrency",id:"autoscaledpoolmaxconcurrency",level:2},{value:"autoscaledPool.maxConcurrency",id:"autoscaledpoolmaxconcurrency-1",level:2},{value:"autoscaledPool.desiredConcurrency",id:"autoscaledpooldesiredconcurrency",level:2},{value:"autoscaledPool.desiredConcurrency",id:"autoscaledpooldesiredconcurrency-1",level:2},{value:"autoscaledPool.currentConcurrency",id:"autoscaledpoolcurrentconcurrency",level:2},{value:"autoscaledPool.run()",id:"autoscaledpoolrun",level:2},{value:"autoscaledPool.abort()",id:"autoscaledpoolabort",level:2},{value:"autoscaledPool.pause([timeoutSecs])",id:"autoscaledpoolpausetimeoutsecs",level:2},{value:"autoscaledPool.resume()",id:"autoscaledpoolresume",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,r);return(0,l.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("p",null,"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and\nmemory available and the Javascript event loop is not blocked."),(0,l.kt)("p",null,"The information about the CPU and memory usage is obtained by the ",(0,l.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," class, which makes regular snapshots of system\nresources that may be either local or from the Apify cloud infrastructure in case the process is running on the Apify platform. Meaningful data\ngathered from these snapshots is provided to ",(0,l.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")," by the ",(0,l.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," class."),(0,l.kt)("p",null,"Before running the pool, you need to implement the following three functions:\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#runtaskfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.runTaskFunction()")),",\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),"."),(0,l.kt)("p",null,"The auto-scaled pool is started by calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function. The pool periodically queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," function for more tasks, managing optimal\nconcurrency, until the function resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),". The pool then queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),". If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),", the run finishes\nafter all running tasks complete. If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", it assumes there will be more tasks available later and keeps periodically querying for\ntasks. If any of the tasks throws then the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function rejects the promise with an error."),(0,l.kt)("p",null,"The pool evaluates whether it should start a new task every time one of the tasks finishes and also in the interval set by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs")," parameter."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const pool = new Apify.AutoscaledPool({\n maxConcurrency: 50,\n runTaskFunction: async () => {\n // Run some resource-intensive asynchronous operation here.\n },\n isTaskReadyFunction: async () => {\n // Tell the pool whether more tasks are ready to be processed.\n // Return true or false\n },\n isFinishedFunction: async () => {\n // Tell the pool whether it should finish\n // or wait for more tasks to become available.\n // Return true or false\n },\n});\n\nawait pool.run();\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("h2",{id:"new-autoscaledpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new AutoscaledPool(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"autoscaledpoollog"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Gets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Sets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Gets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Sets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Gets the desired concurrency for the pool, which is an estimated number of parallel tasks that the system can currently support."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Sets the desired concurrency for the pool, i.e. the number of tasks that should be running in parallel if there's large enough supply of tasks."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"currentconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolcurrentconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.currentConcurrency")),(0,l.kt)("p",null,"Gets the the number of parallel tasks currently running in the pool."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"autoscaledpoolrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.run()")),(0,l.kt)("p",null,"Runs the auto-scaled pool. Returns a promise that gets resolved or rejected once all the tasks are finished or one of them fails."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"abort"}),(0,l.kt)("h2",{id:"autoscaledpoolabort"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.abort()")),(0,l.kt)("p",null,"Aborts the run of the auto-scaled pool and destroys it. The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function\nwill immediately resolve, no more new tasks will be spawned and all running tasks will be left in their current state."),(0,l.kt)("p",null,"Due to the nature of the tasks, auto-scaled pool cannot reliably guarantee abortion of all the running tasks, therefore, no abortion is attempted and\nsome of the tasks may finish, while others may not. Essentially, auto-scaled pool doesn't care about their state after the invocation of ",(0,l.kt)("inlineCode",{parentName:"p"},".abort()"),",\nbut that does not mean that some parts of their asynchronous chains of commands will not execute."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pause"}),(0,l.kt)("h2",{id:"autoscaledpoolpausetimeoutsecs"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.pause([timeoutSecs])")),(0,l.kt)("p",null,"Prevents the auto-scaled pool from starting new tasks, but allows the running ones to finish (unlike abort, which terminates them). Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#resume",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.resume()"))),(0,l.kt)("p",null,"The function's promise will resolve once all running tasks have completed and the pool is effectively idle. If the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," argument is provided,\nthe promise will reject with a timeout error after the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," seconds."),(0,l.kt)("p",null,"The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function will not resolve when ",(0,l.kt)("inlineCode",{parentName:"p"},".pause()")," is invoked (unlike abort,\nwhich resolves it)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"resume"}),(0,l.kt)("h2",{id:"autoscaledpoolresume"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.resume()")),(0,l.kt)("p",null,"Resumes the operation of the autoscaled-pool by allowing more tasks to be run. Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))),(0,l.kt)("p",null,"Tasks will automatically start running again in ",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs"),"."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=o.createContext({}),u=function(e){var t=o.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return o.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=u(n),m=a,k=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return n?o.createElement(k,r(r({ref:t},p),{},{components:n})):o.createElement(k,r({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,r=new Array(l);r[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,r[1]=s;for(var u=2;u{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>k,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var o=n(87462),a=n(63366),l=(n(67294),n(3905)),r=["components"],s={id_old:"version-1.3-autoscaled-pool",title:"AutoscaledPool",id:"autoscaled-pool"},i=void 0,u={unversionedId:"api/autoscaled-pool",id:"version-1.3/api/autoscaled-pool",title:"AutoscaledPool",description:"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and",source:"@site/versioned_docs/version-1.3/api/AutoscaledPool.md",sourceDirName:"api",slug:"/api/autoscaled-pool",permalink:"/sdk/js/docs/1.3/api/autoscaled-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/AutoscaledPool.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-autoscaled-pool",title:"AutoscaledPool",id:"autoscaled-pool"},sidebar:"version-1.3/docs",previous:{title:"KeyValueStore",permalink:"/sdk/js/docs/1.3/api/key-value-store"},next:{title:"Session",permalink:"/sdk/js/docs/1.3/api/session"}},p={},c=[{value:"new AutoscaledPool(options)",id:"new-autoscaledpooloptions",level:2},{value:"autoscaledPool.log",id:"autoscaledpoollog",level:2},{value:"autoscaledPool.minConcurrency",id:"autoscaledpoolminconcurrency",level:2},{value:"autoscaledPool.minConcurrency",id:"autoscaledpoolminconcurrency-1",level:2},{value:"autoscaledPool.maxConcurrency",id:"autoscaledpoolmaxconcurrency",level:2},{value:"autoscaledPool.maxConcurrency",id:"autoscaledpoolmaxconcurrency-1",level:2},{value:"autoscaledPool.desiredConcurrency",id:"autoscaledpooldesiredconcurrency",level:2},{value:"autoscaledPool.desiredConcurrency",id:"autoscaledpooldesiredconcurrency-1",level:2},{value:"autoscaledPool.currentConcurrency",id:"autoscaledpoolcurrentconcurrency",level:2},{value:"autoscaledPool.run()",id:"autoscaledpoolrun",level:2},{value:"autoscaledPool.abort()",id:"autoscaledpoolabort",level:2},{value:"autoscaledPool.pause([timeoutSecs])",id:"autoscaledpoolpausetimeoutsecs",level:2},{value:"autoscaledPool.resume()",id:"autoscaledpoolresume",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,r);return(0,l.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("p",null,"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and\nmemory available and the Javascript event loop is not blocked."),(0,l.kt)("p",null,"The information about the CPU and memory usage is obtained by the ",(0,l.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," class, which makes regular snapshots of system\nresources that may be either local or from the Apify cloud infrastructure in case the process is running on the Apify platform. Meaningful data\ngathered from these snapshots is provided to ",(0,l.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")," by the ",(0,l.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," class."),(0,l.kt)("p",null,"Before running the pool, you need to implement the following three functions:\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#runtaskfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.runTaskFunction()")),",\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),"."),(0,l.kt)("p",null,"The auto-scaled pool is started by calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function. The pool periodically queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," function for more tasks, managing optimal\nconcurrency, until the function resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),". The pool then queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),". If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),", the run finishes\nafter all running tasks complete. If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", it assumes there will be more tasks available later and keeps periodically querying for\ntasks. If any of the tasks throws then the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function rejects the promise with an error."),(0,l.kt)("p",null,"The pool evaluates whether it should start a new task every time one of the tasks finishes and also in the interval set by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs")," parameter."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const pool = new Apify.AutoscaledPool({\n maxConcurrency: 50,\n runTaskFunction: async () => {\n // Run some resource-intensive asynchronous operation here.\n },\n isTaskReadyFunction: async () => {\n // Tell the pool whether more tasks are ready to be processed.\n // Return true or false\n },\n isFinishedFunction: async () => {\n // Tell the pool whether it should finish\n // or wait for more tasks to become available.\n // Return true or false\n },\n});\n\nawait pool.run();\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("h2",{id:"new-autoscaledpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new AutoscaledPool(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"autoscaledpoollog"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Gets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Sets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Gets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Sets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Gets the desired concurrency for the pool, which is an estimated number of parallel tasks that the system can currently support."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Sets the desired concurrency for the pool, i.e. the number of tasks that should be running in parallel if there's large enough supply of tasks."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"currentconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolcurrentconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.currentConcurrency")),(0,l.kt)("p",null,"Gets the the number of parallel tasks currently running in the pool."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"autoscaledpoolrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.run()")),(0,l.kt)("p",null,"Runs the auto-scaled pool. Returns a promise that gets resolved or rejected once all the tasks are finished or one of them fails."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"abort"}),(0,l.kt)("h2",{id:"autoscaledpoolabort"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.abort()")),(0,l.kt)("p",null,"Aborts the run of the auto-scaled pool and destroys it. The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function\nwill immediately resolve, no more new tasks will be spawned and all running tasks will be left in their current state."),(0,l.kt)("p",null,"Due to the nature of the tasks, auto-scaled pool cannot reliably guarantee abortion of all the running tasks, therefore, no abortion is attempted and\nsome of the tasks may finish, while others may not. Essentially, auto-scaled pool doesn't care about their state after the invocation of ",(0,l.kt)("inlineCode",{parentName:"p"},".abort()"),",\nbut that does not mean that some parts of their asynchronous chains of commands will not execute."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pause"}),(0,l.kt)("h2",{id:"autoscaledpoolpausetimeoutsecs"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.pause([timeoutSecs])")),(0,l.kt)("p",null,"Prevents the auto-scaled pool from starting new tasks, but allows the running ones to finish (unlike abort, which terminates them). Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#resume",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.resume()"))),(0,l.kt)("p",null,"The function's promise will resolve once all running tasks have completed and the pool is effectively idle. If the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," argument is provided,\nthe promise will reject with a timeout error after the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," seconds."),(0,l.kt)("p",null,"The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function will not resolve when ",(0,l.kt)("inlineCode",{parentName:"p"},".pause()")," is invoked (unlike abort,\nwhich resolves it)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"resume"}),(0,l.kt)("h2",{id:"autoscaledpoolresume"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.resume()")),(0,l.kt)("p",null,"Resumes the operation of the autoscaled-pool by allowing more tasks to be run. Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))),(0,l.kt)("p",null,"Tasks will automatically start running again in ",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs"),"."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=o.createContext({}),u=function(e){var t=o.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return o.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=u(n),m=a,k=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return n?o.createElement(k,r(r({ref:t},p),{},{components:n})):o.createElement(k,r({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,r=new Array(l);r[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,r[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-key-consumer",title:"KeyConsumer",id:"key-consumer"},s=void 0,p={unversionedId:"typedefs/key-consumer",id:"version-1.3/typedefs/key-consumer",title:"KeyConsumer",description:"User-function used in the KeyValueStore.forEachKey() method.",source:"@site/versioned_docs/version-1.3/typedefs/KeyConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/key-consumer",permalink:"/sdk/js/docs/1.3/typedefs/key-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyConsumer.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-key-consumer",title:"KeyConsumer",id:"key-consumer"},sidebar:"version-1.3/docs",previous:{title:"DatasetReducer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-reducer"},next:{title:"CreateSession",permalink:"/sdk/js/docs/1.3/typedefs/create-session"}},u={},c=[],d={toc:c},m="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#foreachkey",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.forEachKey()"))," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Current {KeyValue} key being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of the current key in ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"info")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," - Information about the current ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," entry.",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"size")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Size of the value associated with the current key in bytes.")))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,y=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return r?n.createElement(y,i(i({ref:t},u),{},{components:r})):n.createElement(y,i({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-key-consumer",title:"KeyConsumer",id:"key-consumer"},s=void 0,p={unversionedId:"typedefs/key-consumer",id:"version-1.3/typedefs/key-consumer",title:"KeyConsumer",description:"User-function used in the KeyValueStore.forEachKey() method.",source:"@site/versioned_docs/version-1.3/typedefs/KeyConsumer.md",sourceDirName:"typedefs",slug:"/typedefs/key-consumer",permalink:"/sdk/js/docs/1.3/typedefs/key-consumer",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyConsumer.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-key-consumer",title:"KeyConsumer",id:"key-consumer"},sidebar:"version-1.3/docs",previous:{title:"DatasetReducer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-reducer"},next:{title:"CreateSession",permalink:"/sdk/js/docs/1.3/typedefs/create-session"}},u={},c=[],d={toc:c},m="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"keyconsumer"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("a",{parentName:"p",href:"../api/key-value-store#foreachkey",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore.forEachKey()"))," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"key")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Current {KeyValue} key being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of the current key in ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore")),"."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"info")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," - Information about the current ",(0,o.kt)("a",{parentName:"li",href:"../api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," entry.",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"size")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Size of the value associated with the current key in bytes.")))),(0,o.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,y=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return r?n.createElement(y,i(i({ref:t},u),{},{components:r})):n.createElement(y,i({ref:t},u))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],s={id_old:"version-1.3-dataset-mapper",title:"DatasetMapper",id:"dataset-mapper"},i=void 0,l={unversionedId:"typedefs/dataset-mapper",id:"version-1.3/typedefs/dataset-mapper",title:"DatasetMapper",description:"User-function used in the Dataset.map() API.",source:"@site/versioned_docs/version-1.3/typedefs/DatasetMapper.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-mapper",permalink:"/sdk/js/docs/1.3/typedefs/dataset-mapper",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetMapper.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-dataset-mapper",title:"DatasetMapper",id:"dataset-mapper"},sidebar:"version-1.3/docs",previous:{title:"DatasetConsumer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-consumer"},next:{title:"DatasetReducer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-reducer"}},d={},c=[],u={toc:c},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetmapper"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.map()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=l(r),m=a,f=c["".concat(i,".").concat(m)]||c[m]||u[m]||o;return r?n.createElement(f,p(p({ref:t},d),{},{components:r})):n.createElement(f,p({ref:t},d))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,p[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>f,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],s={id_old:"version-1.3-dataset-mapper",title:"DatasetMapper",id:"dataset-mapper"},i=void 0,l={unversionedId:"typedefs/dataset-mapper",id:"version-1.3/typedefs/dataset-mapper",title:"DatasetMapper",description:"User-function used in the Dataset.map() API.",source:"@site/versioned_docs/version-1.3/typedefs/DatasetMapper.md",sourceDirName:"typedefs",slug:"/typedefs/dataset-mapper",permalink:"/sdk/js/docs/1.3/typedefs/dataset-mapper",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetMapper.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-dataset-mapper",title:"DatasetMapper",id:"dataset-mapper"},sidebar:"version-1.3/docs",previous:{title:"DatasetConsumer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-consumer"},next:{title:"DatasetReducer",permalink:"/sdk/js/docs/1.3/typedefs/dataset-reducer"}},d={},c=[],u={toc:c},m="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"datasetmapper"}),(0,o.kt)("p",null,"User-function used in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Dataset.map()")," API."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"item")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object")," - Currect ",(0,o.kt)("a",{parentName:"li",href:"../api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," entry being processed."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"index")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number")," - Position of current {Dataset} entry.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},d=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=l(r),m=a,f=c["".concat(i,".").concat(m)]||c[m]||u[m]||o;return r?n.createElement(f,p(p({ref:t},d),{},{components:r})):n.createElement(f,p({ref:t},d))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,p[1]=s;for(var l=2;l{a.d(t,{Z:()=>i});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const i=function(e){var t=e.to,a=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var d=l+"/";return"current"===l?d="next/":p&&(d=""),r.createElement(n.default,{to:"/api/"+d+t},a)}},20724:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>c});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(68889),i=["components"],l={id:"result-storage",title:"Result Storage"},p=void 0,d={unversionedId:"guides/result-storage",id:"guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/../docs/guides/result_storage.mdx",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/next/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/result_storage.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/next/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/next/guides/environment-variables"}},u={},c=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],f={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)(s.Z,{to:"apify/class/Actor#getValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.getValue()"))," and ",(0,o.kt)(s.Z,{to:"apify/class/Actor#setValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Actor.getInput();\n\n// Write actor output to the default key-value store.\nawait Actor.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Actor.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/capture-screenshot",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)(s.Z,{to:"apify/class/Actor#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Actor.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Actor.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(a),f=n,h=u["".concat(l,".").concat(f)]||u[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},d),{},{components:a})):r.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.d(t,{Z:()=>i});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const i=function(e){var t=e.to,a=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var d=l+"/";return"current"===l?d="next/":p&&(d=""),r.createElement(n.default,{to:"/api/"+d+t},a)}},20724:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>c});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(68889),i=["components"],l={id:"result-storage",title:"Result Storage"},p=void 0,d={unversionedId:"guides/result-storage",id:"guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/../docs/guides/result_storage.mdx",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/next/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/result_storage.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/next/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/next/guides/environment-variables"}},u={},c=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],f={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)(s.Z,{to:"apify/class/Actor#getValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.getValue()"))," and ",(0,o.kt)(s.Z,{to:"apify/class/Actor#setValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Actor.getInput();\n\n// Write actor output to the default key-value store.\nawait Actor.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Actor.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/capture-screenshot",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)(s.Z,{to:"apify/class/Actor#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Actor.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Actor.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(a),f=n,h=u["".concat(l,".").concat(f)]||u[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},d),{},{components:a})):r.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),o=["components"],i={id_old:"version-2.3.0-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},p=void 0,s={unversionedId:"api/playwright-crawler",id:"version-2.3/api/playwright-crawler",title:"PlaywrightCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with",source:"@site/versioned_docs/version-2.3/api/PlaywrightCrawler.md",sourceDirName:"api",slug:"/api/playwright-crawler",permalink:"/sdk/js/docs/2.3/api/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PlaywrightCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},sidebar:"version-2.3/docs",previous:{title:"CheerioCrawler",permalink:"/sdk/js/docs/2.3/api/cheerio-crawler"},next:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/2.3/api/puppeteer-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"browserPool",id:"browserpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new PlaywrightCrawler(options)",id:"new-playwrightcrawleroptions",level:2},{value:"playwrightCrawler.optionsShape",id:"playwrightcrawleroptionsshape",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,o);return(0,l.kt)(h,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs\nenabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"Playwright")," uses headless browser to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Playwright instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class. Many constructor options such as\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#maxopenpagesperinstance",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.maxOpenPagesPerInstance"))," or"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Playwright.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("h2",{id:"new-playwrightcrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PlaywrightCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/playwright-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"playwrightcrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"playwrightCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=r.createContext({}),s=function(e){var t=r.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),h=n,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||l;return a?r.createElement(m,o(o({ref:t},u),{},{components:a})):r.createElement(m,o({ref:t},u))}));function m(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,o=new Array(l);o[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var s=2;s{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=a(87462),n=a(63366),l=(a(67294),a(3905)),o=["components"],i={id_old:"version-2.3.0-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},p=void 0,s={unversionedId:"api/playwright-crawler",id:"version-2.3/api/playwright-crawler",title:"PlaywrightCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with",source:"@site/versioned_docs/version-2.3/api/PlaywrightCrawler.md",sourceDirName:"api",slug:"/api/playwright-crawler",permalink:"/sdk/js/docs/2.3/api/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PlaywrightCrawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-playwright-crawler",title:"PlaywrightCrawler",id:"playwright-crawler"},sidebar:"version-2.3/docs",previous:{title:"CheerioCrawler",permalink:"/sdk/js/docs/2.3/api/cheerio-crawler"},next:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/2.3/api/puppeteer-crawler"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"stats",id:"stats",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"sessionPool",id:"sessionpool",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"browserPool",id:"browserpool",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"new PlaywrightCrawler(options)",id:"new-playwrightcrawleroptions",level:2},{value:"playwrightCrawler.optionsShape",id:"playwrightcrawleroptionsshape",level:2}],d={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,o);return(0,l.kt)(h,(0,r.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chromium, Firefox and Webkit browsers with\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". The URLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs\nenabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"Playwright")," uses headless browser to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Playwright instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class. Many constructor options such as\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#maxopenpagesperinstance",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.maxOpenPagesPerInstance"))," or"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Playwright.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"playwrightcrawler"}),(0,l.kt)("h2",{id:"new-playwrightcrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PlaywrightCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/playwright-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"optionsshape"}),(0,l.kt)("h2",{id:"playwrightcrawleroptionsshape"},(0,l.kt)("inlineCode",{parentName:"h2"},"playwrightCrawler.optionsShape")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Internal"),":"),(0,l.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function o(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=r.createContext({}),s=function(e){var t=r.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},u=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(a),h=n,m=c["".concat(p,".").concat(h)]||c[h]||d[h]||l;return a?r.createElement(m,o(o({ref:t},u),{},{components:a})):r.createElement(m,o({ref:t},u))}));function m(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,o=new Array(l);o[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:n,o[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),o=n(63366),r=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},p=void 0,s={unversionedId:"typedefs/playwright-crawler-options",id:"version-1.3/typedefs/playwright-crawler-options",title:"PlaywrightCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/playwright-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"},next:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/playwright-launch-context"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],c={toc:d},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"playwrightcrawleroptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"handlepagefunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-handle-page-function",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunction"))),(0,r.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright")," ",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright"),"\n",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-response",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The\nfunction must return a promise, which is then awaited by the crawler."),(0,r.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,r.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,r.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"navigationtimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlefailedrequestfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,r.kt)("p",null,"A function to handle requests that failed more than ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,r.kt)("p",null,"The function receives the following object as an argument:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"prenavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n }\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"postnavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n };\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))),(0,r.kt)("p",null,"The same options as used by ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#launchplaywright",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.launchPlaywright()")),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlepagetimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which the function passed as ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"browserpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persistcookiespersession"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"proxyconfiguration"},(0,r.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,r.kt)("p",null,"If set, ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," will be configured for all connections to use ",(0,r.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided\nand rotated according to the configuration. For more information, see the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestlist"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,r.kt)("p",null,"Static list of URLs to be processed. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestqueue"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,r.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestretries"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 3")),(0,r.kt)("p",null,"Indicates how many times the request is retried if\n",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," fails."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestspercrawl"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaledpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,r.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usesessionpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Playwright crawler will initialize the ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,r.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(n),h=o,k=d["".concat(p,".").concat(h)]||d[h]||c[h]||r;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[d]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>k,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),o=n(63366),r=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},p=void 0,s={unversionedId:"typedefs/playwright-crawler-options",id:"version-1.3/typedefs/playwright-crawler-options",title:"PlaywrightCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/playwright-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-crawler-options",title:"PlaywrightCrawlerOptions",id:"playwright-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"},next:{title:"PlaywrightLaunchContext",permalink:"/sdk/js/docs/1.3/typedefs/playwright-launch-context"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"handlePageFunction",id:"handlepagefunction",level:3},{value:"navigationTimeoutSecs",id:"navigationtimeoutsecs",level:3},{value:"handleFailedRequestFunction",id:"handlefailedrequestfunction",level:3},{value:"preNavigationHooks",id:"prenavigationhooks",level:3},{value:"postNavigationHooks",id:"postnavigationhooks",level:3},{value:"launchContext",id:"launchcontext",level:3},{value:"handlePageTimeoutSecs",id:"handlepagetimeoutsecs",level:3},{value:"browserPoolOptions",id:"browserpooloptions",level:3},{value:"persistCookiesPerSession",id:"persistcookiespersession",level:3},{value:"proxyConfiguration",id:"proxyconfiguration",level:3},{value:"requestList",id:"requestlist",level:3},{value:"requestQueue",id:"requestqueue",level:3},{value:"maxRequestRetries",id:"maxrequestretries",level:3},{value:"maxRequestsPerCrawl",id:"maxrequestspercrawl",level:3},{value:"autoscaledPoolOptions",id:"autoscaledpooloptions",level:3},{value:"minConcurrency",id:"minconcurrency",level:3},{value:"maxConcurrency",id:"maxconcurrency",level:3},{value:"useSessionPool",id:"usesessionpool",level:3},{value:"sessionPoolOptions",id:"sessionpooloptions",level:3}],c={toc:d},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,l);return(0,r.kt)(h,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"playwrightcrawleroptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"handlepagefunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-handle-page-function",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightHandlePageFunction"))),(0,r.kt)("p",null,"Function that is called to process each request. It is passed an object with the following fields:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"request")," is an instance of the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc. ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," is an instance of the\n",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright")," ",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Page"))," ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," is an instance of the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"response")," is an instance of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Playwright"),"\n",(0,r.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-response",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"Response")),", which is the main resource response as returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto(request.url)"),". The\nfunction must return a promise, which is then awaited by the crawler."),(0,r.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,r.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,r.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"navigationtimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"navigationTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which page navigation needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlefailedrequestfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,r.kt)("p",null,"A function to handle requests that failed more than ",(0,r.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,r.kt)("p",null,"The function receives the following object as an argument:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{\n request: Request,\n response: Response,\n page: Page,\n session: Session,\n browserController: BrowserController,\n proxyInfo: ProxyInfo,\n crawler: PlaywrightCrawler,\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,r.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"prenavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),", which are passed to the ",(0,r.kt)("inlineCode",{parentName:"p"},"page.goto()")," function the crawler calls to\nnavigate. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, gotoOptions) => {\n await page.evaluate((attr) => { window.foo = attr; }, 'bar');\n }\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"postnavigationhooks"},(0,r.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-hook",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Array"))),(0,r.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n const { page } = crawlingContext;\n if (hasCaptcha(page)) {\n await solveCaptcha (page);\n }\n };\n]\n")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-launch-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightLaunchContext"))),(0,r.kt)("p",null,"The same options as used by ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#launchplaywright",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.launchPlaywright()")),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"handlepagetimeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 60")),(0,r.kt)("p",null,"Timeout in which the function passed as ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, in seconds."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"browserpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"browserPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPoolOptions")),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#BrowserPool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))," constructor. You can tweak those to\nfine-tune browser management."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persistcookiespersession"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"proxyconfiguration"},(0,r.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,r.kt)("p",null,"If set, ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," will be configured for all connections to use ",(0,r.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided\nand rotated according to the configuration. For more information, see the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestlist"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,r.kt)("p",null,"Static list of URLs to be processed. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestqueue"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,r.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,r.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestretries"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 3")),(0,r.kt)("p",null,"Indicates how many times the request is retried if\n",(0,r.kt)("a",{parentName:"p",href:"../typedefs/playwright-crawler-options#handlepagefunction",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawlerOptions.handlePageFunction"))," fails."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxrequestspercrawl"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"autoscaledpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,r.kt)("p",null,"Custom options passed to the underlying ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,r.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,r.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1")),(0,r.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("p",null,(0,r.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxconcurrency"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usesessionpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,r.kt)("code",null," = true")),(0,r.kt)("p",null,"Playwright crawler will initialize the ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,r.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be\nthan available in the ",(0,r.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionpooloptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,r.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(n),h=o,k=d["".concat(p,".").concat(h)]||d[h]||c[h]||r;return n?a.createElement(k,l(l({ref:t},u),{},{components:n})):a.createElement(k,l({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[d]="string"==typeof e?e:o,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),p=["components"],i={id:"pseudo-url",title:"PseudoUrl"},s=void 0,o={unversionedId:"api/pseudo-url",id:"version-2.3/api/pseudo-url",title:"PseudoUrl",description:"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the",source:"@site/versioned_docs/version-2.3/api/PseudoUrl.md",sourceDirName:"api",slug:"/api/pseudo-url",permalink:"/sdk/js/docs/2.3/api/pseudo-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PseudoUrl.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"pseudo-url",title:"PseudoUrl"},sidebar:"version-2.3/docs",previous:{title:"RequestQueue",permalink:"/sdk/js/docs/2.3/api/request-queue"},next:{title:"utils",permalink:"/sdk/js/docs/2.3/api/utils"}},u={},c=[{value:"new PseudoUrl(purl, requestTemplate)",id:"new-pseudourlpurl-requesttemplate",level:2},{value:"pseudoUrl.matches(url)",id:"pseudourlmatchesurl",level:2},{value:"pseudoUrl.createRequest(urlOrProps)",id:"pseudourlcreaterequesturlorprops",level:2}],m={toc:c},d="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(d,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("p",null,"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function."),(0,l.kt)("p",null,"A PURL is simply a URL with special directives enclosed in ",(0,l.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Currently, the only supported directive is ",(0,l.kt)("inlineCode",{parentName:"p"},"[RegExp]"),", which defines a\nJavaScript-style regular expression to match against the URL."),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class can be constructed either using a pseudo-URL string or a regular expression (an instance of the ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object). With a\npseudo-URL string, the matching is always case-insensitive. If you need case-sensitive matching, use an appropriate ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object."),(0,l.kt)("p",null,"For example, a PURL ",(0,l.kt)("inlineCode",{parentName:"p"},"http://www.example.com/pages/[(\\w|-)*]")," will match all of the following URLs:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/my-awesome-page")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/something"))),(0,l.kt)("p",null,"Be careful to correctly escape special characters in the pseudo-URL string. If either ",(0,l.kt)("inlineCode",{parentName:"p"},"[")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"]")," is part of the normal query string, it must be\nencoded as ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5B]")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5D]"),", respectively. For example, the following PURL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[\\x5B]load[\\x5D]=1\n")),(0,l.kt)("p",null,"will match the URL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[load]=1\n")),(0,l.kt)("p",null,"If the regular expression in the pseudo-URL contains a backslash character (",")",", you need to escape it with another back backslash, as shown in the\nexample below."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Using a pseudo-URL string\nconst purl = new Apify.PseudoUrl('http://www.example.com/pages/[(\\\\w|-)+]', {\n userData: { foo: 'bar' },\n});\n\n// Using a regular expression\nconst purl2 = new Apify.PseudoUrl(/http:\\/\\/www\\.example\\.com\\/pages\\/(\\w|-)+/);\n\nif (purl.matches('http://www.example.com/pages/my-awesome-page')) console.log('Match!');\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("h2",{id:"new-pseudourlpurl-requesttemplate"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PseudoUrl(purl, requestTemplate)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"purl")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," - A pseudo-URL string or a regular expression object. Using a ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," instance enables more granular control,\nsuch as making the matching case sensitive."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"requestTemplate")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Options for the new ",(0,l.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," instances created for\nmatching URLs by the ",(0,l.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"matches"}),(0,l.kt)("h2",{id:"pseudourlmatchesurl"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.matches(url)")),(0,l.kt)("p",null,"Determines whether a URL matches this pseudo-URL pattern."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - URL to be matched.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," - Returns ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," if given URL matches pseudo-URL."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"createrequest"}),(0,l.kt)("h2",{id:"pseudourlcreaterequesturlorprops"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.createRequest(urlOrProps)")),(0,l.kt)("p",null,"Creates a Request object from a provided ",(0,l.kt)("inlineCode",{parentName:"p"},"requestTemplate")," and a given URL or an object that specifies \\$",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," properties. In\ncase of a collision the properties will override the template, except for ",(0,l.kt)("inlineCode",{parentName:"p"},"userData"),", which will be merged together, with the ",(0,l.kt)("inlineCode",{parentName:"p"},"userData")," property\nhaving preference over the template. This enables dynamic overriding of the template."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"urlOrProps")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"Object"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=o(n),d=a,k=c["".concat(s,".").concat(d)]||c[d]||m[d]||l;return n?r.createElement(k,p(p({ref:t},u),{},{components:n})):r.createElement(k,p({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,p=new Array(l);p[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,p[1]=i;for(var o=2;o{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),p=["components"],i={id:"pseudo-url",title:"PseudoUrl"},s=void 0,o={unversionedId:"api/pseudo-url",id:"version-2.3/api/pseudo-url",title:"PseudoUrl",description:"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the",source:"@site/versioned_docs/version-2.3/api/PseudoUrl.md",sourceDirName:"api",slug:"/api/pseudo-url",permalink:"/sdk/js/docs/2.3/api/pseudo-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PseudoUrl.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"pseudo-url",title:"PseudoUrl"},sidebar:"version-2.3/docs",previous:{title:"RequestQueue",permalink:"/sdk/js/docs/2.3/api/request-queue"},next:{title:"utils",permalink:"/sdk/js/docs/2.3/api/utils"}},u={},c=[{value:"new PseudoUrl(purl, requestTemplate)",id:"new-pseudourlpurl-requesttemplate",level:2},{value:"pseudoUrl.matches(url)",id:"pseudourlmatchesurl",level:2},{value:"pseudoUrl.createRequest(urlOrProps)",id:"pseudourlcreaterequesturlorprops",level:2}],m={toc:c},d="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(d,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("p",null,"Represents a pseudo-URL (PURL) - an URL pattern used by web crawlers to specify which URLs should the crawler visit. This class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function."),(0,l.kt)("p",null,"A PURL is simply a URL with special directives enclosed in ",(0,l.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Currently, the only supported directive is ",(0,l.kt)("inlineCode",{parentName:"p"},"[RegExp]"),", which defines a\nJavaScript-style regular expression to match against the URL."),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class can be constructed either using a pseudo-URL string or a regular expression (an instance of the ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object). With a\npseudo-URL string, the matching is always case-insensitive. If you need case-sensitive matching, use an appropriate ",(0,l.kt)("inlineCode",{parentName:"p"},"RegExp")," object."),(0,l.kt)("p",null,"For example, a PURL ",(0,l.kt)("inlineCode",{parentName:"p"},"http://www.example.com/pages/[(\\w|-)*]")," will match all of the following URLs:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/my-awesome-page")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"http://www.example.com/pages/something"))),(0,l.kt)("p",null,"Be careful to correctly escape special characters in the pseudo-URL string. If either ",(0,l.kt)("inlineCode",{parentName:"p"},"[")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"]")," is part of the normal query string, it must be\nencoded as ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5B]")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"[\\x5D]"),", respectively. For example, the following PURL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[\\x5B]load[\\x5D]=1\n")),(0,l.kt)("p",null,"will match the URL:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-http"},"http://www.example.com/search?do[load]=1\n")),(0,l.kt)("p",null,"If the regular expression in the pseudo-URL contains a backslash character (",")",", you need to escape it with another back backslash, as shown in the\nexample below."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"// Using a pseudo-URL string\nconst purl = new Apify.PseudoUrl('http://www.example.com/pages/[(\\\\w|-)+]', {\n userData: { foo: 'bar' },\n});\n\n// Using a regular expression\nconst purl2 = new Apify.PseudoUrl(/http:\\/\\/www\\.example\\.com\\/pages\\/(\\w|-)+/);\n\nif (purl.matches('http://www.example.com/pages/my-awesome-page')) console.log('Match!');\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pseudourl"}),(0,l.kt)("h2",{id:"new-pseudourlpurl-requesttemplate"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PseudoUrl(purl, requestTemplate)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"purl")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," - A pseudo-URL string or a regular expression object. Using a ",(0,l.kt)("inlineCode",{parentName:"li"},"RegExp")," instance enables more granular control,\nsuch as making the matching case sensitive."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"requestTemplate")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/request-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestOptions"))," - Options for the new ",(0,l.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," instances created for\nmatching URLs by the ",(0,l.kt)("a",{parentName:"li",href:"../api/utils#enqueuelinks",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"utils.enqueueLinks()"))," function.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"matches"}),(0,l.kt)("h2",{id:"pseudourlmatchesurl"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.matches(url)")),(0,l.kt)("p",null,"Determines whether a URL matches this pseudo-URL pattern."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"url")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," - URL to be matched.")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"boolean")," - Returns ",(0,l.kt)("inlineCode",{parentName:"p"},"true")," if given URL matches pseudo-URL."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"createrequest"}),(0,l.kt)("h2",{id:"pseudourlcreaterequesturlorprops"},(0,l.kt)("inlineCode",{parentName:"h2"},"pseudoUrl.createRequest(urlOrProps)")),(0,l.kt)("p",null,"Creates a Request object from a provided ",(0,l.kt)("inlineCode",{parentName:"p"},"requestTemplate")," and a given URL or an object that specifies \\$",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," properties. In\ncase of a collision the properties will override the template, except for ",(0,l.kt)("inlineCode",{parentName:"p"},"userData"),", which will be merged together, with the ",(0,l.kt)("inlineCode",{parentName:"p"},"userData")," property\nhaving preference over the template. This enables dynamic overriding of the template."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"urlOrProps")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"string")," | ",(0,l.kt)("inlineCode",{parentName:"li"},"Object"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),o=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=o(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=o(n),d=a,k=c["".concat(s,".").concat(d)]||c[d]||m[d]||l;return n?r.createElement(k,p(p({ref:t},u),{},{components:n})):r.createElement(k,p({ref:t},u))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,p=new Array(l);p[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,p[1]=i;for(var o=2;o{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-webhook-run",title:"WebhookRun",id:"webhook-run"},p=void 0,d={unversionedId:"typedefs/webhook-run",id:"version-1.3/typedefs/webhook-run",title:"WebhookRun",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/WebhookRun.md",sourceDirName:"typedefs",slug:"/typedefs/webhook-run",permalink:"/sdk/js/docs/1.3/typedefs/webhook-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/WebhookRun.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-webhook-run",title:"WebhookRun",id:"webhook-run"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"userId",id:"userid",level:3},{value:"isAdHoc",id:"isadhoc",level:3},{value:"eventTypes",id:"eventtypes",level:3},{value:"condition",id:"condition",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"doNotRetry",id:"donotretry",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3},{value:"lastDispatch",id:"lastdispatch",level:3},{value:"stats",id:"stats",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,l);return(0,a.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"webhookrun"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"isadhoc"},(0,a.kt)("inlineCode",{parentName:"h3"},"isAdHoc")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"condition"},(0,a.kt)("inlineCode",{parentName:"h3"},"condition")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"donotretry"},(0,a.kt)("inlineCode",{parentName:"h3"},"doNotRetry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lastdispatch"},(0,a.kt)("inlineCode",{parentName:"h3"},"lastDispatch")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stats"},(0,a.kt)("inlineCode",{parentName:"h3"},"stats")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),k=o,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||a;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,l=new Array(a);l[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>d,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),l=["components"],i={id_old:"version-1.3-webhook-run",title:"WebhookRun",id:"webhook-run"},p=void 0,d={unversionedId:"typedefs/webhook-run",id:"version-1.3/typedefs/webhook-run",title:"WebhookRun",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/WebhookRun.md",sourceDirName:"typedefs",slug:"/typedefs/webhook-run",permalink:"/sdk/js/docs/1.3/typedefs/webhook-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/WebhookRun.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-webhook-run",title:"WebhookRun",id:"webhook-run"}},s={},u=[{value:"Properties",id:"properties",level:2},{value:"id",id:"id",level:3},{value:"createdAt",id:"createdat",level:3},{value:"modifiedAt",id:"modifiedat",level:3},{value:"userId",id:"userid",level:3},{value:"isAdHoc",id:"isadhoc",level:3},{value:"eventTypes",id:"eventtypes",level:3},{value:"condition",id:"condition",level:3},{value:"ignoreSslErrors",id:"ignoresslerrors",level:3},{value:"doNotRetry",id:"donotretry",level:3},{value:"requestUrl",id:"requesturl",level:3},{value:"payloadTemplate",id:"payloadtemplate",level:3},{value:"lastDispatch",id:"lastdispatch",level:3},{value:"stats",id:"stats",level:3}],c={toc:u},k="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,l);return(0,a.kt)(k,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"webhookrun"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"modifiedat"},(0,a.kt)("inlineCode",{parentName:"h3"},"modifiedAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userid"},(0,a.kt)("inlineCode",{parentName:"h3"},"userId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"isadhoc"},(0,a.kt)("inlineCode",{parentName:"h3"},"isAdHoc")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"eventtypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"eventTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/event-types",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"EventTypes"))),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"condition"},(0,a.kt)("inlineCode",{parentName:"h3"},"condition")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"donotretry"},(0,a.kt)("inlineCode",{parentName:"h3"},"doNotRetry")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesturl"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payloadtemplate"},(0,a.kt)("inlineCode",{parentName:"h3"},"payloadTemplate")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lastdispatch"},(0,a.kt)("inlineCode",{parentName:"h3"},"lastDispatch")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stats"},(0,a.kt)("inlineCode",{parentName:"h3"},"stats")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"*")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),d=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},k=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=d(n),k=o,m=u["".concat(p,".").concat(k)]||u[k]||c[k]||a;return n?r.createElement(m,l(l({ref:t},s),{},{components:n})):r.createElement(m,l({ref:t},s))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,l=new Array(a);l[0]=k;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),s=["components"],a={id_old:"version-1.3-system-info",title:"SystemInfo",id:"system-info"},l=void 0,p={unversionedId:"typedefs/system-info",id:"version-1.3/typedefs/system-info",title:"SystemInfo",description:"Represents the current status of the system.",source:"@site/versioned_docs/version-1.3/typedefs/SystemInfo.md",sourceDirName:"typedefs",slug:"/typedefs/system-info",permalink:"/sdk/js/docs/1.3/typedefs/system-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemInfo.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-system-info",title:"SystemInfo",id:"system-info"},sidebar:"version-1.3/docs",previous:{title:"SocialHandles",permalink:"/sdk/js/docs/1.3/typedefs/social-handles"},next:{title:"Changelog",permalink:"/sdk/js/docs/1.3/changelog"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"isSystemIdle",id:"issystemidle",level:3},{value:"memInfo",id:"meminfo",level:3},{value:"eventLoopInfo",id:"eventloopinfo",level:3},{value:"cpuInfo",id:"cpuinfo",level:3}],f={toc:c},m="wrapper";function u(e){var t=e.components,n=(0,o.Z)(e,s);return(0,i.kt)(m,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"systeminfo"}),(0,i.kt)("p",null,"Represents the current status of the system."),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"issystemidle"},(0,i.kt)("inlineCode",{parentName:"h3"},"isSystemIdle")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("p",null,"If true, system is being overloaded."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"meminfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"memInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("p",null,"Memory"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"eventloopinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"eventLoopInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"cpuinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"cpuInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null))}u.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,u=c["".concat(l,".").concat(m)]||c[m]||f[m]||i;return n?r.createElement(u,s(s({ref:t},d),{},{components:n})):r.createElement(u,s({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,s[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),s=["components"],a={id_old:"version-1.3-system-info",title:"SystemInfo",id:"system-info"},l=void 0,p={unversionedId:"typedefs/system-info",id:"version-1.3/typedefs/system-info",title:"SystemInfo",description:"Represents the current status of the system.",source:"@site/versioned_docs/version-1.3/typedefs/SystemInfo.md",sourceDirName:"typedefs",slug:"/typedefs/system-info",permalink:"/sdk/js/docs/1.3/typedefs/system-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemInfo.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-system-info",title:"SystemInfo",id:"system-info"},sidebar:"version-1.3/docs",previous:{title:"SocialHandles",permalink:"/sdk/js/docs/1.3/typedefs/social-handles"},next:{title:"Changelog",permalink:"/sdk/js/docs/1.3/changelog"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"isSystemIdle",id:"issystemidle",level:3},{value:"memInfo",id:"meminfo",level:3},{value:"eventLoopInfo",id:"eventloopinfo",level:3},{value:"cpuInfo",id:"cpuinfo",level:3}],f={toc:c},m="wrapper";function u(e){var t=e.components,n=(0,o.Z)(e,s);return(0,i.kt)(m,(0,r.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"systeminfo"}),(0,i.kt)("p",null,"Represents the current status of the system."),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"issystemidle"},(0,i.kt)("inlineCode",{parentName:"h3"},"isSystemIdle")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")),(0,i.kt)("p",null,"If true, system is being overloaded."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"meminfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"memInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("p",null,"Memory"),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"eventloopinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"eventLoopInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"cpuinfo"},(0,i.kt)("inlineCode",{parentName:"h3"},"cpuInfo")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")),(0,i.kt)("hr",null))}u.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,u=c["".concat(l,".").concat(m)]||c[m]||f[m]||i;return n?r.createElement(u,s(s({ref:t},d),{},{components:n})):r.createElement(u,s({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,s[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),s=["components"],l={},i=void 0,p={unversionedId:"readme/overview",id:"version-2.3/readme/overview",title:"overview",description:"Overview",source:"@site/versioned_docs/version-2.3/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/2.3/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/overview.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,s);return(0,o.kt)(m,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," - Enables the parallel crawling of a large\nnumber of web pages using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," HTML parser. This is the most\nefficient web crawler, but it does not work on websites that require JavaScript.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," - Enables the parallel crawling of\na large number of web pages using the headless Chrome browser and ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),".\nThe pool of Chrome browsers is automatically scaled up and down based on available system resources.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," - Unlike ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"\nyou can use ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright")," to manage almost any headless browser.\nIt also provides a cleaner and more mature interface while keeping the ease of use and advanced features.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/basic-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BasicCrawler"))," - Provides a simple framework for the parallel\ncrawling of web pages whose URLs are fed either from a static list or from a dynamic queue of URLs. This class\nserves as a base for the more specialized crawlers above.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/request-list",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestList"))," - Represents a list of URLs to crawl.\nThe URLs can be passed in code or in a text file hosted on the web. The list persists its state so that crawling\ncan resume when the Node.js process restarts.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," - Runs asynchronous background tasks,\nwhile automatically adjusting the concurrency based on free system memory and CPU usage. This is useful for running\nweb scraping tasks at the maximum capacity of the system.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/puppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Browser Utils"))," - Provides several helper functions useful\nfor web scraping. For example, to inject jQuery into web pages or to hide browser origin."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),p=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=n,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||o;return r?a.createElement(f,s(s({ref:t},c),{},{components:r})):a.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,s=new Array(o);s[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:n,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>f,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var a=r(87462),n=r(63366),o=(r(67294),r(3905)),s=["components"],l={},i=void 0,p={unversionedId:"readme/overview",id:"version-2.3/readme/overview",title:"overview",description:"Overview",source:"@site/versioned_docs/version-2.3/readme/overview.md",sourceDirName:"readme",slug:"/readme/overview",permalink:"/sdk/js/docs/2.3/readme/overview",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/overview.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},c={},u=[{value:"Overview",id:"overview",level:2}],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,n.Z)(e,s);return(0,o.kt)(m,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"The Apify SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package and it provides the following tools:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," - Enables the parallel crawling of a large\nnumber of web pages using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"cheerio")," HTML parser. This is the most\nefficient web crawler, but it does not work on websites that require JavaScript.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," - Enables the parallel crawling of\na large number of web pages using the headless Chrome browser and ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),".\nThe pool of Chrome browsers is automatically scaled up and down based on available system resources.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler"))," - Unlike ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"\nyou can use ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright")," to manage almost any headless browser.\nIt also provides a cleaner and more mature interface while keeping the ease of use and advanced features.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/basic-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BasicCrawler"))," - Provides a simple framework for the parallel\ncrawling of web pages whose URLs are fed either from a static list or from a dynamic queue of URLs. This class\nserves as a base for the more specialized crawlers above.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/request-list",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestList"))," - Represents a list of URLs to crawl.\nThe URLs can be passed in code or in a text file hosted on the web. The list persists its state so that crawling\ncan resume when the Node.js process restarts.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," - Represents a queue of URLs to crawl,\nwhich is stored either on a local filesystem or in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify Cloud"),". The queue is used\nfor deep crawling of websites, where you start with several URLs and then recursively follow links to other pages.\nThe data structure supports both breadth-first and depth-first crawling orders.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/dataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Dataset"))," - Provides a store for structured data and enables their export\nto formats like JSON, JSONL, CSV, XML, Excel or HTML. The data is stored on a local filesystem or in the Apify Cloud.\nDatasets are useful for storing and sharing large tabular crawling results, such as a list of products or real estate offers.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/key-value-store",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," - A simple key-value store for arbitrary data\nrecords or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs\nor to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," - Runs asynchronous background tasks,\nwhile automatically adjusting the concurrency based on free system memory and CPU usage. This is useful for running\nweb scraping tasks at the maximum capacity of the system.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/puppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Browser Utils"))," - Provides several helper functions useful\nfor web scraping. For example, to inject jQuery into web pages or to hide browser origin."))),(0,o.kt)("p",null,"Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus\ntake advantage of its pool of proxies, job scheduler, data storage, etc.\nFor more information, see the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK Programmer's Reference"),"."))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),p=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(r),m=n,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||o;return r?a.createElement(f,s(s({ref:t},c),{},{components:r})):a.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,s=new Array(o);s[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:n,s[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),i=(r(67294),r(3905)),p=["components"],a={id:"compiled-script-function",title:"CompiledScriptFunction"},c=void 0,l={unversionedId:"typedefs/compiled-script-function",id:"version-2.3/typedefs/compiled-script-function",title:"CompiledScriptFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/CompiledScriptFunction.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-function",permalink:"/sdk/js/docs/2.3/typedefs/compiled-script-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptFunction.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"compiled-script-function",title:"CompiledScriptFunction"}},s={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,p);return(0,i.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"compiledscriptfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"params")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/compiled-script-params",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptParams")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=a(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||i;return r?n.createElement(f,p(p({ref:t},s),{},{components:r})):n.createElement(f,p({ref:t},s))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,p=new Array(i);p[0]=m;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[u]="string"==typeof e?e:o,p[1]=a;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>f,frontMatter:()=>p,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),i=(r(67294),r(3905)),a=["components"],p={id:"compiled-script-function",title:"CompiledScriptFunction"},c=void 0,l={unversionedId:"typedefs/compiled-script-function",id:"version-2.3/typedefs/compiled-script-function",title:"CompiledScriptFunction",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/CompiledScriptFunction.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-function",permalink:"/sdk/js/docs/2.3/typedefs/compiled-script-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptFunction.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"compiled-script-function",title:"CompiledScriptFunction"}},s={},u=[],d={toc:u},m="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,a);return(0,i.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"compiledscriptfunction"}),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"params")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/compiled-script-params",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CompiledScriptParams")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||i;return r?n.createElement(f,a(a({ref:t},s),{},{components:r})):n.createElement(f,a({ref:t},s))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=m;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[u]="string"==typeof e?e:o,a[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),s=["components"],o={id:"prepare-request",title:"PrepareRequest"},i=void 0,l={unversionedId:"typedefs/prepare-request",id:"version-2.3/typedefs/prepare-request",title:"PrepareRequest",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PrepareRequest.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequest.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"prepare-request",title:"PrepareRequest"},sidebar:"version-2.3/docs",previous:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/handle-request-inputs"},next:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request-inputs"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,s);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequest"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/prepare-request-inputs",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PrepareRequestInputs"))," - Arguments passed to this callback.")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(m,s(s({ref:t},u),{},{components:r})):n.createElement(m,s({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,s=new Array(p);s[0]=f;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[c]="string"==typeof e?e:a,s[1]=o;for(var l=2;l{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],s={id:"prepare-request",title:"PrepareRequest"},i=void 0,l={unversionedId:"typedefs/prepare-request",id:"version-2.3/typedefs/prepare-request",title:"PrepareRequest",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PrepareRequest.md",sourceDirName:"typedefs",slug:"/typedefs/prepare-request",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequest.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"prepare-request",title:"PrepareRequest"},sidebar:"version-2.3/docs",previous:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/handle-request-inputs"},next:{title:"PrepareRequestInputs",permalink:"/sdk/js/docs/2.3/typedefs/prepare-request-inputs"}},u={},c=[],d={toc:c},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"preparerequest"}),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,p.kt)("ul",null,(0,p.kt)("li",{parentName:"ul"},(0,p.kt)("strong",{parentName:"li"},(0,p.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,p.kt)("a",{parentName:"li",href:"../typedefs/prepare-request-inputs",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"PrepareRequestInputs"))," - Arguments passed to this callback.")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Returns"),":"),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,p.kt)("inlineCode",{parentName:"p"},"Promise")),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||p;return r?n.createElement(m,o(o({ref:t},u),{},{components:r})):n.createElement(m,o({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,o[1]=s;for(var l=2;l{n.d(t,{Z:()=>o});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,n=e.hidden,o=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),o=n(63735),i=n(38224),u=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,i=e.selectedValue,u=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==i&&(p(t),u(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;n=null!=(l=d[o])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,o=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",c.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===r}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,u.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),o=n(20636),i=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,o=e.groupId,i=(0,a.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:o});return[(0,l._X)(u),(0,r.useCallback)((function(e){if(u){var t=new URLSearchParams(i.location.search);t.set(u,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[u,i])]}function p(e){var t,n,a,l,o=e.defaultValue,u=e.queryString,p=void 0!==u&&u,m=e.groupId,b=c(e),y=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),g=y[0],f=y[1],I=d({queryString:p,groupId:m}),h=I[0],w=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,i.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=v[0],X=v[1],C=function(){var e=null!=h?h:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){C&&f(C)}),[C]),{selectedValue:g,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);f(e),w(e),X(e)}),[w,X,b]),tabValues:b}}},91042:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>b,default:()=>v,frontMatter:()=>m,metadata:()=>y,toc:()=>f});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=n(65559),i=n(30433);n(14563);const u={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc"},c={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8"};var d,p=["components"],m={id:"crawl-all-links",title:"Crawl all links on a website"},b=void 0,y={unversionedId:"examples/crawl-all-links",id:"version-3.1/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/versioned_docs/version-3.1/examples/crawl_all_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_all_links.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/examples/crawl-multiple-urls"}},g={},f=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:f},w="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(w,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},c)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),c=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(u.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,b=d["".concat(u,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,o(o({ref:t},s),{},{components:n})):r.createElement(b,o({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.d(t,{Z:()=>o});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var t=e.children,n=e.hidden,o=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),o=n(63735),i=n(38224),u=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,i=e.selectedValue,u=e.selectValue,s=e.tabValues,d=[],p=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==i&&(p(t),u(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,o=d.indexOf(e.currentTarget)-1;n=null!=(l=d[o])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,o=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},o,{className:(0,l.Z)("tabs__item",c.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var o=l.find((function(e){return e.props.value===r}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,u.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),o=n(20636),i=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,o.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,o=e.groupId,i=(0,a.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:o});return[(0,l._X)(u),(0,r.useCallback)((function(e){if(u){var t=new URLSearchParams(i.location.search);t.set(u,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[u,i])]}function p(e){var t,n,a,l,o=e.defaultValue,u=e.queryString,p=void 0!==u&&u,m=e.groupId,b=c(e),y=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the component requires at least one children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:b})})),g=y[0],f=y[1],I=d({queryString:p,groupId:m}),h=I[0],v=I[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,i.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=w[0],X=w[1],C=function(){var e=null!=h?h:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){C&&f(C)}),[C]),{selectedValue:g,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);f(e),v(e),X(e)}),[v,X,b]),tabValues:b}}},91042:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>b,default:()=>w,frontMatter:()=>m,metadata:()=>y,toc:()=>f});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),o=n(65559),i=n(30433);n(14563);const u={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc"},c={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8"};var d,p=["components"],m={id:"crawl-all-links",title:"Crawl all links on a website"},b=void 0,y={unversionedId:"examples/crawl-all-links",id:"version-3.1/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/versioned_docs/version-3.1/examples/crawl_all_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_all_links.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/examples/crawl-multiple-urls"}},g={},f=[],I=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),h={toc:f},v="wrapper";function w(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(v,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(I,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},c)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(I,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}w.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),c=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(u.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,b=d["".concat(u,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,o(o({ref:t},s),{},{components:n})):r.createElement(b,o({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var s=n(87462),r=n(63366),i=(n(67294),n(3905)),a=["components"],o={id_old:"version-1.3-request-list-options",title:"RequestListOptions",id:"request-list-options"},l=void 0,p={unversionedId:"typedefs/request-list-options",id:"version-1.3/typedefs/request-list-options",title:"RequestListOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/RequestListOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-options",permalink:"/sdk/js/docs/1.3/typedefs/request-list-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-list-options",title:"RequestListOptions",id:"request-list-options"},sidebar:"version-1.3/docs",previous:{title:"RequestOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-options"},next:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-options"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"sources",id:"sources",level:3},{value:"sourcesFunction",id:"sourcesfunction",level:3},{value:"persistStateKey",id:"persiststatekey",level:3},{value:"persistRequestsKey",id:"persistrequestskey",level:3},{value:"state",id:"state",level:3},{value:"keepDuplicateUrls",id:"keepduplicateurls",level:3}],c={toc:d},m="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,a);return(0,i.kt)(m,(0,s.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlistoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"sources"},(0,i.kt)("inlineCode",{parentName:"h3"},"sources")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|string)>"))),(0,i.kt)("p",null,"An array of sources of URLs for the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the\n",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," initializes. This is a measure to prevent memory leaks in\nsituations when millions of sources are added."),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," to download the source URLs from a given\nremote location. The URLs will be parsed from the received response."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"[\n // A single URL\n 'http://example.com/a/b',\n\n // Modify Request options\n { method: PUT, 'https://example.com/put, payload: { foo: 'bar' }}\n\n // Batch import of URLs from a file hosted on the web,\n // where the URLs should be requested using the HTTP POST request\n { method: 'POST', requestsFromUrl: 'http://example.com/urls.txt' },\n\n // Batch import from remote file, using a specific regular expression to extract the URLs.\n { requestsFromUrl: 'http://example.com/urls.txt', regex: /https:\\/\\/example.com\\/.+/ },\n\n // Get list of URLs from a Google Sheets document. Just add \"/gviz/tq?tqx=out:csv\" to the Google Sheet URL.\n // For details, see https://help.apify.com/en/articles/2906022-scraping-a-list-of-urls-from-a-google-sheets-document\n { requestsFromUrl: 'https://docs.google.com/spreadsheets/d/1GA5sSQhQjB_REes8I5IKg31S-TuRcznWOPjcpNqtxmU/gviz/tq?tqx=out:csv' }\n]\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"sourcesfunction"},(0,i.kt)("inlineCode",{parentName:"h3"},"sourcesFunction")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-sources-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListSourcesFunction"))),(0,i.kt)("p",null,"A function that will be called to get the sources for the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", but only if ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," was not able to fetch their persisted version (see\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey")),"). It must return an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")," of\n",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," or ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestOptions")),"."),(0,i.kt)("p",null,"This is very useful in a scenario when getting the sources is a resource intensive or time consuming task, such as fetching URLs from multiple\nsitemaps or parsing URLs from large datasets. Using the ",(0,i.kt)("inlineCode",{parentName:"p"},"sourcesFunction")," in combination with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," will allow\nyou to fetch and parse those URLs only once, saving valuable time when your actor migrates or restarts."),(0,i.kt)("p",null,"If both ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sourcesfunction",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sourcesFunction"))," are provided, the sources returned by the function will be\nadded after the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Let's say we want to scrape URLs extracted from sitemaps.\n\nconst sourcesFunction = async () => {\n // With super large sitemaps, this operation could take very long\n // and big websites typically have multiple sitemaps.\n const sitemaps = await downloadHugeSitemaps();\n return parseUrlsFromSitemaps(sitemaps);\n};\n\n// Sitemaps can change in real-time, so it's important to persist\n// the URLs we collected. Otherwise we might lose our scraping\n// state in case of an actor migration / failure / time-out.\nconst requestList = new RequestList({\n sourcesFunction,\n persistStateKey: 'state-key',\n persistRequestsKey: 'requests-key',\n});\n\n// The sourcesFunction is called now and the Requests are persisted.\n// If something goes wrong and we need to start again, RequestList\n// will load the persisted Requests from storage and will NOT\n// call the sourcesFunction again, saving time and resources.\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persiststatekey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," periodically stores its state (i.e. which URLs were crawled and which\nnot). If the actor is restarted, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will read the state and continue where it left off."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is not set, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will always start from the beginning, and all the source URLs will be crawled again."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persistrequestskey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistRequestsKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," persists its Requests during the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," call. This is necessary if ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is set and the source URLs might potentially\nchange, to ensure consistency of the source URLs and state object. However, it comes with some storage and performance overheads."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," is not set, ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," will always fetch the sources from their origin,\ncheck that they are consistent with the restored state (if any) and throw an error if they are not."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"state"},(0,i.kt)("inlineCode",{parentName:"h3"},"state")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("p",null,"The state object that the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will be initialized from. It is in the form as returned by ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList.getState()"),", such as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true,\n },\n}\n")),(0,i.kt)("p",null,"Note that the preferred (and simpler) way to persist the state of crawling of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"stateKeyPrefix")," parameter instead."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"keepduplicateurls"},(0,i.kt)("inlineCode",{parentName:"h3"},"keepDuplicateUrls")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,i.kt)("code",null," = false")),(0,i.kt)("p",null,"By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will deduplicate the provided URLs. Default deduplication is based on the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property of passed source\n",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,"If the property is not present, it is generated by normalizing the URL. If present, it is kept intact. In any case, only one request per ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"\nis added to the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," resulting in removal of duplicate URLs / unique keys."),(0,i.kt)("p",null,"Setting ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," will append an additional identifier to the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of each request that does not already include a\n",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),". Therefore, duplicate URLs will be kept in the list. It does not protect the user from having duplicates in user set ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"s however.\nIt is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var s=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},m=s.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,h=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?s.createElement(h,a(a({ref:t},u),{},{components:n})):s.createElement(h,a({ref:t},u))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:r,a[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var s=n(87462),r=n(63366),i=(n(67294),n(3905)),a=["components"],o={id_old:"version-1.3-request-list-options",title:"RequestListOptions",id:"request-list-options"},l=void 0,p={unversionedId:"typedefs/request-list-options",id:"version-1.3/typedefs/request-list-options",title:"RequestListOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/RequestListOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-options",permalink:"/sdk/js/docs/1.3/typedefs/request-list-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-list-options",title:"RequestListOptions",id:"request-list-options"},sidebar:"version-1.3/docs",previous:{title:"RequestOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-options"},next:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/1.3/typedefs/request-as-browser-options"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"sources",id:"sources",level:3},{value:"sourcesFunction",id:"sourcesfunction",level:3},{value:"persistStateKey",id:"persiststatekey",level:3},{value:"persistRequestsKey",id:"persistrequestskey",level:3},{value:"state",id:"state",level:3},{value:"keepDuplicateUrls",id:"keepduplicateurls",level:3}],c={toc:d},m="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,a);return(0,i.kt)(m,(0,s.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlistoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"sources"},(0,i.kt)("inlineCode",{parentName:"h3"},"sources")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|string)>"))),(0,i.kt)("p",null,"An array of sources of URLs for the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the\n",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of ",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," initializes. This is a measure to prevent memory leaks in\nsituations when millions of sources are added."),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," to download the source URLs from a given\nremote location. The URLs will be parsed from the received response."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"[\n // A single URL\n 'http://example.com/a/b',\n\n // Modify Request options\n { method: PUT, 'https://example.com/put, payload: { foo: 'bar' }}\n\n // Batch import of URLs from a file hosted on the web,\n // where the URLs should be requested using the HTTP POST request\n { method: 'POST', requestsFromUrl: 'http://example.com/urls.txt' },\n\n // Batch import from remote file, using a specific regular expression to extract the URLs.\n { requestsFromUrl: 'http://example.com/urls.txt', regex: /https:\\/\\/example.com\\/.+/ },\n\n // Get list of URLs from a Google Sheets document. Just add \"/gviz/tq?tqx=out:csv\" to the Google Sheet URL.\n // For details, see https://help.apify.com/en/articles/2906022-scraping-a-list-of-urls-from-a-google-sheets-document\n { requestsFromUrl: 'https://docs.google.com/spreadsheets/d/1GA5sSQhQjB_REes8I5IKg31S-TuRcznWOPjcpNqtxmU/gviz/tq?tqx=out:csv' }\n]\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"sourcesfunction"},(0,i.kt)("inlineCode",{parentName:"h3"},"sourcesFunction")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-sources-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListSourcesFunction"))),(0,i.kt)("p",null,"A function that will be called to get the sources for the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", but only if ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," was not able to fetch their persisted version (see\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey")),"). It must return an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")," of\n",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," or ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestOptions")),"."),(0,i.kt)("p",null,"This is very useful in a scenario when getting the sources is a resource intensive or time consuming task, such as fetching URLs from multiple\nsitemaps or parsing URLs from large datasets. Using the ",(0,i.kt)("inlineCode",{parentName:"p"},"sourcesFunction")," in combination with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," will allow\nyou to fetch and parse those URLs only once, saving valuable time when your actor migrates or restarts."),(0,i.kt)("p",null,"If both ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sourcesfunction",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sourcesFunction"))," are provided, the sources returned by the function will be\nadded after the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Let's say we want to scrape URLs extracted from sitemaps.\n\nconst sourcesFunction = async () => {\n // With super large sitemaps, this operation could take very long\n // and big websites typically have multiple sitemaps.\n const sitemaps = await downloadHugeSitemaps();\n return parseUrlsFromSitemaps(sitemaps);\n};\n\n// Sitemaps can change in real-time, so it's important to persist\n// the URLs we collected. Otherwise we might lose our scraping\n// state in case of an actor migration / failure / time-out.\nconst requestList = new RequestList({\n sourcesFunction,\n persistStateKey: 'state-key',\n persistRequestsKey: 'requests-key',\n});\n\n// The sourcesFunction is called now and the Requests are persisted.\n// If something goes wrong and we need to start again, RequestList\n// will load the persisted Requests from storage and will NOT\n// call the sourcesFunction again, saving time and resources.\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persiststatekey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," periodically stores its state (i.e. which URLs were crawled and which\nnot). If the actor is restarted, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will read the state and continue where it left off."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is not set, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will always start from the beginning, and all the source URLs will be crawled again."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persistrequestskey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistRequestsKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," persists its Requests during the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," call. This is necessary if ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is set and the source URLs might potentially\nchange, to ensure consistency of the source URLs and state object. However, it comes with some storage and performance overheads."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," is not set, ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," will always fetch the sources from their origin,\ncheck that they are consistent with the restored state (if any) and throw an error if they are not."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"state"},(0,i.kt)("inlineCode",{parentName:"h3"},"state")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("p",null,"The state object that the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will be initialized from. It is in the form as returned by ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList.getState()"),", such as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true,\n },\n}\n")),(0,i.kt)("p",null,"Note that the preferred (and simpler) way to persist the state of crawling of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"stateKeyPrefix")," parameter instead."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"keepduplicateurls"},(0,i.kt)("inlineCode",{parentName:"h3"},"keepDuplicateUrls")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,i.kt)("code",null," = false")),(0,i.kt)("p",null,"By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will deduplicate the provided URLs. Default deduplication is based on the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property of passed source\n",(0,i.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,"If the property is not present, it is generated by normalizing the URL. If present, it is kept intact. In any case, only one request per ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"\nis added to the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," resulting in removal of duplicate URLs / unique keys."),(0,i.kt)("p",null,"Setting ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," will append an additional identifier to the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of each request that does not already include a\n",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),". Therefore, duplicate URLs will be kept in the list. It does not protect the user from having duplicates in user set ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"s however.\nIt is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var s=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},m=s.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,h=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?s.createElement(h,a(a({ref:t},u),{},{components:n})):s.createElement(h,a({ref:t},u))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:r,a[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var r=n(87462),p=n(63366),o=(n(67294),n(3905)),a=["components"],l={id_old:"version-1.3-puppeteer-goto-inputs",title:"PuppeteerGotoInputs",id:"puppeteer-goto-inputs"},i=void 0,u={unversionedId:"typedefs/puppeteer-goto-inputs",id:"version-1.3/typedefs/puppeteer-goto-inputs",title:"PuppeteerGotoInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerGotoInputs.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-goto-inputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-goto-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGotoInputs.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-goto-inputs",title:"PuppeteerGotoInputs",id:"puppeteer-goto-inputs"}},s={},d=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"request",id:"request",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"puppeteerPool",id:"puppeteerpool",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:d},f="wrapper";function m(e){var t=e.components,n=(0,p.Z)(e,a);return(0,o.kt)(f,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"puppeteergotoinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"page"},(0,o.kt)("inlineCode",{parentName:"h3"},"page")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerPage")),(0,o.kt)("p",null,"is an instance of the Puppeteer ",(0,o.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Page"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"An instance of the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"autoscaledpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,o.kt)("p",null,"An instance of the ",(0,o.kt)("inlineCode",{parentName:"p"},"AutoscaledPool"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"puppeteerpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"puppeteerPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))),(0,o.kt)("p",null,"An instance of the ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))," used by this ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Session")," object for this request."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"Proxy info object"),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(p[n]=e[n]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(p[n]=e[n])}return p}var i=r.createContext({}),u=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,p=e.mdxType,o=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=u(n),f=p,m=d["".concat(i,".").concat(f)]||d[f]||c[f]||o;return n?r.createElement(m,a(a({ref:t},s),{},{components:n})):r.createElement(m,a({ref:t},s))}));function m(e,t){var n=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var o=n.length,a=new Array(o);a[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[d]="string"==typeof e?e:p,a[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var r=n(87462),p=n(63366),o=(n(67294),n(3905)),a=["components"],l={id_old:"version-1.3-puppeteer-goto-inputs",title:"PuppeteerGotoInputs",id:"puppeteer-goto-inputs"},i=void 0,u={unversionedId:"typedefs/puppeteer-goto-inputs",id:"version-1.3/typedefs/puppeteer-goto-inputs",title:"PuppeteerGotoInputs",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerGotoInputs.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-goto-inputs",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-goto-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGotoInputs.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-goto-inputs",title:"PuppeteerGotoInputs",id:"puppeteer-goto-inputs"}},s={},d=[{value:"Properties",id:"properties",level:2},{value:"page",id:"page",level:3},{value:"request",id:"request",level:3},{value:"autoscaledPool",id:"autoscaledpool",level:3},{value:"puppeteerPool",id:"puppeteerpool",level:3},{value:"session",id:"session",level:3},{value:"proxyInfo",id:"proxyinfo",level:3}],c={toc:d},f="wrapper";function m(e){var t=e.components,n=(0,p.Z)(e,a);return(0,o.kt)(f,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"puppeteergotoinputs"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"page"},(0,o.kt)("inlineCode",{parentName:"h3"},"page")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerPage")),(0,o.kt)("p",null,"is an instance of the Puppeteer ",(0,o.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-page",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Page"))),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"request"},(0,o.kt)("inlineCode",{parentName:"h3"},"request")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))),(0,o.kt)("p",null,"An instance of the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," object with details about the URL to open, HTTP method etc."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"autoscaledpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,o.kt)("p",null,"An instance of the ",(0,o.kt)("inlineCode",{parentName:"p"},"AutoscaledPool"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"puppeteerpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"puppeteerPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))),(0,o.kt)("p",null,"An instance of the ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))," used by this ",(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"session"},(0,o.kt)("inlineCode",{parentName:"h3"},"session")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Session")," object for this request."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"proxyinfo"},(0,o.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,o.kt)("p",null,"Proxy info object"),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(p[n]=e[n]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(p[n]=e[n])}return p}var i=r.createContext({}),u=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,p=e.mdxType,o=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=u(n),f=p,m=d["".concat(i,".").concat(f)]||d[f]||c[f]||o;return n?r.createElement(m,a(a({ref:t},s),{},{components:n})):r.createElement(m,a({ref:t},s))}));function m(e,t){var n=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var o=n.length,a=new Array(o);a[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[d]="string"==typeof e?e:p,a[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),s=["components"],i={id:"use-stealth-mode",title:"Use stealth mode"},l=void 0,p={unversionedId:"examples/use-stealth-mode",id:"version-2.3/examples/use-stealth-mode",title:"Use stealth mode",description:"Deprecated: This example is deprecated. Checkout the Avoid getting blocked guide.",source:"@site/versioned_docs/version-2.3/examples/use_stealth_mode.md",sourceDirName:"examples",slug:"/examples/use-stealth-mode",permalink:"/sdk/js/docs/2.3/examples/use-stealth-mode",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/use_stealth_mode.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"use-stealth-mode",title:"Use stealth mode"},sidebar:"version-2.3/docs",previous:{title:"Synchronous run",permalink:"/sdk/js/docs/2.3/examples/synchronous-run"},next:{title:"Apify",permalink:"/sdk/js/docs/2.3/api/apify"}},c={},u=[{value:"Single-browser instances",id:"single-browser-instances",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,r.Z)(e,s);return(0,o.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("strong",{parentName:"p"},"Deprecated"),": This example is deprecated. Checkout the ",(0,o.kt)("a",{parentName:"p",href:"../guides/avoid-blocking",target:null,rel:null},"Avoid getting blocked guide"),".")),(0,o.kt)("p",null,"Stealth mode allows you to bypass anti-scraping techniques that use ",(0,o.kt)("a",{parentName:"p",href:"https://pixelprivacy.com/resources/browser-fingerprinting/",target:"_blank",rel:"noopener"},"browser fingerprinting"),". It overrides the attributes specified for ",(0,o.kt)("a",{parentName:"p",href:"https://developers.google.com/web/updates/2017/04/headless-chrome",target:"_blank",rel:"noopener"},"headless")," browser mode, making your headless browser harder to distinguish from the full Chrome browser."),(0,o.kt)("p",null,"To activate stealth mode, you need to ",(0,o.kt)("inlineCode",{parentName:"p"},"useChrome"),", run ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and turn ",(0,o.kt)("inlineCode",{parentName:"p"},"stealth")," on in your ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"launchContext")),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const launchContext = {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n}\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', ['https://news.ycombinator.com/']);\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n launchContext: {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n // You can override default stealth options\n // stealthOptions: {\n // addLanguage: false,\n // },\n },\n handlePageFunction: async ({ page }) => {\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n // Get the title of each post on Hacker News\n $posts.forEach(($post) => {\n const title = $post.querySelector('.title a').innerText;\n scrapedData.push({\n title: `The title is: ${title}`,\n });\n });\n return scrapedData;\n });\n // Save the data array to the Apify dataSet\n await Apify.pushData(data);\n },\n });\n await crawler.run();\n});\n")),(0,o.kt)("p",null,"You can then specify the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/stealth-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"stealthOptions")),", which allow you to adapt to different anti-scraping techniques. All the options are set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," by default. The number of options does not affect performance."),(0,o.kt)("p",null,"While the default configuration will be fine in many cases, you can adapt the options to your use case."),(0,o.kt)("h3",{id:"single-browser-instances"},"Single-browser instances"),(0,o.kt)("p",null,"You can also use stealth mode in single-browser instances when using ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/apify#launchpuppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer")),". The ",(0,o.kt)("inlineCode",{parentName:"p"},"launchContext")," is the same."))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return n?a.createElement(m,s(s({ref:t},c),{},{components:n})):a.createElement(m,s({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:r,s[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),s=["components"],i={id:"use-stealth-mode",title:"Use stealth mode"},l=void 0,p={unversionedId:"examples/use-stealth-mode",id:"version-2.3/examples/use-stealth-mode",title:"Use stealth mode",description:"Deprecated: This example is deprecated. Checkout the Avoid getting blocked guide.",source:"@site/versioned_docs/version-2.3/examples/use_stealth_mode.md",sourceDirName:"examples",slug:"/examples/use-stealth-mode",permalink:"/sdk/js/docs/2.3/examples/use-stealth-mode",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/use_stealth_mode.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"use-stealth-mode",title:"Use stealth mode"},sidebar:"version-2.3/docs",previous:{title:"Synchronous run",permalink:"/sdk/js/docs/2.3/examples/synchronous-run"},next:{title:"Apify",permalink:"/sdk/js/docs/2.3/api/apify"}},c={},u=[{value:"Single-browser instances",id:"single-browser-instances",level:3}],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,r.Z)(e,s);return(0,o.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},(0,o.kt)("strong",{parentName:"p"},"Deprecated"),": This example is deprecated. Checkout the ",(0,o.kt)("a",{parentName:"p",href:"../guides/avoid-blocking",target:null,rel:null},"Avoid getting blocked guide"),".")),(0,o.kt)("p",null,"Stealth mode allows you to bypass anti-scraping techniques that use ",(0,o.kt)("a",{parentName:"p",href:"https://pixelprivacy.com/resources/browser-fingerprinting/",target:"_blank",rel:"noopener"},"browser fingerprinting"),". It overrides the attributes specified for ",(0,o.kt)("a",{parentName:"p",href:"https://developers.google.com/web/updates/2017/04/headless-chrome",target:"_blank",rel:"noopener"},"headless")," browser mode, making your headless browser harder to distinguish from the full Chrome browser."),(0,o.kt)("p",null,"To activate stealth mode, you need to ",(0,o.kt)("inlineCode",{parentName:"p"},"useChrome"),", run ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and turn ",(0,o.kt)("inlineCode",{parentName:"p"},"stealth")," on in your ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"launchContext")),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const launchContext = {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n}\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', ['https://news.ycombinator.com/']);\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n launchContext: {\n useChrome: true,\n stealth: true,\n launchOptions: {\n headless: true,\n },\n // You can override default stealth options\n // stealthOptions: {\n // addLanguage: false,\n // },\n },\n handlePageFunction: async ({ page }) => {\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n // Get the title of each post on Hacker News\n $posts.forEach(($post) => {\n const title = $post.querySelector('.title a').innerText;\n scrapedData.push({\n title: `The title is: ${title}`,\n });\n });\n return scrapedData;\n });\n // Save the data array to the Apify dataSet\n await Apify.pushData(data);\n },\n });\n await crawler.run();\n});\n")),(0,o.kt)("p",null,"You can then specify the ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/typedefs/stealth-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"stealthOptions")),", which allow you to adapt to different anti-scraping techniques. All the options are set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true")," by default. The number of options does not affect performance."),(0,o.kt)("p",null,"While the default configuration will be fine in many cases, you can adapt the options to your use case."),(0,o.kt)("h3",{id:"single-browser-instances"},"Single-browser instances"),(0,o.kt)("p",null,"You can also use stealth mode in single-browser instances when using ",(0,o.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/api/apify#launchpuppeteer",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer")),". The ",(0,o.kt)("inlineCode",{parentName:"p"},"launchContext")," is the same."))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return n?a.createElement(m,s(s({ref:t},c),{},{components:n})):a.createElement(m,s({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:r,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>v,frontMatter:()=>c,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=r(14563);const i="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst input = await Actor.getInput();\nconsole.log(input);\n\nawait Actor.exit();\n";var s=["components"],c={id:"accept-user-input",title:"Accept user input"},l=void 0,u={unversionedId:"examples/accept-user-input",id:"version-3.0/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-3.0/examples/accept_user_input.mdx",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/3.0/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/accept_user_input.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"docs",previous:{title:"Examples",permalink:"/sdk/js/docs/3.0/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/3.0/examples/add-data-to-dataset"}},d={},m=[],f={toc:m},y="wrapper";function v(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(y,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}v.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>v,frontMatter:()=>s,metadata:()=>u,toc:()=>m});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=r(14563);const i="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst input = await Actor.getInput();\nconsole.log(input);\n\nawait Actor.exit();\n";var c=["components"],s={id:"accept-user-input",title:"Accept user input"},l=void 0,u={unversionedId:"examples/accept-user-input",id:"version-3.0/examples/accept-user-input",title:"Accept user input",description:"This example accepts and logs user input:",source:"@site/versioned_docs/version-3.0/examples/accept_user_input.mdx",sourceDirName:"examples",slug:"/examples/accept-user-input",permalink:"/sdk/js/docs/3.0/examples/accept-user-input",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/accept_user_input.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"accept-user-input",title:"Accept user input"},sidebar:"docs",previous:{title:"Examples",permalink:"/sdk/js/docs/3.0/examples"},next:{title:"Add data to dataset",permalink:"/sdk/js/docs/3.0/examples/add-data-to-dataset"}},d={},m=[],f={toc:m},y="wrapper";function v(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(y,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example accepts and logs user input:"),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"To provide the actor with input, create a ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT.json"),' file inside the "default" key-value store:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/key_value_stores/default/INPUT.json\n")),(0,o.kt)("p",null,"Anything in this file will be available to the actor when it runs."),(0,o.kt)("p",null,"To learn about other ways to provide an actor with input, refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/actor#run",target:"_blank",rel:"noopener"},"Apify Platform Documentation"),"."))}v.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,p(p({ref:t},l),{},{components:r})):n.createElement(f,p({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>y,frontMatter:()=>u,metadata:()=>a,toc:()=>p});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),i=["components"],u={id_old:"version-1.3-request-list-sources-function",title:"RequestListSourcesFunction",id:"request-list-sources-function"},c=void 0,a={unversionedId:"typedefs/request-list-sources-function",id:"version-1.3/typedefs/request-list-sources-function",title:"RequestListSourcesFunction",description:"Returns:",source:"@site/versioned_docs/version-1.3/typedefs/RequestListSourcesFunction.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-sources-function",permalink:"/sdk/js/docs/1.3/typedefs/request-list-sources-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListSourcesFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-request-list-sources-function",title:"RequestListSourcesFunction",id:"request-list-sources-function"}},l={},p=[],f={toc:p},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,s.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requestlistsourcesfunction"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Promise>"))),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),a=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=a(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=a(r),d=o,y=p["".concat(c,".").concat(d)]||p[d]||f[d]||s;return r?n.createElement(y,i(i({ref:t},l),{},{components:r})):n.createElement(y,i({ref:t},l))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,i=new Array(s);i[0]=d;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u[p]="string"==typeof e?e:o,i[1]=u;for(var a=2;a{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>y,frontMatter:()=>u,metadata:()=>a,toc:()=>p});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),i=["components"],u={id_old:"version-1.3-request-list-sources-function",title:"RequestListSourcesFunction",id:"request-list-sources-function"},c=void 0,a={unversionedId:"typedefs/request-list-sources-function",id:"version-1.3/typedefs/request-list-sources-function",title:"RequestListSourcesFunction",description:"Returns:",source:"@site/versioned_docs/version-1.3/typedefs/RequestListSourcesFunction.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-sources-function",permalink:"/sdk/js/docs/1.3/typedefs/request-list-sources-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListSourcesFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-request-list-sources-function",title:"RequestListSourcesFunction",id:"request-list-sources-function"}},l={},p=[],f={toc:p},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,s.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"requestlistsourcesfunction"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Promise>"))),(0,s.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),a=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=a(e.components);return n.createElement(c.Provider,{value:t},e.children)},p="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=a(r),d=o,y=p["".concat(c,".").concat(d)]||p[d]||f[d]||s;return r?n.createElement(y,i(i({ref:t},l),{},{components:r})):n.createElement(y,i({ref:t},l))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,i=new Array(s);i[0]=d;var u={};for(var c in t)hasOwnProperty.call(t,c)&&(u[c]=t[c]);u.originalType=e,u[p]="string"==typeof e?e:o,i[1]=u;for(var a=2;a{r.r(t),r.d(t,{assets:()=>m,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=r(14563);const i="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Proxy connection is automatically established in the Crawler\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n async requestHandler({ page }) {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n});\n\nconsole.log('Running Puppeteer script...');\n\nawait crawler.run(['http://proxy.apify.com']);\n\nconsole.log('Puppeteer closed.');\n\nawait Actor.exit();\n";var s=["components"],l={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},c=void 0,u={unversionedId:"examples/puppeteer-with-proxy",id:"version-3.0/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.",source:"@site/versioned_docs/version-3.0/examples/puppeteer_with_proxy.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/3.0/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_with_proxy.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"},next:{title:"Upgrading",permalink:"/sdk/js/docs/3.0/upgrading"}},m={},d=[],y={toc:d},f="wrapper";function h(e){var t=e.components,r=(0,o.Z)(e,s);return(0,p.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,p.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"."),(0,p.kt)("p",null,"To make it work, you'll need an Apify account with access to the proxy. Visit the ",(0,p.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your account from the SDK."),(0,p.kt)("admonition",{type:"tip"},(0,p.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)(a.Z,{className:"language-js",mdxType:"CodeBlock"},i))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),d=o,y=u["".concat(s,".").concat(d)]||u[d]||m[d]||p;return r?n.createElement(y,a(a({ref:t},c),{},{components:r})):n.createElement(y,a({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>l,metadata:()=>u,toc:()=>m});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=r(14563);const i="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Proxy connection is automatically established in the Crawler\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n async requestHandler({ page }) {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n});\n\nconsole.log('Running Puppeteer script...');\n\nawait crawler.run(['http://proxy.apify.com']);\n\nconsole.log('Puppeteer closed.');\n\nawait Actor.exit();\n";var s=["components"],l={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},c=void 0,u={unversionedId:"examples/puppeteer-with-proxy",id:"version-3.0/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.",source:"@site/versioned_docs/version-3.0/examples/puppeteer_with_proxy.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/3.0/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_with_proxy.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"},next:{title:"Upgrading",permalink:"/sdk/js/docs/3.0/upgrading"}},d={},m=[],y={toc:m},f="wrapper";function h(e){var t=e.components,r=(0,o.Z)(e,s);return(0,p.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,p.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"."),(0,p.kt)("p",null,"To make it work, you'll need an Apify account with access to the proxy. Visit the ",(0,p.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your account from the SDK."),(0,p.kt)("admonition",{type:"tip"},(0,p.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)(a.Z,{className:"language-js",mdxType:"CodeBlock"},i))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),m=o,y=u["".concat(s,".").concat(m)]||u[m]||d[m]||p;return r?n.createElement(y,a(a({ref:t},c),{},{components:r})):n.createElement(y,a({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var a=n(87462),o=n(63366),i=(n(67294),n(3905)),r=["components"],l={id_old:"version-1.3-getting-started",title:"Getting Started",id:"getting-started"},s=void 0,u={unversionedId:"guides/getting-started",id:"version-1.3/guides/getting-started",title:"Getting Started",description:"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary",source:"@site/versioned_docs/version-1.3/guides/getting_started.md",sourceDirName:"guides",slug:"/guides/getting-started",permalink:"/sdk/js/docs/1.3/guides/getting-started",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/getting_started.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-getting-started",title:"Getting Started",id:"getting-started"},sidebar:"version-1.3/docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/1.3/guides/apify-platform"},next:{title:"Request Storage",permalink:"/sdk/js/docs/1.3/guides/request-storage"}},p={},d=[{value:"Intro",id:"intro",level:2},{value:"Setting up locally",id:"setting-up-locally",level:2},{value:"Creating a new project",id:"creating-a-new-project",level:3},{value:"Setting up on the Apify Platform",id:"setting-up-on-the-apify-platform",level:2},{value:"Creating a new project",id:"creating-a-new-project-1",level:3},{value:"First crawler",id:"first-crawler",level:2},{value:"The general idea",id:"the-general-idea",level:3},{value:"The Where - Request, RequestList and RequestQueue",id:"the-where---request-requestlist-and-requestqueue",level:3},{value:"The What - handlePageFunction",id:"the-what---handlepagefunction",level:3},{value:"Putting it all together",id:"putting-it-all-together",level:3},{value:"CheerioCrawler aka jQuery crawler",id:"cheeriocrawler-aka-jquery-crawler",level:2},{value:"Overview",id:"overview",level:3},{value:"When to use CheerioCrawler",id:"when-to-use-cheeriocrawler",level:3},{value:"Basic use of CheerioCrawler",id:"basic-use-of-cheeriocrawler",level:3},{value:"Refresher",id:"refresher",level:4},{value:"Finding new links",id:"finding-new-links",level:4},{value:"Filtering links to same domain",id:"filtering-links-to-same-domain",level:4},{value:"Enqueueing links to RequestQueue",id:"enqueueing-links-to-requestqueue",level:4},{value:"Scrape the newly enqueued links",id:"scrape-the-newly-enqueued-links",level:4},{value:"The maxRequestsPerCrawl limit",id:"the-maxrequestspercrawl-limit",level:5},{value:"Putting it all together",id:"putting-it-all-together-1",level:4},{value:"Using Apify SDK to enqueue links like a boss",id:"using-apify-sdk-to-enqueue-links-like-a-boss",level:2},{value:"Meet Apify.utils",id:"meet-apifyutils",level:3},{value:"Introduction to Apify.utils.enqueueLinks()",id:"introduction-to-apifyutilsenqueuelinks",level:3},{value:"Basic use of enqueueLinks() with CheerioCrawler",id:"basic-use-of-enqueuelinks-with-cheeriocrawler",level:3},{value:"Introduction to pseudo-URLs",id:"introduction-to-pseudo-urls",level:4},{value:"Structure of a pseudo-URL",id:"structure-of-a-pseudo-url",level:4},{value:"Using enqueueLinks() to filter links",id:"using-enqueuelinks-to-filter-links",level:4},{value:"Resolving relative URLs with enqueueLinks()",id:"resolving-relative-urls-with-enqueuelinks",level:4},{value:"Integrating enqueueLinks() into our crawler",id:"integrating-enqueuelinks-into-our-crawler",level:4},{value:"Getting some real-world data",id:"getting-some-real-world-data",level:2},{value:"The importance of having a plan",id:"the-importance-of-having-a-plan",level:3},{value:"Choosing the data we need",id:"choosing-the-data-we-need",level:4},{value:"Analyzing the target",id:"analyzing-the-target",level:4},{value:"The start URL(s)",id:"the-start-urls",level:4},{value:"The crawling strategy",id:"the-crawling-strategy",level:3},{value:"Using a RequestList",id:"using-a-requestlist",level:4},{value:"DevTools crash course",id:"devtools-crash-course",level:4},{value:"Enqueueing the detail links using a custom selector",id:"enqueueing-the-detail-links-using-a-custom-selector",level:4},{value:"The selector parameter of enqueueLinks()",id:"the-selector-parameter-of-enqueuelinks",level:5},{value:"The missing pseudoUrls",id:"the-missing-pseudourls",level:5},{value:"Finally, the userData of enqueueLinks()",id:"finally-the-userdata-of-enqueuelinks",level:5},{value:"Another sanity check",id:"another-sanity-check",level:4},{value:"Scraping data",id:"scraping-data",level:3},{value:"Scraping the URL, Owner and Unique identifier",id:"scraping-the-url-owner-and-unique-identifier",level:4},{value:"Scraping Title, Description, Last modification date and Number of runs",id:"scraping-title-description-last-modification-date-and-number-of-runs",level:4},{value:"Title",id:"title",level:5},{value:"Description",id:"description",level:5},{value:"Last modification date",id:"last-modification-date",level:5},{value:"Run count",id:"run-count",level:5},{value:"Trying it out (sanity check #3)",id:"trying-it-out-sanity-check-3",level:4},{value:"Saving the scraped data",id:"saving-the-scraped-data",level:3},{value:"What's Apify.pushData()",id:"whats-apifypushdata",level:4},{value:"Finding my saved data",id:"finding-my-saved-data",level:4},{value:"Dataset on the Apify platform",id:"dataset-on-the-apify-platform",level:5},{value:"Local Dataset",id:"local-dataset",level:5},{value:"Final touch",id:"final-touch",level:3},{value:"Meet the INPUT",id:"meet-the-input",level:4},{value:"Use INPUT to seed our actor with categories",id:"use-input-to-seed-our-actor-with-categories",level:4},{value:"Structuring the code better",id:"structuring-the-code-better",level:4},{value:"Splitting your code into multiple files",id:"splitting-your-code-into-multiple-files",level:4},{value:"Using Apify.utils.log instead of console.log",id:"using-apifyutilslog-instead-of-consolelog",level:4},{value:"Using a router to structure your crawling",id:"using-a-router-to-structure-your-crawling",level:4}],h={toc:d},c="wrapper";function m(e){var t=e.components,l=(0,o.Z)(e,r);return(0,i.kt)(c,(0,a.Z)({},h,l,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary\nrequests, but that only gets you raw HTML and sometimes not even that. Then you have to read this HTML and extract the data you're interested in. Once\nextracted, it must be stored in a machine-readable format and easily accessible for further processing, because it is the processed data that holds\nvalue."),(0,i.kt)("p",null,"Apify SDK covers the process end-to-end. From crawling the web for links and scraping the raw data to storing it in various machine readable formats,\nready for processing. With this guide in hand, you should have your own data extraction solutions up and running in a few hours."),(0,i.kt)("h2",{id:"intro"},"Intro"),(0,i.kt)("p",null,"The goal of this getting started guide is to provide a step-by-step introduction to all the features of the Apify SDK. It will walk you through\ncreating the simplest of crawlers that only prints text to console, all the way up to complex systems that crawl pages, interact with them as if a real\nuser were sitting in front of a real browser and output structured data."),(0,i.kt)("p",null,"Since Apify SDK is usable both locally on any computer and on the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you will be able\nto use the source code in both environments interchangeably. Nevertheless, some initial setup is still required, so choose your preferred starting\nenvironment and let's get into it."),(0,i.kt)("h2",{id:"setting-up-locally"},"Setting up locally"),(0,i.kt)("p",null,"To run Apify SDK on your own computer, you need to meet the following pre-requisites first:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Have Node.js version 10.17 or higher, with the exception of Node.js 11, installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Visit ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/",target:"_blank",rel:"noopener"},"Node.js website")," to download or use\n",(0,i.kt)("a",{parentName:"li",href:"https://github.com/creationix/nvm",target:"_blank",rel:"noopener"},"nvm")))),(0,i.kt)("li",{parentName:"ol"},"Have NPM installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"NPM comes bundled with Node.js so you should already have it. If not, reinstall Node.js.")))),(0,i.kt)("p",null,"If you're not certain, confirm the prerequisites by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"node -v\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm -v\n")),(0,i.kt)("h3",{id:"creating-a-new-project"},"Creating a new project"),(0,i.kt)("p",null,"The fastest and best way to create new projects with the Apify SDK is to use our own\n",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),". This command line tool allows you to create, run and manage Apify\nprojects with ease, including their deployment to the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," if you wish to run them in the\ncloud after developing them locally."),(0,i.kt)("p",null,"Let's install the Apify CLI with the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\n")),(0,i.kt)("p",null,"Once the installation finishes, all you need to do to set up an Apify SDK project is to run:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-new-project\n")),(0,i.kt)("p",null,"A prompt will be shown, asking you to choose a template. Disregard the different options for now and choose the template labeled ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello world"),". The\ncommand will now create a new directory in your current working directory, called ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project"),", create a ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json")," in this folder and install\nall the necessary dependencies. It will also add example source code that you can immediately run."),(0,i.kt)("p",null,"Let's try that!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-new-project\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify run -p\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"-p")," flag is great to remember, because it stands for ",(0,i.kt)("inlineCode",{parentName:"p"},"--purge")," and it clears out your persistent storages before starting the actor.\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," and named storages are kept. Whenever you're just restarting your actor and you're not interested in the data of the previous run, you\nshould use ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run -p")," to prevent the old state from messing with your current run. If this is confusing, don't worry. You'll learn about\nstorages and ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," soon.")),(0,i.kt)("p",null,"You should start seeing log messages in the terminal as the system boots up and after a second, a Chromium browser window should pop up. In the\nwindow, you'll see quickly changing pages and back in the terminal, you should see the titles (contents of the ",(0,i.kt)("inlineCode",{parentName:"p"},"")," HTML tags) of the pages\nprinted."),(0,i.kt)("p",null,"You can always terminate the crawl with a keypress in the terminal:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"CTRL+C\n")),(0,i.kt)("p",null,"Did you see all that? If you did, congratulations! You're ready to go!"),(0,i.kt)("h2",{id:"setting-up-on-the-apify-platform"},"Setting up on the Apify Platform"),(0,i.kt)("p",null,"Maybe you don't have Node.js installed and don't want the hassle. Or you can't install anything on your computer because you're using one provided by your company. Or perhaps you'd just prefer to start working in the cloud right away. Well, no worries, we've got you covered."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," is the foundational product of\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify"),". It's a serverless cloud computing platform, specifically designed for any web automation jobs,\nthat may include crawling and scraping, but really works amazingly for any batch jobs and long-running tasks."),(0,i.kt)("p",null,"It comes with a free account, so let's go to our ",(0,i.kt)("a",{parentName:"p",href:"https://my.apify.com/sign-up",target:"_blank",rel:"noopener"},"sign-up page")," and create one, if you\nhaven't already. Don't forget to verify your email. Without it, you won't be able to run any projects."),(0,i.kt)("p",null,"Once you're in, you might be prompted by our in-app help to walk through a step-by-step guide to some of our new features. Feel free to finish that,\nif you'd like, but once you're done, click on the ",(0,i.kt)("strong",{parentName:"p"},"Actors")," tab in the left menu. To read more about ",(0,i.kt)("strong",{parentName:"p"},"Actors"),", see:\n",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#what-is-an-actor",target:null,rel:null},"What is an actor")),(0,i.kt)("h3",{id:"creating-a-new-project-1"},"Creating a new project"),(0,i.kt)("p",null,"In the page that shows after clicking on Actors in the left menu, choose ",(0,i.kt)("strong",{parentName:"p"},"Create new"),". Give it a name in the form that opens, let's say,\n",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-actor"),". Disregard all the available options for now and save your changes."),(0,i.kt)("p",null,"Now click on the ",(0,i.kt)("strong",{parentName:"p"},"Sources")," tab at the top. Disregard the version and environment variables inputs for now and proceed directly to ",(0,i.kt)("strong",{parentName:"p"},"Source code"),".\nThis is where you develop the actor, if you choose not to do it locally. Just press ",(0,i.kt)("strong",{parentName:"p"},"Run")," below the ",(0,i.kt)("strong",{parentName:"p"},"Source code")," panel. It will automatically\nbuild and run the example source code. You should start seeing log messages that represent the build and after the build is complete, the log messages of\nthe running actor. Feel free to check out the other ",(0,i.kt)("strong",{parentName:"p"},"Run")," tabs, such as ",(0,i.kt)("strong",{parentName:"p"},"Info"),", where you can find useful information about the run, or\n",(0,i.kt)("strong",{parentName:"p"},"Key-value-store"),", where the actor's ",(0,i.kt)("strong",{parentName:"p"},"INPUT"),"\xa0and ",(0,i.kt)("strong",{parentName:"p"},"OUTPUT")," are stored."),(0,i.kt)("p",null,"Good job. You're now ready to run your own source code on the Apify Platform. For more information, visit the\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Actor documentation page"),", where you'll find everything about the platform's various\noptions."),(0,i.kt)("h2",{id:"first-crawler"},"First crawler"),(0,i.kt)("p",null,"Whether you've chosen to develop locally or in the cloud, it's time to start writing some actual source code. But before we do, let's just briefly\nintroduce all the Apify SDK classes necessary to make it happen."),(0,i.kt)("h3",{id:"the-general-idea"},"The general idea"),(0,i.kt)("p",null,"There are 3 crawler classes available for use in the Apify SDK. ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nand ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),". We'll talk about their differences later. Now, let's talk about what they have in common."),(0,i.kt)("p",null,"The general idea of each crawler is to go to a web page, open it, do some stuff there, save some results and continue to the next page, until it's done\nits job. So the crawler always needs to find answers to two questions: ",(0,i.kt)("strong",{parentName:"p"},"Where should I go?")," and ",(0,i.kt)("strong",{parentName:"p"},"What should I do there?")," Answering those two\nquestions is the only setup mandatory for running the crawlers."),(0,i.kt)("h3",{id:"the-where---request-requestlist-and-requestqueue"},"The Where - ",(0,i.kt)("inlineCode",{parentName:"h3"},"Request"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestQueue")),(0,i.kt)("p",null,"All crawlers use instances of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class to determine where they need to go. Each request may hold a lot of information,\nbut at the very least, it must hold a URL - a web page to open. But having only one URL would not make sense for crawling. We need to either have a\npre-existing list of our own URLs that we wish to visit, perhaps a thousand, or a million, or we need to build this list dynamically as we crawl,\nadding more and more URLs to the list as we progress."),(0,i.kt)("p",null,"A representation of the pre-existing list is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class. It is a static, immutable list of URLs and\nother metadata (see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," object) that the crawler will visit, one by one, retrying whenever an error occurs, until there\nare no more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," on the other hand, represents a dynamic queue of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". One that can be updated at runtime by adding more\npages - ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process. This allows the crawler to open one page, extract interesting URLs, such as links to other pages on the same domain,\nadd them to the queue (called ",(0,i.kt)("em",{parentName:"p"},"enqueuing"),") and repeat this process to build a queue of tens of thousands or more URLs while knowing only a single one\nat the beginning."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are essential for the crawler's operation. There is no other way to supply ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),' = "pages to crawl" to the\ncrawlers. At least one of them always needs to be provided while setting up. You can also use both at the same time, if you wish.'),(0,i.kt)("h3",{id:"the-what---handlepagefunction"},"The What - ",(0,i.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is the brain of the crawler. It tells it what to do at each and every page it visits. Generally it handles extraction of data\nfrom the page, processing the data, saving it, calling APIs, doing calculations and whatever else you need it to do."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is provided by you, the user, and invoked automatically by the crawler for each ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," from either the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". It always receives a single argument and that is a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object"),". Its properties change depending on the crawler class used, but it\nalways includes at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, which represents the currently crawled ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance (i.e. the URL the crawler is visiting and\nrelated metadata) and the ",(0,i.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," property, which is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class and we'll talk about\nit in detail later."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// The object received as a single argument by the handlePageFunction\n{\n request: Request,\n autoscaledPool: AutoscaledPool\n}\n")),(0,i.kt)("h3",{id:"putting-it-all-together"},"Putting it all together"),(0,i.kt)("p",null,"Enough theory! Let's put some of those hard-learned facts into practice. We learned above that we need ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to setup\na crawler. We will also use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function. It's not mandatory, but it makes our life easier. We'll\nlearn about it in detail later on."),(0,i.kt)("p",null,"Let's start with something super easy. Visit a page, get its title and close. First of all we need to require Apify, to make all of its features available to us:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n")),(0,i.kt)("p",null,"Easy, right? It really doesn't get much more difficult than that. For the purposes of this tutorial, we'll be scraping our own webpage\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"https://apify.com"),". Now, to get there, we need a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," with the page's URL in one of our sources,\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". Let's go with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," for now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\n// This is how you use the Apify.main() function.\nApify.main(async () => {\n // First we create the request queue instance.\n const requestQueue = await Apify.openRequestQueue();\n // And then we add a request to it.\n await requestQueue.addRequest({ url: 'https://apify.com' });\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you're not familiar with the ",(0,i.kt)("inlineCode",{parentName:"p"},"async")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords used in the example, you should know that these are native syntax in modern JavaScript. You can\n",(0,i.kt)("a",{parentName:"p",href:"https://nikgrozev.com/2017/10/01/async-await/",target:"_blank",rel:"noopener"},"learn more about them here"),".")),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue#addrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"requestQueue.addRequest()"))," function automatically converts the plain object we passed to it to a\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance, so now we have a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," that holds one ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," which points to ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),". Now we need the\n",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// We'll define the function separately so it's more obvious.\nconst handlePageFunction = async ({ request, $ }) => {\n // This should look familiar if you ever worked with jQuery.\n // We're just getting the text content of the <title> HTML element.\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n};\n")),(0,i.kt)("p",null,"Wait, where did the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," come from? Remember what we learned about the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," earlier. It expects a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," as an argument that\nwill always have a ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, but it will also have other properties, depending on the chosen crawler class. Well, ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," is a property provided\nby the ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," class, which we'll set up right now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And we're done! You just created your first crawler from scratch. It will download the HTML of ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),", find the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," element, get\nits text content and print it to console. Good job!"),(0,i.kt)("p",null,"To run the code locally, copy and paste the code, if you haven't already typed it in yourself, to the ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file in the ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project")," we\ncreated earlier and run ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run")," from that project's directory."),(0,i.kt)("p",null,"To run the code on Apify Platform, just replace the original example with your new code and hit Run."),(0,i.kt)("p",null,"Whichever environment you choose, you should see the message\n",(0,i.kt)("inlineCode",{parentName:"p"},'The title of "https://apify.com" is: Web Scraping, Data Extraction and Automation - Apify.')," printed to the screen. If you do, congratulations and\nlet's move onto some bigger challenges! And if you feel like you don't really know what just happened there, no worries, it will all become clear when\nyou learn more about ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("h2",{id:"cheeriocrawler-aka-jquery-crawler"},"CheerioCrawler aka jQuery crawler"),(0,i.kt)("p",null,"This is the crawler that we used in our earlier example. Our simplest and also the fastest crawling solution. If you're familiar with ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", you'll\nunderstand ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," in minutes. ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," is\nessentially ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," for Node.js. It offers the same API, including the familiar ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object. You can use it, as you would ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", for manipulating\nthe DOM of a HTML page. In crawling, you'll mostly use it to select the right elements and extract their text values - the data you're interested in.\nBut ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," runs in a browser and attaches directly to the browser's DOM. Where does ",(0,i.kt)("inlineCode",{parentName:"p"},"cheerio")," get its HTML? This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"Crawler")," part of\n",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," comes in."),(0,i.kt)("h3",{id:"overview"},"Overview"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," crawls by making plain HTTP requests to the provided URLs. As you remember from the previous section, the\nURLs are fed to the crawler using either the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". The HTTP responses\nit gets back are HTML pages, the same pages you would get in your browser when you first load a URL."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note, however, that modern web pages often do not serve all of their content in the first HTML response, but rather the first HTML contains links to\nother resources such as CSS and JavaScript that get downloaded afterwards and together they create the final page. See our\n",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to crawl those.")),(0,i.kt)("p",null,"Once the page's HTML is retrieved, the crawler will pass it to ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," for\nparsing. The result is the typical ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function, which should be familiar to ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," users. You can use this ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," to do all sorts of lookups and\nmanipulation of the page's HTML, but in scraping, we will mostly use it to find specific HTML elements and extract their data."),(0,i.kt)("p",null,"Example use of Cheerio and its ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function in comparison to browser JavaScript:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Return the text content of the <title> element.\ndocument.querySelector('title').textContent; // plain JS\n$('title').text(); // Cheerio\n\n// Return an array of all 'href' links on the page.\nArray.from(document.querySelectorAll('[href]')).map(el => el.href); // plain JS\n$('[href]')\n .map((i, el) => $(el).attr('href'))\n .get(); // Cheerio\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"This is not to show that Cheerio is better than plain browser JavaScript. Some might actually prefer the more expressive way plain JS provides.\nUnfortunately, the browser JavaScript methods are not available in Node.js, so Cheerio is our best bet to do the parsing.")),(0,i.kt)("h3",{id:"when-to-use-cheeriocrawler"},"When to use ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Even though using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," is extremely easy, it probably will not be your first choice for most kinds of crawling or scraping in production\nenvironments. Since most websites nowadays use modern JavaScript to create rich, responsive and data-driven user experiences, the plain HTTP requests\nthe crawler uses may just fall short of your needs."),(0,i.kt)("p",null,"But ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," is far from useless! It really shines when you need to cope with extremely high workloads. With just 4 GBs of memory and a single CPU\ncore, you can scrape 500 or more pages a minute! ",(0,i.kt)("em",{parentName:"p"},"(assuming each page contains approximately 400KB of HTML)")," To scrape this fast with a full browser\nscraper, such as the ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", you'd need significantly more computing power."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Extremely fast"),(0,i.kt)("li",{parentName:"ul"},"Easy to set up"),(0,i.kt)("li",{parentName:"ul"},"Familiar for jQuery users"),(0,i.kt)("li",{parentName:"ul"},"Super cheap to run"),(0,i.kt)("li",{parentName:"ul"},"Each request can go through a different proxy")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Disadvantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Does not work for all websites"),(0,i.kt)("li",{parentName:"ul"},"May easily overload the target website with requests"),(0,i.kt)("li",{parentName:"ul"},"Does not enable any manipulation of the website before scraping")),(0,i.kt)("h3",{id:"basic-use-of-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Now that we have an idea of the crawler's inner workings, let's build one. We'll use the example from the previous section and improve on it by\nletting it truly crawl the page, finding new links as it goes, enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and then scraping them."),(0,i.kt)("h4",{id:"refresher"},"Refresher"),(0,i.kt)("p",null,"Just to refresh your memory, in the previous section we built a very simple crawler that downloads the HTML of a single page, reads its title and prints\nit to the console. This is the original source code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Earlier we said that we would let the crawler:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"So let's get to it!"),(0,i.kt)("h4",{id:"finding-new-links"},"Finding new links"),(0,i.kt)("p",null,"There are numerous approaches to finding links to follow when crawling the web. For our purposes, we will be looking for ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute. For example ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="https://apify.com/store>This is a link to Apify Store</a>'),". To do this, we need to update our Cheerio\nfunction."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n")),(0,i.kt)("p",null,"Our new function finds all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain the ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute and extracts the attributes into an array of strings. But there's a problem. There could be relative links in the list and those can't be used on their own. We need to resolve them using our domain as base URL and\nwe will use one of Node.js' standard libraries to do this."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst ourDomain = 'https://apify.com';\nconst absoluteUrls = links.map(link => new URL(link, ourDomain));\n")),(0,i.kt)("h4",{id:"filtering-links-to-same-domain"},"Filtering links to same domain"),(0,i.kt)("p",null,"Websites typically contain a lot of links that lead away from the original page. This is normal, but when crawling a website, we usually want to crawl\nthat one site and not let our crawler wander away to Google, Facebook and Twitter. Therefore, we need to filter out the off-domain links and only\nkeep the ones that lead to the same domain."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Don't worry, we'll learn how to do this with a single function call using Apify in a few moments.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst ourDomain = 'apify.com';\nconst absoluteUrls = links.map(link => new URL(link, ourDomain));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n// ...\n")),(0,i.kt)("h4",{id:"enqueueing-links-to-requestqueue"},"Enqueueing links to ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestQueue")),(0,i.kt)("p",null,"This should be easy, because we already did that ",(0,i.kt)("a",{parentName:"p",href:"#putting-it-all-together",target:null,rel:null},"earlier"),", remember? Just call ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue.addRequest()")," for all the new\nlinks. This will add them to the end of the queue for processing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst ourDomain = 'https://apify.com';\nconst absoluteUrls = links.map(link => new URL(link, ourDomain));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n// Add the requests in series. There's of course room for speed\n// improvement by parallelization. Try to implement it, if you wish.\nconsole.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\nfor (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n}\n\n// ...\n")),(0,i.kt)("h4",{id:"scrape-the-newly-enqueued-links"},"Scrape the newly enqueued links"),(0,i.kt)("p",null,"And we're approching the finishing line. All we need to do now is integrate the new code into our original crawler. It will be easy, because\nalmost everything needs to go into the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". But just before we do that, let's introduce the first crawler configuration option that\nis not a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". It's called ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl"),"."),(0,i.kt)("h5",{id:"the-maxrequestspercrawl-limit"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"maxRequestsPerCrawl")," limit"),(0,i.kt)("p",null,"This configuration option is available in all crawler classes and you can use it to limit the number of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," the crawler should process. It's\nvery useful when you're just testing your code or when your crawler could potentially crawl millions of pages and you want to save resources. You can\nadd it to the crawler options like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("p",null,"This limits the number of successfully handled ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to 20. Bear in mind that the actual number of processed requests might be a little higher\nand that's because usually there are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," processed at the same time and once the 20th ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," finishes, the other running ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),"\nwill be allowed to finish too."),(0,i.kt)("h4",{id:"putting-it-all-together-1"},"Putting it all together"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const ourDomain = 'https://apify.com';\n const absoluteUrls = links.map(link => new URL(link, ourDomain));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"No matter if you followed along with our coding or just copy-pasted the resulting source, try running it now, perhaps even in both environments. You\nshould see the crawler log the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the first page, then the ",(0,i.kt)("strong",{parentName:"p"},"enqueueing")," message showing number of URLs, followed by the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the\nfirst enqueued page and so on and so on."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you need help with running the code, refer back to the chapters on environment setup: ",(0,i.kt)("a",{parentName:"p",href:"#setting-up-locally",target:null,rel:null},"Setting up locally")," and\n",(0,i.kt)("a",{parentName:"p",href:"#setting-up-on-the-apify-platform",target:null,rel:null},"Setting up on the Apify platform"),".")),(0,i.kt)("h2",{id:"using-apify-sdk-to-enqueue-links-like-a-boss"},"Using Apify SDK to enqueue links like a boss"),(0,i.kt)("p",null,"If you were paying attention carefully in the previous chapter, we said that we would show you a way to enqueue new ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," with a single function\ncall. You might be wondering why we had to go through the whole process of getting the individual links, filtering the same domain ones and then\nmanually enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),", when there is a simpler way."),(0,i.kt)("p",null,"Well, the obvious reason is practice. This is a tutorial after all. The other reason is to make you think about all the bits and pieces that come\ntogether, so that in the end, a new page, not previously entered in by you, can be scraped. We think that by seeing the bigger picture, you will be\nable to get the most out of Apify SDK."),(0,i.kt)("h3",{id:"meet-apifyutils"},"Meet ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils")),(0,i.kt)("p",null,"We will talk at length about them later, but in short, ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," is a namespace where you can find various helpful functions and constants that\nmake your life easier. One of the available functions is ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," which encapsulates the whole enqueueing process and even adds\nsome extra functionality."),(0,i.kt)("h3",{id:"introduction-to-apifyutilsenqueuelinks"},"Introduction to ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils.enqueueLinks()")),(0,i.kt)("p",null,"Since enqueuing new links to crawl is such an integral part of web crawling, we created a function that attempts to simplify this process as much as\npossible. With a single function call, it allows you to find all the links on a page that match specified criteria and add them to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),".\nIt also allows you to modify the resulting ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to match your crawling needs."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," is quite a powerful function so, like crawlers, it gets its arguments from an options object. This is useful, because you don't have to\nremember their order! But also because we can easily extend its API and add new features. You can\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},"find the full reference here"),"."),(0,i.kt)("p",null,"We suggest using ES6 destructuring to grab the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function off of the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils")," object, so you don't have to type ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," all the\ntime."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\n// Now you can use enqueueLinks like this:\nawait enqueueLinks({\n /* options */\n});\n")),(0,i.kt)("h3",{id:"basic-use-of-enqueuelinks-with-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"enqueueLinks()")," with ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"We already implemented logic that takes care of enqueueing new links to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," in the previous chapter on ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". Let's look at\nthat logic and implement the same functionality using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),"."),(0,i.kt)("p",null,"We found that the crawler needed to do these 4 things to crawl ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),":"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"Using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," we can squash the first 3 into a single function call, if we set the options correctly. For now, let's just stick to the\nbasics. At the very least, we need a source where to find the links and the queue to enqueue them to. The ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," Cheerio object is one of the sources the\nfunction accepts and we already know how to work with it in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". We also know how to get a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," instance."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nawait enqueueLinks({ $, requestQueue });\n")),(0,i.kt)("p",null,"That's all we need to do to enqueue all ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="...">')," links from the given page to the given queue. Easy, right? Scratch number 1 and 3 off the\nlist. Only number 2 remains and to tackle this one, we need to talk about yet another new concept, the pseudo-URL."),(0,i.kt)("h4",{id:"introduction-to-pseudo-urls"},"Introduction to pseudo-URLs"),(0,i.kt)("p",null,"Pseudo-URLs are represented by our ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class and even though the name sounds discouraging, they're a pretty simple concept. They're just URLs\nwith some parts replaced by wildcards (read ",(0,i.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions"},"regular\nexpressions"),"). They are matched against URLs to find specific links, domains, patterns, file extensions and so on."),(0,i.kt)("p",null,"In scraping, there are usually patterns to be found in website URLs that can be leveraged to scrape only the pages we're interested in. Imagine\na typical online store. It has different categories which list different items The URL for might looks something like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\n")),(0,i.kt)("p",null,"A category would then have a different URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\n")),(0,i.kt)("p",null,"Going to this page would produce a list of offered computers. Then, clicking on one of the computers might take us to a detail URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"As you can see, there's a structure to the links. In the real world, the structure might not always be perfectly obvious, but it's very often there.\nPseudo-URLs help to use this structure to select only the relevant links from a given page."),(0,i.kt)("h4",{id:"structure-of-a-pseudo-url"},"Structure of a pseudo-URL"),(0,i.kt)("p",null,"A pseudo-URL is a URL with ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions",target:"_blank",rel:"noopener"},"regular expressions"),") enclosed\nin ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Since we're running Node.js, the regular expressions should follow the JavaScript style."),(0,i.kt)("p",null,"For example, a pseudo-URL"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/[(\\w|-)+]\n")),(0,i.kt)("p",null,"will match all of the following URLs:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\nhttps://www.online-store.com/categories/mobile-phones\nhttps://www.online-store.com/categories/black-friday\n")),(0,i.kt)("p",null,"but it will not match"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\nhttps://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"This way, you can easily find just the URLs that you're looking for while ignoring the rest."),(0,i.kt)("p",null,"A pseudo-URL may include any number of bracketed regular expressions, so you can compose much more complex matching logic. The following Pseudo URL\nwill match the items in the store even if the links use the non-secure ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," protocol, omit the ",(0,i.kt)("inlineCode",{parentName:"p"},"www")," from the hostname or use a different TLD."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http[s?]://[(www)?\\.]online-store.[com|net|org]/items/[\\d+]\n")),(0,i.kt)("p",null,"will match any combination of:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://www.online-store.org/items/12345\nhttps://online-store.com/items/633423\nhttp://online-store.net/items/7003\n")),(0,i.kt)("p",null,"but it will not match:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://shop.online-store.org/items/12345\nhttps://www.online-store.com/items/calculator\nwww.online-store.org/items/7003\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pssst! Don't tell anyone, but you can create ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrls")," with plain old ",(0,i.kt)("inlineCode",{parentName:"p"},"RegExp")," instances instead of this brackety madness as well.")),(0,i.kt)("h4",{id:"using-enqueuelinks-to-filter-links"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," to filter links"),(0,i.kt)("p",null,"That's been quite a lot of theory and examples. We might as well put it to practice. Going back to our ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," exercise, we still have number\n2 left to cross off the list - filter links pointing to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),". We've already shown that at the very least, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function needs\ntwo arguments. The source, in our case the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object, and the destination - the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". To filter links, we need to add a third argument:\n",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls"),"."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"options.pseudoUrls")," argument is always an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array"),", but its contents can take on many forms. ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"See the reference"),"\nfor all of them. Since we just need to filter out same domain links, we'll keep it simple and use a pseudo-URL ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To break the pseudo-URL string down, we're looking for both ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," protocols and the links may only lead to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," domain. The\nfinal brackets ",(0,i.kt)("inlineCode",{parentName:"p"},"[.*]")," allow everything, so ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/contact")," as well as ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," will match. If this sounds complex to you, we suggest\n",(0,i.kt)("a",{parentName:"p",href:"https://www.regular-expressions.info/tutorial.html",target:"_blank",rel:"noopener"},"reading a tutorial")," or two on regular expression syntax.")),(0,i.kt)("h4",{id:"resolving-relative-urls-with-enqueuelinks"},"Resolving relative URLs with ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"TLDR;")," Just use ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl: request.loadedUrl")," when working with ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"This is probably the weirdest and most complicated addition to the list. This is not the place to talk at length about\n",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/2005079/absolute-vs-relative-urls",target:"_blank",rel:"noopener"},"absolute and relative paths"),", but in short, the\nlinks we encounter in a page can either be absolute, such as:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/john-doe/my-actor\n")),(0,i.kt)("p",null,"or relative:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"./john-doe/my-actor\n")),(0,i.kt)("p",null,"Browsers handle this automatically, but since we're only using plain HTTP requests, we need to tell the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function how to resolve the\nrelative links to the absolute ones, so we can use them for scraping. This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl")," comes into play, because it returns the\ncorrect URL to use as ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$', 'requestQueue' and 'request' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Even though it seems possible, we can't use the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.url")," of our ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances, because the page could have been redirected and the final\nURL would be different from the one we requested.")),(0,i.kt)("h4",{id:"integrating-enqueuelinks-into-our-crawler"},"Integrating ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," into our crawler"),(0,i.kt)("p",null,"That was fairly easy, wasn't it. That ticks number 2 off our list and we're done! Let's take a look at the original crawler code, where we\nenqueued all the links manually."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const ourDomain = 'https://apify.com';\n const absoluteUrls = links.map(link => new URL(link, ourDomain));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Since we've already prepared the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," options, we can just replace all the above enqueuing logic with a single function call, as promised."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Enqueue links\n const enqueued = await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n });\n console.log(`Enqueued ${enqueued.length} URLs.`);\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And that's it! No more parsing the links from HTML using Cheerio, filtering them and enqueueing them one by one It all gets done automatically!\n",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," is just one example of Apify SDK's powerful helper functions. They're all designed to make your life easier so you can focus on\ngetting your data, while leaving the mundane crawling management to your tools."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," has a lot more tricks up its sleeve. Make sure to check out the\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"reference documentation")," to see what else it can do for you. Namely the feature to prepopulate the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"\ninstances it creates with ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," of your choice is extremely useful!"),(0,i.kt)("h2",{id:"getting-some-real-world-data"},"Getting some real-world data"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Hey, guys, you know, it's cool that we can scrape the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," elements of web pages, but that's not very useful. Can we finally scrape some real\ndata and save it somewhere in a machine readable format? Because that's why you started reading this tutorial in the first place!")),(0,i.kt)("p",null,"We hear you, young padawan! First, learn how to crawl, you must. Only then, walk through data, you can!"),(0,i.kt)("p",null,"###\xa0Making a store crawler"),(0,i.kt)("p",null,"Fortunately, we don't have to travel to a galaxy far far away to find a good candidate for learning how to scrape\nstructured data. The ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," is a library of public actors that anyone can grab and use. You\ncan find ready-made solutions for crawling ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/drobnikj/crawler-google-places",target:"_blank",rel:"noopener"},"Google Places"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/vaclavrut/amazon-crawler",target:"_blank",rel:"noopener"},"Amazon"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/google-search-scraper",target:"_blank",rel:"noopener"},"Google Search"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/dtrungtin/booking-scraper",target:"_blank",rel:"noopener"},"Booking"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/jaroslavhejlek/instagram-scraper",target:"_blank",rel:"noopener"},"Instagram"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/maxcopell/tripadvisor",target:"_blank",rel:"noopener"},"Tripadvisor")," and many other websites. Feel free to check them out! It's also a great place to practice our Jedi scraping skills since it has categories, lists and details. That's almost like our imaginary\n",(0,i.kt)("inlineCode",{parentName:"p"},"online-store.com")," from the previous chapter."),(0,i.kt)("h3",{id:"the-importance-of-having-a-plan"},"The importance of having a plan"),(0,i.kt)("p",null,'Sometimes scraping is really straightforward, but most of the times, it really pays to do a little bit of research first. How is the website\nstructured? Can I scrape it only with HTTP requests (read "with ',(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"\") or would I need a full browser solution? Are there any\nanti-scraping protections in place? Do I need to parse the HTML or can I get the data otherwise, such as directly from the website's API. Jakub,\none of Apify's founders, wrote a\n",(0,i.kt)("a",{parentName:"p",href:"https://blog.apify.com/web-scraping-in-2018-forget-html-use-xhrs-metadata-or-javascript-variables-8167f252439c",target:"_blank",rel:"noopener"},"great article about all the different techniques"),"\nand tips and tricks, so make sure to check that out!"),(0,i.kt)("p",null,"For the purposes of this tutorial, let's just go ahead with HTTP requests and HTML parsing using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". The number one reason being: We\nalready know how to use it and we want to build on that knowledge to learn specific crawling and scraping techniques."),(0,i.kt)("h4",{id:"choosing-the-data-we-need"},"Choosing the data we need"),(0,i.kt)("p",null,"A good first step is always to figure out what it is we want to scrape and where to find it. For the time being, let's just agree that we want to\nscrape all actors (see the ",(0,i.kt)("inlineCode",{parentName:"p"},"Show")," dropdown) in all categories (which can be found on the left side of the page) and for each actor we want to get its"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,'We can see that some of the information is available directly on the list page, but for details such as "Last modification date" or "Number of runs" we\'ll also need\nto open the actor detail pages.'),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"analyzing-the-target"},"Analyzing the target"),(0,i.kt)("p",null,"Knowing that we will use plain HTTP requests, we immediately know that we won't be able to manipulate the website in any way. We will only be able to\ngo through the HTML it gives us and parse our data from there. This might sound like a huge limitation, but you might be surprised in how effective it\ncan be. Let's get to it!"),(0,i.kt)("h4",{id:"the-start-urls"},"The start URL(s)"),(0,i.kt)("p",null,"This is where we start our crawl. It's convenient to start as close to our data as possible. For example, it wouldn't make much sense to start at\n",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," and look for a ",(0,i.kt)("inlineCode",{parentName:"p"},"store")," link there, when we already know that everything we want to extract can be found at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page."),(0,i.kt)("p",null,"Once we look at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page more carefully, we see that the categories themselves produce URLs that we can use to access those\nindividual categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("p",null,"Should we write down all the category URLs down and use all of them as start URLs? It's definitely possible, but what if a new category appears on the\npage later? We would not learn about it unless we manually visit the page and inspect it again. So scraping the category links off the store page\ndefinitely makes sense. This way we always get an up to date list of categories."),(0,i.kt)("p",null,"But is it really that straightforward? By digging further into the store page's HTML we find that it does not actually contain the category links. The\nmenu on the left uses JavaScript to display the items from a given category and, as we've learned earlier, ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," cannot execute JavaScript."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We've deliberately chosen this scenario to show an example of the number one weakness of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". We will overcome this difficulty in our\n",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," tutorial, but at the cost of compute resources and speed. Always remember that no tool is best for everything!")),(0,i.kt)("p",null,"So we're back to the pre-selected list of URLs. Since we cannot scrape the list dynamically, we have to manually collect the links and then use them\nin our crawler. We lose the ability to scrape new categories, but we keep the low resource consumption and speed advantages of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"Therefore, after careful consideration, we've determined that we should use multiple start URLs and that they should look as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\nhttps://apify.com/store?category=ECOMMERCE\nhttps://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("h3",{id:"the-crawling-strategy"},"The crawling strategy"),(0,i.kt)("p",null,"Now that we know where to start, we need to figure out where to go next. Since we've eliminated one level of crawling by selecting the categories\nmanually, we now only need to crawl the actor detail pages. The algorithm therefore follows:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Visit the category list page (one of our start URLs)."),(0,i.kt)("li",{parentName:"ol"},"Enqueue all links to actor details."),(0,i.kt)("li",{parentName:"ol"},"Visit all actor details and extract data."),(0,i.kt)("li",{parentName:"ol"},"Repeat 1 - 3 for all categories.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Technically, this is a depth first crawl and the crawler will perform a breadth first crawl by default, but that's an implementation detail. We've\nchosen this notation since a breadth first crawl would be less readable.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will make sure to visit the pages for us, if we provide the correct ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and we already know how to enqueue pages, so this\nshould be fairly easy. Nevertheless, there are two more tricks that we'd like to show you."),(0,i.kt)("h4",{id:"using-a-requestlist"},"Using a ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestList")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is a perfect tool for scraping a pre-existing list of URLs and if you think about our start URLs, this is exactly what we have! A list\nof links to the different categories of the store. Let's see how we'd get them into a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n];\n\nconst requestList = await Apify.openRequestList('categories', sources);\n")),(0,i.kt)("p",null,"As you can see, similarly to the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestQueue()")," function, there is an ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestList()")," function that will create a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"\ninstance for you. The first argument is the name of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),". It is used to persist the crawling state of the list. This is useful when you\nwant to continue where you left off after an error or a process restart. The second argument is the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array, which is nothing more than a list\nof URLs you wish to crawl."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is a persistent store by default, so no name is needed, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," only lives in memory and giving it a name enables it\nto become persistent.")),(0,i.kt)("p",null,"You might now want to ask one of these questions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Can I enqueue into ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," too?"),(0,i.kt)("li",{parentName:"ul"},"How do I make ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," work together with ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")," since I need the queue to enqueue new ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests"),".")),(0,i.kt)("p",null,"The answer to the first one is a definitive no. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is immutable and once you create it, you cannot add or remove ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," from it. The\nanswer to the second one is simple. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are made to work together out of the box in crawlers, so all you need to do is\nuse them both and the crawlers will do the rest."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"For those wondering how this works, the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," are enqueued into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," right before their execution and only\nprocessed by the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," afterwards. You can, of course, enqueue the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to the queue manually, but that would take some boilerplate\ncode and perhaps quite a long time, if we were talking about tens of thousands or more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". The crawlers do it while running, so the time to\nenqueue is spread out and you won't even notice it.")),(0,i.kt)("p",null,"####\xa0Sanity check"),(0,i.kt)("p",null,"It's always useful to create some simple boilerplate code to see that we've got everything set up correctly before we start to write\nthe scraping logic itself. We might realize that something in our previous analysis doesn't quite add up, or the website might not behave exactly as we expected."),(0,i.kt)("p",null,"Let's use our newly acquired ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," knowledge and everything we know from the previous chapters to create a new crawler that'll just visit all\nthe category URLs we selected and print the text content of all the actors in the category. Try running the code below in your selected environment.\nYou should see, albeit very badly formatted, the text of the individual actor cards that are displayed in the selected categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ $, request }) => {\n // Select all the actor cards.\n $('.item').each((i, el) => {\n const text = $(el).text();\n console.log(`ITEM: ${text}\\n`);\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If there's anything you don't understand, refer to the previous chapters on setting up your environment, building your first crawler and\n",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),".")),(0,i.kt)("p",null,"You might be wondering how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. After analyzing the category pages using a browser's DevTools, we've determined that it's a\ngood selector to select all the currently displayed actor cards. DevTools and CSS selectors are quite a large topic, so we can't go into too much\ndetail now, but here are a few general pointers."),(0,i.kt)("h4",{id:"devtools-crash-course"},"DevTools crash course"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We'll use Chrome DevTools here, since it's the most common browser, but feel free to use any other, it's all very similar.")),(0,i.kt)("p",null,"We could pick any category, but let's just go with Travel because it includes some interesting actors. Go to"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\n")),(0,i.kt)("p",null,"and open DevTools either by right-clicking anywhere in the page and selecting ",(0,i.kt)("inlineCode",{parentName:"p"},"Inspect"),", or by pressing ",(0,i.kt)("inlineCode",{parentName:"p"},"F12")," or by any other means relevant to your\nsystem. Once you're there, you'll see a bunch of DevToolsy stuff and a view of the category page with the individual actor cards."),(0,i.kt)("p",null,"Now, find the ",(0,i.kt)("inlineCode",{parentName:"p"},"Select an element")," tool and use it to select one of the actor cards. Make sure to select the whole card, not just some of its contents, such\nas its title or description."),(0,i.kt)("p",null,"In the resulting HTML display, it will put your cursor somewhere. Inspect the HTML around it. You'll see that there are CSS classes attached to the\ndifferent HTML elements."),(0,i.kt)("p",null,"By hovering over the individual elements, you will see their placement in the page's view. It's easy to see the page's structure around the actor\ncards now. All the cards are displayed in a ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with a classname that starts with ",(0,i.kt)("inlineCode",{parentName:"p"},"ItemsGrid__StyledDiv"),", which holds another ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with some\ncomputer-generated class names and finally, inside this ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>"),", the individual cards are represented by other ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," elements with the class of\n",(0,i.kt)("inlineCode",{parentName:"p"},"item"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Yes, there are other HTML elements and other classes too. We can safely ignore them.")),(0,i.kt)("p",null,"It should now make sense how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. It's just a selector that finds all elements that are annotated with the ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," class and\nthose just happen to be the actor cards only."),(0,i.kt)("p",null,"It's always a good idea to double check that though, so go into the DevTools Console and run"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"document.querySelectorAll('.item');\n")),(0,i.kt)("p",null,"You will see that only the actor cards will be returned, and nothing else."),(0,i.kt)("h4",{id:"enqueueing-the-detail-links-using-a-custom-selector"},"Enqueueing the detail links using a custom selector"),(0,i.kt)("p",null,"In the previous chapter, we used the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," function like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n});\n")),(0,i.kt)("p",null,"While very useful in that scenario, we need something different now. Instead of finding all the ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="..">')," links that match the ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrl"),", we\nneed to find only the specific ones that will take us to the actor detail pages. Otherwise, we'd be visiting a lot of other pages that we're not\ninterested in. Using the power of DevTools and yet another ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameter, this becomes fairly easy."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n};\n")),(0,i.kt)("p",null,"The code should look pretty familiar to you. It's a very simple ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," where we log the currently processed URL to the console and\nenqueue more links. But there are also a few new, interesting additions. Let's break it down."),(0,i.kt)("h5",{id:"the-selector-parameter-of-enqueuelinks"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"selector")," parameter of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"When we previously used ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", we were not providing any ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," parameter and it was fine, because we wanted to use the default\nsetting, which is ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," - finds all ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements. But now, we need to be more specific. There are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," links on the given category page, but\nwe're only interested in those that will take us to item (actor) details. Using the DevTools, we found out that we can select the links we wanted\nusing the ",(0,i.kt)("inlineCode",{parentName:"p"},"div.item > a")," selector, which selects all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},'<div class="item ...">')," parent. And those are exactly the ones\nwe're interested in."),(0,i.kt)("h5",{id:"the-missing-pseudourls"},"The missing ",(0,i.kt)("inlineCode",{parentName:"h5"},"pseudoUrls")),(0,i.kt)("p",null,"Earlier we learned that ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," are not required and if omitted, all links matching the given ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," will be enqueued. This is exactly\nwhat we need, so we're skipping ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," this time. That does not mean that you can't use ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," together with a custom ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," though,\nbecause you absolutely can!"),(0,i.kt)("h5",{id:"finally-the-userdata-of-enqueuelinks"},"Finally, the ",(0,i.kt)("inlineCode",{parentName:"h5"},"userData")," of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"You will see ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," used often throughout Apify SDK and it's nothing more than a place to store your own data on a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance. You can\naccess it with ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData")," and it's a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," that can be used to store anything that needs to survive the full life-cycle of the\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"."),(0,i.kt)("p",null,"We can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"transformRequestFunction")," option of ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," to modify all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances it creates and enqueues. In our case, we\nuse it to set a ",(0,i.kt)("inlineCode",{parentName:"p"},"detailPage")," property to the enqueued ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to be able to easily differentiate between the category pages and the detail pages."),(0,i.kt)("h4",{id:"another-sanity-check"},"Another sanity check"),(0,i.kt)("p",null,"It's always good to work step by step. We have this new enqueueing logic in place and since the previous ",(0,i.kt)("a",{parentName:"p",href:"#sanity-check",target:null,rel:null},"Sanity check")," worked only\nwith a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", because we were not enqueueing anything, don't forget to add back the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl")," limit. Let's\ntest it out!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue(); // <----------------\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50, // <----------------------------------------\n requestList,\n requestQueue, // <---------------------------------------------------\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"We've added the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," with the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," logic from the previous section to the code we wrote earlier. As always, try\nrunning it in the environment of your choice. You should see the crawler output a number of links to the console, as it crawls the category pages first\nand then all the links to the actor detail pages it found."),(0,i.kt)("p",null,"This concludes our Crawling strategy section, because we have taught the crawler to visit all the pages we need. Let's continue with scraping the\ntasty data."),(0,i.kt)("h3",{id:"scraping-data"},"Scraping data"),(0,i.kt)("p",null,"At the beginning of this chapter, we created a list of the information we wanted to collect about the actors in the store. Let's review that and figure\nout ways to access it."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"scraping-the-url-owner-and-unique-identifier"},"Scraping the URL, Owner and Unique identifier"),(0,i.kt)("p",null,"Some information is lying right there in front of us without even having to touch the actor detail pages. The ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," we already have - the\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.url"),". And by looking at it carefully, we realize that it already includes the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," and the ",(0,i.kt)("inlineCode",{parentName:"p"},"unique identifier")," too. We can just split the\n",(0,i.kt)("inlineCode",{parentName:"p"},"string")," and be on our way then!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// request.url = https://apify.com/apify/web-scraper\n\nconst urlArr = request.url.split('/').slice(-2); // ['apify', 'web-scraper']\nconst uniqueIdentifier = urlArr.join('/'); // 'apify/web-scraper'\nconst owner = urlArr[0]; // 'apify'\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"It's always a matter of preference, whether to store this information separately in the resulting dataset, or not. Whoever uses the dataset can\neasily parse the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," from the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL"),", so should we duplicate the data unnecessarily? Our opinion is that unless the increased data consumption\nwould be too large to bear, it's always better to make the dataset as readable as possible. Someone might want to filter by ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," for example and\nkeeping only the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," in the dataset would make this complicated without using additional tools.")),(0,i.kt)("h4",{id:"scraping-title-description-last-modification-date-and-number-of-runs"},"Scraping Title, Description, Last modification date and Number of runs"),(0,i.kt)("p",null,"Now it's time to add more data to the results. Let's open one of the actor detail pages in the Store, for example the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/web-scraper",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"apify/web-scraper"))," page and use our DevTools-Fu to figure out how to get the title of the actor."),(0,i.kt)("h5",{id:"title"},"Title"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor title",src:n(67543).Z,title:"Finding actor title in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("p",null,"By using the element selector tool, we find out that the title is there under an ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, as titles should be.\nMaybe surprisingly, we find that there are actually two ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tags on the detail page. This should get us thinking.\nIs there any parent element that includes our ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, but not the other ones? Yes, there is! There is a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>"),"\nelement that we can use to select only the heading we're interested in."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Remember that you can press CTRL+F (CMD+F) in the Elements tab of DevTools to open the search bar where you can quickly search for elements using\ntheir selectors. And always make sure to use the DevTools to verify your scraping process and assumptions. It's faster than changing the crawler\ncode all the time.")),(0,i.kt)("p",null,"To get the title we just need to find it using ",(0,i.kt)("inlineCode",{parentName:"p"},"Cheerio")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"header h1")," selector, which selects all ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," ancestor.\nAnd as we already know, there's only one."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n};\n")),(0,i.kt)("h5",{id:"description"},"Description"),(0,i.kt)("p",null,"Getting the actor's description is a little more involved, but still pretty straightforward. We can't just simply search for a ",(0,i.kt)("inlineCode",{parentName:"p"},"<p>")," tag, because\nthere's a lot of them in the page. We need to narrow our search down a little. Using the DevTools we find that the actor description is nested within\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," element too, same as the title. Moreover, the actual description is nested inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"<span>")," tag with a class ",(0,i.kt)("inlineCode",{parentName:"p"},"actor-description"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor description selector",src:n(12872).Z,title:"Finding actor description in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n};\n")),(0,i.kt)("h5",{id:"last-modification-date"},"Last modification date"),(0,i.kt)("p",null,"The DevTools tell us that the ",(0,i.kt)("inlineCode",{parentName:"p"},"modifiedDate")," can be found in the ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element inside ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats">'),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor last modification date selector",src:n(56281).Z,title:"Finding actor last modification date in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n};\n")),(0,i.kt)("p",null,"It might look a little too complex at first glance, but let's walk through it. We find the right ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element,\nand then we read its ",(0,i.kt)("inlineCode",{parentName:"p"},"datetime")," attribute, because that's where a unix timestamp is stored as a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("p",null,"But we would much rather see a readable date in our results, not a unix timestamp, so we need to convert it. Unfortunately the ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),"\nconstructor will not accept a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we cast the ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," function before actually calling ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),".\nPhew!"),(0,i.kt)("h5",{id:"run-count"},"Run count"),(0,i.kt)("p",null,"And so we're finishing up with the ",(0,i.kt)("inlineCode",{parentName:"p"},"runCount"),". There's no specific element like ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>"),", so we need to create a complex selector and then do a\ntransformation on the result."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"ul.ActorHeader-stats > li:nth-of-type(3)")," looks complicated, but it only reads that we're looking for a ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats ...">')," element and within that\nelement we're looking for the third ",(0,i.kt)("inlineCode",{parentName:"p"},"<li>")," element. We grab its text, but we're only interested in the number of runs. So we parse the number out\nusing a regular expression, but its type is still a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we finally convert the result to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," by wrapping it with a ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," call."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The numbers are formatted with commas as thousands separators (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1,234,567'"),"), so to extract it, we\nfirst use regular expression ",(0,i.kt)("inlineCode",{parentName:"p"},"/[\\d,]+/")," - it will search for consecutive number or comma characters.\nThen we extract the match via ",(0,i.kt)("inlineCode",{parentName:"p"},".match(/[\\d,]+/)[0]")," and finally remove the commas by calling ",(0,i.kt)("inlineCode",{parentName:"p"},".replace(',', '')"),".\nThis will give us a string (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1234567'"),") that can be converted via ",(0,i.kt)("inlineCode",{parentName:"p"},"Number")," function.")),(0,i.kt)("p",null,"And there we have it! All the data we needed in a single object. For the sake of completeness, let's add the properties we parsed from the URL earlier\nand we're good to go."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const urlArr = request.url.split('/').slice(-2);\n\nconst results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n\nconsole.log('RESULTS: ', results);\n")),(0,i.kt)("h4",{id:"trying-it-out-sanity-check-3"},"Trying it out (sanity check #3)"),(0,i.kt)("p",null,"We have everything we need so just grab our newly created scraping logic, dump it into our original ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," and see the magic happen!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n console.log('RESULTS', results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notice again that we're scraping on the detail pages ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === true"),", but we're only enqueueing on the category pages\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === undefined"),".")),(0,i.kt)("p",null,"When running the actor in the environment of your choice, you should see the crawled URLs and their scraped data printed to the console."),(0,i.kt)("h3",{id:"saving-the-scraped-data"},"Saving the scraped data"),(0,i.kt)("p",null,"A data extraction job would not be complete without saving the data for later use and processing. We've come to the final and most difficult part of\nthis chapter so make sure to pay attention very carefully!"),(0,i.kt)("p",null,"First, replace the ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log('RESULTS', results)")," call with"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await Apify.pushData(results);\n")),(0,i.kt)("p",null,"and that's it. Unlike in the previous paragraph, I'm being serious now. That's it, we're done. The final code therefore looks exactly like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n await Apify.pushData(results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("h4",{id:"whats-apifypushdata"},"What's ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.pushData()")),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," is a helper function that saves data to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset")),". ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," is a\nstorage designed to hold virtually unlimited amount of data in a format similar to a table. Each time you call ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," a new row in the\ntable is created, with the property names serving as column titles."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Each actor run has one default ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," so no need to initialize it or create an instance first. It just gets done automatically for you. You can\nalso create named datasets at will.")),(0,i.kt)("h4",{id:"finding-my-saved-data"},"Finding my saved data"),(0,i.kt)("p",null,"It might not be perfectly obvious where the data we saved using the previous command went, so let's break it down by environment:"),(0,i.kt)("h5",{id:"dataset-on-the-apify-platform"},"Dataset on the Apify platform"),(0,i.kt)("p",null,"Open any Run of your actor on the Platform and you will see a Dataset as one of the available tabs. Clicking on it will reveal basic information about\nthe Dataset and a list of options that you can use to download your data. There are various formats such as JSON, XLSX or CSV available and there's\nalso the possibility of downloading only clean items, i.e. a filtered dataset with empty rows and hidden fields removed."),(0,i.kt)("h5",{id:"local-dataset"},"Local Dataset"),(0,i.kt)("p",null,"Unless you changed the environment variables that Apify SDK uses locally, which would suggest that you knew what you were doing and you didn't need\nthis tutorial anyway, you'll find your data in your local Apify Storage."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")),(0,i.kt)("p",null,"The above folder will hold all your saved data in numbered files, as they were pushed into the dataset. Each file represents one invocation of\n",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," or one table row."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Unfortunately, the local datasets don't yet support the export in various formats functionality that the Platform Dataset page offers, so for the\ntime being, we're stuck with JSON.")),(0,i.kt)("h3",{id:"final-touch"},"Final touch"),(0,i.kt)("p",null,"It may seem that the data are extracted and the actor is done, but honestly, this is just the beginning. For the sake of brevity, we've completely\nomitted error handling, proxies, debug logging, tests, documentation and other stuff that a reliable software should have. The good thing is, ",(0,i.kt)("strong",{parentName:"p"},"error\nhandling is mostly done by Apify SDK itself"),", so no worries on that front, unless you need some custom magic."),(0,i.kt)("p",null,"Anyway, to spark some ideas, let's look at two more things. First, passing an input to the actor, which will enable us to change the categories we\nwant to scrape without changing the source code itself! And then some refactoring, to show you how we reckon is preferable to structure and annotate\nactor code."),(0,i.kt)("h4",{id:"meet-the-input"},"Meet the ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is just a convention on how we call the actor's input. Because there's no magic in actors, just features, the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is actually nothing more\nthan a key in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," that's, by convention, used as input on the Apify platform. Also by convention, the\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is mostly expected to be of ",(0,i.kt)("inlineCode",{parentName:"p"},"Content-Type: application/json"),"."),(0,i.kt)("p",null,"We will not go into ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," details here, but for the sake of ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," you need to remember that there is a function that helps you get it."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"On the Apify Platform, the actor's input that you can set in the Console is automatically saved to the default ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," under the key ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),"\nand by calling ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," you retrieve the value from the ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore"),"."),(0,i.kt)("p",null,"Running locally, you need to place an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file in your default key value store for this to work."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,i.kt)("h4",{id:"use-input-to-seed-our-actor-with-categories"},"Use ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")," to seed our actor with categories"),(0,i.kt)("p",null,"Currently we're using the full URLs of categories as sources, but it's quite obvious that we only need the final parameters, the rest of the URL is\nalways the same. Knowing that, we can pass an array of those parameters on ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," and build the URLs dynamically, which would allow us to scrape\ndifferent categories without changing the source code. Let's get to it!"),(0,i.kt)("p",null,"First, we set up our ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),", either in the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," form of the actor on the Apify platform, or by creating an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," in our default key-value store\nlocally."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'["TRAVEL", "ECOMMERCE", "ENTERTAINMENT"]\n')),(0,i.kt)("p",null,"Once we have that, we can load it in the actor and populate the crawler's sources with it. In the following example, we're using the categories in the\ninput to construct the category URLs and we're also passing custom ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," to the sources. This means that the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," that get created will\nautomatically contain this ",(0,i.kt)("inlineCode",{parentName:"p"},"userData"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// ...\nconst input = await Apify.getInput();\n\nconst sources = input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n}));\n\nconst requestList = await Apify.openRequestList('categories', sources);\n// ...\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"userData.label")," is also a convention that we've been using for quite some time to label different ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". We know that this is a category URL\nso we ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," it ",(0,i.kt)("inlineCode",{parentName:"p"},"CATEGORY"),". This way, we can easily make decisions in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," without having to inspect the URL itself."),(0,i.kt)("p",null,"We can then refactor the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," for decision-making. This does not make much sense for a crawler\nwith only two different pages, because a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," would suffice, but for pages with multiple different views, it becomes very useful."),(0,i.kt)("h4",{id:"structuring-the-code-better"},"Structuring the code better"),(0,i.kt)("p",null,"But perhaps we should not stop at refactoring the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses. There are several ways we can make the actor look more elegant and - most\nimportantly - easier to reason about and make changes to."),(0,i.kt)("p",null,"In the following code we've made several changes."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Split the code into multiple files."),(0,i.kt)("li",{parentName:"ul"},"Added the ",(0,i.kt)("inlineCode",{parentName:"li"},"Apify.utils.log")," and replaced ",(0,i.kt)("inlineCode",{parentName:"li"},"console.log")," with it."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"getSources()")," function to encapsulate ",(0,i.kt)("inlineCode",{parentName:"li"},"INPUT")," consumption."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"createRouter()")," function to make our routing cleaner, without nested ",(0,i.kt)("inlineCode",{parentName:"li"},"if")," clauses."),(0,i.kt)("li",{parentName:"ul"},"Removed the ",(0,i.kt)("inlineCode",{parentName:"li"},"maxRequestsPerCrawl")," limit.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To create a multi-file actor on the Apify Platform, select ",(0,i.kt)("strong",{parentName:"p"},"Multiple source files")," in the ",(0,i.kt)("strong",{parentName:"p"},"Type")," dropdown on the ",(0,i.kt)("strong",{parentName:"p"},"Source")," screen.")),(0,i.kt)("p",null,"In our ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file, we place the general structure of the crawler:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// main.js\nconst Apify = require('apify');\nconst tools = require('./tools');\nconst {\n utils: { log },\n} = Apify;\n\nApify.main(async () => {\n log.info('Starting actor.');\n const requestList = await Apify.openRequestList('categories', await tools.getSources());\n const requestQueue = await Apify.openRequestQueue();\n const router = tools.createRouter({ requestQueue });\n\n log.debug('Setting up crawler.');\n const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction: async context => {\n const { request } = context;\n log.info(`Processing ${request.url}`);\n await router(request.userData.label, context);\n },\n });\n\n log.info('Starting the crawl.');\n await crawler.run();\n log.info('Actor finished.');\n});\n")),(0,i.kt)("p",null,"Then in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"tools.js"),", we add our helper functions:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// tools.js\nconst Apify = require('apify');\nconst routes = require('./routes');\nconst {\n utils: { log },\n} = Apify;\n\nexports.getSources = async () => {\n log.debug('Getting sources.');\n const input = await Apify.getInput();\n return input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n }));\n};\n\nexports.createRouter = globalContext => {\n return async function(routeName, requestContext) {\n const route = routes[routeName];\n if (!route) throw new Error(`No route for name: ${routeName}`);\n log.debug(`Invoking route: ${routeName}`);\n return route(requestContext, globalContext);\n };\n};\n")),(0,i.kt)("p",null,"And finally our routes in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"routes.js")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// routes.js\nconst Apify = require('apify');\nconst {\n utils: { log },\n} = Apify;\n\nexports.CATEGORY = async ({ $, request }, { requestQueue }) => {\n return Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.label = 'DETAIL';\n return req;\n },\n });\n};\n\nexports.DETAIL = async ({ $, request }) => {\n const urlArr = request.url.split('/').slice(-2);\n\n log.debug('Scraping results.');\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n\n log.debug('Pushing data to dataset.');\n await Apify.pushData(results);\n};\n")),(0,i.kt)("p",null,"Let us tell you a little bit more about the changes. We hope that in the end, you'll agree that this structure makes the actor more readable and\nmanageable."),(0,i.kt)("h4",{id:"splitting-your-code-into-multiple-files"},"Splitting your code into multiple files"),(0,i.kt)("p",null,"This was not always the case, but now that the Apify platform has a multifile editor, there's no reason not to split your code into multiple files and keep\nyour logic separate. Less code in a single file means less code you need to think about at any time, and that's a great thing!"),(0,i.kt)("h4",{id:"using-apifyutilslog-instead-of-consolelog"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"h4"},"console.log")),(0,i.kt)("p",null,"We wont go to great lengths here to talk about ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log"),", because you can read ",(0,i.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},"it all in the documentation"),", but there's just\none thing that we need to stress: ",(0,i.kt)("strong",{parentName:"p"},"log levels"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")," enables you to use different log levels, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"log.debug"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"log.info")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"log.warning"),". It not only makes your log more readable, but\nit also allows selective turning off of some levels by either calling the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log.setLevel()")," function or by setting an ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," variable.\nThis is huge! Because you can now add a lot of debug logs in your actor, which will help you when something goes wrong and turn them on or off with a\nsimple ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," change, or by setting an environment variable."),(0,i.kt)("p",null,"The punch line? Use ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log")," now and thank us later when something goes wrong!"),(0,i.kt)("h4",{id:"using-a-router-to-structure-your-crawling"},"Using a router to structure your crawling"),(0,i.kt)("p",null,"At first, it might seem more readable using just a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"if / else")," statement to select different logic based on the crawled pages, but trust me, it\nbecomes far less impressive when working with more than two different pages and it definitely starts to fall apart when the logic to handle each page\nspans tens or hundreds of lines of code."),(0,i.kt)("p",null,"It's good practice in any programming to split your logic into bite-sized chunks that are easy to read and reason about. Scrolling through a\nthousand line long ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," where everything interacts with everything and variables can be used everywhere is not a beautiful thing to\ndo and a pain to debug. That's why we prefer the separation of routes into a special file and with large routes, we would even suggest having one file\nper route."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"TO BE CONTINUED with details on ",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and other features...")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),c=o,m=d["".concat(s,".").concat(c)]||d[c]||h[c]||i;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:o,r[1]=l;for(var u=2;u<i;u++)r[u]=n[u];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},12872:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/description-f9aec3abf3d17de2239e058d5dce838e.jpg"},56281:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/modified-date-5516a5ec24f9b0ef2f6a69f196e005db.jpg"},35631:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/scraping-practice-c0dd0ead6c920dcf687f0bb9d09087a9.jpg"},67543:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/title-01-424dd1253b7b093145561728d490d202.jpg"}}]); \ No newline at end of file diff --git a/assets/js/cf720268.405d5679.js b/assets/js/cf720268.405d5679.js new file mode 100644 index 0000000000..65d07ea99e --- /dev/null +++ b/assets/js/cf720268.405d5679.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2987],{25483:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var a=n(87462),o=n(63366),i=(n(67294),n(3905)),r=["components"],l={id_old:"version-1.3-getting-started",title:"Getting Started",id:"getting-started"},s=void 0,u={unversionedId:"guides/getting-started",id:"version-1.3/guides/getting-started",title:"Getting Started",description:"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary",source:"@site/versioned_docs/version-1.3/guides/getting_started.md",sourceDirName:"guides",slug:"/guides/getting-started",permalink:"/sdk/js/docs/1.3/guides/getting-started",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/getting_started.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-getting-started",title:"Getting Started",id:"getting-started"},sidebar:"version-1.3/docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/1.3/guides/apify-platform"},next:{title:"Request Storage",permalink:"/sdk/js/docs/1.3/guides/request-storage"}},p={},d=[{value:"Intro",id:"intro",level:2},{value:"Setting up locally",id:"setting-up-locally",level:2},{value:"Creating a new project",id:"creating-a-new-project",level:3},{value:"Setting up on the Apify Platform",id:"setting-up-on-the-apify-platform",level:2},{value:"Creating a new project",id:"creating-a-new-project-1",level:3},{value:"First crawler",id:"first-crawler",level:2},{value:"The general idea",id:"the-general-idea",level:3},{value:"The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code>",id:"the-where---request-requestlist-and-requestqueue",level:3},{value:"The What - <code>handlePageFunction</code>",id:"the-what---handlepagefunction",level:3},{value:"Putting it all together",id:"putting-it-all-together",level:3},{value:"CheerioCrawler aka jQuery crawler",id:"cheeriocrawler-aka-jquery-crawler",level:2},{value:"Overview",id:"overview",level:3},{value:"When to use <code>CheerioCrawler</code>",id:"when-to-use-cheeriocrawler",level:3},{value:"Basic use of <code>CheerioCrawler</code>",id:"basic-use-of-cheeriocrawler",level:3},{value:"Refresher",id:"refresher",level:4},{value:"Finding new links",id:"finding-new-links",level:4},{value:"Filtering links to same domain",id:"filtering-links-to-same-domain",level:4},{value:"Enqueueing links to <code>RequestQueue</code>",id:"enqueueing-links-to-requestqueue",level:4},{value:"Scrape the newly enqueued links",id:"scrape-the-newly-enqueued-links",level:4},{value:"The <code>maxRequestsPerCrawl</code> limit",id:"the-maxrequestspercrawl-limit",level:5},{value:"Putting it all together",id:"putting-it-all-together-1",level:4},{value:"Using Apify SDK to enqueue links like a boss",id:"using-apify-sdk-to-enqueue-links-like-a-boss",level:2},{value:"Meet <code>Apify.utils</code>",id:"meet-apifyutils",level:3},{value:"Introduction to <code>Apify.utils.enqueueLinks()</code>",id:"introduction-to-apifyutilsenqueuelinks",level:3},{value:"Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code>",id:"basic-use-of-enqueuelinks-with-cheeriocrawler",level:3},{value:"Introduction to pseudo-URLs",id:"introduction-to-pseudo-urls",level:4},{value:"Structure of a pseudo-URL",id:"structure-of-a-pseudo-url",level:4},{value:"Using <code>enqueueLinks()</code> to filter links",id:"using-enqueuelinks-to-filter-links",level:4},{value:"Resolving relative URLs with <code>enqueueLinks()</code>",id:"resolving-relative-urls-with-enqueuelinks",level:4},{value:"Integrating <code>enqueueLinks()</code> into our crawler",id:"integrating-enqueuelinks-into-our-crawler",level:4},{value:"Getting some real-world data",id:"getting-some-real-world-data",level:2},{value:"The importance of having a plan",id:"the-importance-of-having-a-plan",level:3},{value:"Choosing the data we need",id:"choosing-the-data-we-need",level:4},{value:"Analyzing the target",id:"analyzing-the-target",level:4},{value:"The start URL(s)",id:"the-start-urls",level:4},{value:"The crawling strategy",id:"the-crawling-strategy",level:3},{value:"Using a <code>RequestList</code>",id:"using-a-requestlist",level:4},{value:"DevTools crash course",id:"devtools-crash-course",level:4},{value:"Enqueueing the detail links using a custom selector",id:"enqueueing-the-detail-links-using-a-custom-selector",level:4},{value:"The <code>selector</code> parameter of <code>enqueueLinks()</code>",id:"the-selector-parameter-of-enqueuelinks",level:5},{value:"The missing <code>pseudoUrls</code>",id:"the-missing-pseudourls",level:5},{value:"Finally, the <code>userData</code> of <code>enqueueLinks()</code>",id:"finally-the-userdata-of-enqueuelinks",level:5},{value:"Another sanity check",id:"another-sanity-check",level:4},{value:"Scraping data",id:"scraping-data",level:3},{value:"Scraping the URL, Owner and Unique identifier",id:"scraping-the-url-owner-and-unique-identifier",level:4},{value:"Scraping Title, Description, Last modification date and Number of runs",id:"scraping-title-description-last-modification-date-and-number-of-runs",level:4},{value:"Title",id:"title",level:5},{value:"Description",id:"description",level:5},{value:"Last modification date",id:"last-modification-date",level:5},{value:"Run count",id:"run-count",level:5},{value:"Trying it out (sanity check #3)",id:"trying-it-out-sanity-check-3",level:4},{value:"Saving the scraped data",id:"saving-the-scraped-data",level:3},{value:"What's <code>Apify.pushData()</code>",id:"whats-apifypushdata",level:4},{value:"Finding my saved data",id:"finding-my-saved-data",level:4},{value:"Dataset on the Apify platform",id:"dataset-on-the-apify-platform",level:5},{value:"Local Dataset",id:"local-dataset",level:5},{value:"Final touch",id:"final-touch",level:3},{value:"Meet the <code>INPUT</code>",id:"meet-the-input",level:4},{value:"Use <code>INPUT</code> to seed our actor with categories",id:"use-input-to-seed-our-actor-with-categories",level:4},{value:"Structuring the code better",id:"structuring-the-code-better",level:4},{value:"Splitting your code into multiple files",id:"splitting-your-code-into-multiple-files",level:4},{value:"Using <code>Apify.utils.log</code> instead of <code>console.log</code>",id:"using-apifyutilslog-instead-of-consolelog",level:4},{value:"Using a router to structure your crawling",id:"using-a-router-to-structure-your-crawling",level:4}],h={toc:d},c="wrapper";function m(e){var t=e.components,l=(0,o.Z)(e,r);return(0,i.kt)(c,(0,a.Z)({},h,l,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary\nrequests, but that only gets you raw HTML and sometimes not even that. Then you have to read this HTML and extract the data you're interested in. Once\nextracted, it must be stored in a machine-readable format and easily accessible for further processing, because it is the processed data that holds\nvalue."),(0,i.kt)("p",null,"Apify SDK covers the process end-to-end. From crawling the web for links and scraping the raw data to storing it in various machine readable formats,\nready for processing. With this guide in hand, you should have your own data extraction solutions up and running in a few hours."),(0,i.kt)("h2",{id:"intro"},"Intro"),(0,i.kt)("p",null,"The goal of this getting started guide is to provide a step-by-step introduction to all the features of the Apify SDK. It will walk you through\ncreating the simplest of crawlers that only prints text to console, all the way up to complex systems that crawl pages, interact with them as if a real\nuser were sitting in front of a real browser and output structured data."),(0,i.kt)("p",null,"Since Apify SDK is usable both locally on any computer and on the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you will be able\nto use the source code in both environments interchangeably. Nevertheless, some initial setup is still required, so choose your preferred starting\nenvironment and let's get into it."),(0,i.kt)("h2",{id:"setting-up-locally"},"Setting up locally"),(0,i.kt)("p",null,"To run Apify SDK on your own computer, you need to meet the following pre-requisites first:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Have Node.js version 10.17 or higher, with the exception of Node.js 11, installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Visit ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/",target:"_blank",rel:"noopener"},"Node.js website")," to download or use\n",(0,i.kt)("a",{parentName:"li",href:"https://github.com/creationix/nvm",target:"_blank",rel:"noopener"},"nvm")))),(0,i.kt)("li",{parentName:"ol"},"Have NPM installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"NPM comes bundled with Node.js so you should already have it. If not, reinstall Node.js.")))),(0,i.kt)("p",null,"If you're not certain, confirm the prerequisites by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"node -v\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm -v\n")),(0,i.kt)("h3",{id:"creating-a-new-project"},"Creating a new project"),(0,i.kt)("p",null,"The fastest and best way to create new projects with the Apify SDK is to use our own\n",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),". This command line tool allows you to create, run and manage Apify\nprojects with ease, including their deployment to the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," if you wish to run them in the\ncloud after developing them locally."),(0,i.kt)("p",null,"Let's install the Apify CLI with the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\n")),(0,i.kt)("p",null,"Once the installation finishes, all you need to do to set up an Apify SDK project is to run:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-new-project\n")),(0,i.kt)("p",null,"A prompt will be shown, asking you to choose a template. Disregard the different options for now and choose the template labeled ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello world"),". The\ncommand will now create a new directory in your current working directory, called ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project"),", create a ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json")," in this folder and install\nall the necessary dependencies. It will also add example source code that you can immediately run."),(0,i.kt)("p",null,"Let's try that!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-new-project\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify run -p\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"-p")," flag is great to remember, because it stands for ",(0,i.kt)("inlineCode",{parentName:"p"},"--purge")," and it clears out your persistent storages before starting the actor.\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," and named storages are kept. Whenever you're just restarting your actor and you're not interested in the data of the previous run, you\nshould use ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run -p")," to prevent the old state from messing with your current run. If this is confusing, don't worry. You'll learn about\nstorages and ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," soon.")),(0,i.kt)("p",null,"You should start seeing log messages in the terminal as the system boots up and after a second, a Chromium browser window should pop up. In the\nwindow, you'll see quickly changing pages and back in the terminal, you should see the titles (contents of the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," HTML tags) of the pages\nprinted."),(0,i.kt)("p",null,"You can always terminate the crawl with a keypress in the terminal:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"CTRL+C\n")),(0,i.kt)("p",null,"Did you see all that? If you did, congratulations! You're ready to go!"),(0,i.kt)("h2",{id:"setting-up-on-the-apify-platform"},"Setting up on the Apify Platform"),(0,i.kt)("p",null,"Maybe you don't have Node.js installed and don't want the hassle. Or you can't install anything on your computer because you're using one provided by your company. Or perhaps you'd just prefer to start working in the cloud right away. Well, no worries, we've got you covered."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," is the foundational product of\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify"),". It's a serverless cloud computing platform, specifically designed for any web automation jobs,\nthat may include crawling and scraping, but really works amazingly for any batch jobs and long-running tasks."),(0,i.kt)("p",null,"It comes with a free account, so let's go to our ",(0,i.kt)("a",{parentName:"p",href:"https://my.apify.com/sign-up",target:"_blank",rel:"noopener"},"sign-up page")," and create one, if you\nhaven't already. Don't forget to verify your email. Without it, you won't be able to run any projects."),(0,i.kt)("p",null,"Once you're in, you might be prompted by our in-app help to walk through a step-by-step guide to some of our new features. Feel free to finish that,\nif you'd like, but once you're done, click on the ",(0,i.kt)("strong",{parentName:"p"},"Actors")," tab in the left menu. To read more about ",(0,i.kt)("strong",{parentName:"p"},"Actors"),", see:\n",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#what-is-an-actor",target:null,rel:null},"What is an actor")),(0,i.kt)("h3",{id:"creating-a-new-project-1"},"Creating a new project"),(0,i.kt)("p",null,"In the page that shows after clicking on Actors in the left menu, choose ",(0,i.kt)("strong",{parentName:"p"},"Create new"),". Give it a name in the form that opens, let's say,\n",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-actor"),". Disregard all the available options for now and save your changes."),(0,i.kt)("p",null,"Now click on the ",(0,i.kt)("strong",{parentName:"p"},"Sources")," tab at the top. Disregard the version and environment variables inputs for now and proceed directly to ",(0,i.kt)("strong",{parentName:"p"},"Source code"),".\nThis is where you develop the actor, if you choose not to do it locally. Just press ",(0,i.kt)("strong",{parentName:"p"},"Run")," below the ",(0,i.kt)("strong",{parentName:"p"},"Source code")," panel. It will automatically\nbuild and run the example source code. You should start seeing log messages that represent the build and after the build is complete, the log messages of\nthe running actor. Feel free to check out the other ",(0,i.kt)("strong",{parentName:"p"},"Run")," tabs, such as ",(0,i.kt)("strong",{parentName:"p"},"Info"),", where you can find useful information about the run, or\n",(0,i.kt)("strong",{parentName:"p"},"Key-value-store"),", where the actor's ",(0,i.kt)("strong",{parentName:"p"},"INPUT"),"\xa0and ",(0,i.kt)("strong",{parentName:"p"},"OUTPUT")," are stored."),(0,i.kt)("p",null,"Good job. You're now ready to run your own source code on the Apify Platform. For more information, visit the\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Actor documentation page"),", where you'll find everything about the platform's various\noptions."),(0,i.kt)("h2",{id:"first-crawler"},"First crawler"),(0,i.kt)("p",null,"Whether you've chosen to develop locally or in the cloud, it's time to start writing some actual source code. But before we do, let's just briefly\nintroduce all the Apify SDK classes necessary to make it happen."),(0,i.kt)("h3",{id:"the-general-idea"},"The general idea"),(0,i.kt)("p",null,"There are 3 crawler classes available for use in the Apify SDK. ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nand ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),". We'll talk about their differences later. Now, let's talk about what they have in common."),(0,i.kt)("p",null,"The general idea of each crawler is to go to a web page, open it, do some stuff there, save some results and continue to the next page, until it's done\nits job. So the crawler always needs to find answers to two questions: ",(0,i.kt)("strong",{parentName:"p"},"Where should I go?")," and ",(0,i.kt)("strong",{parentName:"p"},"What should I do there?")," Answering those two\nquestions is the only setup mandatory for running the crawlers."),(0,i.kt)("h3",{id:"the-where---request-requestlist-and-requestqueue"},"The Where - ",(0,i.kt)("inlineCode",{parentName:"h3"},"Request"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestQueue")),(0,i.kt)("p",null,"All crawlers use instances of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class to determine where they need to go. Each request may hold a lot of information,\nbut at the very least, it must hold a URL - a web page to open. But having only one URL would not make sense for crawling. We need to either have a\npre-existing list of our own URLs that we wish to visit, perhaps a thousand, or a million, or we need to build this list dynamically as we crawl,\nadding more and more URLs to the list as we progress."),(0,i.kt)("p",null,"A representation of the pre-existing list is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class. It is a static, immutable list of URLs and\nother metadata (see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," object) that the crawler will visit, one by one, retrying whenever an error occurs, until there\nare no more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," on the other hand, represents a dynamic queue of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". One that can be updated at runtime by adding more\npages - ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process. This allows the crawler to open one page, extract interesting URLs, such as links to other pages on the same domain,\nadd them to the queue (called ",(0,i.kt)("em",{parentName:"p"},"enqueuing"),") and repeat this process to build a queue of tens of thousands or more URLs while knowing only a single one\nat the beginning."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are essential for the crawler's operation. There is no other way to supply ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),' = "pages to crawl" to the\ncrawlers. At least one of them always needs to be provided while setting up. You can also use both at the same time, if you wish.'),(0,i.kt)("h3",{id:"the-what---handlepagefunction"},"The What - ",(0,i.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is the brain of the crawler. It tells it what to do at each and every page it visits. Generally it handles extraction of data\nfrom the page, processing the data, saving it, calling APIs, doing calculations and whatever else you need it to do."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is provided by you, the user, and invoked automatically by the crawler for each ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," from either the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". It always receives a single argument and that is a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object"),". Its properties change depending on the crawler class used, but it\nalways includes at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, which represents the currently crawled ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance (i.e. the URL the crawler is visiting and\nrelated metadata) and the ",(0,i.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," property, which is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class and we'll talk about\nit in detail later."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// The object received as a single argument by the handlePageFunction\n{\n request: Request,\n autoscaledPool: AutoscaledPool\n}\n")),(0,i.kt)("h3",{id:"putting-it-all-together"},"Putting it all together"),(0,i.kt)("p",null,"Enough theory! Let's put some of those hard-learned facts into practice. We learned above that we need ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to setup\na crawler. We will also use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function. It's not mandatory, but it makes our life easier. We'll\nlearn about it in detail later on."),(0,i.kt)("p",null,"Let's start with something super easy. Visit a page, get its title and close. First of all we need to require Apify, to make all of its features available to us:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n")),(0,i.kt)("p",null,"Easy, right? It really doesn't get much more difficult than that. For the purposes of this tutorial, we'll be scraping our own webpage\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"https://apify.com"),". Now, to get there, we need a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," with the page's URL in one of our sources,\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". Let's go with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," for now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\n// This is how you use the Apify.main() function.\nApify.main(async () => {\n // First we create the request queue instance.\n const requestQueue = await Apify.openRequestQueue();\n // And then we add a request to it.\n await requestQueue.addRequest({ url: 'https://apify.com' });\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you're not familiar with the ",(0,i.kt)("inlineCode",{parentName:"p"},"async")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords used in the example, you should know that these are native syntax in modern JavaScript. You can\n",(0,i.kt)("a",{parentName:"p",href:"https://nikgrozev.com/2017/10/01/async-await/",target:"_blank",rel:"noopener"},"learn more about them here"),".")),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue#addrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"requestQueue.addRequest()"))," function automatically converts the plain object we passed to it to a\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance, so now we have a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," that holds one ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," which points to ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),". Now we need the\n",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// We'll define the function separately so it's more obvious.\nconst handlePageFunction = async ({ request, $ }) => {\n // This should look familiar if you ever worked with jQuery.\n // We're just getting the text content of the <title> HTML element.\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n};\n")),(0,i.kt)("p",null,"Wait, where did the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," come from? Remember what we learned about the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," earlier. It expects a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," as an argument that\nwill always have a ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, but it will also have other properties, depending on the chosen crawler class. Well, ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," is a property provided\nby the ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," class, which we'll set up right now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And we're done! You just created your first crawler from scratch. It will download the HTML of ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),", find the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," element, get\nits text content and print it to console. Good job!"),(0,i.kt)("p",null,"To run the code locally, copy and paste the code, if you haven't already typed it in yourself, to the ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file in the ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project")," we\ncreated earlier and run ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run")," from that project's directory."),(0,i.kt)("p",null,"To run the code on Apify Platform, just replace the original example with your new code and hit Run."),(0,i.kt)("p",null,"Whichever environment you choose, you should see the message\n",(0,i.kt)("inlineCode",{parentName:"p"},'The title of "https://apify.com" is: Web Scraping, Data Extraction and Automation - Apify.')," printed to the screen. If you do, congratulations and\nlet's move onto some bigger challenges! And if you feel like you don't really know what just happened there, no worries, it will all become clear when\nyou learn more about ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("h2",{id:"cheeriocrawler-aka-jquery-crawler"},"CheerioCrawler aka jQuery crawler"),(0,i.kt)("p",null,"This is the crawler that we used in our earlier example. Our simplest and also the fastest crawling solution. If you're familiar with ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", you'll\nunderstand ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," in minutes. ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," is\nessentially ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," for Node.js. It offers the same API, including the familiar ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object. You can use it, as you would ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", for manipulating\nthe DOM of a HTML page. In crawling, you'll mostly use it to select the right elements and extract their text values - the data you're interested in.\nBut ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," runs in a browser and attaches directly to the browser's DOM. Where does ",(0,i.kt)("inlineCode",{parentName:"p"},"cheerio")," get its HTML? This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"Crawler")," part of\n",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," comes in."),(0,i.kt)("h3",{id:"overview"},"Overview"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," crawls by making plain HTTP requests to the provided URLs. As you remember from the previous section, the\nURLs are fed to the crawler using either the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". The HTTP responses\nit gets back are HTML pages, the same pages you would get in your browser when you first load a URL."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note, however, that modern web pages often do not serve all of their content in the first HTML response, but rather the first HTML contains links to\nother resources such as CSS and JavaScript that get downloaded afterwards and together they create the final page. See our\n",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to crawl those.")),(0,i.kt)("p",null,"Once the page's HTML is retrieved, the crawler will pass it to ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," for\nparsing. The result is the typical ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function, which should be familiar to ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," users. You can use this ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," to do all sorts of lookups and\nmanipulation of the page's HTML, but in scraping, we will mostly use it to find specific HTML elements and extract their data."),(0,i.kt)("p",null,"Example use of Cheerio and its ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function in comparison to browser JavaScript:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Return the text content of the <title> element.\ndocument.querySelector('title').textContent; // plain JS\n$('title').text(); // Cheerio\n\n// Return an array of all 'href' links on the page.\nArray.from(document.querySelectorAll('[href]')).map(el => el.href); // plain JS\n$('[href]')\n .map((i, el) => $(el).attr('href'))\n .get(); // Cheerio\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"This is not to show that Cheerio is better than plain browser JavaScript. Some might actually prefer the more expressive way plain JS provides.\nUnfortunately, the browser JavaScript methods are not available in Node.js, so Cheerio is our best bet to do the parsing.")),(0,i.kt)("h3",{id:"when-to-use-cheeriocrawler"},"When to use ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Even though using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," is extremely easy, it probably will not be your first choice for most kinds of crawling or scraping in production\nenvironments. Since most websites nowadays use modern JavaScript to create rich, responsive and data-driven user experiences, the plain HTTP requests\nthe crawler uses may just fall short of your needs."),(0,i.kt)("p",null,"But ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," is far from useless! It really shines when you need to cope with extremely high workloads. With just 4 GBs of memory and a single CPU\ncore, you can scrape 500 or more pages a minute! ",(0,i.kt)("em",{parentName:"p"},"(assuming each page contains approximately 400KB of HTML)")," To scrape this fast with a full browser\nscraper, such as the ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", you'd need significantly more computing power."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Extremely fast"),(0,i.kt)("li",{parentName:"ul"},"Easy to set up"),(0,i.kt)("li",{parentName:"ul"},"Familiar for jQuery users"),(0,i.kt)("li",{parentName:"ul"},"Super cheap to run"),(0,i.kt)("li",{parentName:"ul"},"Each request can go through a different proxy")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Disadvantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Does not work for all websites"),(0,i.kt)("li",{parentName:"ul"},"May easily overload the target website with requests"),(0,i.kt)("li",{parentName:"ul"},"Does not enable any manipulation of the website before scraping")),(0,i.kt)("h3",{id:"basic-use-of-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Now that we have an idea of the crawler's inner workings, let's build one. We'll use the example from the previous section and improve on it by\nletting it truly crawl the page, finding new links as it goes, enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and then scraping them."),(0,i.kt)("h4",{id:"refresher"},"Refresher"),(0,i.kt)("p",null,"Just to refresh your memory, in the previous section we built a very simple crawler that downloads the HTML of a single page, reads its title and prints\nit to the console. This is the original source code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Earlier we said that we would let the crawler:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"So let's get to it!"),(0,i.kt)("h4",{id:"finding-new-links"},"Finding new links"),(0,i.kt)("p",null,"There are numerous approaches to finding links to follow when crawling the web. For our purposes, we will be looking for ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute. For example ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="https://apify.com/store>This is a link to Apify Store</a>'),". To do this, we need to update our Cheerio\nfunction."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n")),(0,i.kt)("p",null,"Our new function finds all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain the ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute and extracts the attributes into an array of strings. But there's a problem. There could be relative links in the list and those can't be used on their own. We need to resolve them using our domain as base URL and\nwe will use one of Node.js' standard libraries to do this."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst ourDomain = 'https://apify.com';\nconst absoluteUrls = links.map(link => new URL(link, ourDomain));\n")),(0,i.kt)("h4",{id:"filtering-links-to-same-domain"},"Filtering links to same domain"),(0,i.kt)("p",null,"Websites typically contain a lot of links that lead away from the original page. This is normal, but when crawling a website, we usually want to crawl\nthat one site and not let our crawler wander away to Google, Facebook and Twitter. Therefore, we need to filter out the off-domain links and only\nkeep the ones that lead to the same domain."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Don't worry, we'll learn how to do this with a single function call using Apify in a few moments.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst ourDomain = 'apify.com';\nconst absoluteUrls = links.map(link => new URL(link, ourDomain));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n// ...\n")),(0,i.kt)("h4",{id:"enqueueing-links-to-requestqueue"},"Enqueueing links to ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestQueue")),(0,i.kt)("p",null,"This should be easy, because we already did that ",(0,i.kt)("a",{parentName:"p",href:"#putting-it-all-together",target:null,rel:null},"earlier"),", remember? Just call ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue.addRequest()")," for all the new\nlinks. This will add them to the end of the queue for processing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst ourDomain = 'https://apify.com';\nconst absoluteUrls = links.map(link => new URL(link, ourDomain));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n// Add the requests in series. There's of course room for speed\n// improvement by parallelization. Try to implement it, if you wish.\nconsole.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\nfor (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n}\n\n// ...\n")),(0,i.kt)("h4",{id:"scrape-the-newly-enqueued-links"},"Scrape the newly enqueued links"),(0,i.kt)("p",null,"And we're approching the finishing line. All we need to do now is integrate the new code into our original crawler. It will be easy, because\nalmost everything needs to go into the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". But just before we do that, let's introduce the first crawler configuration option that\nis not a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". It's called ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl"),"."),(0,i.kt)("h5",{id:"the-maxrequestspercrawl-limit"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"maxRequestsPerCrawl")," limit"),(0,i.kt)("p",null,"This configuration option is available in all crawler classes and you can use it to limit the number of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," the crawler should process. It's\nvery useful when you're just testing your code or when your crawler could potentially crawl millions of pages and you want to save resources. You can\nadd it to the crawler options like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("p",null,"This limits the number of successfully handled ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to 20. Bear in mind that the actual number of processed requests might be a little higher\nand that's because usually there are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," processed at the same time and once the 20th ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," finishes, the other running ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),"\nwill be allowed to finish too."),(0,i.kt)("h4",{id:"putting-it-all-together-1"},"Putting it all together"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const ourDomain = 'https://apify.com';\n const absoluteUrls = links.map(link => new URL(link, ourDomain));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"No matter if you followed along with our coding or just copy-pasted the resulting source, try running it now, perhaps even in both environments. You\nshould see the crawler log the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the first page, then the ",(0,i.kt)("strong",{parentName:"p"},"enqueueing")," message showing number of URLs, followed by the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the\nfirst enqueued page and so on and so on."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you need help with running the code, refer back to the chapters on environment setup: ",(0,i.kt)("a",{parentName:"p",href:"#setting-up-locally",target:null,rel:null},"Setting up locally")," and\n",(0,i.kt)("a",{parentName:"p",href:"#setting-up-on-the-apify-platform",target:null,rel:null},"Setting up on the Apify platform"),".")),(0,i.kt)("h2",{id:"using-apify-sdk-to-enqueue-links-like-a-boss"},"Using Apify SDK to enqueue links like a boss"),(0,i.kt)("p",null,"If you were paying attention carefully in the previous chapter, we said that we would show you a way to enqueue new ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," with a single function\ncall. You might be wondering why we had to go through the whole process of getting the individual links, filtering the same domain ones and then\nmanually enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),", when there is a simpler way."),(0,i.kt)("p",null,"Well, the obvious reason is practice. This is a tutorial after all. The other reason is to make you think about all the bits and pieces that come\ntogether, so that in the end, a new page, not previously entered in by you, can be scraped. We think that by seeing the bigger picture, you will be\nable to get the most out of Apify SDK."),(0,i.kt)("h3",{id:"meet-apifyutils"},"Meet ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils")),(0,i.kt)("p",null,"We will talk at length about them later, but in short, ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," is a namespace where you can find various helpful functions and constants that\nmake your life easier. One of the available functions is ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," which encapsulates the whole enqueueing process and even adds\nsome extra functionality."),(0,i.kt)("h3",{id:"introduction-to-apifyutilsenqueuelinks"},"Introduction to ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils.enqueueLinks()")),(0,i.kt)("p",null,"Since enqueuing new links to crawl is such an integral part of web crawling, we created a function that attempts to simplify this process as much as\npossible. With a single function call, it allows you to find all the links on a page that match specified criteria and add them to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),".\nIt also allows you to modify the resulting ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to match your crawling needs."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," is quite a powerful function so, like crawlers, it gets its arguments from an options object. This is useful, because you don't have to\nremember their order! But also because we can easily extend its API and add new features. You can\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},"find the full reference here"),"."),(0,i.kt)("p",null,"We suggest using ES6 destructuring to grab the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function off of the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils")," object, so you don't have to type ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," all the\ntime."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\n// Now you can use enqueueLinks like this:\nawait enqueueLinks({\n /* options */\n});\n")),(0,i.kt)("h3",{id:"basic-use-of-enqueuelinks-with-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"enqueueLinks()")," with ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"We already implemented logic that takes care of enqueueing new links to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," in the previous chapter on ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". Let's look at\nthat logic and implement the same functionality using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),"."),(0,i.kt)("p",null,"We found that the crawler needed to do these 4 things to crawl ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),":"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"Using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," we can squash the first 3 into a single function call, if we set the options correctly. For now, let's just stick to the\nbasics. At the very least, we need a source where to find the links and the queue to enqueue them to. The ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," Cheerio object is one of the sources the\nfunction accepts and we already know how to work with it in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". We also know how to get a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," instance."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nawait enqueueLinks({ $, requestQueue });\n")),(0,i.kt)("p",null,"That's all we need to do to enqueue all ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="...">')," links from the given page to the given queue. Easy, right? Scratch number 1 and 3 off the\nlist. Only number 2 remains and to tackle this one, we need to talk about yet another new concept, the pseudo-URL."),(0,i.kt)("h4",{id:"introduction-to-pseudo-urls"},"Introduction to pseudo-URLs"),(0,i.kt)("p",null,"Pseudo-URLs are represented by our ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class and even though the name sounds discouraging, they're a pretty simple concept. They're just URLs\nwith some parts replaced by wildcards (read ",(0,i.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions"},"regular\nexpressions"),"). They are matched against URLs to find specific links, domains, patterns, file extensions and so on."),(0,i.kt)("p",null,"In scraping, there are usually patterns to be found in website URLs that can be leveraged to scrape only the pages we're interested in. Imagine\na typical online store. It has different categories which list different items The URL for might looks something like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\n")),(0,i.kt)("p",null,"A category would then have a different URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\n")),(0,i.kt)("p",null,"Going to this page would produce a list of offered computers. Then, clicking on one of the computers might take us to a detail URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"As you can see, there's a structure to the links. In the real world, the structure might not always be perfectly obvious, but it's very often there.\nPseudo-URLs help to use this structure to select only the relevant links from a given page."),(0,i.kt)("h4",{id:"structure-of-a-pseudo-url"},"Structure of a pseudo-URL"),(0,i.kt)("p",null,"A pseudo-URL is a URL with ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions",target:"_blank",rel:"noopener"},"regular expressions"),") enclosed\nin ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Since we're running Node.js, the regular expressions should follow the JavaScript style."),(0,i.kt)("p",null,"For example, a pseudo-URL"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/[(\\w|-)+]\n")),(0,i.kt)("p",null,"will match all of the following URLs:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\nhttps://www.online-store.com/categories/mobile-phones\nhttps://www.online-store.com/categories/black-friday\n")),(0,i.kt)("p",null,"but it will not match"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\nhttps://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"This way, you can easily find just the URLs that you're looking for while ignoring the rest."),(0,i.kt)("p",null,"A pseudo-URL may include any number of bracketed regular expressions, so you can compose much more complex matching logic. The following Pseudo URL\nwill match the items in the store even if the links use the non-secure ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," protocol, omit the ",(0,i.kt)("inlineCode",{parentName:"p"},"www")," from the hostname or use a different TLD."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http[s?]://[(www)?\\.]online-store.[com|net|org]/items/[\\d+]\n")),(0,i.kt)("p",null,"will match any combination of:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://www.online-store.org/items/12345\nhttps://online-store.com/items/633423\nhttp://online-store.net/items/7003\n")),(0,i.kt)("p",null,"but it will not match:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://shop.online-store.org/items/12345\nhttps://www.online-store.com/items/calculator\nwww.online-store.org/items/7003\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pssst! Don't tell anyone, but you can create ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrls")," with plain old ",(0,i.kt)("inlineCode",{parentName:"p"},"RegExp")," instances instead of this brackety madness as well.")),(0,i.kt)("h4",{id:"using-enqueuelinks-to-filter-links"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," to filter links"),(0,i.kt)("p",null,"That's been quite a lot of theory and examples. We might as well put it to practice. Going back to our ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," exercise, we still have number\n2 left to cross off the list - filter links pointing to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),". We've already shown that at the very least, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function needs\ntwo arguments. The source, in our case the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object, and the destination - the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". To filter links, we need to add a third argument:\n",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls"),"."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"options.pseudoUrls")," argument is always an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array"),", but its contents can take on many forms. ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"See the reference"),"\nfor all of them. Since we just need to filter out same domain links, we'll keep it simple and use a pseudo-URL ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To break the pseudo-URL string down, we're looking for both ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," protocols and the links may only lead to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," domain. The\nfinal brackets ",(0,i.kt)("inlineCode",{parentName:"p"},"[.*]")," allow everything, so ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/contact")," as well as ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," will match. If this sounds complex to you, we suggest\n",(0,i.kt)("a",{parentName:"p",href:"https://www.regular-expressions.info/tutorial.html",target:"_blank",rel:"noopener"},"reading a tutorial")," or two on regular expression syntax.")),(0,i.kt)("h4",{id:"resolving-relative-urls-with-enqueuelinks"},"Resolving relative URLs with ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"TLDR;")," Just use ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl: request.loadedUrl")," when working with ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"This is probably the weirdest and most complicated addition to the list. This is not the place to talk at length about\n",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/2005079/absolute-vs-relative-urls",target:"_blank",rel:"noopener"},"absolute and relative paths"),", but in short, the\nlinks we encounter in a page can either be absolute, such as:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/john-doe/my-actor\n")),(0,i.kt)("p",null,"or relative:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"./john-doe/my-actor\n")),(0,i.kt)("p",null,"Browsers handle this automatically, but since we're only using plain HTTP requests, we need to tell the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function how to resolve the\nrelative links to the absolute ones, so we can use them for scraping. This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl")," comes into play, because it returns the\ncorrect URL to use as ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$', 'requestQueue' and 'request' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Even though it seems possible, we can't use the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.url")," of our ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances, because the page could have been redirected and the final\nURL would be different from the one we requested.")),(0,i.kt)("h4",{id:"integrating-enqueuelinks-into-our-crawler"},"Integrating ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," into our crawler"),(0,i.kt)("p",null,"That was fairly easy, wasn't it. That ticks number 2 off our list and we're done! Let's take a look at the original crawler code, where we\nenqueued all the links manually."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const ourDomain = 'https://apify.com';\n const absoluteUrls = links.map(link => new URL(link, ourDomain));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Since we've already prepared the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," options, we can just replace all the above enqueuing logic with a single function call, as promised."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Enqueue links\n const enqueued = await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n });\n console.log(`Enqueued ${enqueued.length} URLs.`);\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And that's it! No more parsing the links from HTML using Cheerio, filtering them and enqueueing them one by one It all gets done automatically!\n",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," is just one example of Apify SDK's powerful helper functions. They're all designed to make your life easier so you can focus on\ngetting your data, while leaving the mundane crawling management to your tools."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," has a lot more tricks up its sleeve. Make sure to check out the\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"reference documentation")," to see what else it can do for you. Namely the feature to prepopulate the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"\ninstances it creates with ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," of your choice is extremely useful!"),(0,i.kt)("h2",{id:"getting-some-real-world-data"},"Getting some real-world data"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Hey, guys, you know, it's cool that we can scrape the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," elements of web pages, but that's not very useful. Can we finally scrape some real\ndata and save it somewhere in a machine readable format? Because that's why you started reading this tutorial in the first place!")),(0,i.kt)("p",null,"We hear you, young padawan! First, learn how to crawl, you must. Only then, walk through data, you can!"),(0,i.kt)("p",null,"###\xa0Making a store crawler"),(0,i.kt)("p",null,"Fortunately, we don't have to travel to a galaxy far far away to find a good candidate for learning how to scrape\nstructured data. The ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," is a library of public actors that anyone can grab and use. You\ncan find ready-made solutions for crawling ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/drobnikj/crawler-google-places",target:"_blank",rel:"noopener"},"Google Places"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/vaclavrut/amazon-crawler",target:"_blank",rel:"noopener"},"Amazon"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/google-search-scraper",target:"_blank",rel:"noopener"},"Google Search"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/dtrungtin/booking-scraper",target:"_blank",rel:"noopener"},"Booking"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/jaroslavhejlek/instagram-scraper",target:"_blank",rel:"noopener"},"Instagram"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/maxcopell/tripadvisor",target:"_blank",rel:"noopener"},"Tripadvisor")," and many other websites. Feel free to check them out! It's also a great place to practice our Jedi scraping skills since it has categories, lists and details. That's almost like our imaginary\n",(0,i.kt)("inlineCode",{parentName:"p"},"online-store.com")," from the previous chapter."),(0,i.kt)("h3",{id:"the-importance-of-having-a-plan"},"The importance of having a plan"),(0,i.kt)("p",null,'Sometimes scraping is really straightforward, but most of the times, it really pays to do a little bit of research first. How is the website\nstructured? Can I scrape it only with HTTP requests (read "with ',(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"\") or would I need a full browser solution? Are there any\nanti-scraping protections in place? Do I need to parse the HTML or can I get the data otherwise, such as directly from the website's API. Jakub,\none of Apify's founders, wrote a\n",(0,i.kt)("a",{parentName:"p",href:"https://blog.apify.com/web-scraping-in-2018-forget-html-use-xhrs-metadata-or-javascript-variables-8167f252439c",target:"_blank",rel:"noopener"},"great article about all the different techniques"),"\nand tips and tricks, so make sure to check that out!"),(0,i.kt)("p",null,"For the purposes of this tutorial, let's just go ahead with HTTP requests and HTML parsing using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". The number one reason being: We\nalready know how to use it and we want to build on that knowledge to learn specific crawling and scraping techniques."),(0,i.kt)("h4",{id:"choosing-the-data-we-need"},"Choosing the data we need"),(0,i.kt)("p",null,"A good first step is always to figure out what it is we want to scrape and where to find it. For the time being, let's just agree that we want to\nscrape all actors (see the ",(0,i.kt)("inlineCode",{parentName:"p"},"Show")," dropdown) in all categories (which can be found on the left side of the page) and for each actor we want to get its"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,'We can see that some of the information is available directly on the list page, but for details such as "Last modification date" or "Number of runs" we\'ll also need\nto open the actor detail pages.'),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"analyzing-the-target"},"Analyzing the target"),(0,i.kt)("p",null,"Knowing that we will use plain HTTP requests, we immediately know that we won't be able to manipulate the website in any way. We will only be able to\ngo through the HTML it gives us and parse our data from there. This might sound like a huge limitation, but you might be surprised in how effective it\ncan be. Let's get to it!"),(0,i.kt)("h4",{id:"the-start-urls"},"The start URL(s)"),(0,i.kt)("p",null,"This is where we start our crawl. It's convenient to start as close to our data as possible. For example, it wouldn't make much sense to start at\n",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," and look for a ",(0,i.kt)("inlineCode",{parentName:"p"},"store")," link there, when we already know that everything we want to extract can be found at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page."),(0,i.kt)("p",null,"Once we look at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page more carefully, we see that the categories themselves produce URLs that we can use to access those\nindividual categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("p",null,"Should we write down all the category URLs down and use all of them as start URLs? It's definitely possible, but what if a new category appears on the\npage later? We would not learn about it unless we manually visit the page and inspect it again. So scraping the category links off the store page\ndefinitely makes sense. This way we always get an up to date list of categories."),(0,i.kt)("p",null,"But is it really that straightforward? By digging further into the store page's HTML we find that it does not actually contain the category links. The\nmenu on the left uses JavaScript to display the items from a given category and, as we've learned earlier, ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," cannot execute JavaScript."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We've deliberately chosen this scenario to show an example of the number one weakness of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". We will overcome this difficulty in our\n",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," tutorial, but at the cost of compute resources and speed. Always remember that no tool is best for everything!")),(0,i.kt)("p",null,"So we're back to the pre-selected list of URLs. Since we cannot scrape the list dynamically, we have to manually collect the links and then use them\nin our crawler. We lose the ability to scrape new categories, but we keep the low resource consumption and speed advantages of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"Therefore, after careful consideration, we've determined that we should use multiple start URLs and that they should look as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\nhttps://apify.com/store?category=ECOMMERCE\nhttps://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("h3",{id:"the-crawling-strategy"},"The crawling strategy"),(0,i.kt)("p",null,"Now that we know where to start, we need to figure out where to go next. Since we've eliminated one level of crawling by selecting the categories\nmanually, we now only need to crawl the actor detail pages. The algorithm therefore follows:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Visit the category list page (one of our start URLs)."),(0,i.kt)("li",{parentName:"ol"},"Enqueue all links to actor details."),(0,i.kt)("li",{parentName:"ol"},"Visit all actor details and extract data."),(0,i.kt)("li",{parentName:"ol"},"Repeat 1 - 3 for all categories.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Technically, this is a depth first crawl and the crawler will perform a breadth first crawl by default, but that's an implementation detail. We've\nchosen this notation since a breadth first crawl would be less readable.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will make sure to visit the pages for us, if we provide the correct ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and we already know how to enqueue pages, so this\nshould be fairly easy. Nevertheless, there are two more tricks that we'd like to show you."),(0,i.kt)("h4",{id:"using-a-requestlist"},"Using a ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestList")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is a perfect tool for scraping a pre-existing list of URLs and if you think about our start URLs, this is exactly what we have! A list\nof links to the different categories of the store. Let's see how we'd get them into a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n];\n\nconst requestList = await Apify.openRequestList('categories', sources);\n")),(0,i.kt)("p",null,"As you can see, similarly to the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestQueue()")," function, there is an ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestList()")," function that will create a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"\ninstance for you. The first argument is the name of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),". It is used to persist the crawling state of the list. This is useful when you\nwant to continue where you left off after an error or a process restart. The second argument is the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array, which is nothing more than a list\nof URLs you wish to crawl."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is a persistent store by default, so no name is needed, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," only lives in memory and giving it a name enables it\nto become persistent.")),(0,i.kt)("p",null,"You might now want to ask one of these questions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Can I enqueue into ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," too?"),(0,i.kt)("li",{parentName:"ul"},"How do I make ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," work together with ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")," since I need the queue to enqueue new ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests"),".")),(0,i.kt)("p",null,"The answer to the first one is a definitive no. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is immutable and once you create it, you cannot add or remove ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," from it. The\nanswer to the second one is simple. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are made to work together out of the box in crawlers, so all you need to do is\nuse them both and the crawlers will do the rest."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"For those wondering how this works, the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," are enqueued into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," right before their execution and only\nprocessed by the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," afterwards. You can, of course, enqueue the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to the queue manually, but that would take some boilerplate\ncode and perhaps quite a long time, if we were talking about tens of thousands or more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". The crawlers do it while running, so the time to\nenqueue is spread out and you won't even notice it.")),(0,i.kt)("p",null,"####\xa0Sanity check"),(0,i.kt)("p",null,"It's always useful to create some simple boilerplate code to see that we've got everything set up correctly before we start to write\nthe scraping logic itself. We might realize that something in our previous analysis doesn't quite add up, or the website might not behave exactly as we expected."),(0,i.kt)("p",null,"Let's use our newly acquired ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," knowledge and everything we know from the previous chapters to create a new crawler that'll just visit all\nthe category URLs we selected and print the text content of all the actors in the category. Try running the code below in your selected environment.\nYou should see, albeit very badly formatted, the text of the individual actor cards that are displayed in the selected categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ $, request }) => {\n // Select all the actor cards.\n $('.item').each((i, el) => {\n const text = $(el).text();\n console.log(`ITEM: ${text}\\n`);\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If there's anything you don't understand, refer to the previous chapters on setting up your environment, building your first crawler and\n",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),".")),(0,i.kt)("p",null,"You might be wondering how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. After analyzing the category pages using a browser's DevTools, we've determined that it's a\ngood selector to select all the currently displayed actor cards. DevTools and CSS selectors are quite a large topic, so we can't go into too much\ndetail now, but here are a few general pointers."),(0,i.kt)("h4",{id:"devtools-crash-course"},"DevTools crash course"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We'll use Chrome DevTools here, since it's the most common browser, but feel free to use any other, it's all very similar.")),(0,i.kt)("p",null,"We could pick any category, but let's just go with Travel because it includes some interesting actors. Go to"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\n")),(0,i.kt)("p",null,"and open DevTools either by right-clicking anywhere in the page and selecting ",(0,i.kt)("inlineCode",{parentName:"p"},"Inspect"),", or by pressing ",(0,i.kt)("inlineCode",{parentName:"p"},"F12")," or by any other means relevant to your\nsystem. Once you're there, you'll see a bunch of DevToolsy stuff and a view of the category page with the individual actor cards."),(0,i.kt)("p",null,"Now, find the ",(0,i.kt)("inlineCode",{parentName:"p"},"Select an element")," tool and use it to select one of the actor cards. Make sure to select the whole card, not just some of its contents, such\nas its title or description."),(0,i.kt)("p",null,"In the resulting HTML display, it will put your cursor somewhere. Inspect the HTML around it. You'll see that there are CSS classes attached to the\ndifferent HTML elements."),(0,i.kt)("p",null,"By hovering over the individual elements, you will see their placement in the page's view. It's easy to see the page's structure around the actor\ncards now. All the cards are displayed in a ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with a classname that starts with ",(0,i.kt)("inlineCode",{parentName:"p"},"ItemsGrid__StyledDiv"),", which holds another ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with some\ncomputer-generated class names and finally, inside this ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>"),", the individual cards are represented by other ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," elements with the class of\n",(0,i.kt)("inlineCode",{parentName:"p"},"item"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Yes, there are other HTML elements and other classes too. We can safely ignore them.")),(0,i.kt)("p",null,"It should now make sense how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. It's just a selector that finds all elements that are annotated with the ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," class and\nthose just happen to be the actor cards only."),(0,i.kt)("p",null,"It's always a good idea to double check that though, so go into the DevTools Console and run"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"document.querySelectorAll('.item');\n")),(0,i.kt)("p",null,"You will see that only the actor cards will be returned, and nothing else."),(0,i.kt)("h4",{id:"enqueueing-the-detail-links-using-a-custom-selector"},"Enqueueing the detail links using a custom selector"),(0,i.kt)("p",null,"In the previous chapter, we used the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," function like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n});\n")),(0,i.kt)("p",null,"While very useful in that scenario, we need something different now. Instead of finding all the ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="..">')," links that match the ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrl"),", we\nneed to find only the specific ones that will take us to the actor detail pages. Otherwise, we'd be visiting a lot of other pages that we're not\ninterested in. Using the power of DevTools and yet another ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameter, this becomes fairly easy."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n};\n")),(0,i.kt)("p",null,"The code should look pretty familiar to you. It's a very simple ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," where we log the currently processed URL to the console and\nenqueue more links. But there are also a few new, interesting additions. Let's break it down."),(0,i.kt)("h5",{id:"the-selector-parameter-of-enqueuelinks"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"selector")," parameter of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"When we previously used ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", we were not providing any ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," parameter and it was fine, because we wanted to use the default\nsetting, which is ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," - finds all ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements. But now, we need to be more specific. There are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," links on the given category page, but\nwe're only interested in those that will take us to item (actor) details. Using the DevTools, we found out that we can select the links we wanted\nusing the ",(0,i.kt)("inlineCode",{parentName:"p"},"div.item > a")," selector, which selects all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},'<div class="item ...">')," parent. And those are exactly the ones\nwe're interested in."),(0,i.kt)("h5",{id:"the-missing-pseudourls"},"The missing ",(0,i.kt)("inlineCode",{parentName:"h5"},"pseudoUrls")),(0,i.kt)("p",null,"Earlier we learned that ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," are not required and if omitted, all links matching the given ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," will be enqueued. This is exactly\nwhat we need, so we're skipping ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," this time. That does not mean that you can't use ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," together with a custom ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," though,\nbecause you absolutely can!"),(0,i.kt)("h5",{id:"finally-the-userdata-of-enqueuelinks"},"Finally, the ",(0,i.kt)("inlineCode",{parentName:"h5"},"userData")," of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"You will see ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," used often throughout Apify SDK and it's nothing more than a place to store your own data on a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance. You can\naccess it with ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData")," and it's a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," that can be used to store anything that needs to survive the full life-cycle of the\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"."),(0,i.kt)("p",null,"We can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"transformRequestFunction")," option of ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," to modify all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances it creates and enqueues. In our case, we\nuse it to set a ",(0,i.kt)("inlineCode",{parentName:"p"},"detailPage")," property to the enqueued ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to be able to easily differentiate between the category pages and the detail pages."),(0,i.kt)("h4",{id:"another-sanity-check"},"Another sanity check"),(0,i.kt)("p",null,"It's always good to work step by step. We have this new enqueueing logic in place and since the previous ",(0,i.kt)("a",{parentName:"p",href:"#sanity-check",target:null,rel:null},"Sanity check")," worked only\nwith a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", because we were not enqueueing anything, don't forget to add back the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl")," limit. Let's\ntest it out!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue(); // <----------------\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50, // <----------------------------------------\n requestList,\n requestQueue, // <---------------------------------------------------\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"We've added the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," with the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," logic from the previous section to the code we wrote earlier. As always, try\nrunning it in the environment of your choice. You should see the crawler output a number of links to the console, as it crawls the category pages first\nand then all the links to the actor detail pages it found."),(0,i.kt)("p",null,"This concludes our Crawling strategy section, because we have taught the crawler to visit all the pages we need. Let's continue with scraping the\ntasty data."),(0,i.kt)("h3",{id:"scraping-data"},"Scraping data"),(0,i.kt)("p",null,"At the beginning of this chapter, we created a list of the information we wanted to collect about the actors in the store. Let's review that and figure\nout ways to access it."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"scraping-the-url-owner-and-unique-identifier"},"Scraping the URL, Owner and Unique identifier"),(0,i.kt)("p",null,"Some information is lying right there in front of us without even having to touch the actor detail pages. The ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," we already have - the\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.url"),". And by looking at it carefully, we realize that it already includes the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," and the ",(0,i.kt)("inlineCode",{parentName:"p"},"unique identifier")," too. We can just split the\n",(0,i.kt)("inlineCode",{parentName:"p"},"string")," and be on our way then!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// request.url = https://apify.com/apify/web-scraper\n\nconst urlArr = request.url.split('/').slice(-2); // ['apify', 'web-scraper']\nconst uniqueIdentifier = urlArr.join('/'); // 'apify/web-scraper'\nconst owner = urlArr[0]; // 'apify'\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"It's always a matter of preference, whether to store this information separately in the resulting dataset, or not. Whoever uses the dataset can\neasily parse the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," from the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL"),", so should we duplicate the data unnecessarily? Our opinion is that unless the increased data consumption\nwould be too large to bear, it's always better to make the dataset as readable as possible. Someone might want to filter by ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," for example and\nkeeping only the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," in the dataset would make this complicated without using additional tools.")),(0,i.kt)("h4",{id:"scraping-title-description-last-modification-date-and-number-of-runs"},"Scraping Title, Description, Last modification date and Number of runs"),(0,i.kt)("p",null,"Now it's time to add more data to the results. Let's open one of the actor detail pages in the Store, for example the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/web-scraper",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"apify/web-scraper"))," page and use our DevTools-Fu to figure out how to get the title of the actor."),(0,i.kt)("h5",{id:"title"},"Title"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor title",src:n(67543).Z,title:"Finding actor title in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("p",null,"By using the element selector tool, we find out that the title is there under an ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, as titles should be.\nMaybe surprisingly, we find that there are actually two ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tags on the detail page. This should get us thinking.\nIs there any parent element that includes our ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, but not the other ones? Yes, there is! There is a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>"),"\nelement that we can use to select only the heading we're interested in."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Remember that you can press CTRL+F (CMD+F) in the Elements tab of DevTools to open the search bar where you can quickly search for elements using\ntheir selectors. And always make sure to use the DevTools to verify your scraping process and assumptions. It's faster than changing the crawler\ncode all the time.")),(0,i.kt)("p",null,"To get the title we just need to find it using ",(0,i.kt)("inlineCode",{parentName:"p"},"Cheerio")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"header h1")," selector, which selects all ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," ancestor.\nAnd as we already know, there's only one."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n};\n")),(0,i.kt)("h5",{id:"description"},"Description"),(0,i.kt)("p",null,"Getting the actor's description is a little more involved, but still pretty straightforward. We can't just simply search for a ",(0,i.kt)("inlineCode",{parentName:"p"},"<p>")," tag, because\nthere's a lot of them in the page. We need to narrow our search down a little. Using the DevTools we find that the actor description is nested within\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," element too, same as the title. Moreover, the actual description is nested inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"<span>")," tag with a class ",(0,i.kt)("inlineCode",{parentName:"p"},"actor-description"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor description selector",src:n(12872).Z,title:"Finding actor description in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n};\n")),(0,i.kt)("h5",{id:"last-modification-date"},"Last modification date"),(0,i.kt)("p",null,"The DevTools tell us that the ",(0,i.kt)("inlineCode",{parentName:"p"},"modifiedDate")," can be found in the ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element inside ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats">'),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor last modification date selector",src:n(56281).Z,title:"Finding actor last modification date in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n};\n")),(0,i.kt)("p",null,"It might look a little too complex at first glance, but let's walk through it. We find the right ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element,\nand then we read its ",(0,i.kt)("inlineCode",{parentName:"p"},"datetime")," attribute, because that's where a unix timestamp is stored as a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("p",null,"But we would much rather see a readable date in our results, not a unix timestamp, so we need to convert it. Unfortunately the ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),"\nconstructor will not accept a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we cast the ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," function before actually calling ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),".\nPhew!"),(0,i.kt)("h5",{id:"run-count"},"Run count"),(0,i.kt)("p",null,"And so we're finishing up with the ",(0,i.kt)("inlineCode",{parentName:"p"},"runCount"),". There's no specific element like ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>"),", so we need to create a complex selector and then do a\ntransformation on the result."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"ul.ActorHeader-stats > li:nth-of-type(3)")," looks complicated, but it only reads that we're looking for a ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats ...">')," element and within that\nelement we're looking for the third ",(0,i.kt)("inlineCode",{parentName:"p"},"<li>")," element. We grab its text, but we're only interested in the number of runs. So we parse the number out\nusing a regular expression, but its type is still a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we finally convert the result to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," by wrapping it with a ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," call."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The numbers are formatted with commas as thousands separators (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1,234,567'"),"), so to extract it, we\nfirst use regular expression ",(0,i.kt)("inlineCode",{parentName:"p"},"/[\\d,]+/")," - it will search for consecutive number or comma characters.\nThen we extract the match via ",(0,i.kt)("inlineCode",{parentName:"p"},".match(/[\\d,]+/)[0]")," and finally remove the commas by calling ",(0,i.kt)("inlineCode",{parentName:"p"},".replace(',', '')"),".\nThis will give us a string (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1234567'"),") that can be converted via ",(0,i.kt)("inlineCode",{parentName:"p"},"Number")," function.")),(0,i.kt)("p",null,"And there we have it! All the data we needed in a single object. For the sake of completeness, let's add the properties we parsed from the URL earlier\nand we're good to go."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const urlArr = request.url.split('/').slice(-2);\n\nconst results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n\nconsole.log('RESULTS: ', results);\n")),(0,i.kt)("h4",{id:"trying-it-out-sanity-check-3"},"Trying it out (sanity check #3)"),(0,i.kt)("p",null,"We have everything we need so just grab our newly created scraping logic, dump it into our original ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," and see the magic happen!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n console.log('RESULTS', results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notice again that we're scraping on the detail pages ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === true"),", but we're only enqueueing on the category pages\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === undefined"),".")),(0,i.kt)("p",null,"When running the actor in the environment of your choice, you should see the crawled URLs and their scraped data printed to the console."),(0,i.kt)("h3",{id:"saving-the-scraped-data"},"Saving the scraped data"),(0,i.kt)("p",null,"A data extraction job would not be complete without saving the data for later use and processing. We've come to the final and most difficult part of\nthis chapter so make sure to pay attention very carefully!"),(0,i.kt)("p",null,"First, replace the ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log('RESULTS', results)")," call with"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await Apify.pushData(results);\n")),(0,i.kt)("p",null,"and that's it. Unlike in the previous paragraph, I'm being serious now. That's it, we're done. The final code therefore looks exactly like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n await Apify.pushData(results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("h4",{id:"whats-apifypushdata"},"What's ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.pushData()")),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," is a helper function that saves data to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset")),". ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," is a\nstorage designed to hold virtually unlimited amount of data in a format similar to a table. Each time you call ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," a new row in the\ntable is created, with the property names serving as column titles."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Each actor run has one default ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," so no need to initialize it or create an instance first. It just gets done automatically for you. You can\nalso create named datasets at will.")),(0,i.kt)("h4",{id:"finding-my-saved-data"},"Finding my saved data"),(0,i.kt)("p",null,"It might not be perfectly obvious where the data we saved using the previous command went, so let's break it down by environment:"),(0,i.kt)("h5",{id:"dataset-on-the-apify-platform"},"Dataset on the Apify platform"),(0,i.kt)("p",null,"Open any Run of your actor on the Platform and you will see a Dataset as one of the available tabs. Clicking on it will reveal basic information about\nthe Dataset and a list of options that you can use to download your data. There are various formats such as JSON, XLSX or CSV available and there's\nalso the possibility of downloading only clean items, i.e. a filtered dataset with empty rows and hidden fields removed."),(0,i.kt)("h5",{id:"local-dataset"},"Local Dataset"),(0,i.kt)("p",null,"Unless you changed the environment variables that Apify SDK uses locally, which would suggest that you knew what you were doing and you didn't need\nthis tutorial anyway, you'll find your data in your local Apify Storage."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")),(0,i.kt)("p",null,"The above folder will hold all your saved data in numbered files, as they were pushed into the dataset. Each file represents one invocation of\n",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," or one table row."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Unfortunately, the local datasets don't yet support the export in various formats functionality that the Platform Dataset page offers, so for the\ntime being, we're stuck with JSON.")),(0,i.kt)("h3",{id:"final-touch"},"Final touch"),(0,i.kt)("p",null,"It may seem that the data are extracted and the actor is done, but honestly, this is just the beginning. For the sake of brevity, we've completely\nomitted error handling, proxies, debug logging, tests, documentation and other stuff that a reliable software should have. The good thing is, ",(0,i.kt)("strong",{parentName:"p"},"error\nhandling is mostly done by Apify SDK itself"),", so no worries on that front, unless you need some custom magic."),(0,i.kt)("p",null,"Anyway, to spark some ideas, let's look at two more things. First, passing an input to the actor, which will enable us to change the categories we\nwant to scrape without changing the source code itself! And then some refactoring, to show you how we reckon is preferable to structure and annotate\nactor code."),(0,i.kt)("h4",{id:"meet-the-input"},"Meet the ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is just a convention on how we call the actor's input. Because there's no magic in actors, just features, the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is actually nothing more\nthan a key in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," that's, by convention, used as input on the Apify platform. Also by convention, the\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is mostly expected to be of ",(0,i.kt)("inlineCode",{parentName:"p"},"Content-Type: application/json"),"."),(0,i.kt)("p",null,"We will not go into ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," details here, but for the sake of ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," you need to remember that there is a function that helps you get it."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"On the Apify Platform, the actor's input that you can set in the Console is automatically saved to the default ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," under the key ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),"\nand by calling ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," you retrieve the value from the ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore"),"."),(0,i.kt)("p",null,"Running locally, you need to place an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file in your default key value store for this to work."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,i.kt)("h4",{id:"use-input-to-seed-our-actor-with-categories"},"Use ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")," to seed our actor with categories"),(0,i.kt)("p",null,"Currently we're using the full URLs of categories as sources, but it's quite obvious that we only need the final parameters, the rest of the URL is\nalways the same. Knowing that, we can pass an array of those parameters on ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," and build the URLs dynamically, which would allow us to scrape\ndifferent categories without changing the source code. Let's get to it!"),(0,i.kt)("p",null,"First, we set up our ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),", either in the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," form of the actor on the Apify platform, or by creating an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," in our default key-value store\nlocally."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'["TRAVEL", "ECOMMERCE", "ENTERTAINMENT"]\n')),(0,i.kt)("p",null,"Once we have that, we can load it in the actor and populate the crawler's sources with it. In the following example, we're using the categories in the\ninput to construct the category URLs and we're also passing custom ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," to the sources. This means that the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," that get created will\nautomatically contain this ",(0,i.kt)("inlineCode",{parentName:"p"},"userData"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// ...\nconst input = await Apify.getInput();\n\nconst sources = input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n}));\n\nconst requestList = await Apify.openRequestList('categories', sources);\n// ...\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"userData.label")," is also a convention that we've been using for quite some time to label different ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". We know that this is a category URL\nso we ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," it ",(0,i.kt)("inlineCode",{parentName:"p"},"CATEGORY"),". This way, we can easily make decisions in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," without having to inspect the URL itself."),(0,i.kt)("p",null,"We can then refactor the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," for decision-making. This does not make much sense for a crawler\nwith only two different pages, because a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," would suffice, but for pages with multiple different views, it becomes very useful."),(0,i.kt)("h4",{id:"structuring-the-code-better"},"Structuring the code better"),(0,i.kt)("p",null,"But perhaps we should not stop at refactoring the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses. There are several ways we can make the actor look more elegant and - most\nimportantly - easier to reason about and make changes to."),(0,i.kt)("p",null,"In the following code we've made several changes."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Split the code into multiple files."),(0,i.kt)("li",{parentName:"ul"},"Added the ",(0,i.kt)("inlineCode",{parentName:"li"},"Apify.utils.log")," and replaced ",(0,i.kt)("inlineCode",{parentName:"li"},"console.log")," with it."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"getSources()")," function to encapsulate ",(0,i.kt)("inlineCode",{parentName:"li"},"INPUT")," consumption."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"createRouter()")," function to make our routing cleaner, without nested ",(0,i.kt)("inlineCode",{parentName:"li"},"if")," clauses."),(0,i.kt)("li",{parentName:"ul"},"Removed the ",(0,i.kt)("inlineCode",{parentName:"li"},"maxRequestsPerCrawl")," limit.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To create a multi-file actor on the Apify Platform, select ",(0,i.kt)("strong",{parentName:"p"},"Multiple source files")," in the ",(0,i.kt)("strong",{parentName:"p"},"Type")," dropdown on the ",(0,i.kt)("strong",{parentName:"p"},"Source")," screen.")),(0,i.kt)("p",null,"In our ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file, we place the general structure of the crawler:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// main.js\nconst Apify = require('apify');\nconst tools = require('./tools');\nconst {\n utils: { log },\n} = Apify;\n\nApify.main(async () => {\n log.info('Starting actor.');\n const requestList = await Apify.openRequestList('categories', await tools.getSources());\n const requestQueue = await Apify.openRequestQueue();\n const router = tools.createRouter({ requestQueue });\n\n log.debug('Setting up crawler.');\n const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction: async context => {\n const { request } = context;\n log.info(`Processing ${request.url}`);\n await router(request.userData.label, context);\n },\n });\n\n log.info('Starting the crawl.');\n await crawler.run();\n log.info('Actor finished.');\n});\n")),(0,i.kt)("p",null,"Then in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"tools.js"),", we add our helper functions:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// tools.js\nconst Apify = require('apify');\nconst routes = require('./routes');\nconst {\n utils: { log },\n} = Apify;\n\nexports.getSources = async () => {\n log.debug('Getting sources.');\n const input = await Apify.getInput();\n return input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n }));\n};\n\nexports.createRouter = globalContext => {\n return async function(routeName, requestContext) {\n const route = routes[routeName];\n if (!route) throw new Error(`No route for name: ${routeName}`);\n log.debug(`Invoking route: ${routeName}`);\n return route(requestContext, globalContext);\n };\n};\n")),(0,i.kt)("p",null,"And finally our routes in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"routes.js")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// routes.js\nconst Apify = require('apify');\nconst {\n utils: { log },\n} = Apify;\n\nexports.CATEGORY = async ({ $, request }, { requestQueue }) => {\n return Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.label = 'DETAIL';\n return req;\n },\n });\n};\n\nexports.DETAIL = async ({ $, request }) => {\n const urlArr = request.url.split('/').slice(-2);\n\n log.debug('Scraping results.');\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n\n log.debug('Pushing data to dataset.');\n await Apify.pushData(results);\n};\n")),(0,i.kt)("p",null,"Let us tell you a little bit more about the changes. We hope that in the end, you'll agree that this structure makes the actor more readable and\nmanageable."),(0,i.kt)("h4",{id:"splitting-your-code-into-multiple-files"},"Splitting your code into multiple files"),(0,i.kt)("p",null,"This was not always the case, but now that the Apify platform has a multifile editor, there's no reason not to split your code into multiple files and keep\nyour logic separate. Less code in a single file means less code you need to think about at any time, and that's a great thing!"),(0,i.kt)("h4",{id:"using-apifyutilslog-instead-of-consolelog"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"h4"},"console.log")),(0,i.kt)("p",null,"We wont go to great lengths here to talk about ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log"),", because you can read ",(0,i.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},"it all in the documentation"),", but there's just\none thing that we need to stress: ",(0,i.kt)("strong",{parentName:"p"},"log levels"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")," enables you to use different log levels, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"log.debug"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"log.info")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"log.warning"),". It not only makes your log more readable, but\nit also allows selective turning off of some levels by either calling the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log.setLevel()")," function or by setting an ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," variable.\nThis is huge! Because you can now add a lot of debug logs in your actor, which will help you when something goes wrong and turn them on or off with a\nsimple ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," change, or by setting an environment variable."),(0,i.kt)("p",null,"The punch line? Use ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log")," now and thank us later when something goes wrong!"),(0,i.kt)("h4",{id:"using-a-router-to-structure-your-crawling"},"Using a router to structure your crawling"),(0,i.kt)("p",null,"At first, it might seem more readable using just a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"if / else")," statement to select different logic based on the crawled pages, but trust me, it\nbecomes far less impressive when working with more than two different pages and it definitely starts to fall apart when the logic to handle each page\nspans tens or hundreds of lines of code."),(0,i.kt)("p",null,"It's good practice in any programming to split your logic into bite-sized chunks that are easy to read and reason about. Scrolling through a\nthousand line long ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," where everything interacts with everything and variables can be used everywhere is not a beautiful thing to\ndo and a pain to debug. That's why we prefer the separation of routes into a special file and with large routes, we would even suggest having one file\nper route."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"TO BE CONTINUED with details on ",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and other features...")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),c=o,m=d["".concat(s,".").concat(c)]||d[c]||h[c]||i;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:o,r[1]=l;for(var u=2;u<i;u++)r[u]=n[u];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},12872:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/description-f9aec3abf3d17de2239e058d5dce838e.jpg"},56281:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/modified-date-5516a5ec24f9b0ef2f6a69f196e005db.jpg"},35631:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/scraping-practice-c0dd0ead6c920dcf687f0bb9d09087a9.jpg"},67543:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/title-01-424dd1253b7b093145561728d490d202.jpg"}}]); \ No newline at end of file diff --git a/assets/js/d01228a5.1d6e74ec.js b/assets/js/d01228a5.1d6e74ec.js deleted file mode 100644 index 2476ec00cf..0000000000 --- a/assets/js/d01228a5.1d6e74ec.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4218],{79614:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id:"crawl-single-url",title:"Crawl a single URL"},i=void 0,p={unversionedId:"examples/crawl-single-url",id:"version-2.3/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the Apify.utils.requestAsBrowser() function to grab the",source:"@site/versioned_docs/version-2.3/examples/crawl_single_url.md",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/2.3/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_single_url.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"version-2.3/docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/2.3/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/2.3/examples/crawl-sitemap"}},c={},u=[],f={toc:u},m="wrapper";function d(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/utils#utilsrequestasbrowseroptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()"))," function to grab the\nHTML of a web page."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Get the HTML of a web page\n const { body } = await Apify.utils.requestAsBrowser({ url: 'https://www.example.com' });\n console.log(body);\n});\n")),(0,l.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,l.kt)("a",{parentName:"p",href:"accept-user-input",target:null,rel:null},"Accept User Input")," example."))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),m=a,d=u["".concat(i,".").concat(m)]||u[m]||f[m]||l;return r?n.createElement(d,o(o({ref:t},c),{},{components:r})):n.createElement(d,o({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var p=2;p<l;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d01228a5.42ef4e5f.js b/assets/js/d01228a5.42ef4e5f.js new file mode 100644 index 0000000000..1931dcf2de --- /dev/null +++ b/assets/js/d01228a5.42ef4e5f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4218],{79614:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),o=["components"],s={id:"crawl-single-url",title:"Crawl a single URL"},i=void 0,p={unversionedId:"examples/crawl-single-url",id:"version-2.3/examples/crawl-single-url",title:"Crawl a single URL",description:"This example uses the Apify.utils.requestAsBrowser() function to grab the",source:"@site/versioned_docs/version-2.3/examples/crawl_single_url.md",sourceDirName:"examples",slug:"/examples/crawl-single-url",permalink:"/sdk/js/docs/2.3/examples/crawl-single-url",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_single_url.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-single-url",title:"Crawl a single URL"},sidebar:"version-2.3/docs",previous:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/2.3/examples/crawl-relative-links"},next:{title:"Crawl a sitemap",permalink:"/sdk/js/docs/2.3/examples/crawl-sitemap"}},c={},u=[],f={toc:u},m="wrapper";function d(e){var t=e.components,r=(0,a.Z)(e,o);return(0,l.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/utils#utilsrequestasbrowseroptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()"))," function to grab the\nHTML of a web page."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Get the HTML of a web page\n const { body } = await Apify.utils.requestAsBrowser({ url: 'https://www.example.com' });\n console.log(body);\n});\n")),(0,l.kt)("p",null,"If you don't want to hard-code the URL into the script, refer to the ",(0,l.kt)("a",{parentName:"p",href:"accept-user-input",target:null,rel:null},"Accept User Input")," example."))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(r),m=a,d=u["".concat(i,".").concat(m)]||u[m]||f[m]||l;return r?n.createElement(d,o(o({ref:t},c),{},{components:r})):n.createElement(d,o({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:a,o[1]=s;for(var p=2;p<l;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d0fee05b.8ca71fc1.js b/assets/js/d0fee05b.8ca71fc1.js new file mode 100644 index 0000000000..afe2cf75d1 --- /dev/null +++ b/assets/js/d0fee05b.8ca71fc1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9262],{10412:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>d,default:()=>f,frontMatter:()=>p,metadata:()=>l,toc:()=>c});var r=n(87462),o=n(63366),i=(n(67294),n(3905)),a=["components"],p={id_old:"version-1.3-direct-navigation-options",title:"DirectNavigationOptions",id:"direct-navigation-options"},d=void 0,l={unversionedId:"typedefs/direct-navigation-options",id:"version-1.3/typedefs/direct-navigation-options",title:"DirectNavigationOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/DirectNavigationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/direct-navigation-options",permalink:"/sdk/js/docs/1.3/typedefs/direct-navigation-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DirectNavigationOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-direct-navigation-options",title:"DirectNavigationOptions",id:"direct-navigation-options"}},s={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>timeout</code>",id:"timeout",level:3},{value:"<code>waitUntil</code>",id:"waituntil",level:3},{value:"<code>referer</code>",id:"referer",level:3}],u={toc:c},m="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,a);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"directnavigationoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var d=r.createContext({}),l=function(e){var t=r.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=l(e.components);return r.createElement(d.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=l(n),m=o,f=c["".concat(d,".").concat(m)]||c[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},s),{},{components:n})):r.createElement(f,a({ref:t},s))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p[c]="string"==typeof e?e:o,a[1]=p;for(var l=2;l<i;l++)a[l]=n[l];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d0fee05b.f6c21f41.js b/assets/js/d0fee05b.f6c21f41.js deleted file mode 100644 index d478489305..0000000000 --- a/assets/js/d0fee05b.f6c21f41.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9262],{10412:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>d,default:()=>f,frontMatter:()=>p,metadata:()=>l,toc:()=>c});var r=n(87462),i=n(63366),o=(n(67294),n(3905)),a=["components"],p={id_old:"version-1.3-direct-navigation-options",title:"DirectNavigationOptions",id:"direct-navigation-options"},d=void 0,l={unversionedId:"typedefs/direct-navigation-options",id:"version-1.3/typedefs/direct-navigation-options",title:"DirectNavigationOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/DirectNavigationOptions.md",sourceDirName:"typedefs",slug:"/typedefs/direct-navigation-options",permalink:"/sdk/js/docs/1.3/typedefs/direct-navigation-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DirectNavigationOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-direct-navigation-options",title:"DirectNavigationOptions",id:"direct-navigation-options"}},s={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>timeout</code>",id:"timeout",level:3},{value:"<code>waitUntil</code>",id:"waituntil",level:3},{value:"<code>referer</code>",id:"referer",level:3}],u={toc:c},m="wrapper";function f(e){var t=e.components,n=(0,i.Z)(e,a);return(0,o.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"directnavigationoptions"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"timeout"},(0,o.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,o.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"waituntil"},(0,o.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,o.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,o.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,o.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,o.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,o.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,o.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,o.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,o.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,o.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,o.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"referer"},(0,o.kt)("inlineCode",{parentName:"h3"},"referer")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,o.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var d=r.createContext({}),l=function(e){var t=r.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=l(e.components);return r.createElement(d.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=l(n),m=i,f=c["".concat(d,".").concat(m)]||c[m]||u[m]||o;return n?r.createElement(f,a(a({ref:t},s),{},{components:n})):r.createElement(f,a({ref:t},s))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=m;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p[c]="string"==typeof e?e:i,a[1]=p;for(var l=2;l<o;l++)a[l]=n[l];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d1b5f25c.cb4621a2.js b/assets/js/d1b5f25c.c28bde94.js similarity index 55% rename from assets/js/d1b5f25c.cb4621a2.js rename to assets/js/d1b5f25c.c28bde94.js index fb525b1e75..805809d742 100644 --- a/assets/js/d1b5f25c.cb4621a2.js +++ b/assets/js/d1b5f25c.c28bde94.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1003],{30433:(e,r,t)=>{t.d(r,{Z:()=>o});var n=t(67294),a=t(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var r=e.children,t=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:t},r)}},65559:(e,r,t)=>{t.d(r,{Z:()=>m});var n=t(87462),a=t(67294),l=t(34334),o=t(63735),i=t(38224),u=t(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function c(e){var r=e.className,t=e.block,i=e.selectedValue,u=e.selectValue,c=e.tabValues,p=[],d=(0,o.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var r=e.currentTarget,t=p.indexOf(r),n=c[t].value;n!==i&&(d(r),u(n))},f=function(e){var r,t=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,a=p.indexOf(e.currentTarget)+1;t=null!=(n=p[a])?n:p[0];break;case"ArrowLeft":var l,o=p.indexOf(e.currentTarget)-1;t=null!=(l=p[o])?l:p[p.length-1]}null==(r=t)||r.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":t},r)},c.map((function(e){var r=e.value,t=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===r?0:-1,"aria-selected":i===r,key:r,ref:function(e){return p.push(e)},onKeyDown:f,onClick:m},o,{className:(0,l.Z)("tabs__item",s.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===r})}),null!=t?t:r)})))}function p(e){var r=e.lazy,t=e.children,n=e.selectedValue,l=(Array.isArray(t)?t:[t]).filter(Boolean);if(r){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,r){return(0,a.cloneElement)(e,{key:r,hidden:e.props.value!==n})})))}function d(e){var r=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",s.tabList)},a.createElement(c,(0,n.Z)({},e,r)),a.createElement(p,(0,n.Z)({},e,r)))}function m(e){var r=(0,u.Z)();return a.createElement(d,(0,n.Z)({key:String(r)},e))}},38224:(e,r,t)=>{t.d(r,{Y:()=>d});var n=t(67294),a=t(16550),l=t(34423),o=t(20636),i=t(99200);function u(e){return function(e){var r,t;return null!=(r=null==(t=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(r=e.props)&&"object"==typeof r&&"value"in r)return e;var r;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:t.filter(Boolean))?r:[]}(e).map((function(e){var r=e.props;return{value:r.value,label:r.label,attributes:r.attributes,default:r.default}}))}function s(e){var r=e.values,t=e.children;return(0,n.useMemo)((function(){var e=null!=r?r:u(t);return function(e){var r=(0,o.l)(e,(function(e,r){return e.value===r.value}));if(r.length>0)throw new Error('Docusaurus error: Duplicate values "'+r.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[r,t])}function c(e){var r=e.value;return e.tabValues.some((function(e){return e.value===r}))}function p(e){var r=e.queryString,t=void 0!==r&&r,o=e.groupId,i=(0,a.k6)(),u=function(e){var r=e.queryString,t=void 0!==r&&r,n=e.groupId;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:t,groupId:o});return[(0,l._X)(u),(0,n.useCallback)((function(e){if(u){var r=new URLSearchParams(i.location.search);r.set(u,e),i.replace(Object.assign({},i.location,{search:r.toString()}))}}),[u,i])]}function d(e){var r,t,a,l,o=e.defaultValue,u=e.queryString,d=void 0!==u&&u,m=e.groupId,f=s(e),w=(0,n.useState)((function(){return function(e){var r,t=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!c({value:t,tabValues:n}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+t+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return t}var a=null!=(r=n.find((function(e){return e.default})))?r:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:f})})),v=w[0],y=w[1],b=p({queryString:d,groupId:m}),h=b[0],k=b[1],g=(r=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),t=(0,i.Nk)(r),a=t[0],l=t[1],[a,(0,n.useCallback)((function(e){r&&l.set(e)}),[r,l])]),C=g[0],x=g[1],q=function(){var e=null!=h?h:C;return c({value:e,tabValues:f})?e:null}();return(0,n.useLayoutEffect)((function(){q&&y(q)}),[q]),{selectedValue:v,selectValue:(0,n.useCallback)((function(e){if(!c({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);y(e),k(e),x(e)}),[k,x,f]),tabValues:f}}},22652:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>v,contentTitle:()=>f,default:()=>k,frontMatter:()=>m,metadata:()=>w,toc:()=>y});var n=t(87462),a=t(63366),l=(t(67294),t(3905)),o=t(65559),i=t(30433),u=t(14563);const s="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",c="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n";var d=["components"],m={id:"crawl-all-links",title:"Crawl all links on a website"},f=void 0,w={unversionedId:"examples/crawl-all-links",id:"version-3.0/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/versioned_docs/version-3.0/examples/crawl_all_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/3.0/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_all_links.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/3.0/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/3.0/examples/crawl-multiple-urls"}},v={},y=[],b={toc:y},h="wrapper";function k(e){var r=e.components,t=(0,a.Z)(e,d);return(0,l.kt)(h,(0,n.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},s)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p))))}k.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t=l[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)t=l[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var u=n.createContext({}),s=function(e){var r=n.useContext(u),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(u.Provider,{value:r},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=s(t),m=a,f=p["".concat(u,".").concat(m)]||p[m]||d[m]||l;return t?n.createElement(f,o(o({ref:r},c),{},{components:t})):n.createElement(f,o({ref:r},c))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=m;var i={};for(var u in r)hasOwnProperty.call(r,u)&&(i[u]=r[u]);i.originalType=e,i[p]="string"==typeof e?e:a,o[1]=i;for(var s=2;s<l;s++)o[s]=t[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1003],{30433:(e,r,t)=>{t.d(r,{Z:()=>o});var n=t(67294),a=t(34334);const l={tabItem:"tabItem_Ymn6"};function o(e){var r=e.children,t=e.hidden,o=e.className;return n.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,o),hidden:t},r)}},65559:(e,r,t)=>{t.d(r,{Z:()=>d});var n=t(87462),a=t(67294),l=t(34334),o=t(63735),i=t(38224),u=t(5730);const s={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function c(e){var r=e.className,t=e.block,i=e.selectedValue,u=e.selectValue,c=e.tabValues,p=[],m=(0,o.o5)().blockElementScrollPositionUntilNextRender,d=function(e){var r=e.currentTarget,t=p.indexOf(r),n=c[t].value;n!==i&&(m(r),u(n))},f=function(e){var r,t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":var n,a=p.indexOf(e.currentTarget)+1;t=null!=(n=p[a])?n:p[0];break;case"ArrowLeft":var l,o=p.indexOf(e.currentTarget)-1;t=null!=(l=p[o])?l:p[p.length-1]}null==(r=t)||r.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":t},r)},c.map((function(e){var r=e.value,t=e.label,o=e.attributes;return a.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===r?0:-1,"aria-selected":i===r,key:r,ref:function(e){return p.push(e)},onKeyDown:f,onClick:d},o,{className:(0,l.Z)("tabs__item",s.tabItem,null==o?void 0:o.className,{"tabs__item--active":i===r})}),null!=t?t:r)})))}function p(e){var r=e.lazy,t=e.children,n=e.selectedValue,l=(Array.isArray(t)?t:[t]).filter(Boolean);if(r){var o=l.find((function(e){return e.props.value===n}));return o?(0,a.cloneElement)(o,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,r){return(0,a.cloneElement)(e,{key:r,hidden:e.props.value!==n})})))}function m(e){var r=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",s.tabList)},a.createElement(c,(0,n.Z)({},e,r)),a.createElement(p,(0,n.Z)({},e,r)))}function d(e){var r=(0,u.Z)();return a.createElement(m,(0,n.Z)({key:String(r)},e))}},38224:(e,r,t)=>{t.d(r,{Y:()=>m});var n=t(67294),a=t(16550),l=t(34423),o=t(20636),i=t(99200);function u(e){return function(e){var r,t;return null!=(r=null==(t=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(r=e.props)&&"object"==typeof r&&"value"in r)return e;var r;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:t.filter(Boolean))?r:[]}(e).map((function(e){var r=e.props;return{value:r.value,label:r.label,attributes:r.attributes,default:r.default}}))}function s(e){var r=e.values,t=e.children;return(0,n.useMemo)((function(){var e=null!=r?r:u(t);return function(e){var r=(0,o.l)(e,(function(e,r){return e.value===r.value}));if(r.length>0)throw new Error('Docusaurus error: Duplicate values "'+r.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[r,t])}function c(e){var r=e.value;return e.tabValues.some((function(e){return e.value===r}))}function p(e){var r=e.queryString,t=void 0!==r&&r,o=e.groupId,i=(0,a.k6)(),u=function(e){var r=e.queryString,t=void 0!==r&&r,n=e.groupId;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:t,groupId:o});return[(0,l._X)(u),(0,n.useCallback)((function(e){if(u){var r=new URLSearchParams(i.location.search);r.set(u,e),i.replace(Object.assign({},i.location,{search:r.toString()}))}}),[u,i])]}function m(e){var r,t,a,l,o=e.defaultValue,u=e.queryString,m=void 0!==u&&u,d=e.groupId,f=s(e),w=(0,n.useState)((function(){return function(e){var r,t=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!c({value:t,tabValues:n}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+t+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return t}var a=null!=(r=n.find((function(e){return e.default})))?r:n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:o,tabValues:f})})),v=w[0],y=w[1],b=p({queryString:m,groupId:d}),h=b[0],k=b[1],g=(r=function(e){return e?"docusaurus.tab."+e:null}({groupId:d}.groupId),t=(0,i.Nk)(r),a=t[0],l=t[1],[a,(0,n.useCallback)((function(e){r&&l.set(e)}),[r,l])]),C=g[0],x=g[1],q=function(){var e=null!=h?h:C;return c({value:e,tabValues:f})?e:null}();return(0,n.useLayoutEffect)((function(){q&&y(q)}),[q]),{selectedValue:v,selectValue:(0,n.useCallback)((function(e){if(!c({value:e,tabValues:f}))throw new Error("Can't select invalid tab value="+e);y(e),k(e),x(e)}),[k,x,f]),tabValues:f}}},22652:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>v,contentTitle:()=>f,default:()=>k,frontMatter:()=>d,metadata:()=>w,toc:()=>y});var n=t(87462),a=t(63366),l=(t(67294),t(3905)),o=t(65559),i=t(30433),u=t(14563);const s="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",c="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",p="import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n // Add all links from page to RequestQueue\n await enqueueLinks();\n },\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n";var m=["components"],d={id:"crawl-all-links",title:"Crawl all links on a website"},f=void 0,w={unversionedId:"examples/crawl-all-links",id:"version-3.0/examples/crawl-all-links",title:"Crawl all links on a website",description:"This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the",source:"@site/versioned_docs/version-3.0/examples/crawl_all_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-all-links",permalink:"/sdk/js/docs/3.0/examples/crawl-all-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_all_links.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-all-links",title:"Crawl all links on a website"},sidebar:"docs",previous:{title:"Cheerio crawler",permalink:"/sdk/js/docs/3.0/examples/cheerio-crawler"},next:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/3.0/examples/crawl-multiple-urls"}},v={},y=[],b={toc:y},h="wrapper";function k(e){var r=e.components,t=(0,a.Z)(e,m);return(0,l.kt)(h,(0,n.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example uses the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method to add new links to the ",(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")," as the crawler navigates from page to page. If only the\nrequired parameters are defined, all links will be crawled."),(0,l.kt)(o.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},s)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},c)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(u.Z,{className:"language-js",mdxType:"CodeBlock"},p))))}k.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>c,kt:()=>f});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t=l[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)t=l[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var u=n.createContext({}),s=function(e){var r=n.useContext(u),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},c=function(e){var r=s(e.components);return n.createElement(u.Provider,{value:r},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=s(t),d=a,f=p["".concat(u,".").concat(d)]||p[d]||m[d]||l;return t?n.createElement(f,o(o({ref:r},c),{},{components:t})):n.createElement(f,o({ref:r},c))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var l=t.length,o=new Array(l);o[0]=d;var i={};for(var u in r)hasOwnProperty.call(r,u)&&(i[u]=r[u]);i.originalType=e,i[p]="string"==typeof e?e:a,o[1]=i;for(var s=2;s<l;s++)o[s]=t[s];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d1c4056c.0c61b767.js b/assets/js/d1c4056c.0c61b767.js new file mode 100644 index 0000000000..f82aaecfde --- /dev/null +++ b/assets/js/d1c4056c.0c61b767.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[387],{68889:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(67294),a=n(88746),i=n(6141),o=n(6832);const p=function(e){var t=e.to,n=e.children,p=(0,i.E)(),s=p.version,c=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var l=s+"/";return"current"===s?l="next/":c&&(l=""),r.createElement(a.default,{to:"/api/"+l+t},n)}},24816:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=(n(68889),["components"]),p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-3.0/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-3.0/guides/typescript_actor.mdx",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/3.0/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/typescript_actor.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/3.0/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/3.0/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Actor.getInput()) as any; // getInput returns Promise<Object<string, *>|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Actor.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d1c4056c.33982c47.js b/assets/js/d1c4056c.33982c47.js deleted file mode 100644 index c24c24d5cc..0000000000 --- a/assets/js/d1c4056c.33982c47.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[387],{68889:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(67294),a=n(88746),i=n(6141),o=n(6832);const p=function(e){var t=e.to,n=e.children,p=(0,i.E)(),s=p.version,c=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var l=s+"/";return"current"===s?l="next/":c&&(l=""),r.createElement(a.default,{to:"/api/"+l+t},n)}},24816:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=(n(68889),["components"]),p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"version-3.0/guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/versioned_docs/version-3.0/guides/typescript_actor.mdx",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/3.0/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/typescript_actor.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/3.0/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/3.0/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Actor.getInput()) as any; // getInput returns Promise<Object<string, *>|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Actor.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d54f8bf8.a27703a1.js b/assets/js/d54f8bf8.a27703a1.js deleted file mode 100644 index 40206230a2..0000000000 --- a/assets/js/d54f8bf8.a27703a1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2929],{68889:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(67294),o=n(88746),r=n(6141),i=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(o.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(o.default,{to:"/api/"+d+t},n)}},70835:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a,o=n(87462),r=n(63366),i=(n(67294),n(3905)),l=n(68889),s=["components"],p={id:"environment-variables",title:"Environment Variables"},d=void 0,u={unversionedId:"guides/environment-variables",id:"guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/../docs/guides/environment_variables.mdx",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/next/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/environment_variables.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/next/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/next/guides/proxy-management"}},c={},m=[{value:"Important env vars",id:"important-env-vars",level:2},{value:"<code>APIFY_LOCAL_STORAGE_DIR</code>",id:"apify_local_storage_dir",level:3},{value:"<code>APIFY_TOKEN</code>",id:"apify_token",level:3},{value:"Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code>",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars",id:"convenience-env-vars",level:2},{value:"<code>APIFY_HEADLESS</code>",id:"apify_headless",level:3},{value:"<code>APIFY_LOG_LEVEL</code>",id:"apify_log_level",level:3},{value:"<code>APIFY_MEMORY_MBYTES</code>",id:"apify_memory_mbytes",level:3},{value:"<code>APIFY_PROXY_PASSWORD</code>",id:"apify_proxy_password",level:3}],y=(a="CrawleeApiLink",function(e){return console.warn("Component "+a+" was not imported, exported, or provided by MDXProvider as global scope"),(0,i.kt)("div",e)}),f={toc:m},h="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(h,(0,o.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,i.kt)("h2",{id:"important-env-vars"},"Important env vars"),(0,i.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,i.kt)("h3",{id:"apify_local_storage_dir"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("p",null,"Defines the path to a local directory where ",(0,i.kt)(l.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")),", ",(0,i.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")),", and ",(0,i.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," store their data. Typically, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage"),". If omitted, you should define the ",(0,i.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable instead."),(0,i.kt)("h3",{id:"apify_token"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,i.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,i.kt)("th",{parentName:"tr",align:null},"API"),(0,i.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"none OR ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"no"),(0,i.kt)("td",{parentName:"tr",align:null},"local")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,i.kt)("p",null,"When using both ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Actor.openDataset('my-local-data');\nconst remoteDataset = await Actor.openDataset('my-remote-data', { forceCloud: true });\n")),(0,i.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars"),(0,i.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,i.kt)("h3",{id:"apify_headless"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,i.kt)("p",null,"If set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the"),(0,i.kt)(l.Z,{to:"apify/class/Actor#launchPuppeteer",mdxType:"ApiLink"},"`Actor.launchPuppeteer()`")," function. But having this setting in an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging, and only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers are launched in headful mode, i.e. with windows.",(0,i.kt)("h3",{id:"apify_log_level"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,i.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,i.kt)(y,{to:"core/class/Log",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")),"\nnamespace for logging utilities."),(0,i.kt)("h3",{id:"apify_memory_mbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,i.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,i.kt)(y,{to:"core/class/AutoscaledPool",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i.e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,i.kt)("h3",{id:"apify_proxy_password"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,i.kt)("p",null,"Optional password to ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>y});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,y=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p<r;p++)i[p]=n[p];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d54f8bf8.d2d8b680.js b/assets/js/d54f8bf8.d2d8b680.js new file mode 100644 index 0000000000..a5fd372118 --- /dev/null +++ b/assets/js/d54f8bf8.d2d8b680.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2929],{68889:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(67294),o=n(88746),r=n(6141),i=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(o.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(o.default,{to:"/api/"+d+t},n)}},70835:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>d,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>m});var a,o=n(87462),r=n(63366),i=(n(67294),n(3905)),l=n(68889),s=["components"],p={id:"environment-variables",title:"Environment Variables"},d=void 0,u={unversionedId:"guides/environment-variables",id:"guides/environment-variables",title:"Environment Variables",description:"The following is a list of the environment variables used by Apify SDK that are available to the user.",source:"@site/../docs/guides/environment_variables.mdx",sourceDirName:"guides",slug:"/guides/environment-variables",permalink:"/sdk/js/docs/next/guides/environment-variables",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/environment_variables.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"environment-variables",title:"Environment Variables"},sidebar:"docs",previous:{title:"Result Storage",permalink:"/sdk/js/docs/next/guides/result-storage"},next:{title:"Proxy Management",permalink:"/sdk/js/docs/next/guides/proxy-management"}},c={},m=[{value:"Important env vars",id:"important-env-vars",level:2},{value:"<code>APIFY_LOCAL_STORAGE_DIR</code>",id:"apify_local_storage_dir",level:3},{value:"<code>APIFY_TOKEN</code>",id:"apify_token",level:3},{value:"Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code>",id:"combinations-of-apify_local_storage_dir-and-apify_token",level:3},{value:"Convenience env vars",id:"convenience-env-vars",level:2},{value:"<code>APIFY_HEADLESS</code>",id:"apify_headless",level:3},{value:"<code>APIFY_LOG_LEVEL</code>",id:"apify_log_level",level:3},{value:"<code>APIFY_MEMORY_MBYTES</code>",id:"apify_memory_mbytes",level:3},{value:"<code>APIFY_PROXY_PASSWORD</code>",id:"apify_proxy_password",level:3}],y=(a="CrawleeApiLink",function(e){return console.warn("Component "+a+" was not imported, exported, or provided by MDXProvider as global scope"),(0,i.kt)("div",e)}),f={toc:m},h="wrapper";function v(e){var t=e.components,n=(0,r.Z)(e,s);return(0,i.kt)(h,(0,o.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"The following is a list of the environment variables used by Apify SDK that are available to the user.\nThe SDK is capable of running without any env vars present, but certain features will only become available\nafter env vars are properly set. You can use ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"\nto set the env vars for you. ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," also sets the variables automatically."),(0,i.kt)("h2",{id:"important-env-vars"},"Important env vars"),(0,i.kt)("p",null,"The following environment variables have large impact on the way Apify SDK works and its behavior\ncan be changed significantly by setting or unsetting them."),(0,i.kt)("h3",{id:"apify_local_storage_dir"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("p",null,"Defines the path to a local directory where ",(0,i.kt)(l.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")),", ",(0,i.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")),", and ",(0,i.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," store their data. Typically, it is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"./storage"),". If omitted, you should define the ",(0,i.kt)("a",{parentName:"p",href:"#apify_token",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable instead."),(0,i.kt)("h3",{id:"apify_token"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"The API token for your Apify account. It is used to access the Apify API, e.g. to access cloud storage\nor to run an actor on the Apify platform. You can find your API token on the\n",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page. If omitted,\nyou should define the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable instead."),(0,i.kt)("h3",{id:"combinations-of-apify_local_storage_dir-and-apify_token"},"Combinations of ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOCAL_STORAGE_DIR")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_TOKEN")),(0,i.kt)("p",null,"By combining the env vars in various ways, you can greatly influence the behavior of Apify SDK."),(0,i.kt)("table",null,(0,i.kt)("thead",{parentName:"table"},(0,i.kt)("tr",{parentName:"thead"},(0,i.kt)("th",{parentName:"tr",align:null},"Env Vars"),(0,i.kt)("th",{parentName:"tr",align:null},"API"),(0,i.kt)("th",{parentName:"tr",align:null},"Storages"))),(0,i.kt)("tbody",{parentName:"table"},(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},"none OR ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"no"),(0,i.kt)("td",{parentName:"tr",align:null},"local")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"Apify platform")),(0,i.kt)("tr",{parentName:"tbody"},(0,i.kt)("td",{parentName:"tr",align:null},(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_TOKEN")," AND ",(0,i.kt)("inlineCode",{parentName:"td"},"APIFY_LOCAL_STORAGE_DIR")),(0,i.kt)("td",{parentName:"tr",align:null},"yes"),(0,i.kt)("td",{parentName:"tr",align:null},"local+platform")))),(0,i.kt)("p",null,"When using both ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR"),", you can use all the Apify platform\nfeatures and your data will be stored locally by default. If you want to access platform storages,\nyou can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"{ forceCloud: true }")," option in their respective functions."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const localDataset = await Actor.openDataset('my-local-data');\nconst remoteDataset = await Actor.openDataset('my-remote-data', { forceCloud: true });\n")),(0,i.kt)("h2",{id:"convenience-env-vars"},"Convenience env vars"),(0,i.kt)("p",null,"The next group includes env vars that can help achieve certain goals without having to change\nyour code, such as temporarily switching log level to DEBUG."),(0,i.kt)("h3",{id:"apify_headless"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_HEADLESS")),(0,i.kt)("p",null,"If set to ",(0,i.kt)("inlineCode",{parentName:"p"},"1"),", web browsers launched by Apify SDK will run in the headless mode. You can still override\nthis setting in the code, e.g. by passing the ",(0,i.kt)("inlineCode",{parentName:"p"},"headless: true")," option to the"),(0,i.kt)(l.Z,{to:"apify/class/Actor#launchPuppeteer",mdxType:"ApiLink"},"`Actor.launchPuppeteer()`")," function. But having this setting in an environment variable allows you to develop the crawler locally in headful mode to simplify the debugging, and only run the crawler in headless mode once you deploy it to the Apify platform. By default, the browsers are launched in headful mode, i.e. with windows.",(0,i.kt)("h3",{id:"apify_log_level"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_LOG_LEVEL")),(0,i.kt)("p",null,"Specifies the minimum log level, which can be one of the following values (in order of severity):\n",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"WARNING")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"ERROR"),". By default, the log level is set to ",(0,i.kt)("inlineCode",{parentName:"p"},"INFO"),",\nwhich means that ",(0,i.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages are not printed to console. See the ",(0,i.kt)(y,{to:"core/class/Log",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")),"\nnamespace for logging utilities."),(0,i.kt)("h3",{id:"apify_memory_mbytes"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_MEMORY_MBYTES")),(0,i.kt)("p",null,"Sets the amount of system memory in megabytes to be used by the ",(0,i.kt)(y,{to:"core/class/AutoscaledPool",mdxType:"CrawleeApiLink"},(0,i.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")),".\nIt is used to limit the number of concurrently running tasks. By default, the max amount of memory\nto be used is set to one quarter of total system memory, i.e. on a system with 8192 MB of memory,\nthe autoscaling feature will only use up to 2048 MB of memory."),(0,i.kt)("h3",{id:"apify_proxy_password"},(0,i.kt)("inlineCode",{parentName:"h3"},"APIFY_PROXY_PASSWORD")),(0,i.kt)("p",null,"Optional password to ",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," for IP address rotation.\nIf you have an Apify Account, you can find the password on the ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"Proxy page"),"\nin the Apify Console. The password is automatically inferred using the ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," env var,\nso in most cases, you don't need to touch it. You should use it when, for some reason,\nyou need access to Apify Proxy, but no access to Apify API, or when you need access to\nproxy from a different account than your token represents."))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>y});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,y=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var p=2;p<r;p++)i[p]=n[p];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d564bc96.28964036.js b/assets/js/d564bc96.28964036.js deleted file mode 100644 index 88e90e0b4c..0000000000 --- a/assets/js/d564bc96.28964036.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9750],{84777:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var o=n(87462),r=n(63366),i=(n(67294),n(3905)),a=["components"],p={id_old:"version-1.3-playwright-goto-options",title:"PlaywrightGotoOptions",id:"playwright-goto-options"},l=void 0,s={unversionedId:"typedefs/playwright-goto-options",id:"version-1.3/typedefs/playwright-goto-options",title:"PlaywrightGotoOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightGotoOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-goto-options",permalink:"/sdk/js/docs/1.3/typedefs/playwright-goto-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightGotoOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-playwright-goto-options",title:"PlaywrightGotoOptions",id:"playwright-goto-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"<code>timeout</code>",id:"timeout",level:3},{value:"<code>waitUntil</code>",id:"waituntil",level:3},{value:"<code>referer</code>",id:"referer",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,a);return(0,i.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrightgotooptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),s=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},d=function(e){var t=s(e.components);return o.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),m=r,f=u["".concat(l,".").concat(m)]||u[m]||c[m]||i;return n?o.createElement(f,a(a({ref:t},d),{},{components:n})):o.createElement(f,a({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:r,a[1]=p;for(var s=2;s<i;s++)a[s]=n[s];return o.createElement.apply(null,a)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d564bc96.ba613be6.js b/assets/js/d564bc96.ba613be6.js new file mode 100644 index 0000000000..c866481cb5 --- /dev/null +++ b/assets/js/d564bc96.ba613be6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9750],{84777:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var o=n(87462),r=n(63366),i=(n(67294),n(3905)),a=["components"],p={id_old:"version-1.3-playwright-goto-options",title:"PlaywrightGotoOptions",id:"playwright-goto-options"},l=void 0,s={unversionedId:"typedefs/playwright-goto-options",id:"version-1.3/typedefs/playwright-goto-options",title:"PlaywrightGotoOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/PlaywrightGotoOptions.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-goto-options",permalink:"/sdk/js/docs/1.3/typedefs/playwright-goto-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightGotoOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-playwright-goto-options",title:"PlaywrightGotoOptions",id:"playwright-goto-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"<code>timeout</code>",id:"timeout",level:3},{value:"<code>waitUntil</code>",id:"waituntil",level:3},{value:"<code>referer</code>",id:"referer",level:3}],c={toc:u},m="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,a);return(0,i.kt)(m,(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwrightgotooptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"timeout"},(0,i.kt)("inlineCode",{parentName:"h3"},"timeout")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("p",null,"Maximum operation time in milliseconds, defaults to 30 seconds, pass ",(0,i.kt)("inlineCode",{parentName:"p"},"0")," to disable timeout. The default value can be changed by using the\nbrowserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or\npage.setDefaultTimeout(timeout) methods."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"waituntil"},(0,i.kt)("inlineCode",{parentName:"h3"},"waitUntil")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},""domcontentloaded"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""load"")," | ",(0,i.kt)("inlineCode",{parentName:"p"},""networkidle"")),(0,i.kt)("p",null,"When to consider operation succeeded, defaults to ",(0,i.kt)("inlineCode",{parentName:"p"},"load"),". Events can be either: - ",(0,i.kt)("inlineCode",{parentName:"p"},"'domcontentloaded'")," - consider operation to be finished when the\n",(0,i.kt)("inlineCode",{parentName:"p"},"DOMContentLoaded")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'load'")," - consider operation to be finished when the ",(0,i.kt)("inlineCode",{parentName:"p"},"load")," event is fired. - ",(0,i.kt)("inlineCode",{parentName:"p"},"'networkidle'")," - consider\noperation to be finished when there are no network connections for at least ",(0,i.kt)("inlineCode",{parentName:"p"},"500")," ms."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"referer"},(0,i.kt)("inlineCode",{parentName:"h3"},"referer")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers)."),(0,i.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),s=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},d=function(e){var t=s(e.components);return o.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),m=r,f=u["".concat(l,".").concat(m)]||u[m]||c[m]||i;return n?o.createElement(f,a(a({ref:t},d),{},{components:n})):o.createElement(f,a({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:r,a[1]=p;for(var s=2;s<i;s++)a[s]=n[s];return o.createElement.apply(null,a)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d5a4b422.6332d0b4.js b/assets/js/d5a4b422.6332d0b4.js deleted file mode 100644 index 257432fb05..0000000000 --- a/assets/js/d5a4b422.6332d0b4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9679],{41421:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=r(87462),a=r(63366),s=(r(67294),r(3905)),o=["components"],l={id_old:"version-1.3-handle-request",title:"HandleRequest",id:"handle-request"},i=void 0,p={unversionedId:"typedefs/handle-request",id:"version-1.3/typedefs/handle-request",title:"HandleRequest",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/HandleRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request",permalink:"/sdk/js/docs/1.3/typedefs/handle-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequest.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-handle-request",title:"HandleRequest",id:"handle-request"},sidebar:"version-1.3/docs",previous:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request-input"},next:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/handle-request-inputs"}},d={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,o);return(0,s.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"handlerequest"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/handle-request-inputs",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"HandleRequestInputs"))," - Arguments passed to this callback.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(r),f=a,m=u["".concat(i,".").concat(f)]||u[f]||c[f]||s;return r?n.createElement(m,o(o({ref:t},d),{},{components:r})):n.createElement(m,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var p=2;p<s;p++)o[p]=r[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d5a4b422.cf91be28.js b/assets/js/d5a4b422.cf91be28.js new file mode 100644 index 0000000000..9c1a31a547 --- /dev/null +++ b/assets/js/d5a4b422.cf91be28.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9679],{41421:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],l={id_old:"version-1.3-handle-request",title:"HandleRequest",id:"handle-request"},i=void 0,p={unversionedId:"typedefs/handle-request",id:"version-1.3/typedefs/handle-request",title:"HandleRequest",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/HandleRequest.md",sourceDirName:"typedefs",slug:"/typedefs/handle-request",permalink:"/sdk/js/docs/1.3/typedefs/handle-request",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequest.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-handle-request",title:"HandleRequest",id:"handle-request"},sidebar:"version-1.3/docs",previous:{title:"HandleFailedRequestInput",permalink:"/sdk/js/docs/1.3/typedefs/handle-failed-request-input"},next:{title:"HandleRequestInputs",permalink:"/sdk/js/docs/1.3/typedefs/handle-request-inputs"}},d={},u=[],c={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"handlerequest"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/handle-request-inputs",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleRequestInputs"))," - Arguments passed to this callback.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(r),f=a,m=u["".concat(i,".").concat(f)]||u[f]||c[f]||o;return r?n.createElement(m,s(s({ref:t},d),{},{components:r})):n.createElement(m,s({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[u]="string"==typeof e?e:a,s[1]=l;for(var p=2;p<o;p++)s[p]=r[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d6b4fa26.851290e4.js b/assets/js/d6b4fa26.851290e4.js deleted file mode 100644 index 3cafea3a92..0000000000 --- a/assets/js/d6b4fa26.851290e4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7030],{85694:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id:"proxy-info",title:"ProxyInfo"},l=void 0,s={unversionedId:"typedefs/proxy-info",id:"version-2.3/typedefs/proxy-info",title:"ProxyInfo",description:"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of",source:"@site/versioned_docs/version-2.3/typedefs/ProxyInfo.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-info",permalink:"/sdk/js/docs/2.3/typedefs/proxy-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyInfo.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-info",title:"ProxyInfo"},sidebar:"version-2.3/docs",previous:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-options"},next:{title:"LoggerOptions",permalink:"/sdk/js/docs/2.3/typedefs/logger-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"<code>sessionId</code>",id:"sessionid",level:3},{value:"<code>url</code>",id:"url",level:3},{value:"<code>groups</code>",id:"groups",level:3},{value:"<code>countryCode</code>",id:"countrycode",level:3},{value:"<code>password</code>",id:"password",level:3},{value:"<code>hostname</code>",id:"hostname",level:3},{value:"<code>port</code>",id:"port",level:3}],c={toc:u},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyinfo"}),(0,a.kt)("p",null,"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of\ncrawlers, you can get this object by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo")),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\n// Getting proxyInfo object by calling class method directly\nconst proxyInfo = proxyConfiguration.newProxyInfo();\n\n// In crawler\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n // Getting used proxy URL\n const proxyUrl = proxyInfo.url;\n\n // Getting ID of used Session\n const sessionIdentifier = proxyInfo.sessionId;\n }\n})\n\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"sessionid"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The identifier of used ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session")),", if used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The URL of the proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array<string>")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors on the Apify cloud, or when using the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"hostname"},(0,a.kt)("inlineCode",{parentName:"h3"},"hostname")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Hostname of your proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"port"},(0,a.kt)("inlineCode",{parentName:"h3"},"port")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Proxy port."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),y=o,f=u["".concat(l,".").concat(y)]||u[y]||c[y]||a;return n?r.createElement(f,i(i({ref:t},d),{},{components:n})):r.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,i[1]=p;for(var s=2;s<a;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}y.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d6b4fa26.da1ac863.js b/assets/js/d6b4fa26.da1ac863.js new file mode 100644 index 0000000000..045f7de65a --- /dev/null +++ b/assets/js/d6b4fa26.da1ac863.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7030],{85694:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>p,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],p={id:"proxy-info",title:"ProxyInfo"},l=void 0,s={unversionedId:"typedefs/proxy-info",id:"version-2.3/typedefs/proxy-info",title:"ProxyInfo",description:"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of",source:"@site/versioned_docs/version-2.3/typedefs/ProxyInfo.md",sourceDirName:"typedefs",slug:"/typedefs/proxy-info",permalink:"/sdk/js/docs/2.3/typedefs/proxy-info",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyInfo.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-info",title:"ProxyInfo"},sidebar:"version-2.3/docs",previous:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/2.3/typedefs/proxy-configuration-options"},next:{title:"LoggerOptions",permalink:"/sdk/js/docs/2.3/typedefs/logger-options"}},d={},u=[{value:"Properties",id:"properties",level:2},{value:"<code>sessionId</code>",id:"sessionid",level:3},{value:"<code>url</code>",id:"url",level:3},{value:"<code>groups</code>",id:"groups",level:3},{value:"<code>countryCode</code>",id:"countrycode",level:3},{value:"<code>password</code>",id:"password",level:3},{value:"<code>hostname</code>",id:"hostname",level:3},{value:"<code>port</code>",id:"port",level:3}],c={toc:u},y="wrapper";function f(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(y,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"proxyinfo"}),(0,a.kt)("p",null,"The main purpose of the ProxyInfo object is to provide information about the current proxy connection used by the crawler for the request. Outside of\ncrawlers, you can get this object by calling ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newproxyinfo",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration.newProxyInfo")),"."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"\nconst proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups\n countryCode: 'US',\n});\n\n// Getting proxyInfo object by calling class method directly\nconst proxyInfo = proxyConfiguration.newProxyInfo();\n\n// In crawler\nconst crawler = new Apify.CheerioCrawler({\n // ...\n proxyConfiguration,\n handlePageFunction: ({ proxyInfo }) => {\n // Getting used proxy URL\n const proxyUrl = proxyInfo.url;\n\n // Getting ID of used Session\n const sessionIdentifier = proxyInfo.sessionId;\n }\n})\n\n")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"sessionid"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionId")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The identifier of used ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session")),", if used."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"url"},(0,a.kt)("inlineCode",{parentName:"h3"},"url")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The URL of the proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"groups"},(0,a.kt)("inlineCode",{parentName:"h3"},"groups")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array<string>")),(0,a.kt)("p",null,"An array of proxy groups to be used by the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". If not provided, the proxy will select the groups\nautomatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"countrycode"},(0,a.kt)("inlineCode",{parentName:"h3"},"countryCode")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified\ncountry. For example ",(0,a.kt)("inlineCode",{parentName:"p"},"GB")," for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the\ncountry selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is\nassigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",target:"_blank",rel:"noopener"},"full list of available country codes"),". This parameter is\noptional, by default, the proxy uses all available proxy servers from all countries."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"password"},(0,a.kt)("inlineCode",{parentName:"h3"},"password")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"User's password for the proxy. By default, it is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_PROXY_PASSWORD")," environment variable, which is automatically set by the system\nwhen running the actors on the Apify cloud, or when using the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"hostname"},(0,a.kt)("inlineCode",{parentName:"h3"},"hostname")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Hostname of your proxy."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"port"},(0,a.kt)("inlineCode",{parentName:"h3"},"port")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"Proxy port."),(0,a.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(n),y=o,f=u["".concat(l,".").concat(y)]||u[y]||c[y]||a;return n?r.createElement(f,i(i({ref:t},d),{},{components:n})):r.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=y;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p[u]="string"==typeof e?e:o,i[1]=p;for(var s=2;s<a;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}y.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d6d3abb7.942e4395.js b/assets/js/d6d3abb7.942e4395.js new file mode 100644 index 0000000000..463d09fe5c --- /dev/null +++ b/assets/js/d6d3abb7.942e4395.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1320],{510:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=a(87462),l=a(63366),o=(a(67294),a(3905)),r=["components"],i={id_old:"version-2.3.0-social",title:"utils.social",id:"social"},s=void 0,p={unversionedId:"api/social",id:"version-2.3/api/social",title:"utils.social",description:"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents.",source:"@site/versioned_docs/version-2.3/api/social.md",sourceDirName:"api",slug:"/api/social",permalink:"/sdk/js/docs/2.3/api/social",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/social.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-social",title:"utils.social",id:"social"},sidebar:"version-2.3/docs",previous:{title:"utils.puppeteer",permalink:"/sdk/js/docs/2.3/api/puppeteer"},next:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"}},c={},u=[{value:"<code>social.LINKEDIN_REGEX</code>",id:"sociallinkedin_regex",level:2},{value:"<code>social.LINKEDIN_REGEX_GLOBAL</code>",id:"sociallinkedin_regex_global",level:2},{value:"<code>social.INSTAGRAM_REGEX</code>",id:"socialinstagram_regex",level:2},{value:"<code>social.INSTAGRAM_REGEX_GLOBAL</code>",id:"socialinstagram_regex_global",level:2},{value:"<code>social.TWITTER_REGEX</code>",id:"socialtwitter_regex",level:2},{value:"<code>social.TWITTER_REGEX_GLOBAL</code>",id:"socialtwitter_regex_global",level:2},{value:"<code>social.FACEBOOK_REGEX</code>",id:"socialfacebook_regex",level:2},{value:"<code>social.FACEBOOK_REGEX_GLOBAL</code>",id:"socialfacebook_regex_global",level:2},{value:"<code>social.YOUTUBE_REGEX</code>",id:"socialyoutube_regex",level:2},{value:"<code>social.YOUTUBE_REGEX_GLOBAL</code>",id:"socialyoutube_regex_global",level:2},{value:"<code>social.EMAIL_REGEX</code>",id:"socialemail_regex",level:2},{value:"<code>social.EMAIL_REGEX_GLOBAL</code>",id:"socialemail_regex_global",level:2},{value:"<code>social.emailsFromText(text)</code>",id:"socialemailsfromtexttext",level:2},{value:"<code>social.emailsFromUrls(urls)</code>",id:"socialemailsfromurlsurls",level:2},{value:"<code>social.phonesFromText(text)</code>",id:"socialphonesfromtexttext",level:2},{value:"<code>social.phonesFromUrls(urls)</code>",id:"socialphonesfromurlsurls",level:2},{value:"<code>social.parseHandlesFromHtml(html, [data])</code>",id:"socialparsehandlesfromhtmlhtml-data",level:2}],m={toc:u},d="wrapper";function h(e){var t=e.components,a=(0,l.Z)(e,r);return(0,o.kt)(d,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"social"}),(0,o.kt)("p",null,"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst emails = Apify.utils.social.emailsFromText('alice@example.com bob@example.com');\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex"}),(0,o.kt)("h2",{id:"sociallinkedin_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single LinkedIn profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.LINKEDIN_REGEX.test('https://www.linkedin.com/in/alan-turing')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex_global"}),(0,o.kt)("h2",{id:"sociallinkedin_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple LinkedIn profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.LINKEDIN_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} LinkedIn profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex"}),(0,o.kt)("h2",{id:"socialinstagram_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Instagram profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.INSTAGRAM_REGEX.test('https://www.instagram.com/old_prague')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex_global"}),(0,o.kt)("h2",{id:"socialinstagram_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Instagram profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.INSTAGRAM_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Instagram profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex"}),(0,o.kt)("h2",{id:"socialtwitter_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Twitter profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.TWITTER_REGEX.test('https://www.twitter.com/apify')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex_global"}),(0,o.kt)("h2",{id:"socialtwitter_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Twitter profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.TWITTER_REGEX_STRING);\nif (matches) console.log(`${matches.length} Twitter profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex"}),(0,o.kt)("h2",{id:"socialfacebook_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Facebook profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\nhttps://www.facebook.com/profile.php?id=123456789\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.FACEBOOK_REGEX.test('https://www.facebook.com/apifytech')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex_global"}),(0,o.kt)("h2",{id:"socialfacebook_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Facebook profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.FACEBOOK_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Facebook profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex"}),(0,o.kt)("h2",{id:"socialyoutube_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Youtube channel, user or video URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\nhttps://www.youtube.com/c/TrapNation\nhttps://www.youtube.com/channel/UCklie6BM0fhFvzWYqQVoCTA\nhttps://www.youtube.com/user/pewdiepie\n")),(0,o.kt)("p",null,"Please note that this won't match URLs like ",(0,o.kt)("a",{parentName:"p",href:"https://www.youtube.com/pewdiepie",target:"_blank",rel:"noopener"},"https://www.youtube.com/pewdiepie")," that redirect to /user or /channel."),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex_global"}),(0,o.kt)("h2",{id:"socialyoutube_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Youtube channel, user or video URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such\nas:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\nhttps://www.youtube.com/c/TrapNation\nhttps://www.youtube.com/channel/UCklie6BM0fhFvzWYqQVoCTA\nhttps://www.youtube.com/user/pewdiepie\n")),(0,o.kt)("p",null,"Please note that this won't match URLs like ",(0,o.kt)("a",{parentName:"p",href:"https://www.youtube.com/pewdiepie",target:"_blank",rel:"noopener"},"https://www.youtube.com/pewdiepie")," that redirect to /user or /channel."),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.YOUTUBE_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Youtube videos found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex"}),(0,o.kt)("h2",{id:"socialemail_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single email address. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex_global"}),(0,o.kt)("h2",{id:"socialemail_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple email addresses in a text. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromtext"}),(0,o.kt)("h2",{id:"socialemailsfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromText(text)")),(0,o.kt)("p",null,"The function extracts email addresses from a plain text. Note that the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromurls"}),(0,o.kt)("h2",{id:"socialemailsfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromUrls(urls)")),(0,o.kt)("p",null,"The function extracts email addresses from a list of URLs. Basically it looks for all ",(0,o.kt)("inlineCode",{parentName:"p"},"mailto:")," URLs and returns valid email addresses from them. Note\nthat the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array<string>")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromtext"}),(0,o.kt)("h2",{id:"socialphonesfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromText(text)")),(0,o.kt)("p",null,"The function attempts to extract phone numbers from a text. Please note that the results might not be accurate, since phone numbers appear in a large\nvariety of formats and conventions. If you encounter some problems, please ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"file an issue"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search the phone numbers in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromurls"}),(0,o.kt)("h2",{id:"socialphonesfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromUrls(urls)")),(0,o.kt)("p",null,"Finds phone number links in an array of URLs and extracts the phone numbers from them. Note that the phone number links look like ",(0,o.kt)("inlineCode",{parentName:"p"},"tel://123456789"),",\n",(0,o.kt)("inlineCode",{parentName:"p"},"tel:/123456789")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"tel:123456789"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array<string>")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"parsehandlesfromhtml"}),(0,o.kt)("h2",{id:"socialparsehandlesfromhtmlhtml-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.parseHandlesFromHtml(html, [data])")),(0,o.kt)("p",null,"The function attempts to extract emails, phone numbers and social profile URLs from a HTML document, specifically LinkedIn, Twitter, Instagram and\nFacebook profile URLs. The function removes duplicates from the resulting arrays and sorts the items alphabetically."),(0,o.kt)("p",null,"Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"phones")," field contains phone numbers extracted from the special phone links such as ",(0,o.kt)("inlineCode",{parentName:"p"},"[call us](tel:+1234556789)")," (see\n",(0,o.kt)("a",{parentName:"p",href:"../api/social#phonesfromurls",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"social.phonesFromUrls()")),") and potentially other sources with high certainty, while ",(0,o.kt)("inlineCode",{parentName:"p"},"phonesUncertain")," contains phone\nnumbers extracted from the plain text, which might be very inaccurate."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('http://www.example.com');\nconst html = await page.content();\n\nconst result = Apify.utils.social.parseHandlesFromHtml(html);\nconsole.log('Social handles:');\nconsole.dir(result);\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - HTML text"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," | ",(0,o.kt)("inlineCode",{parentName:"li"},"null")," ",(0,o.kt)("code",null," = ")," - Optional object which will receive the ",(0,o.kt)("inlineCode",{parentName:"li"},"text")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"$")," properties that contain text content of the\nHTML and ",(0,o.kt)("inlineCode",{parentName:"li"},"cheerio")," object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/social-handles",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SocialHandles"))," - An object with the social handles."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>h});var n=a(67294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,n,l=function(e,t){if(null==e)return{};var a,n,l={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),d=l,h=u["".concat(s,".").concat(d)]||u[d]||m[d]||o;return a?n.createElement(h,r(r({ref:t},c),{},{components:a})):n.createElement(h,r({ref:t},c))}));function h(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=a.length,r=new Array(o);r[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:l,r[1]=i;for(var p=2;p<o;p++)r[p]=a[p];return n.createElement.apply(null,r)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d6d3abb7.bcea5039.js b/assets/js/d6d3abb7.bcea5039.js deleted file mode 100644 index a4018dd731..0000000000 --- a/assets/js/d6d3abb7.bcea5039.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1320],{510:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=a(87462),l=a(63366),o=(a(67294),a(3905)),r=["components"],i={id_old:"version-2.3.0-social",title:"utils.social",id:"social"},s=void 0,p={unversionedId:"api/social",id:"version-2.3/api/social",title:"utils.social",description:"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents.",source:"@site/versioned_docs/version-2.3/api/social.md",sourceDirName:"api",slug:"/api/social",permalink:"/sdk/js/docs/2.3/api/social",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/social.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-social",title:"utils.social",id:"social"},sidebar:"version-2.3/docs",previous:{title:"utils.puppeteer",permalink:"/sdk/js/docs/2.3/api/puppeteer"},next:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"}},c={},u=[{value:"<code>social.LINKEDIN_REGEX</code>",id:"sociallinkedin_regex",level:2},{value:"<code>social.LINKEDIN_REGEX_GLOBAL</code>",id:"sociallinkedin_regex_global",level:2},{value:"<code>social.INSTAGRAM_REGEX</code>",id:"socialinstagram_regex",level:2},{value:"<code>social.INSTAGRAM_REGEX_GLOBAL</code>",id:"socialinstagram_regex_global",level:2},{value:"<code>social.TWITTER_REGEX</code>",id:"socialtwitter_regex",level:2},{value:"<code>social.TWITTER_REGEX_GLOBAL</code>",id:"socialtwitter_regex_global",level:2},{value:"<code>social.FACEBOOK_REGEX</code>",id:"socialfacebook_regex",level:2},{value:"<code>social.FACEBOOK_REGEX_GLOBAL</code>",id:"socialfacebook_regex_global",level:2},{value:"<code>social.YOUTUBE_REGEX</code>",id:"socialyoutube_regex",level:2},{value:"<code>social.YOUTUBE_REGEX_GLOBAL</code>",id:"socialyoutube_regex_global",level:2},{value:"<code>social.EMAIL_REGEX</code>",id:"socialemail_regex",level:2},{value:"<code>social.EMAIL_REGEX_GLOBAL</code>",id:"socialemail_regex_global",level:2},{value:"<code>social.emailsFromText(text)</code>",id:"socialemailsfromtexttext",level:2},{value:"<code>social.emailsFromUrls(urls)</code>",id:"socialemailsfromurlsurls",level:2},{value:"<code>social.phonesFromText(text)</code>",id:"socialphonesfromtexttext",level:2},{value:"<code>social.phonesFromUrls(urls)</code>",id:"socialphonesfromurlsurls",level:2},{value:"<code>social.parseHandlesFromHtml(html, [data])</code>",id:"socialparsehandlesfromhtmlhtml-data",level:2}],m={toc:u},d="wrapper";function h(e){var t=e.components,a=(0,l.Z)(e,r);return(0,o.kt)(d,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"social"}),(0,o.kt)("p",null,"A namespace that contains various utilities to help you extract social handles from text, URLs and and HTML documents."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst emails = Apify.utils.social.emailsFromText('alice@example.com bob@example.com');\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex"}),(0,o.kt)("h2",{id:"sociallinkedin_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single LinkedIn profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.LINKEDIN_REGEX.test('https://www.linkedin.com/in/alan-turing')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"linkedin_regex_global"}),(0,o.kt)("h2",{id:"sociallinkedin_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.LINKEDIN_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple LinkedIn profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/alan-turing\nen.linkedin.com/in/alan-turing\nlinkedin.com/in/alan-turing\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds/latest-activity\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.linkedin.com/in/linus-torvalds\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.LINKEDIN_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} LinkedIn profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex"}),(0,o.kt)("h2",{id:"socialinstagram_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Instagram profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.INSTAGRAM_REGEX.test('https://www.instagram.com/old_prague')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"instagram_regex_global"}),(0,o.kt)("h2",{id:"socialinstagram_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.INSTAGRAM_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Instagram profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/old_prague\nwww.instagram.com/old_prague/\ninstagr.am/old_prague\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano/followers\n")),(0,o.kt)("p",null,"the expression extracts just the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.instagram.com/cristiano\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.INSTAGRAM_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Instagram profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex"}),(0,o.kt)("h2",{id:"socialtwitter_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Twitter profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.TWITTER_REGEX.test('https://www.twitter.com/apify')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"twitter_regex_global"}),(0,o.kt)("h2",{id:"socialtwitter_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.TWITTER_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Twitter profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/apify\ntwitter.com/apify\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump/following\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.twitter.com/realdonaldtrump\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.TWITTER_REGEX_STRING);\nif (matches) console.log(`${matches.length} Twitter profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex"}),(0,o.kt)("h2",{id:"socialfacebook_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Facebook profile URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\nhttps://www.facebook.com/profile.php?id=123456789\n")),(0,o.kt)("p",null,"The regular expression does NOT match URLs with additional subdirectories or query parameters, such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.FACEBOOK_REGEX.test('https://www.facebook.com/apifytech')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"facebook_regex_global"}),(0,o.kt)("h2",{id:"socialfacebook_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.FACEBOOK_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Facebook profile URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\nfacebook.com/apifytech\nfb.com/apifytech\n")),(0,o.kt)("p",null,"If the profile URL contains subdirectories or query parameters, the regular expression extracts just the base part of the profile URL. For example,\nfrom text such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech/photos\n")),(0,o.kt)("p",null,"the expression extracts only the following base URL:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.facebook.com/apifytech\n")),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.FACEBOOK_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Facebook profiles found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex"}),(0,o.kt)("h2",{id:"socialyoutube_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single Youtube channel, user or video URL. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i")," and matches URLs such as:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\nhttps://www.youtube.com/c/TrapNation\nhttps://www.youtube.com/channel/UCklie6BM0fhFvzWYqQVoCTA\nhttps://www.youtube.com/user/pewdiepie\n")),(0,o.kt)("p",null,"Please note that this won't match URLs like ",(0,o.kt)("a",{parentName:"p",href:"https://www.youtube.com/pewdiepie",target:"_blank",rel:"noopener"},"https://www.youtube.com/pewdiepie")," that redirect to /user or /channel."),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"if (Apify.utils.social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')) {\n console.log('Match!');\n}\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"youtube_regex_global"}),(0,o.kt)("h2",{id:"socialyoutube_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.YOUTUBE_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple Youtube channel, user or video URLs in a text or HTML. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig")," and matches URLs such\nas:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"https://www.youtube.com/watch?v=kM7YfhfkiEE\nhttps://youtu.be/kM7YfhfkiEE\nhttps://www.youtube.com/c/TrapNation\nhttps://www.youtube.com/channel/UCklie6BM0fhFvzWYqQVoCTA\nhttps://www.youtube.com/user/pewdiepie\n")),(0,o.kt)("p",null,"Please note that this won't match URLs like ",(0,o.kt)("a",{parentName:"p",href:"https://www.youtube.com/pewdiepie",target:"_blank",rel:"noopener"},"https://www.youtube.com/pewdiepie")," that redirect to /user or /channel."),(0,o.kt)("p",null,"Example usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"const matches = text.match(Apify.utils.social.YOUTUBE_REGEX_GLOBAL);\nif (matches) console.log(`${matches.length} Youtube videos found!`);\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex"}),(0,o.kt)("h2",{id:"socialemail_regex"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX")),(0,o.kt)("p",null,"Regular expression to exactly match a single email address. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/^...$/i"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"email_regex_global"}),(0,o.kt)("h2",{id:"socialemail_regex_global"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.EMAIL_REGEX_GLOBAL")),(0,o.kt)("p",null,"Regular expression to find multiple email addresses in a text. It has the following form: ",(0,o.kt)("inlineCode",{parentName:"p"},"/.../ig"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromtext"}),(0,o.kt)("h2",{id:"socialemailsfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromText(text)")),(0,o.kt)("p",null,"The function extracts email addresses from a plain text. Note that the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"emailsfromurls"}),(0,o.kt)("h2",{id:"socialemailsfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.emailsFromUrls(urls)")),(0,o.kt)("p",null,"The function extracts email addresses from a list of URLs. Basically it looks for all ",(0,o.kt)("inlineCode",{parentName:"p"},"mailto:")," URLs and returns valid email addresses from them. Note\nthat the function preserves the order of emails and keep duplicates."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array<string>")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of emails addresses found. If no emails are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromtext"}),(0,o.kt)("h2",{id:"socialphonesfromtexttext"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromText(text)")),(0,o.kt)("p",null,"The function attempts to extract phone numbers from a text. Please note that the results might not be accurate, since phone numbers appear in a large\nvariety of formats and conventions. If you encounter some problems, please ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/issues",target:"_blank",rel:"noopener"},"file an issue"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"text")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - Text to search the phone numbers in.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"phonesfromurls"}),(0,o.kt)("h2",{id:"socialphonesfromurlsurls"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.phonesFromUrls(urls)")),(0,o.kt)("p",null,"Finds phone number links in an array of URLs and extracts the phone numbers from them. Note that the phone number links look like ",(0,o.kt)("inlineCode",{parentName:"p"},"tel://123456789"),",\n",(0,o.kt)("inlineCode",{parentName:"p"},"tel:/123456789")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"tel:123456789"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"urls")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Array<string>")," - Array of URLs.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<string>")," - Array of phone numbers found. If no phone numbers are found, the function returns an empty array."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"parsehandlesfromhtml"}),(0,o.kt)("h2",{id:"socialparsehandlesfromhtmlhtml-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"social.parseHandlesFromHtml(html, [data])")),(0,o.kt)("p",null,"The function attempts to extract emails, phone numbers and social profile URLs from a HTML document, specifically LinkedIn, Twitter, Instagram and\nFacebook profile URLs. The function removes duplicates from the resulting arrays and sorts the items alphabetically."),(0,o.kt)("p",null,"Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"phones")," field contains phone numbers extracted from the special phone links such as ",(0,o.kt)("inlineCode",{parentName:"p"},"[call us](tel:+1234556789)")," (see\n",(0,o.kt)("a",{parentName:"p",href:"../api/social#phonesfromurls",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"social.phonesFromUrls()")),") and potentially other sources with high certainty, while ",(0,o.kt)("inlineCode",{parentName:"p"},"phonesUncertain")," contains phone\nnumbers extracted from the plain text, which might be very inaccurate."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nconst browser = await Apify.launchPuppeteer();\nconst page = await browser.newPage();\nawait page.goto('http://www.example.com');\nconst html = await page.content();\n\nconst result = Apify.utils.social.parseHandlesFromHtml(html);\nconsole.log('Social handles:');\nconsole.dir(result);\n")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"html")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")," - HTML text"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," | ",(0,o.kt)("inlineCode",{parentName:"li"},"null")," ",(0,o.kt)("code",null," = ")," - Optional object which will receive the ",(0,o.kt)("inlineCode",{parentName:"li"},"text")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"$")," properties that contain text content of the\nHTML and ",(0,o.kt)("inlineCode",{parentName:"li"},"cheerio")," object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/social-handles",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SocialHandles"))," - An object with the social handles."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>h});var n=a(67294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){l(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,n,l=function(e,t){if(null==e)return{};var a,n,l={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(a),d=l,h=u["".concat(s,".").concat(d)]||u[d]||m[d]||o;return a?n.createElement(h,r(r({ref:t},c),{},{components:a})):n.createElement(h,r({ref:t},c))}));function h(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=a.length,r=new Array(o);r[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:l,r[1]=i;for(var p=2;p<o;p++)r[p]=a[p];return n.createElement.apply(null,r)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d6dcf287.16d2c0d4.js b/assets/js/d6dcf287.16d2c0d4.js new file mode 100644 index 0000000000..5ae1779cee --- /dev/null +++ b/assets/js/d6dcf287.16d2c0d4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6329],{92082:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>c,toc:()=>u});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),i=["components"],o={id_old:"version-1.3-basic-crawler",title:"Basic crawler",id:"basic-crawler"},l=void 0,c={unversionedId:"examples/basic-crawler",id:"version-1.3/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the",source:"@site/versioned_docs/version-1.3/examples/basic_crawler.md",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/1.3/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/basic_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-basic-crawler",title:"Basic crawler",id:"basic-crawler"},sidebar:"version-1.3/docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/1.3/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/1.3/examples/call-actor"}},p={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,s.kt)(f,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the\n",(0,s.kt)("a",{parentName:"p",href:"/docs/api/basic-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full\nfeatured crawlers like ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/cheerio-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," or\n",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/playwright-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,s.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/utils#requestasbrowser",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()")),"\nconvenience function and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create and initialize an instance of the RequestList class that contains\n // a list of URLs to crawl. Here we use just a few hard-coded URLs.\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n ]);\n\n // Create a BasicCrawler - the simplest crawler that enables\n // users to implement the crawling logic themselves.\n const crawler = new Apify.BasicCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // This function will be called for each URL to crawl.\n handleRequestFunction: async ({ request }) => {\n console.log(`Processing ${request.url}...`);\n\n // Fetch the page HTML via Apify utils requestAsBrowser\n const { body } = await Apify.utils.requestAsBrowser(request);\n\n // Store the HTML and URL to the default dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},s=Object.keys(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var l=a.createContext({}),c=function(e){var t=a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(r),f=n,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||s;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,i=new Array(s);i[0]=f;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[u]="string"==typeof e?e:n,i[1]=o;for(var c=2;c<s;c++)i[c]=r[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d6dcf287.e6d694c8.js b/assets/js/d6dcf287.e6d694c8.js deleted file mode 100644 index 67e9375b75..0000000000 --- a/assets/js/d6dcf287.e6d694c8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6329],{92082:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=r(87462),n=r(63366),s=(r(67294),r(3905)),i=["components"],l={id_old:"version-1.3-basic-crawler",title:"Basic crawler",id:"basic-crawler"},o=void 0,c={unversionedId:"examples/basic-crawler",id:"version-1.3/examples/basic-crawler",title:"Basic crawler",description:"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the",source:"@site/versioned_docs/version-1.3/examples/basic_crawler.md",sourceDirName:"examples",slug:"/examples/basic-crawler",permalink:"/sdk/js/docs/1.3/examples/basic-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/basic_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-basic-crawler",title:"Basic crawler",id:"basic-crawler"},sidebar:"version-1.3/docs",previous:{title:"Add data to dataset",permalink:"/sdk/js/docs/1.3/examples/add-data-to-dataset"},next:{title:"Call actor",permalink:"/sdk/js/docs/1.3/examples/call-actor"}},p={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,n.Z)(e,i);return(0,s.kt)(f,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the\n",(0,s.kt)("a",{parentName:"p",href:"/docs/api/basic-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),". You probably don't need to go this deep though, and it would be better to start with one of the full\nfeatured crawlers like ",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/cheerio-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," or\n",(0,s.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/examples/playwright-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,s.kt)("p",null,"The script simply downloads several web pages with plain HTTP requests using the ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/utils#requestasbrowser",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"Apify.utils.requestAsBrowser()")),"\nconvenience function and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in\n",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default"),"."),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create and initialize an instance of the RequestList class that contains\n // a list of URLs to crawl. Here we use just a few hard-coded URLs.\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.google.com/' },\n { url: 'http://www.example.com/' },\n { url: 'http://www.bing.com/' },\n { url: 'http://www.wikipedia.com/' },\n ]);\n\n // Create a BasicCrawler - the simplest crawler that enables\n // users to implement the crawling logic themselves.\n const crawler = new Apify.BasicCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // This function will be called for each URL to crawl.\n handleRequestFunction: async ({ request }) => {\n console.log(`Processing ${request.url}...`);\n\n // Fetch the page HTML via Apify utils requestAsBrowser\n const { body } = await Apify.utils.requestAsBrowser(request);\n\n // Store the HTML and URL to the default dataset.\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},s=Object.keys(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var o=a.createContext({}),c=function(e){var t=a.useContext(o),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return a.createElement(o.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},f=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,s=e.originalType,o=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(r),f=n,m=u["".concat(o,".").concat(f)]||u[f]||d[f]||s;return r?a.createElement(m,i(i({ref:t},p),{},{components:r})):a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var s=r.length,i=new Array(s);i[0]=f;var l={};for(var o in t)hasOwnProperty.call(t,o)&&(l[o]=t[o]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var c=2;c<s;c++)i[c]=r[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d7c3b9b6.0fe98483.js b/assets/js/d7c3b9b6.0fe98483.js deleted file mode 100644 index 4ef4399380..0000000000 --- a/assets/js/d7c3b9b6.0fe98483.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7463],{91407:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),s=(r(67294),r(3905)),o=["components"],i={id_old:"version-1.3-puppeteer-crawler",title:"Puppeteer crawler",id:"puppeteer-crawler"},p=void 0,l={unversionedId:"examples/puppeteer-crawler",id:"version-1.3/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination with RequestQueue",source:"@site/versioned_docs/version-1.3/examples/puppeteer_crawler.md",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/1.3/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-crawler",title:"Puppeteer crawler",id:"puppeteer-crawler"},sidebar:"version-1.3/docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/1.3/examples/playwright-crawler"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"}},u={},c=[],d={toc:c},f="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,o);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example demonstrates how to use ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," in combination with ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue")),"\nto recursively scrape the ",(0,s.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer. The crawler starts with a single URL,\nfinds links to next pages, enqueues them and continues until no more desired links are available. The results are stored to the default dataset. In\nlocal configuration, the results are stored as JSON files in ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PuppeteerCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Puppeteer.\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n\n // Here you can set options that are passed to the Apify.launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', $posts => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach($post => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,h=c["".concat(p,".").concat(f)]||c[f]||d[f]||s;return r?n.createElement(h,o(o({ref:t},u),{},{components:r})):n.createElement(h,o({ref:t},u))}));function h(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d7c3b9b6.2ea4132c.js b/assets/js/d7c3b9b6.2ea4132c.js new file mode 100644 index 0000000000..65b9350a8a --- /dev/null +++ b/assets/js/d7c3b9b6.2ea4132c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7463],{91407:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=["components"],i={id_old:"version-1.3-puppeteer-crawler",title:"Puppeteer crawler",id:"puppeteer-crawler"},p=void 0,l={unversionedId:"examples/puppeteer-crawler",id:"version-1.3/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination with RequestQueue",source:"@site/versioned_docs/version-1.3/examples/puppeteer_crawler.md",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/1.3/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_crawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-crawler",title:"Puppeteer crawler",id:"puppeteer-crawler"},sidebar:"version-1.3/docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/1.3/examples/playwright-crawler"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"}},u={},c=[],d={toc:c},f="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," in combination with ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue")),"\nto recursively scrape the ",(0,o.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer. The crawler starts with a single URL,\nfinds links to next pages, enqueues them and continues until no more desired links are available. The results are stored to the default dataset. In\nlocal configuration, the results are stored as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PuppeteerCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Puppeteer.\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n\n // Here you can set options that are passed to the Apify.launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', $posts => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach($post => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,h=c["".concat(p,".").concat(f)]||c[f]||d[f]||o;return r?n.createElement(h,s(s({ref:t},u),{},{components:r})):n.createElement(h,s({ref:t},u))}));function h(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:a,s[1]=i;for(var l=2;l<o;l++)s[l]=r[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d8156f77.46077ff3.js b/assets/js/d8156f77.46077ff3.js new file mode 100644 index 0000000000..1c9924f07a --- /dev/null +++ b/assets/js/d8156f77.46077ff3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7465],{68889:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(67294),a=n(88746),i=n(6141),o=n(6832);const p=function(e){var t=e.to,n=e.children,p=(0,i.E)(),s=p.version,c=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var l=s+"/";return"current"===s?l="next/":c&&(l=""),r.createElement(a.default,{to:"/api/"+l+t},n)}},368:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=(n(68889),["components"]),p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/../docs/guides/typescript_actor.mdx",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/next/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/typescript_actor.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/next/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/next/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Actor.getInput()) as any; // getInput returns Promise<Object<string, *>|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Actor.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d8156f77.bc0b692e.js b/assets/js/d8156f77.bc0b692e.js deleted file mode 100644 index 799ce8b399..0000000000 --- a/assets/js/d8156f77.bc0b692e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7465],{68889:(e,t,n)=>{n.d(t,{Z:()=>p});var r=n(67294),a=n(88746),i=n(6141),o=n(6832);const p=function(e){var t=e.to,n=e.children,p=(0,i.E)(),s=p.version,c=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var l=s+"/";return"current"===s?l="next/":c&&(l=""),r.createElement(a.default,{to:"/api/"+l+t},n)}},368:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>d});var r=n(87462),a=n(63366),i=(n(67294),n(3905)),o=(n(68889),["components"]),p={id:"type-script-actor",title:"TypeScript Actors"},s=void 0,c={unversionedId:"guides/type-script-actor",id:"guides/type-script-actor",title:"TypeScript Actors",description:"Apify SDK supports TypeScript by covering public APIs with type declarations. This",source:"@site/../docs/guides/typescript_actor.mdx",sourceDirName:"guides",slug:"/guides/type-script-actor",permalink:"/sdk/js/docs/next/guides/type-script-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/typescript_actor.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"type-script-actor",title:"TypeScript Actors"},sidebar:"docs",previous:{title:"Session Management",permalink:"/sdk/js/docs/next/guides/session-management"},next:{title:"Running in Docker",permalink:"/sdk/js/docs/next/guides/docker-images"}},l={},d=[],u={toc:d},m="wrapper";function y(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Apify SDK supports TypeScript by covering public APIs with type declarations. This\nallows writing code with auto-completion for TypeScript and JavaScript code alike.\nBesides that, actors written in TypeScript can take advantage of compile-time\ntype-checking and avoid many coding mistakes, while providing documentation for\nfunctions, parameters and return values."),(0,i.kt)("h1",{id:"setting-up-a-typescript-project"},"Setting up a TypeScript project"),(0,i.kt)("p",null,"To use TypeScript in your actors, you'll need the following prerequisites."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript compiler ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," installed somewhere:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev typescript\n")),(0,i.kt)("p",{parentName:"li"},"TypeScript can be a development dependency in your project, as shown above. There's no\nneed to pollute your production environment or your system's global repository\nwith TypeScript.")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"A build script invoking ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," and a correctly specified ",(0,i.kt)("inlineCode",{parentName:"p"},"main")," entry point defined\nin your ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json"),":"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "scripts": {\n "build": "tsc -p tsconfig.json"\n },\n "main": "build/main.js"\n}\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Type declarations for NodeJS, so you can take advantage of type-checking in all the features you'll use:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-shell",metastring:"script",script:!0},"npm install --dev @types/node\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"TypeScript configuration file allowing ",(0,i.kt)("inlineCode",{parentName:"p"},"tsc")," to understand your project layout and\nthe features used in your project:"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-json"},'{\n "compilerOptions": {\n "target": "es2019",\n "module": "commonjs",\n "moduleResolution": "node",\n "strict": true,\n "noImplicitAny": false,\n "strictNullChecks": false,\n "lib": [\n "DOM",\n "DOM.Iterable",\n "ES2015",\n "ES2016",\n "ES2018",\n "ES2019.Object",\n "ES2018.AsyncIterable",\n "ES2020.String",\n "ES2019.Array"\n ],\n "rootDir": "src/",\n "outDir": "build/"\n },\n "include": [\n "src/"\n ]\n}\n')),(0,i.kt)("p",{parentName:"li"},"Place the content above inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"tsconfig.json")," in your root folder."),(0,i.kt)("p",{parentName:"li"},"Also, if you are a VSCode user that is using JavaScript, create a ",(0,i.kt)("inlineCode",{parentName:"p"},"jsconfig.json")," with the same content, adding ",(0,i.kt)("inlineCode",{parentName:"p"},'"checkJs": true')," to ",(0,i.kt)("inlineCode",{parentName:"p"},'"compilerOptions"'),", so you can enjoy using the types in your ",(0,i.kt)("inlineCode",{parentName:"p"},".js")," source files."))),(0,i.kt)("h1",{id:"auto-completion"},"Auto-completion"),(0,i.kt)("p",null,"IDE auto-completion should work in most places. That's true even if you are writting\nactors in pure JavaScript. For time constraints, we left out the amendment of an\ninternal API for the time being, and these need to be added as the SDK developers write\nnew and enhance old code."),(0,i.kt)("h1",{id:"sdk-documentation"},"SDK Documentation"),(0,i.kt)("p",null,"SDK documentation has grown a lot. There is a new API Reference section ",(0,i.kt)("strong",{parentName:"p"},"Type definitions"),"\nthat holds documentation for all constructible types, function parameters and\nreturn types, in the Apify SDK."),(0,i.kt)("h1",{id:"caveats"},"Caveats"),(0,i.kt)("p",null,"As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties\nand parameters annotated with ",(0,i.kt)("inlineCode",{parentName:"p"},"any")," type, therefore the settings ",(0,i.kt)("inlineCode",{parentName:"p"},"noImplicitAny")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"strictNullChecks"),", set to ",(0,i.kt)("inlineCode",{parentName:"p"},"true"),", may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary."),(0,i.kt)("p",null,"Besides the ",(0,i.kt)("em",{parentName:"p"},"implicit any")," errors that might occur in the code when writing in TypeScript, the\ncurrent typings doesn't offer generics that make outputs type-safe, so you need to declare your\ntypes, as such:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},"interface MySchema {\n expectedParam1?: string;\n expectedParam2?: number;\n}\n\nconst input: MySchema = (await Actor.getInput()) as any; // getInput returns Promise<Object<string, *>|string|Buffer|null> here\n\nif (!input?.expectedParam1) { // input is MySchema now and you can check in a type-safe way\n throw new Error('Missing expectedParam1');\n}\n")),(0,i.kt)("p",null,"There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (",(0,i.kt)("inlineCode",{parentName:"p"},"map"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"reduce"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"forEach"),"):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-typescript"},'interface ExpectedShape {\n id: string;\n someFields: Fields[];\n}\n\nconst dataset = await Actor.openDataset();\nawait dataset.forEach((item: ExpectedShape) => {\n // deal with item.id / item.someFields\n // otherwise item is "any"\n})\n')))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>y});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,y=d["".concat(s,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(y,o(o({ref:t},l),{},{components:n})):r.createElement(y,o({ref:t},l))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,o[1]=p;for(var c=2;c<i;c++)o[c]=n[c];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d886524c.978a56c7.js b/assets/js/d886524c.978a56c7.js new file mode 100644 index 0000000000..5944e014f0 --- /dev/null +++ b/assets/js/d886524c.978a56c7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4725],{2642:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),p=["components"],s={id:"post-response-inputs",title:"PostResponseInputs"},i=void 0,l={unversionedId:"typedefs/post-response-inputs",id:"version-2.3/typedefs/post-response-inputs",title:"PostResponseInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PostResponseInputs.md",sourceDirName:"typedefs",slug:"/typedefs/post-response-inputs",permalink:"/sdk/js/docs/2.3/typedefs/post-response-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponseInputs.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"post-response-inputs",title:"PostResponseInputs"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>response</code>",id:"response",level:3},{value:"<code>request</code>",id:"request",level:3},{value:"<code>session</code>",id:"session",level:3},{value:"<code>proxyInfo</code>",id:"proxyinfo",level:3},{value:"<code>crawler</code>",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,a.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"postresponseinputs"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"response"},(0,a.kt)("inlineCode",{parentName:"h3"},"response")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"IncomingMessage")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"Readable")),(0,a.kt)("p",null,"stream"),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"request"},(0,a.kt)("inlineCode",{parentName:"h3"},"request")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))),(0,a.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"session"},(0,a.kt)("inlineCode",{parentName:"h3"},"session")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))),(0,a.kt)("p",null,"The current session"),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyinfo"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,a.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawler"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),l=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(n),f=o,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||a;return n?r.createElement(m,p(p({ref:t},u),{},{components:n})):r.createElement(m,p({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,p=new Array(a);p[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:o,p[1]=s;for(var l=2;l<a;l++)p[l]=n[l];return r.createElement.apply(null,p)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d886524c.d3071687.js b/assets/js/d886524c.d3071687.js deleted file mode 100644 index f559ba2325..0000000000 --- a/assets/js/d886524c.d3071687.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4725],{2642:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),p=["components"],s={id:"post-response-inputs",title:"PostResponseInputs"},i=void 0,l={unversionedId:"typedefs/post-response-inputs",id:"version-2.3/typedefs/post-response-inputs",title:"PostResponseInputs",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/PostResponseInputs.md",sourceDirName:"typedefs",slug:"/typedefs/post-response-inputs",permalink:"/sdk/js/docs/2.3/typedefs/post-response-inputs",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponseInputs.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"post-response-inputs",title:"PostResponseInputs"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>response</code>",id:"response",level:3},{value:"<code>request</code>",id:"request",level:3},{value:"<code>session</code>",id:"session",level:3},{value:"<code>proxyInfo</code>",id:"proxyinfo",level:3},{value:"<code>crawler</code>",id:"crawler",level:3}],d={toc:c},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,p);return(0,a.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"postresponseinputs"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"response"},(0,a.kt)("inlineCode",{parentName:"h3"},"response")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"IncomingMessage")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"Readable")),(0,a.kt)("p",null,"stream"),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"request"},(0,a.kt)("inlineCode",{parentName:"h3"},"request")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))),(0,a.kt)("p",null,"Original instance fo the {Request} object. Must be modified in-place."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"session"},(0,a.kt)("inlineCode",{parentName:"h3"},"session")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))),(0,a.kt)("p",null,"The current session"),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyinfo"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyInfo")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyInfo"))),(0,a.kt)("p",null,"An object with information about currently used proxy by the crawler and configured by the ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"crawler"},(0,a.kt)("inlineCode",{parentName:"h3"},"crawler")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),l=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):p(p({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(n),f=o,m=c["".concat(i,".").concat(f)]||c[f]||d[f]||a;return n?r.createElement(m,p(p({ref:t},u),{},{components:n})):r.createElement(m,p({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,p=new Array(a);p[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:o,p[1]=s;for(var l=2;l<a;l++)p[l]=n[l];return r.createElement.apply(null,p)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d9576928.8b9d2f26.js b/assets/js/d9576928.8b9d2f26.js new file mode 100644 index 0000000000..ceb633d944 --- /dev/null +++ b/assets/js/d9576928.8b9d2f26.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5852],{30433:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>m});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),s=a(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,a=e.block,l=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],d=(0,i.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,a=c.indexOf(t),n=p[a].value;n!==l&&(d(t),s(n))},h=function(e){var t,a=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},p.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:h,onClick:m},i,{className:(0,o.Z)("tabs__item",u.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function d(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",u.tabList)},r.createElement(p,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function m(e){var t=(0,s.Z)();return r.createElement(d,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function s(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,a])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),s=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(l.location.search);t.set(s,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[s,l])]}function d(e){var t,a,r,o,i=e.defaultValue,s=e.queryString,d=void 0!==s&&s,m=e.groupId,h=u(e),g=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(a){if(!p({value:a,tabValues:n}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:h})})),f=g[0],k=g[1],y=c({queryString:d,groupId:m}),b=y[0],w=y[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=v[0],C=v[1],x=function(){var e=null!=b?b:N;return p({value:e,tabValues:h})?e:null}();return(0,n.useLayoutEffect)((function(){x&&k(x)}),[x]),{selectedValue:f,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:h}))throw new Error("Can't select invalid tab value="+e);k(e),w(e),C(e)}),[w,C,h]),tabValues:h}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),s=l.version,u=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var p=s+"/";return"current"===s?p="next/":u&&(p=""),n.createElement(r.default,{to:"/api/"+p+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},21685:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>y,contentTitle:()=>f,default:()=>N,frontMatter:()=>g,metadata:()=>k,toc:()=>b});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(68889),a(26569)),l=a(65559),s=a(30433),u=a(14563);const p='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm start --silent\n',c='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder /usr/src/app/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm run start:prod --silent\n',d='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image.\nCMD npm start --silent\n',m='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY --chown=myuser . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder --chown=myuser /home/myuser/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image. If you know you won\'t need headful browsers,\n# you can remove the XVFB start script for a micro perf gain.\nCMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent\n';var h=["components"],g={id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},f=void 0,k={unversionedId:"guides/docker-images",id:"guides/docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers",source:"@site/../docs/guides/docker_images.mdx",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/next/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/docker_images.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},sidebar:"docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/next/guides/type-script-actor"},next:{title:"Examples",permalink:"/sdk/js/docs/next/examples"}},y={},b=[{value:"Overview",id:"overview",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"Apify Docker Images",id:"apify-docker-images",level:2},{value:"actor-node",id:"actor-node",level:3},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:3},{value:"actor-node-playwright",id:"actor-node-playwright",level:3},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:3},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:3},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:3},{value:"Example Dockerfile",id:"example-dockerfile",level:2}],w={toc:b},v="wrapper";function N(e){var t=e.components,a=(0,r.Z)(e,h);return(0,o.kt)(v,(0,n.Z)({},w,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"./apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js ",(0,o.kt)("strong",{parentName:"p"},"versions 16 and 18 are supported")," (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 16\nFROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-13.7.0")," comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chromium that's pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.21.1")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Node.js version tag should ",(0,o.kt)("strong",{parentName:"li"},"always")," be used."),(0,o.kt)("li",{parentName:"ul"},"The automation library version tag should be used for ",(0,o.kt)("strong",{parentName:"li"},"added security"),"."),(0,o.kt)("li",{parentName:"ul"},"Asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," should be used as the automation library version in our ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "crawlee": "^3.0.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"When you use only what you need, you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"apify-docker-images"},"Apify Docker Images"),(0,o.kt)("h3",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,"\u200b",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"))," and other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"))," environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so we can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use the above images, it's necessary to have a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)(i.B,{to:"docs/introduction/setting-up",mdxType:"CrawleeLink"},"Crawlee CLI")," which automatically adds the correct Dockerfile into our project folder."),(0,o.kt)(l.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"node+js",label:"Node+JavaScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},p)),(0,o.kt)(s.Z,{value:"node+ts",label:"Node+TypeScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"browser+js",label:"Browser+JavaScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in the ",(0,o.kt)("code",null,"FROM")," declaration.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},d)),(0,o.kt)(s.Z,{value:"browser+ts",label:"Browser+TypeScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in both ",(0,o.kt)("code",null,"FROM")," declarations.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},m))))}N.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=u(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return a?n.createElement(h,i(i({ref:t},p),{},{components:a})):n.createElement(h,i({ref:t},p))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var u=2;u<o;u++)i[u]=a[u];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d9576928.c323db4e.js b/assets/js/d9576928.c323db4e.js deleted file mode 100644 index e6833ac959..0000000000 --- a/assets/js/d9576928.c323db4e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5852],{30433:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>m});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),s=a(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,a=e.block,l=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],d=(0,i.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,a=c.indexOf(t),n=p[a].value;n!==l&&(d(t),s(n))},h=function(e){var t,a=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},p.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:h,onClick:m},i,{className:(0,o.Z)("tabs__item",u.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function d(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",u.tabList)},r.createElement(p,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function m(e){var t=(0,s.Z)();return r.createElement(d,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function s(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,a])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),s=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(l.location.search);t.set(s,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[s,l])]}function d(e){var t,a,r,o,i=e.defaultValue,s=e.queryString,d=void 0!==s&&s,m=e.groupId,h=u(e),g=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(a){if(!p({value:a,tabValues:n}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:h})})),f=g[0],k=g[1],y=c({queryString:d,groupId:m}),b=y[0],w=y[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=v[0],C=v[1],x=function(){var e=null!=b?b:N;return p({value:e,tabValues:h})?e:null}();return(0,n.useLayoutEffect)((function(){x&&k(x)}),[x]),{selectedValue:f,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:h}))throw new Error("Can't select invalid tab value="+e);k(e),w(e),C(e)}),[w,C,h]),tabValues:h}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),s=l.version,u=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var p=s+"/";return"current"===s?p="next/":u&&(p=""),n.createElement(r.default,{to:"/api/"+p+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},21685:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>y,contentTitle:()=>f,default:()=>N,frontMatter:()=>g,metadata:()=>k,toc:()=>b});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(68889),a(26569)),l=a(65559),s=a(30433),u=a(14563);const p='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm start --silent\n',c='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder /usr/src/app/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm run start:prod --silent\n',d='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image.\nCMD npm start --silent\n',m='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY --chown=myuser . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder --chown=myuser /home/myuser/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image. If you know you won\'t need headful browsers,\n# you can remove the XVFB start script for a micro perf gain.\nCMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent\n';var h=["components"],g={id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},f=void 0,k={unversionedId:"guides/docker-images",id:"guides/docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers",source:"@site/../docs/guides/docker_images.mdx",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/next/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/docker_images.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},sidebar:"docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/next/guides/type-script-actor"},next:{title:"Examples",permalink:"/sdk/js/docs/next/examples"}},y={},b=[{value:"Overview",id:"overview",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"Apify Docker Images",id:"apify-docker-images",level:2},{value:"actor-node",id:"actor-node",level:3},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:3},{value:"actor-node-playwright",id:"actor-node-playwright",level:3},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:3},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:3},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:3},{value:"Example Dockerfile",id:"example-dockerfile",level:2}],w={toc:b},v="wrapper";function N(e){var t=e.components,a=(0,r.Z)(e,h);return(0,o.kt)(v,(0,n.Z)({},w,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"./apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js ",(0,o.kt)("strong",{parentName:"p"},"versions 16 and 18 are supported")," (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 16\nFROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-13.7.0")," comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chromium that's pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.21.1")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Node.js version tag should ",(0,o.kt)("strong",{parentName:"li"},"always")," be used."),(0,o.kt)("li",{parentName:"ul"},"The automation library version tag should be used for ",(0,o.kt)("strong",{parentName:"li"},"added security"),"."),(0,o.kt)("li",{parentName:"ul"},"Asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," should be used as the automation library version in our ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "crawlee": "^3.0.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"When you use only what you need, you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"apify-docker-images"},"Apify Docker Images"),(0,o.kt)("h3",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,"\u200b",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"))," and other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"))," environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so we can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use the above images, it's necessary to have a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)(i.B,{to:"docs/introduction/setting-up",mdxType:"CrawleeLink"},"Crawlee CLI")," which automatically adds the correct Dockerfile into our project folder."),(0,o.kt)(l.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"node+js",label:"Node+JavaScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},p)),(0,o.kt)(s.Z,{value:"node+ts",label:"Node+TypeScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"browser+js",label:"Browser+JavaScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in the ",(0,o.kt)("code",null,"FROM")," declaration.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},d)),(0,o.kt)(s.Z,{value:"browser+ts",label:"Browser+TypeScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in both ",(0,o.kt)("code",null,"FROM")," declarations.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},m))))}N.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=u(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return a?n.createElement(h,i(i({ref:t},p),{},{components:a})):n.createElement(h,i({ref:t},p))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var u=2;u<o;u++)i[u]=a[u];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/d9fd8234.399d3fa2.js b/assets/js/d9fd8234.3c54f763.js similarity index 61% rename from assets/js/d9fd8234.399d3fa2.js rename to assets/js/d9fd8234.3c54f763.js index 328fc37382..b58256e271 100644 --- a/assets/js/d9fd8234.399d3fa2.js +++ b/assets/js/d9fd8234.3c54f763.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1505],{30433:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function c(e){var t=e.children,n=e.hidden,c=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,c),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),c=n(63735),i=n(38224),o=n(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,i=e.selectedValue,o=e.selectValue,s=e.tabValues,d=[],p=(0,c.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==i&&(p(t),o(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,c=d.indexOf(e.currentTarget)-1;n=null!=(l=d[c])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,c=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},c,{className:(0,l.Z)("tabs__item",u.tabItem,null==c?void 0:c.className,{"tabs__item--active":i===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var c=l.find((function(e){return e.props.value===r}));return c?(0,a.cloneElement)(c,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,o.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),c=n(20636),i=n(99200);function o(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:o(n);return function(e){var t=(0,c.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,c=e.groupId,i=(0,a.k6)(),o=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:c});return[(0,l._X)(o),(0,r.useCallback)((function(e){if(o){var t=new URLSearchParams(i.location.search);t.set(o,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[o,i])]}function p(e){var t,n,a,l,c=e.defaultValue,o=e.queryString,p=void 0!==o&&o,m=e.groupId,b=u(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:c,tabValues:b})})),f=g[0],y=g[1],w=d({queryString:p,groupId:m}),I=w[0],h=w[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,i.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=v[0],C=v[1],X=function(){var e=null!=I?I:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){X&&y(X)}),[X]),{selectedValue:f,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),h(e),C(e)}),[h,C,b]),tabValues:b}}},72989:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>f,contentTitle:()=>b,default:()=>v,frontMatter:()=>m,metadata:()=>g,toc:()=>y});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),c=n(65559),i=n(30433);n(14563);const o={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, $ }) {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0"};var d,p=["components"],m={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},b=void 0,g={unversionedId:"examples/crawl-multiple-urls",id:"version-3.1/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-3.1/examples/crawl_multiple_urls.mdx",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_multiple_urls.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/examples/crawl-relative-links"}},f={},y=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),I={toc:y},h="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(h,(0,r.Z)({},I,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)(c.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(w,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var o=r.createContext({}),u=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(o.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,o=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=u(n),m=a,b=d["".concat(o,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,c(c({ref:t},s),{},{components:n})):r.createElement(b,c({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,c=new Array(l);c[0]=m;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:a,c[1]=i;for(var u=2;u<l;u++)c[u]=n[u];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1505],{30433:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function c(e){var t=e.children,n=e.hidden,c=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,c),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),c=n(63735),o=n(38224),i=n(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,c.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==o&&(p(t),i(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,c=d.indexOf(e.currentTarget)-1;n=null!=(l=d[c])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,c=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},c,{className:(0,l.Z)("tabs__item",u.tabItem,null==c?void 0:c.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var c=l.find((function(e){return e.props.value===r}));return c?(0,a.cloneElement)(c,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,o.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),c=n(20636),o=n(99200);function i(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:i(n);return function(e){var t=(0,c.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,c=e.groupId,o=(0,a.k6)(),i=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:c});return[(0,l._X)(i),(0,r.useCallback)((function(e){if(i){var t=new URLSearchParams(o.location.search);t.set(i,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[i,o])]}function p(e){var t,n,a,l,c=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=u(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:c,tabValues:b})})),f=g[0],y=g[1],w=d({queryString:p,groupId:m}),I=w[0],v=w[1],h=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,o.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=h[0],C=h[1],X=function(){var e=null!=I?I:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){X&&y(X)}),[X]),{selectedValue:f,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),v(e),C(e)}),[v,C,b]),tabValues:b}}},72989:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>f,contentTitle:()=>b,default:()=>h,frontMatter:()=>m,metadata:()=>g,toc:()=>y});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),c=n(65559),o=n(30433);n(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, $ }) {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0"};var d,p=["components"],m={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},b=void 0,g={unversionedId:"examples/crawl-multiple-urls",id:"version-3.1/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-3.1/examples/crawl_multiple_urls.mdx",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_multiple_urls.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/examples/crawl-relative-links"}},f={},y=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),I={toc:y},v="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(v,(0,r.Z)({},I,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)(c.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(w,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(o.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(o.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),u=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=u(n),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,c(c({ref:t},s),{},{components:n})):r.createElement(b,c({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,c=new Array(l);c[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var u=2;u<l;u++)c[u]=n[u];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/da95e9ed.176462b4.js b/assets/js/da95e9ed.176462b4.js deleted file mode 100644 index c636eb45be..0000000000 --- a/assets/js/da95e9ed.176462b4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8594],{18226:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"basic-crawler-options",title:"BasicCrawlerOptions"},s=void 0,p={unversionedId:"typedefs/basic-crawler-options",id:"version-2.3/typedefs/basic-crawler-options",title:"BasicCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/BasicCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/basic-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/basic-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BasicCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"basic-crawler-options",title:"BasicCrawlerOptions"},sidebar:"version-2.3/docs",previous:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"},next:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>handleRequestFunction</code>",id:"handlerequestfunction",level:3},{value:"<code>requestList</code>",id:"requestlist",level:3},{value:"<code>requestQueue</code>",id:"requestqueue",level:3},{value:"<code>handleRequestTimeoutSecs</code>",id:"handlerequesttimeoutsecs",level:3},{value:"<code>handleFailedRequestFunction</code>",id:"handlefailedrequestfunction",level:3},{value:"<code>maxRequestRetries</code>",id:"maxrequestretries",level:3},{value:"<code>maxRequestsPerCrawl</code>",id:"maxrequestspercrawl",level:3},{value:"<code>autoscaledPoolOptions</code>",id:"autoscaledpooloptions",level:3},{value:"<code>minConcurrency</code>",id:"minconcurrency",level:3},{value:"<code>maxConcurrency</code>",id:"maxconcurrency",level:3},{value:"<code>useSessionPool</code>",id:"usesessionpool",level:3},{value:"<code>sessionPoolOptions</code>",id:"sessionpooloptions",level:3}],d={toc:c},m="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"basiccrawleroptions"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"handlerequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleRequest"))),(0,o.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each URL to crawl."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance represents the URL to crawl."),(0,o.kt)("p",null,"The function must return a promise, which is then awaited by the crawler."),(0,o.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,o.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,o.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestlist"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,o.kt)("p",null,"Static list of URLs to be processed. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestqueue"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,o.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlerequesttimeoutsecs"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestTimeoutSecs")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 60")),(0,o.kt)("p",null,"Timeout in which the function passed as ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction")," needs to finish, in seconds."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlefailedrequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,o.kt)("p",null,"A function to handle requests that failed more than ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n error: Error,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,o.kt)("p",null,"See ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/basic_crawler.js#L11",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestretries"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 3")),(0,o.kt)("p",null,"Indicates how many times the request is retried if\n",(0,o.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," fails."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestspercrawl"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"autoscaledpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,o.kt)("p",null,"Custom options passed to the underlying ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,o.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,o.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,o.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"minconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1")),(0,o.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("p",null,(0,o.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1000")),(0,o.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usesessionpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = true")),(0,o.kt)("p",null,"Basic crawler will initialize the ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,o.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be than\navailable in the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"sessionpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,o.kt)("p",null,"The configuration options for ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return n?r.createElement(h,l(l({ref:t},u),{},{components:n})):r.createElement(h,l({ref:t},u))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,l[1]=i;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/da95e9ed.c521af15.js b/assets/js/da95e9ed.c521af15.js new file mode 100644 index 0000000000..4fbbd03069 --- /dev/null +++ b/assets/js/da95e9ed.c521af15.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8594],{18226:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>h,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"basic-crawler-options",title:"BasicCrawlerOptions"},s=void 0,p={unversionedId:"typedefs/basic-crawler-options",id:"version-2.3/typedefs/basic-crawler-options",title:"BasicCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/BasicCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/basic-crawler-options",permalink:"/sdk/js/docs/2.3/typedefs/basic-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BasicCrawlerOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"basic-crawler-options",title:"BasicCrawlerOptions"},sidebar:"version-2.3/docs",previous:{title:"AutoscaledPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"},next:{title:"CheerioCrawlerOptions",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>handleRequestFunction</code>",id:"handlerequestfunction",level:3},{value:"<code>requestList</code>",id:"requestlist",level:3},{value:"<code>requestQueue</code>",id:"requestqueue",level:3},{value:"<code>handleRequestTimeoutSecs</code>",id:"handlerequesttimeoutsecs",level:3},{value:"<code>handleFailedRequestFunction</code>",id:"handlefailedrequestfunction",level:3},{value:"<code>maxRequestRetries</code>",id:"maxrequestretries",level:3},{value:"<code>maxRequestsPerCrawl</code>",id:"maxrequestspercrawl",level:3},{value:"<code>autoscaledPoolOptions</code>",id:"autoscaledpooloptions",level:3},{value:"<code>minConcurrency</code>",id:"minconcurrency",level:3},{value:"<code>maxConcurrency</code>",id:"maxconcurrency",level:3},{value:"<code>useSessionPool</code>",id:"usesessionpool",level:3},{value:"<code>sessionPoolOptions</code>",id:"sessionpooloptions",level:3}],d={toc:c},m="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(m,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"basiccrawleroptions"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"handlerequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleRequest"))),(0,o.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each URL to crawl."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance represents the URL to crawl."),(0,o.kt)("p",null,"The function must return a promise, which is then awaited by the crawler."),(0,o.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,o.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,o.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestlist"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,o.kt)("p",null,"Static list of URLs to be processed. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"requestqueue"},(0,o.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,o.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,o.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlerequesttimeoutsecs"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleRequestTimeoutSecs")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 60")),(0,o.kt)("p",null,"Timeout in which the function passed as ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction")," needs to finish, in seconds."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"handlefailedrequestfunction"},(0,o.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,o.kt)("p",null,"A function to handle requests that failed more than ",(0,o.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times."),(0,o.kt)("p",null,"The function receives the following object as an argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{\n request: Request,\n error: Error,\n session: Session,\n crawler: BasicCrawler,\n}\n")),(0,o.kt)("p",null,"where the ",(0,o.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,o.kt)("p",null,"See ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/basic_crawler.js#L11",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestretries"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 3")),(0,o.kt)("p",null,"Indicates how many times the request is retried if\n",(0,o.kt)("a",{parentName:"p",href:"../typedefs/basic-crawler-options#handlerequestfunction",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BasicCrawlerOptions.handleRequestFunction"))," fails."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxrequestspercrawl"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"autoscaledpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,o.kt)("p",null,"Custom options passed to the underlying ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,o.kt)("inlineCode",{parentName:"p"},"runTaskFunction")," and\n",(0,o.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction")," options are provided by ",(0,o.kt)("inlineCode",{parentName:"p"},"BasicCrawler")," and cannot be overridden. However, you can provide a custom implementation of\n",(0,o.kt)("inlineCode",{parentName:"p"},"isFinishedFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"minconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1")),(0,o.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("p",null,(0,o.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxconcurrency"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")," ",(0,o.kt)("code",null," = 1000")),(0,o.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usesessionpool"},(0,o.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,o.kt)("code",null," = true")),(0,o.kt)("p",null,"Basic crawler will initialize the ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," with the corresponding ",(0,o.kt)("inlineCode",{parentName:"p"},"sessionPoolOptions"),". The session instance will be than\navailable in the ",(0,o.kt)("inlineCode",{parentName:"p"},"handleRequestFunction"),"."),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"sessionpooloptions"},(0,o.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,o.kt)("p",null,"The configuration options for ",(0,o.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," to use."),(0,o.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return n?r.createElement(h,l(l({ref:t},u),{},{components:n})):r.createElement(h,l({ref:t},u))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[c]="string"==typeof e?e:a,l[1]=i;for(var p=2;p<o;p++)l[p]=n[p];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dab92480.d55ec404.js b/assets/js/dab92480.d55ec404.js new file mode 100644 index 0000000000..54468b09b5 --- /dev/null +++ b/assets/js/dab92480.d55ec404.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5503],{61141:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id:"intercept-handler",title:"InterceptHandler"},l=void 0,c={unversionedId:"typedefs/intercept-handler",id:"version-2.3/typedefs/intercept-handler",title:"InterceptHandler",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/InterceptHandler.md",sourceDirName:"typedefs",slug:"/typedefs/intercept-handler",permalink:"/sdk/js/docs/2.3/typedefs/intercept-handler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/InterceptHandler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"intercept-handler",title:"InterceptHandler"}},s={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"intercepthandler"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerRequest")))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,p(p({ref:t},s),{},{components:r})):n.createElement(m,p({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,p[1]=i;for(var c=2;c<o;c++)p[c]=r[c];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dab92480.f9a3a440.js b/assets/js/dab92480.f9a3a440.js deleted file mode 100644 index 11ce8f34af..0000000000 --- a/assets/js/dab92480.f9a3a440.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5503],{61141:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),p=["components"],i={id:"intercept-handler",title:"InterceptHandler"},l=void 0,c={unversionedId:"typedefs/intercept-handler",id:"version-2.3/typedefs/intercept-handler",title:"InterceptHandler",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/InterceptHandler.md",sourceDirName:"typedefs",slug:"/typedefs/intercept-handler",permalink:"/sdk/js/docs/2.3/typedefs/intercept-handler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/InterceptHandler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"intercept-handler",title:"InterceptHandler"}},s={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,p);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"intercepthandler"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerRequest")))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=c(r),f=a,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,p(p({ref:t},s),{},{components:r})):n.createElement(m,p({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,p=new Array(o);p[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,p[1]=i;for(var c=2;c<o;c++)p[c]=r[c];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dbb49d41.0bcc8d87.js b/assets/js/dbb49d41.0bcc8d87.js new file mode 100644 index 0000000000..5bdd683ef1 --- /dev/null +++ b/assets/js/dbb49d41.0bcc8d87.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2736],{3342:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],s={id:"cheerio-crawler",title:"Cheerio crawler"},l=void 0,c={unversionedId:"examples/cheerio-crawler",id:"version-2.3/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler",source:"@site/versioned_docs/version-2.3/examples/cheerio_crawler.md",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/2.3/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/cheerio_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"version-2.3/docs",previous:{title:"Capture a screenshot",permalink:"/sdk/js/docs/2.3/examples/capture-screenshot"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-all-links"}},p={},u=[],h={toc:u},d="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(d,(0,r.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nto crawl a list of URLs from an external file, load each URL using a plain HTTP request,\nparse the HTML using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library"),"\nand extract some data from it: the page title and all ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.utils contains various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nconst { log } = Apify.utils;\nlog.setLevel(log.LEVELS.DEBUG);\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create an instance of the RequestList class that contains a list of URLs to crawl.\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Create an instance of the CheerioCrawler class - a crawler\n // that automatically loads the URLs and parses their HTML using the cheerio library.\n const crawler = new Apify.CheerioCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n handlePageTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n handlePageFunction: async ({ request, $ }) => {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the default dataset. In local configuration,\n // the data will be stored as JSON files in ./apify_storage/datasets/default\n await Apify.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n log.debug(`Request ${request.url} failed twice.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n log.debug('Crawler finished.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),d=a,m=u["".concat(l,".").concat(d)]||u[d]||h[d]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c<o;c++)i[c]=n[c];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dbb49d41.8a87b336.js b/assets/js/dbb49d41.8a87b336.js deleted file mode 100644 index 3799eec9f6..0000000000 --- a/assets/js/dbb49d41.8a87b336.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2736],{3342:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],s={id:"cheerio-crawler",title:"Cheerio crawler"},l=void 0,c={unversionedId:"examples/cheerio-crawler",id:"version-2.3/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler",source:"@site/versioned_docs/version-2.3/examples/cheerio_crawler.md",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/2.3/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/cheerio_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"version-2.3/docs",previous:{title:"Capture a screenshot",permalink:"/sdk/js/docs/2.3/examples/capture-screenshot"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/2.3/examples/crawl-all-links"}},p={},u=[],d={toc:u},h="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nto crawl a list of URLs from an external file, load each URL using a plain HTTP request,\nparse the HTML using the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library"),"\nand extract some data from it: the page title and all ",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\n// Apify.utils contains various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nconst { log } = Apify.utils;\nlog.setLevel(log.LEVELS.DEBUG);\n\n// Apify.main() function wraps the crawler logic (it is optional).\nApify.main(async () => {\n // Create an instance of the RequestList class that contains a list of URLs to crawl.\n // Add URLs to a RequestList\n const requestList = await Apify.openRequestList('start-urls',\n [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Create an instance of the CheerioCrawler class - a crawler\n // that automatically loads the URLs and parses their HTML using the cheerio library.\n const crawler = new Apify.CheerioCrawler({\n // Let the crawler fetch URLs from our list.\n requestList,\n\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n handlePageTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n handlePageFunction: async ({ request, $ }) => {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the default dataset. In local configuration,\n // the data will be stored as JSON files in ./apify_storage/datasets/default\n await Apify.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n log.debug(`Request ${request.url} failed twice.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n log.debug('Crawler finished.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),h=a,m=u["".concat(l,".").concat(h)]||u[h]||d[h]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[u]="string"==typeof e?e:a,i[1]=s;for(var c=2;c<o;c++)i[c]=n[c];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dbd783b0.7281029f.js b/assets/js/dbd783b0.7281029f.js new file mode 100644 index 0000000000..a7c6eadc45 --- /dev/null +++ b/assets/js/dbd783b0.7281029f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9943],{85315:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],i={id:"create-session",title:"CreateSession"},l=void 0,p={unversionedId:"typedefs/create-session",id:"version-2.3/typedefs/create-session",title:"CreateSession",description:"Factory user-function which creates customized Session instances.",source:"@site/versioned_docs/version-2.3/typedefs/CreateSession.md",sourceDirName:"typedefs",slug:"/typedefs/create-session",permalink:"/sdk/js/docs/2.3/typedefs/create-session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CreateSession.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"create-session",title:"CreateSession"},sidebar:"version-2.3/docs",previous:{title:"KeyConsumer",permalink:"/sdk/js/docs/2.3/typedefs/key-consumer"},next:{title:"RequestTransform",permalink:"/sdk/js/docs/2.3/typedefs/request-transform"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"createsession"}),(0,o.kt)("p",null,"Factory user-function which creates customized ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"sessionPool")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," - Pool requesting the new session.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise<Session>"))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),f=s,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:s,a[1]=i;for(var p=2;p<o;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dbd783b0.8292bdcf.js b/assets/js/dbd783b0.8292bdcf.js deleted file mode 100644 index 397ce5387b..0000000000 --- a/assets/js/dbd783b0.8292bdcf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9943],{85315:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>u});var n=r(87462),s=r(63366),o=(r(67294),r(3905)),a=["components"],i={id:"create-session",title:"CreateSession"},l=void 0,p={unversionedId:"typedefs/create-session",id:"version-2.3/typedefs/create-session",title:"CreateSession",description:"Factory user-function which creates customized Session instances.",source:"@site/versioned_docs/version-2.3/typedefs/CreateSession.md",sourceDirName:"typedefs",slug:"/typedefs/create-session",permalink:"/sdk/js/docs/2.3/typedefs/create-session",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CreateSession.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"create-session",title:"CreateSession"},sidebar:"version-2.3/docs",previous:{title:"KeyConsumer",permalink:"/sdk/js/docs/2.3/typedefs/key-consumer"},next:{title:"RequestTransform",permalink:"/sdk/js/docs/2.3/typedefs/request-transform"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,s.Z)(e,a);return(0,o.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"createsession"}),(0,o.kt)("p",null,"Factory user-function which creates customized ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"sessionPool")),": ",(0,o.kt)("a",{parentName:"li",href:"../api/session-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SessionPool"))," - Pool requesting the new session.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Promise<Session>"))),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,s=function(e,t){if(null==e)return{};var r,n,s={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(s[r]=e[r]);return s}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,s=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=p(r),f=s,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var o=r.length,a=new Array(o);a[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:s,a[1]=i;for(var p=2;p<o;p++)a[p]=r[p];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dc709263.2617ede0.js b/assets/js/dc709263.2617ede0.js deleted file mode 100644 index be8aca5b63..0000000000 --- a/assets/js/dc709263.2617ede0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8386],{87435:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>u,default:()=>b,frontMatter:()=>l,metadata:()=>s,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905));r(14563);const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Proxy connection is automatically established in the Crawler\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n async requestHandler({ page }) {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n});\n\nconsole.log('Running Puppeteer script...');\n\nawait crawler.run(['http://proxy.apify.com']);\n\nconsole.log('Puppeteer closed.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk"};var i,c=["components"],l={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},u=void 0,s={unversionedId:"examples/puppeteer-with-proxy",id:"version-3.1/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.",source:"@site/versioned_docs/version-3.1/examples/puppeteer_with_proxy.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_with_proxy.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/examples/puppeteer-recursive-crawl"},next:{title:"Upgrading",permalink:"/sdk/js/docs/upgrading"}},d={},y=[],m=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:y},g="wrapper";function b(e){var t=e.components,r=(0,o.Z)(e,c);return(0,a.kt)(g,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"."),(0,a.kt)("p",null,"To make it work, you'll need an Apify account with access to the proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your account from the SDK."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}b.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),s=l(r),y=o,m=s["".concat(c,".").concat(y)]||s[y]||d[y]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[s]="string"==typeof e?e:o,p[1]=i;for(var l=2;l<a;l++)p[l]=r[l];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dc709263.77340951.js b/assets/js/dc709263.77340951.js new file mode 100644 index 0000000000..184928c793 --- /dev/null +++ b/assets/js/dc709263.77340951.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8386],{87435:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>u,default:()=>g,frontMatter:()=>l,metadata:()=>s,toc:()=>y});var n=r(87462),o=r(63366),a=(r(67294),r(3905));r(14563);const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Proxy connection is automatically established in the Crawler\nconst proxyConfiguration = await Actor.createProxyConfiguration();\n\nconst crawler = new PuppeteerCrawler({\n proxyConfiguration,\n async requestHandler({ page }) {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n});\n\nconsole.log('Running Puppeteer script...');\n\nawait crawler.run(['http://proxy.apify.com']);\n\nconsole.log('Puppeteer closed.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk"};var i,c=["components"],l={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},u=void 0,s={unversionedId:"examples/puppeteer-with-proxy",id:"version-3.1/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.",source:"@site/versioned_docs/version-3.1/examples/puppeteer_with_proxy.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_with_proxy.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/examples/puppeteer-recursive-crawl"},next:{title:"Upgrading",permalink:"/sdk/js/docs/upgrading"}},d={},y=[],m=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,a.kt)("div",e)}),f={toc:y},b="wrapper";function g(e){var t=e.components,r=(0,o.Z)(e,c);return(0,a.kt)(b,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"."),(0,a.kt)("p",null,"To make it work, you'll need an Apify account with access to the proxy. Visit the ",(0,a.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your account from the SDK."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},y=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),s=l(r),y=o,m=s["".concat(c,".").concat(y)]||s[y]||d[y]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=y;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[s]="string"==typeof e?e:o,p[1]=i;for(var l=2;l<a;l++)p[l]=r[l];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}y.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dd418e11.0e780fac.js b/assets/js/dd418e11.0e780fac.js new file mode 100644 index 0000000000..1941f90626 --- /dev/null +++ b/assets/js/dd418e11.0e780fac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8946],{40678:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),s=["components"],i={id:"synchronous-run",title:"Synchronous run"},p=void 0,c={unversionedId:"examples/synchronous-run",id:"version-2.3/examples/synchronous-run",title:"Synchronous run",description:"This example shows a quick actor that has a run time of just a few seconds.",source:"@site/versioned_docs/version-2.3/examples/synchronous_run.md",sourceDirName:"examples",slug:"/examples/synchronous-run",permalink:"/sdk/js/docs/2.3/examples/synchronous-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/synchronous_run.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"synchronous-run",title:"Synchronous run"},sidebar:"version-2.3/docs",previous:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/2.3/examples/puppeteer-with-proxy"},next:{title:"Use stealth mode",permalink:"/sdk/js/docs/2.3/examples/use-stealth-mode"}},l={},u=[],d={toc:u},y="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,s);return(0,a.kt)(y,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example shows a quick actor that has a run time of just a few seconds.\nIt opens a ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org",target:"_blank",rel:"noopener"},"web page"),' (the Wikipedia home page), which contains a list of "Did you know"\ntexts that change daily. The actor scrapes all the "Did you know" items and saves them to the default dataset.'),(0,a.kt)("p",null," This actor can be invoked synchronously using a single HTTP request to directly obtain its output\nas a response, using the\n",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input",target:"_blank",rel:"noopener"},"Run actor synchronously"),"\nApify API endpoint."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch web browser.\n const browser = await Apify.launchPuppeteer({ launchOptions: { headless: true } });\n // Load https://en.wikipedia.org and get all \"Did you know\" texts.\n console.log('Opening web page...');\n const page = await browser.newPage();\n await page.goto('https://en.wikipedia.org');\n\n // Get all \"Did you know\" items from the page.\n console.log('Getting \"Did you know\" items from the page.');\n const results = await page.$$eval(\n 'div#mp-dyk > ul li',\n (nodes) => nodes.map((node) => node.innerText.replace('...', 'Did you know')),\n );\n console.log(results);\n\n // Save all the items to the Apify dataSet.\n await Apify.pushData(results);\n console.log('Actor finished.');\n\n // Close browser\n await browser.close();\n});\n")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(n),y=o,m=u["".concat(p,".").concat(y)]||u[y]||d[y]||a;return n?r.createElement(m,s(s({ref:t},l),{},{components:n})):r.createElement(m,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=y;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c<a;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}y.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dd418e11.26ca8a0f.js b/assets/js/dd418e11.26ca8a0f.js deleted file mode 100644 index 130cdbda53..0000000000 --- a/assets/js/dd418e11.26ca8a0f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8946],{40678:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>p,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),s=["components"],i={id:"synchronous-run",title:"Synchronous run"},p=void 0,c={unversionedId:"examples/synchronous-run",id:"version-2.3/examples/synchronous-run",title:"Synchronous run",description:"This example shows a quick actor that has a run time of just a few seconds.",source:"@site/versioned_docs/version-2.3/examples/synchronous_run.md",sourceDirName:"examples",slug:"/examples/synchronous-run",permalink:"/sdk/js/docs/2.3/examples/synchronous-run",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/synchronous_run.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"synchronous-run",title:"Synchronous run"},sidebar:"version-2.3/docs",previous:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/2.3/examples/puppeteer-with-proxy"},next:{title:"Use stealth mode",permalink:"/sdk/js/docs/2.3/examples/use-stealth-mode"}},l={},u=[],d={toc:u},y="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,s);return(0,a.kt)(y,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example shows a quick actor that has a run time of just a few seconds.\nIt opens a ",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org",target:"_blank",rel:"noopener"},"web page"),' (the Wikipedia home page), which contains a list of "Did you know"\ntexts that change daily. The actor scrapes all the "Did you know" items and saves them to the default dataset.'),(0,a.kt)("p",null," This actor can be invoked synchronously using a single HTTP request to directly obtain its output\nas a response, using the\n",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input",target:"_blank",rel:"noopener"},"Run actor synchronously"),"\nApify API endpoint."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Launch web browser.\n const browser = await Apify.launchPuppeteer({ launchOptions: { headless: true } });\n // Load https://en.wikipedia.org and get all \"Did you know\" texts.\n console.log('Opening web page...');\n const page = await browser.newPage();\n await page.goto('https://en.wikipedia.org');\n\n // Get all \"Did you know\" items from the page.\n console.log('Getting \"Did you know\" items from the page.');\n const results = await page.$$eval(\n 'div#mp-dyk > ul li',\n (nodes) => nodes.map((node) => node.innerText.replace('...', 'Did you know')),\n );\n console.log(results);\n\n // Save all the items to the Apify dataSet.\n await Apify.pushData(results);\n console.log('Actor finished.');\n\n // Close browser\n await browser.close();\n});\n")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},y=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=c(n),y=o,m=u["".concat(p,".").concat(y)]||u[y]||d[y]||a;return n?r.createElement(m,s(s({ref:t},l),{},{components:n})):r.createElement(m,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=y;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c<a;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}y.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dda920fe.221872b5.js b/assets/js/dda920fe.221872b5.js deleted file mode 100644 index 031b448ad0..0000000000 --- a/assets/js/dda920fe.221872b5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[637],{56165:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id:"playwright-hook",title:"PlaywrightHook"},p=void 0,s={unversionedId:"typedefs/playwright-hook",id:"version-2.3/typedefs/playwright-hook",title:"PlaywrightHook",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightHook.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-hook",permalink:"/sdk/js/docs/2.3/typedefs/playwright-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHook.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-hook",title:"PlaywrightHook"}},c={},u=[],d={toc:u},f="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"playwrighthook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/playwright-goto-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PlaywrightGotoOptions")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=o,y=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(y,i(i({ref:t},c),{},{components:r})):n.createElement(y,i({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s<a;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dda920fe.afbfc990.js b/assets/js/dda920fe.afbfc990.js new file mode 100644 index 0000000000..d4b595cc76 --- /dev/null +++ b/assets/js/dda920fe.afbfc990.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[637],{56165:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],l={id:"playwright-hook",title:"PlaywrightHook"},p=void 0,s={unversionedId:"typedefs/playwright-hook",id:"version-2.3/typedefs/playwright-hook",title:"PlaywrightHook",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/PlaywrightHook.md",sourceDirName:"typedefs",slug:"/typedefs/playwright-hook",permalink:"/sdk/js/docs/2.3/typedefs/playwright-hook",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHook.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-hook",title:"PlaywrightHook"}},c={},u=[],d={toc:u},f="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"playwrighthook"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"crawlingContext")),": ",(0,a.kt)("inlineCode",{parentName:"li"},"Object")," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," |\n",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"gotoOptions")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/playwright-goto-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PlaywrightGotoOptions")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),f=o,y=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return r?n.createElement(y,i(i({ref:t},c),{},{components:r})):n.createElement(y,i({ref:t},c))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s<a;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ded84e96.a966c3a4.js b/assets/js/ded84e96.a966c3a4.js new file mode 100644 index 0000000000..5947734e73 --- /dev/null +++ b/assets/js/ded84e96.a966c3a4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5850],{13340:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},s=void 0,p={unversionedId:"typedefs/cheerio-crawler-options",id:"version-1.3/typedefs/cheerio-crawler-options",title:"CheerioCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CheerioCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/basic-crawler-options"},next:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/playwright-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>handlePageFunction</code>",id:"handlepagefunction",level:3},{value:"<code>requestList</code>",id:"requestlist",level:3},{value:"<code>requestQueue</code>",id:"requestqueue",level:3},{value:"<code>prepareRequestFunction</code>",id:"preparerequestfunction",level:3},{value:"<code>postResponseFunction</code>",id:"postresponsefunction",level:3},{value:"<code>handlePageTimeoutSecs</code>",id:"handlepagetimeoutsecs",level:3},{value:"<code>requestTimeoutSecs</code>",id:"requesttimeoutsecs",level:3},{value:"<code>ignoreSslErrors</code>",id:"ignoresslerrors",level:3},{value:"<code>proxyConfiguration</code>",id:"proxyconfiguration",level:3},{value:"<code>handleFailedRequestFunction</code>",id:"handlefailedrequestfunction",level:3},{value:"<code>preNavigationHooks</code>",id:"prenavigationhooks",level:3},{value:"<code>postNavigationHooks</code>",id:"postnavigationhooks",level:3},{value:"<code>additionalMimeTypes</code>",id:"additionalmimetypes",level:3},{value:"<code>suggestResponseEncoding</code>",id:"suggestresponseencoding",level:3},{value:"<code>forceResponseEncoding</code>",id:"forceresponseencoding",level:3},{value:"<code>maxRequestRetries</code>",id:"maxrequestretries",level:3},{value:"<code>maxRequestsPerCrawl</code>",id:"maxrequestspercrawl",level:3},{value:"<code>autoscaledPoolOptions</code>",id:"autoscaledpooloptions",level:3},{value:"<code>minConcurrency</code>",id:"minconcurrency",level:3},{value:"<code>maxConcurrency</code>",id:"maxconcurrency",level:3},{value:"<code>useSessionPool</code>",id:"usesessionpool",level:3},{value:"<code>sessionPoolOptions</code>",id:"sessionpooloptions",level:3},{value:"<code>persistCookiesPerSession</code>",id:"persistcookiespersession",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"cheeriocrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioHandlePage"))),(0,a.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each page loaded and parsed by the crawler."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n // The Cheerio object's function with the parsed HTML.\n $: Cheerio,\n\n // The request body of the web page, whose type depends on the content type.\n body: String|Buffer,\n\n // The parsed object from JSON for responses with the \"application/json\" content types.\n // For other content types it's null.\n json: Object,\n\n // Apify.Request object with details of the requested web page\n request: Request,\n\n // Parsed Content-Type HTTP header: { type, encoding }\n contentType: Object,\n\n // An instance of Node's http.IncomingMessage object,\n response: Object,\n\n // Session object, useful to work around anti-scraping protections\n session: Session\n\n // ProxyInfo object with information about currently used proxy\n proxyInfo: ProxyInfo\n\n // The running cheerio crawler instance.\n crawler: CheerioCrawler\n}\n")),(0,a.kt)("p",null,"Type of ",(0,a.kt)("inlineCode",{parentName:"p"},"body")," depends on the ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header of the web page:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"String for ",(0,a.kt)("inlineCode",{parentName:"li"},"text/html"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xhtml+xml"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xml")," MIME content types"),(0,a.kt)("li",{parentName:"ul"},"Buffer for others MIME content types")),(0,a.kt)("p",null,"Parsed ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header using ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/content-type",target:"_blank",rel:"noopener"},"content-type package")," is stored in ",(0,a.kt)("inlineCode",{parentName:"p"},"contentType"),"."),(0,a.kt)("p",null,"Cheerio is available only for HTML and XML content types."),(0,a.kt)("p",null,"With the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object representing the URL to crawl."),(0,a.kt)("p",null,"If the function returns, the returned promise is awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"preparerequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"prepareRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/prepare-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PrepareRequest"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes before the HTTP request is made to the target resource. This function is suitable for setting dynamic properties such as\ncookies to the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the initialized request and the ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," instance corresponds to used\nsession."),(0,a.kt)("p",null,"The function should modify the properties of the passed ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance in place because there are already earlier references to\nit. Making a copy and returning it from this function is therefore not supported, because it would create inconsistencies where different parts of SDK\nwould have access to a different ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postresponsefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"postResponseFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/post-response",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PostResponse"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes right after the HTTP request is made to the target resource and response is returned. This function is suitable for\noverriding custom properties of response e.g. setting headers because of response parsing."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerioCrawlerOptions = {\n // ...\n postResponseFunction: ({ request, response }) => {\n if (request.userData.parseAsJSON) {\n response.headers['content-type'] = 'application/json; charset=utf-8';\n }\n },\n};\n")),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n response: Object,\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"The response is an instance of Node's http.IncomingMessage object."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 30")),(0,a.kt)("p",null,"Timeout in which the HTTP request to the resource needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true, SSL certificate errors will be ignored."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided and\nrotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n error: Error,\n request: Request,\n session: Session,\n $: Cheerio,\n body: String|Buffer,\n json: Object,\n contentType: Object,\n response: Object,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("p",null,"See ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/cheerio_crawler.js#L13",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array<Hook>"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowser()")," function the\ncrawler calls to navigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n }\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array<Hook>"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n // ...\n };\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"additionalmimetypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"additionalMimeTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array<string>")),(0,a.kt)("p",null,"An array of ",(0,a.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types",target:"_blank"},"MIME types")," you want the crawler to load and process. By default, only ",(0,a.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME types are\nsupported."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"suggestresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"suggestResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Sadly, there are some websites which use invalid headers.\nThose are encoded using the UTF-8 encoding. If those sites actually use a different encoding, the response will be corrupted. You can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"suggestResponseEncoding")," to fall back to a certain encoding, if you know that your target website uses it. To force a certain encoding, disregarding\nthe response headers, use ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#forceresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.forceResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will fall back to windows-1250 encoding if none found\nsuggestResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"forceresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"forceResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"forceResponseEncoding")," to force a certain encoding,\ndisregarding the response headers. To only provide a default for missing encodings, use\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#suggestresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.suggestResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will force windows-1250 encoding even if headers say otherwise\nforceResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestFunction")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction"),"\nand ",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction")," options are provided by ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and cannot be overridden. Reasonable ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," defaults are provided to account for the fact that ",(0,a.kt)("inlineCode",{parentName:"p"},"cheerio")," parses HTML synchronously and therefore blocks the\nevent loop."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true Crawler will automatically use Session Pool. It will automatically retire sessions on 403, 401 and 429 status codes. It also marks\nSession as bad after a request timeout."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," constructor."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("p",null,'It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request. It passes the\n"Cookie" header to the request with the session cookies.'),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),h=o,k=c["".concat(s,".").concat(h)]||c[h]||d[h]||a;return n?r.createElement(k,i(i({ref:t},u),{},{components:n})):r.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p<a;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ded84e96.ec9aa0b0.js b/assets/js/ded84e96.ec9aa0b0.js deleted file mode 100644 index 81c92eac31..0000000000 --- a/assets/js/ded84e96.ec9aa0b0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5850],{13340:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>s,default:()=>k,frontMatter:()=>l,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},s=void 0,p={unversionedId:"typedefs/cheerio-crawler-options",id:"version-1.3/typedefs/cheerio-crawler-options",title:"CheerioCrawlerOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/CheerioCrawlerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-crawler-options",permalink:"/sdk/js/docs/1.3/typedefs/cheerio-crawler-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioCrawlerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-cheerio-crawler-options",title:"CheerioCrawlerOptions",id:"cheerio-crawler-options"},sidebar:"version-1.3/docs",previous:{title:"BasicCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/basic-crawler-options"},next:{title:"PlaywrightCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/playwright-crawler-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>handlePageFunction</code>",id:"handlepagefunction",level:3},{value:"<code>requestList</code>",id:"requestlist",level:3},{value:"<code>requestQueue</code>",id:"requestqueue",level:3},{value:"<code>prepareRequestFunction</code>",id:"preparerequestfunction",level:3},{value:"<code>postResponseFunction</code>",id:"postresponsefunction",level:3},{value:"<code>handlePageTimeoutSecs</code>",id:"handlepagetimeoutsecs",level:3},{value:"<code>requestTimeoutSecs</code>",id:"requesttimeoutsecs",level:3},{value:"<code>ignoreSslErrors</code>",id:"ignoresslerrors",level:3},{value:"<code>proxyConfiguration</code>",id:"proxyconfiguration",level:3},{value:"<code>handleFailedRequestFunction</code>",id:"handlefailedrequestfunction",level:3},{value:"<code>preNavigationHooks</code>",id:"prenavigationhooks",level:3},{value:"<code>postNavigationHooks</code>",id:"postnavigationhooks",level:3},{value:"<code>additionalMimeTypes</code>",id:"additionalmimetypes",level:3},{value:"<code>suggestResponseEncoding</code>",id:"suggestresponseencoding",level:3},{value:"<code>forceResponseEncoding</code>",id:"forceresponseencoding",level:3},{value:"<code>maxRequestRetries</code>",id:"maxrequestretries",level:3},{value:"<code>maxRequestsPerCrawl</code>",id:"maxrequestspercrawl",level:3},{value:"<code>autoscaledPoolOptions</code>",id:"autoscaledpooloptions",level:3},{value:"<code>minConcurrency</code>",id:"minconcurrency",level:3},{value:"<code>maxConcurrency</code>",id:"maxconcurrency",level:3},{value:"<code>useSessionPool</code>",id:"usesessionpool",level:3},{value:"<code>sessionPoolOptions</code>",id:"sessionpooloptions",level:3},{value:"<code>persistCookiesPerSession</code>",id:"persistcookiespersession",level:3}],d={toc:c},h="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"cheeriocrawleroptions"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"handlepagefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-handle-page",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioHandlePage"))),(0,a.kt)("p",null,"User-provided function that performs the logic of the crawler. It is called for each page loaded and parsed by the crawler."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n // The Cheerio object's function with the parsed HTML.\n $: Cheerio,\n\n // The request body of the web page, whose type depends on the content type.\n body: String|Buffer,\n\n // The parsed object from JSON for responses with the \"application/json\" content types.\n // For other content types it's null.\n json: Object,\n\n // Apify.Request object with details of the requested web page\n request: Request,\n\n // Parsed Content-Type HTTP header: { type, encoding }\n contentType: Object,\n\n // An instance of Node's http.IncomingMessage object,\n response: Object,\n\n // Session object, useful to work around anti-scraping protections\n session: Session\n\n // ProxyInfo object with information about currently used proxy\n proxyInfo: ProxyInfo\n\n // The running cheerio crawler instance.\n crawler: CheerioCrawler\n}\n")),(0,a.kt)("p",null,"Type of ",(0,a.kt)("inlineCode",{parentName:"p"},"body")," depends on the ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header of the web page:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"String for ",(0,a.kt)("inlineCode",{parentName:"li"},"text/html"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xhtml+xml"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"application/xml")," MIME content types"),(0,a.kt)("li",{parentName:"ul"},"Buffer for others MIME content types")),(0,a.kt)("p",null,"Parsed ",(0,a.kt)("inlineCode",{parentName:"p"},"Content-Type")," header using ",(0,a.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/content-type",target:"_blank",rel:"noopener"},"content-type package")," is stored in ",(0,a.kt)("inlineCode",{parentName:"p"},"contentType"),"."),(0,a.kt)("p",null,"Cheerio is available only for HTML and XML content types."),(0,a.kt)("p",null,"With the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," object representing the URL to crawl."),(0,a.kt)("p",null,"If the function returns, the returned promise is awaited by the crawler."),(0,a.kt)("p",null,"If the function throws an exception, the crawler will try to re-crawl the request later, up to ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. If all the retries\nfail, the crawler calls the function provided to the ",(0,a.kt)("inlineCode",{parentName:"p"},"handleFailedRequestFunction")," parameter. To make this work, you should ",(0,a.kt)("strong",{parentName:"p"},"always")," let your\nfunction throw exceptions rather than catch them. The exceptions are logged to the request using the\n",(0,a.kt)("a",{parentName:"p",href:"../api/request#pusherrormessage",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request.pushErrorMessage()"))," function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestlist"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,a.kt)("p",null,"Static list of URLs to be processed. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be provided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requestqueue"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,a.kt)("p",null,"Dynamic queue of URLs to be processed. This is useful for recursive crawling of websites. Either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestList")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"requestQueue")," option must be\nprovided (or both)."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"preparerequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"prepareRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/prepare-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PrepareRequest"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes before the HTTP request is made to the target resource. This function is suitable for setting dynamic properties such as\ncookies to the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request")),"."),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the initialized request and the ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," instance corresponds to used\nsession."),(0,a.kt)("p",null,"The function should modify the properties of the passed ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance in place because there are already earlier references to\nit. Making a copy and returning it from this function is therefore not supported, because it would create inconsistencies where different parts of SDK\nwould have access to a different ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postresponsefunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"postResponseFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/post-response",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PostResponse"))),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"This option is deprecated, use ",(0,a.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," instead.")),(0,a.kt)("p",null,"A function that executes right after the HTTP request is made to the target resource and response is returned. This function is suitable for\noverriding custom properties of response e.g. setting headers because of response parsing."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Example usage:")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const cheerioCrawlerOptions = {\n // ...\n postResponseFunction: ({ request, response }) => {\n if (request.userData.parseAsJSON) {\n response.headers['content-type'] = 'application/json; charset=utf-8';\n }\n },\n};\n")),(0,a.kt)("p",null,"The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n response: Object,\n request: Request,\n session: Session,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"The response is an instance of Node's http.IncomingMessage object."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlepagetimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"handlePageTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 60")),(0,a.kt)("p",null,"Timeout in which the function passed as ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"requesttimeoutsecs"},(0,a.kt)("inlineCode",{parentName:"h3"},"requestTimeoutSecs")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 30")),(0,a.kt)("p",null,"Timeout in which the HTTP request to the resource needs to finish, given in seconds."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignoresslerrors"},(0,a.kt)("inlineCode",{parentName:"h3"},"ignoreSslErrors")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true, SSL certificate errors will be ignored."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"proxyconfiguration"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,a.kt)("p",null,"If set, ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will be configured for all connections to use ",(0,a.kt)("a",{parentName:"p",href:"https://my.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy")," or your own Proxy URLs provided and\nrotated according to the configuration. For more information, see the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"documentation"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"handlefailedrequestfunction"},(0,a.kt)("inlineCode",{parentName:"h3"},"handleFailedRequestFunction")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/handle-failed-request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"HandleFailedRequest"))),(0,a.kt)("p",null,"A function to handle requests that failed more than ",(0,a.kt)("inlineCode",{parentName:"p"},"option.maxRequestRetries")," times. The function receives the following object as an argument:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"{\n error: Error,\n request: Request,\n session: Session,\n $: Cheerio,\n body: String|Buffer,\n json: Object,\n contentType: Object,\n response: Object,\n proxyInfo: ProxyInfo,\n crawler: CheerioCrawler,\n}\n")),(0,a.kt)("p",null,"where the ",(0,a.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Request"))," instance corresponds to the failed request, and the ",(0,a.kt)("inlineCode",{parentName:"p"},"Error")," instance represents the last error thrown during\nprocessing of the request."),(0,a.kt)("p",null,"See ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-js/blob/master/src/crawlers/cheerio_crawler.js#L13",target:"_blank",rel:"noopener"},"source code")," for the default implementation of this function."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"prenavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"preNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array<Hook>"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated before the navigation. Good for setting additional cookies or browser properties before navigation.\nThe function accepts two parameters, ",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowserOptions"),", which are passed to the ",(0,a.kt)("inlineCode",{parentName:"p"},"requestAsBrowser()")," function the\ncrawler calls to navigate. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"preNavigationHooks: [\n async (crawlingContext, requestAsBrowserOptions) => {\n requestAsBrowserOptions.forceUrlEncoding = true;\n }\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"postnavigationhooks"},(0,a.kt)("inlineCode",{parentName:"h3"},"postNavigationHooks")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/hook",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Array<Hook>"))),(0,a.kt)("p",null,"Async functions that are sequentially evaluated after the navigation. Good for checking if the navigation was successful. The function accepts\n",(0,a.kt)("inlineCode",{parentName:"p"},"crawlingContext")," as the only parameter. Example:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"postNavigationHooks: [\n async (crawlingContext) => {\n // ...\n };\n]\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"additionalmimetypes"},(0,a.kt)("inlineCode",{parentName:"h3"},"additionalMimeTypes")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Array<string>")),(0,a.kt)("p",null,"An array of ",(0,a.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types",target:"_blank"},"MIME types")," you want the crawler to load and process. By default, only ",(0,a.kt)("inlineCode",{parentName:"p"},"text/html")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"application/xhtml+xml")," MIME types are\nsupported."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"suggestresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"suggestResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Sadly, there are some websites which use invalid headers.\nThose are encoded using the UTF-8 encoding. If those sites actually use a different encoding, the response will be corrupted. You can use\n",(0,a.kt)("inlineCode",{parentName:"p"},"suggestResponseEncoding")," to fall back to a certain encoding, if you know that your target website uses it. To force a certain encoding, disregarding\nthe response headers, use ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#forceresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.forceResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will fall back to windows-1250 encoding if none found\nsuggestResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"forceresponseencoding"},(0,a.kt)("inlineCode",{parentName:"h3"},"forceResponseEncoding")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"By default ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will extract correct encoding from the HTTP response headers. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"forceResponseEncoding")," to force a certain encoding,\ndisregarding the response headers. To only provide a default for missing encodings, use\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/cheerio-crawler-options#suggestresponseencoding",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawlerOptions.suggestResponseEncoding"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"// Will force windows-1250 encoding even if headers say otherwise\nforceResponseEncoding: 'windows-1250'\n")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestretries"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestRetries")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 3")),(0,a.kt)("p",null,"Indicates how many times the request is retried if either ",(0,a.kt)("inlineCode",{parentName:"p"},"requestFunction")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," fails."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxrequestspercrawl"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxRequestsPerCrawl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("p",null,"Maximum number of pages that the crawler will open. The crawl will stop when this limit is reached. Always set this value in order to prevent infinite\nloops in misconfigured crawlers. Note that in cases of parallel crawling, the actual number of pages visited might be slightly higher than this value."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"autoscaledpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"autoscaledPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," constructor. Note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"runTaskFunction"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"isTaskReadyFunction"),"\nand ",(0,a.kt)("inlineCode",{parentName:"p"},"isFinishedFunction")," options are provided by ",(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and cannot be overridden. Reasonable ",(0,a.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," defaults are provided to account for the fact that ",(0,a.kt)("inlineCode",{parentName:"p"},"cheerio")," parses HTML synchronously and therefore blocks the\nevent loop."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"minconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"minConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1")),(0,a.kt)("p",null,"Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("p",null,(0,a.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If\nyou're not sure, just keep the default value and the concurrency will scale up automatically."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxconcurrency"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxConcurrency")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")," ",(0,a.kt)("code",null," = 1000")),(0,a.kt)("p",null,"Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding ",(0,a.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," option."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usesessionpool"},(0,a.kt)("inlineCode",{parentName:"h3"},"useSessionPool")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = true")),(0,a.kt)("p",null,"If set to true Crawler will automatically use Session Pool. It will automatically retire sessions on 403, 401 and 429 status codes. It also marks\nSession as bad after a request timeout."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sessionpooloptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"sessionPoolOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/session-pool-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPoolOptions"))),(0,a.kt)("p",null,"Custom options passed to the underlying ",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," constructor."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"persistcookiespersession"},(0,a.kt)("inlineCode",{parentName:"h3"},"persistCookiesPerSession")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Automatically saves cookies to Session. Works only if Session Pool is used."),(0,a.kt)("p",null,'It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request. It passes the\n"Cookie" header to the request with the session cookies.'),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),h=o,k=c["".concat(s,".").concat(h)]||c[h]||d[h]||a;return n?r.createElement(k,i(i({ref:t},u),{},{components:n})):r.createElement(k,i({ref:t},u))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:o,i[1]=l;for(var p=2;p<a;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dee3ecd2.44158cf9.js b/assets/js/dee3ecd2.44158cf9.js new file mode 100644 index 0000000000..f727cfc0e7 --- /dev/null +++ b/assets/js/dee3ecd2.44158cf9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4766],{91189:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>k,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var o=n(87462),a=n(63366),l=(n(67294),n(3905)),r=["components"],s={id:"autoscaled-pool",title:"AutoscaledPool"},i=void 0,u={unversionedId:"api/autoscaled-pool",id:"version-2.3/api/autoscaled-pool",title:"AutoscaledPool",description:"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and",source:"@site/versioned_docs/version-2.3/api/AutoscaledPool.md",sourceDirName:"api",slug:"/api/autoscaled-pool",permalink:"/sdk/js/docs/2.3/api/autoscaled-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/AutoscaledPool.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"autoscaled-pool",title:"AutoscaledPool"},sidebar:"version-2.3/docs",previous:{title:"KeyValueStore",permalink:"/sdk/js/docs/2.3/api/key-value-store"},next:{title:"Session",permalink:"/sdk/js/docs/2.3/api/session"}},p={},c=[{value:"<code>new AutoscaledPool(options)</code>",id:"new-autoscaledpooloptions",level:2},{value:"<code>autoscaledPool.log</code>",id:"autoscaledpoollog",level:2},{value:"<code>autoscaledPool.minConcurrency</code>",id:"autoscaledpoolminconcurrency",level:2},{value:"<code>autoscaledPool.minConcurrency</code>",id:"autoscaledpoolminconcurrency-1",level:2},{value:"<code>autoscaledPool.maxConcurrency</code>",id:"autoscaledpoolmaxconcurrency",level:2},{value:"<code>autoscaledPool.maxConcurrency</code>",id:"autoscaledpoolmaxconcurrency-1",level:2},{value:"<code>autoscaledPool.desiredConcurrency</code>",id:"autoscaledpooldesiredconcurrency",level:2},{value:"<code>autoscaledPool.desiredConcurrency</code>",id:"autoscaledpooldesiredconcurrency-1",level:2},{value:"<code>autoscaledPool.currentConcurrency</code>",id:"autoscaledpoolcurrentconcurrency",level:2},{value:"<code>autoscaledPool.run()</code>",id:"autoscaledpoolrun",level:2},{value:"<code>autoscaledPool.abort()</code>",id:"autoscaledpoolabort",level:2},{value:"<code>autoscaledPool.pause([timeoutSecs])</code>",id:"autoscaledpoolpausetimeoutsecs",level:2},{value:"<code>autoscaledPool.resume()</code>",id:"autoscaledpoolresume",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,r);return(0,l.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("p",null,"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and\nmemory available and the Javascript event loop is not blocked."),(0,l.kt)("p",null,"The information about the CPU and memory usage is obtained by the ",(0,l.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," class, which makes regular snapshots of system\nresources that may be either local or from the Apify cloud infrastructure in case the process is running on the Apify platform. Meaningful data\ngathered from these snapshots is provided to ",(0,l.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")," by the ",(0,l.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," class."),(0,l.kt)("p",null,"Before running the pool, you need to implement the following three functions:\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#runtaskfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.runTaskFunction()")),",\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),"."),(0,l.kt)("p",null,"The auto-scaled pool is started by calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function. The pool periodically queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," function for more tasks, managing optimal\nconcurrency, until the function resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),". The pool then queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),". If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),", the run finishes\nafter all running tasks complete. If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", it assumes there will be more tasks available later and keeps periodically querying for\ntasks. If any of the tasks throws then the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function rejects the promise with an error."),(0,l.kt)("p",null,"The pool evaluates whether it should start a new task every time one of the tasks finishes and also in the interval set by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs")," parameter."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const pool = new Apify.AutoscaledPool({\n maxConcurrency: 50,\n runTaskFunction: async () => {\n // Run some resource-intensive asynchronous operation here.\n },\n isTaskReadyFunction: async () => {\n // Tell the pool whether more tasks are ready to be processed.\n // Return true or false\n },\n isFinishedFunction: async () => {\n // Tell the pool whether it should finish\n // or wait for more tasks to become available.\n // Return true or false\n },\n});\n\nawait pool.run();\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("h2",{id:"new-autoscaledpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new AutoscaledPool(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"autoscaledpoollog"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Gets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Sets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Gets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Sets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Gets the desired concurrency for the pool, which is an estimated number of parallel tasks that the system can currently support."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Sets the desired concurrency for the pool, i.e. the number of tasks that should be running in parallel if there's large enough supply of tasks."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"currentconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolcurrentconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.currentConcurrency")),(0,l.kt)("p",null,"Gets the the number of parallel tasks currently running in the pool."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"autoscaledpoolrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.run()")),(0,l.kt)("p",null,"Runs the auto-scaled pool. Returns a promise that gets resolved or rejected once all the tasks are finished or one of them fails."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"abort"}),(0,l.kt)("h2",{id:"autoscaledpoolabort"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.abort()")),(0,l.kt)("p",null,"Aborts the run of the auto-scaled pool and destroys it. The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function\nwill immediately resolve, no more new tasks will be spawned and all running tasks will be left in their current state."),(0,l.kt)("p",null,"Due to the nature of the tasks, auto-scaled pool cannot reliably guarantee abortion of all the running tasks, therefore, no abortion is attempted and\nsome of the tasks may finish, while others may not. Essentially, auto-scaled pool doesn't care about their state after the invocation of ",(0,l.kt)("inlineCode",{parentName:"p"},".abort()"),",\nbut that does not mean that some parts of their asynchronous chains of commands will not execute."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pause"}),(0,l.kt)("h2",{id:"autoscaledpoolpausetimeoutsecs"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.pause([timeoutSecs])")),(0,l.kt)("p",null,"Prevents the auto-scaled pool from starting new tasks, but allows the running ones to finish (unlike abort, which terminates them). Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#resume",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.resume()"))),(0,l.kt)("p",null,"The function's promise will resolve once all running tasks have completed and the pool is effectively idle. If the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," argument is provided,\nthe promise will reject with a timeout error after the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," seconds."),(0,l.kt)("p",null,"The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function will not resolve when ",(0,l.kt)("inlineCode",{parentName:"p"},".pause()")," is invoked (unlike abort,\nwhich resolves it)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"resume"}),(0,l.kt)("h2",{id:"autoscaledpoolresume"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.resume()")),(0,l.kt)("p",null,"Resumes the operation of the autoscaled-pool by allowing more tasks to be run. Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))),(0,l.kt)("p",null,"Tasks will automatically start running again in ",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs"),"."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=o.createContext({}),u=function(e){var t=o.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return o.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=u(n),m=a,k=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return n?o.createElement(k,r(r({ref:t},p),{},{components:n})):o.createElement(k,r({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,r=new Array(l);r[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,r[1]=s;for(var u=2;u<l;u++)r[u]=n[u];return o.createElement.apply(null,r)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dee3ecd2.f0c70771.js b/assets/js/dee3ecd2.f0c70771.js deleted file mode 100644 index 38bdcd91ad..0000000000 --- a/assets/js/dee3ecd2.f0c70771.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4766],{91189:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>k,frontMatter:()=>s,metadata:()=>u,toc:()=>c});var o=n(87462),a=n(63366),l=(n(67294),n(3905)),r=["components"],s={id:"autoscaled-pool",title:"AutoscaledPool"},i=void 0,u={unversionedId:"api/autoscaled-pool",id:"version-2.3/api/autoscaled-pool",title:"AutoscaledPool",description:"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and",source:"@site/versioned_docs/version-2.3/api/AutoscaledPool.md",sourceDirName:"api",slug:"/api/autoscaled-pool",permalink:"/sdk/js/docs/2.3/api/autoscaled-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/AutoscaledPool.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"autoscaled-pool",title:"AutoscaledPool"},sidebar:"version-2.3/docs",previous:{title:"KeyValueStore",permalink:"/sdk/js/docs/2.3/api/key-value-store"},next:{title:"Session",permalink:"/sdk/js/docs/2.3/api/session"}},p={},c=[{value:"<code>new AutoscaledPool(options)</code>",id:"new-autoscaledpooloptions",level:2},{value:"<code>autoscaledPool.log</code>",id:"autoscaledpoollog",level:2},{value:"<code>autoscaledPool.minConcurrency</code>",id:"autoscaledpoolminconcurrency",level:2},{value:"<code>autoscaledPool.minConcurrency</code>",id:"autoscaledpoolminconcurrency-1",level:2},{value:"<code>autoscaledPool.maxConcurrency</code>",id:"autoscaledpoolmaxconcurrency",level:2},{value:"<code>autoscaledPool.maxConcurrency</code>",id:"autoscaledpoolmaxconcurrency-1",level:2},{value:"<code>autoscaledPool.desiredConcurrency</code>",id:"autoscaledpooldesiredconcurrency",level:2},{value:"<code>autoscaledPool.desiredConcurrency</code>",id:"autoscaledpooldesiredconcurrency-1",level:2},{value:"<code>autoscaledPool.currentConcurrency</code>",id:"autoscaledpoolcurrentconcurrency",level:2},{value:"<code>autoscaledPool.run()</code>",id:"autoscaledpoolrun",level:2},{value:"<code>autoscaledPool.abort()</code>",id:"autoscaledpoolabort",level:2},{value:"<code>autoscaledPool.pause([timeoutSecs])</code>",id:"autoscaledpoolpausetimeoutsecs",level:2},{value:"<code>autoscaledPool.resume()</code>",id:"autoscaledpoolresume",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,a.Z)(e,r);return(0,l.kt)(m,(0,o.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("p",null,"Manages a pool of asynchronous resource-intensive tasks that are executed in parallel. The pool only starts new tasks if there is enough free CPU and\nmemory available and the Javascript event loop is not blocked."),(0,l.kt)("p",null,"The information about the CPU and memory usage is obtained by the ",(0,l.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," class, which makes regular snapshots of system\nresources that may be either local or from the Apify cloud infrastructure in case the process is running on the Apify platform. Meaningful data\ngathered from these snapshots is provided to ",(0,l.kt)("inlineCode",{parentName:"p"},"AutoscaledPool")," by the ",(0,l.kt)("a",{parentName:"p",href:"../api/system-status",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SystemStatus"))," class."),(0,l.kt)("p",null,"Before running the pool, you need to implement the following three functions:\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#runtaskfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.runTaskFunction()")),",\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),"."),(0,l.kt)("p",null,"The auto-scaled pool is started by calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function. The pool periodically queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#istaskreadyfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isTaskReadyFunction()"))," function for more tasks, managing optimal\nconcurrency, until the function resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),". The pool then queries the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options#isfinishedfunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions.isFinishedFunction()")),". If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"true"),", the run finishes\nafter all running tasks complete. If it resolves to ",(0,l.kt)("inlineCode",{parentName:"p"},"false"),", it assumes there will be more tasks available later and keeps periodically querying for\ntasks. If any of the tasks throws then the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function rejects the promise with an error."),(0,l.kt)("p",null,"The pool evaluates whether it should start a new task every time one of the tasks finishes and also in the interval set by the\n",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs")," parameter."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const pool = new Apify.AutoscaledPool({\n maxConcurrency: 50,\n runTaskFunction: async () => {\n // Run some resource-intensive asynchronous operation here.\n },\n isTaskReadyFunction: async () => {\n // Tell the pool whether more tasks are ready to be processed.\n // Return true or false\n },\n isFinishedFunction: async () => {\n // Tell the pool whether it should finish\n // or wait for more tasks to become available.\n // Return true or false\n },\n});\n\nawait pool.run();\n")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"autoscaledpool"}),(0,l.kt)("h2",{id:"new-autoscaledpooloptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new AutoscaledPool(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"autoscaledpoollog"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Gets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"minconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolminconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.minConcurrency")),(0,l.kt)("p",null,"Sets the minimum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"WARNING:")," If you set this value too high with respect to the available system memory and CPU, your code might run extremely slow or crash. If you're\nnot sure, just keep the default value and the concurrency will scale up automatically."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Gets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"maxconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolmaxconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.maxConcurrency")),(0,l.kt)("p",null,"Sets the maximum number of tasks running in parallel."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Gets the desired concurrency for the pool, which is an estimated number of parallel tasks that the system can currently support."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"desiredconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpooldesiredconcurrency-1"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.desiredConcurrency")),(0,l.kt)("p",null,"Sets the desired concurrency for the pool, i.e. the number of tasks that should be running in parallel if there's large enough supply of tasks."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"value")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"currentconcurrency"}),(0,l.kt)("h2",{id:"autoscaledpoolcurrentconcurrency"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.currentConcurrency")),(0,l.kt)("p",null,"Gets the the number of parallel tasks currently running in the pool."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"number")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"run"}),(0,l.kt)("h2",{id:"autoscaledpoolrun"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.run()")),(0,l.kt)("p",null,"Runs the auto-scaled pool. Returns a promise that gets resolved or rejected once all the tasks are finished or one of them fails."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"abort"}),(0,l.kt)("h2",{id:"autoscaledpoolabort"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.abort()")),(0,l.kt)("p",null,"Aborts the run of the auto-scaled pool and destroys it. The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function\nwill immediately resolve, no more new tasks will be spawned and all running tasks will be left in their current state."),(0,l.kt)("p",null,"Due to the nature of the tasks, auto-scaled pool cannot reliably guarantee abortion of all the running tasks, therefore, no abortion is attempted and\nsome of the tasks may finish, while others may not. Essentially, auto-scaled pool doesn't care about their state after the invocation of ",(0,l.kt)("inlineCode",{parentName:"p"},".abort()"),",\nbut that does not mean that some parts of their asynchronous chains of commands will not execute."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"pause"}),(0,l.kt)("h2",{id:"autoscaledpoolpausetimeoutsecs"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.pause([timeoutSecs])")),(0,l.kt)("p",null,"Prevents the auto-scaled pool from starting new tasks, but allows the running ones to finish (unlike abort, which terminates them). Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#resume",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.resume()"))),(0,l.kt)("p",null,"The function's promise will resolve once all running tasks have completed and the pool is effectively idle. If the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," argument is provided,\nthe promise will reject with a timeout error after the ",(0,l.kt)("inlineCode",{parentName:"p"},"timeoutSecs")," seconds."),(0,l.kt)("p",null,"The promise returned from the ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.run()"))," function will not resolve when ",(0,l.kt)("inlineCode",{parentName:"p"},".pause()")," is invoked (unlike abort,\nwhich resolves it)."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[timeoutSecs]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"resume"}),(0,l.kt)("h2",{id:"autoscaledpoolresume"},(0,l.kt)("inlineCode",{parentName:"h2"},"autoscaledPool.resume()")),(0,l.kt)("p",null,"Resumes the operation of the autoscaled-pool by allowing more tasks to be run. Used together with\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))),(0,l.kt)("p",null,"Tasks will automatically start running again in ",(0,l.kt)("inlineCode",{parentName:"p"},"options.maybeRunIntervalSecs"),"."),(0,l.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},l=Object.keys(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(o=0;o<l.length;o++)n=l[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=o.createContext({}),u=function(e){var t=o.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return o.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=u(n),m=a,k=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return n?o.createElement(k,r(r({ref:t},p),{},{components:n})):o.createElement(k,r({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,r=new Array(l);r[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[c]="string"==typeof e?e:a,r[1]=s;for(var u=2;u<l;u++)r[u]=n[u];return o.createElement.apply(null,r)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dfb1d591.104e674c.js b/assets/js/dfb1d591.104e674c.js deleted file mode 100644 index e5f9997520..0000000000 --- a/assets/js/dfb1d591.104e674c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2258],{11334:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>m});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,s={unversionedId:"examples/call-actor",id:"version-3.1/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/versioned_docs/version-3.1/examples/call_actor.mdx",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/call_actor.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/examples/basic-crawler"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/examples/cheerio-crawler"}},p={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(u,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#newClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.newClient()")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Settings - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on Apify Platform, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\nconsole.log('Obtaining own email address...');\nconst apifyClient = Actor.newClient();\nconst { email } = await apifyClient.user().get();\n\n// Load randomword.com and get a random word\nconsole.log('Fetching a random word.');\nconst page = await browser.newPage();\nawait page.goto('https://randomword.com/');\nconst randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n// Send random word to your email. For that, you can use an actor we already\n// have available on the platform under the name: apify/send-mail.\n// The second parameter to the Actor.call() invocation is the actor's\n// desired input. You can find the required input parameters by checking\n// the actor's documentation page: https://apify.com/apify/send-mail\nconsole.log(`Sending email to ${user.email}...`);\nawait Actor.call('apify/send-mail', {\n to: email,\n subject: 'Random Word',\n html: `<h1>Random Word</h1>${randomWord}`,\n});\nconsole.log('Email sent. Good luck!');\n\n// Close Browser\nawait browser.close();\n\nawait Actor.exit();\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:a,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dfb1d591.4c5640a6.js b/assets/js/dfb1d591.4c5640a6.js new file mode 100644 index 0000000000..42748890a3 --- /dev/null +++ b/assets/js/dfb1d591.4c5640a6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2258],{11334:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>m});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,s={unversionedId:"examples/call-actor",id:"version-3.1/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/versioned_docs/version-3.1/examples/call_actor.mdx",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/call_actor.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/examples/basic-crawler"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/examples/cheerio-crawler"}},p={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(u,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#newClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.newClient()")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Settings - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on Apify Platform, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\nconsole.log('Obtaining own email address...');\nconst apifyClient = Actor.newClient();\nconst { email } = await apifyClient.user().get();\n\n// Load randomword.com and get a random word\nconsole.log('Fetching a random word.');\nconst page = await browser.newPage();\nawait page.goto('https://randomword.com/');\nconst randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n// Send random word to your email. For that, you can use an actor we already\n// have available on the platform under the name: apify/send-mail.\n// The second parameter to the Actor.call() invocation is the actor's\n// desired input. You can find the required input parameters by checking\n// the actor's documentation page: https://apify.com/apify/send-mail\nconsole.log(`Sending email to ${user.email}...`);\nawait Actor.call('apify/send-mail', {\n to: email,\n subject: 'Random Word',\n html: `<h1>Random Word</h1>${randomWord}`,\n});\nconsole.log('Email sent. Good luck!');\n\n// Close Browser\nawait browser.close();\n\nawait Actor.exit();\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:a,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dfff5bbd.6db4493e.js b/assets/js/dfff5bbd.6db4493e.js new file mode 100644 index 0000000000..027bb27ffa --- /dev/null +++ b/assets/js/dfff5bbd.6db4493e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1756],{68889:(e,t,a)=>{a.d(t,{Z:()=>s});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const s=function(e){var t=e.to,a=e.children,s=(0,o.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var d=p+"/";return"current"===p?d="next/":l&&(d=""),n.createElement(r.default,{to:"/api/"+d+t},a)}},23266:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>h,contentTitle:()=>m,default:()=>g,frontMatter:()=>u,metadata:()=>c,toc:()=>f});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=a(14563),s=a(68889);const p="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst dataset = await Actor.openDataset<{ headingCount: number }>();\n\n// calling map function and filtering through mapped items\nconst moreThan5headers = (await dataset.map((item) => item.headingCount)).filter((count) => count > 5);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_with_more_than_5_headers', moreThan5headers);\n\nawait Actor.exit();\n",l="import { Actor } from 'apify';\n\nconst dataset = await Actor.openDataset();\n\n// calling reduce function and using memo to calculate number of headers\nconst pagesHeadingCount = await dataset.reduce((memo, value) => {\n return memo += value.headingCount;\n}, 0);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_heading_count', pagesHeadingCount);\n";var d=["components"],u={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},m=void 0,c={unversionedId:"examples/map-and-reduce",id:"version-3.0/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Dataset map",source:"@site/versioned_docs/version-3.0/examples/map_and_reduce.mdx",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/3.0/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/map_and_reduce.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"docs",previous:{title:"Forms",permalink:"/sdk/js/docs/3.0/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/3.0/examples/playwright-crawler"}},h={},f=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],y={toc:f},k="wrapper";function g(e){var t=e.components,a=(0,r.Z)(e,d);return(0,o.kt)(k,(0,n.Z)({},y,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#map",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"map")),"\nand ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"reduce"))," methods. Both methods can be used to simplify\nthe dataset results workflow process. Both can be called on the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()")),"\nmethod to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},p),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},l),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}g.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function s(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},d=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(a),c=r,h=u["".concat(p,".").concat(c)]||u[c]||m[c]||o;return a?n.createElement(h,i(i({ref:t},d),{},{components:a})):n.createElement(h,i({ref:t},d))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:r,i[1]=s;for(var l=2;l<o;l++)i[l]=a[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}c.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/dfff5bbd.c78044fc.js b/assets/js/dfff5bbd.c78044fc.js deleted file mode 100644 index b8b2d9a39c..0000000000 --- a/assets/js/dfff5bbd.c78044fc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1756],{68889:(e,t,a)=>{a.d(t,{Z:()=>s});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const s=function(e){var t=e.to,a=e.children,s=(0,o.E)(),p=s.version,l=s.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var d=p+"/";return"current"===p?d="next/":l&&(d=""),n.createElement(r.default,{to:"/api/"+d+t},a)}},23266:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>h,contentTitle:()=>m,default:()=>g,frontMatter:()=>u,metadata:()=>c,toc:()=>f});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=a(14563),s=a(68889);const p="import { Actor } from 'apify';\n\nawait Actor.init();\n\nconst dataset = await Actor.openDataset<{ headingCount: number }>();\n\n// calling map function and filtering through mapped items\nconst moreThan5headers = (await dataset.map((item) => item.headingCount)).filter((count) => count > 5);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_with_more_than_5_headers', moreThan5headers);\n\nawait Actor.exit();\n",l="import { Actor } from 'apify';\n\nconst dataset = await Actor.openDataset();\n\n// calling reduce function and using memo to calculate number of headers\nconst pagesHeadingCount = await dataset.reduce((memo, value) => {\n return memo += value.headingCount;\n}, 0);\n\n// saving result of map to default Key-value store\nawait Actor.setValue('pages_heading_count', pagesHeadingCount);\n";var d=["components"],u={id:"map-and-reduce",title:"Dataset Map and Reduce methods"},m=void 0,c={unversionedId:"examples/map-and-reduce",id:"version-3.0/examples/map-and-reduce",title:"Dataset Map and Reduce methods",description:"This example shows an easy use-case of the Dataset map",source:"@site/versioned_docs/version-3.0/examples/map_and_reduce.mdx",sourceDirName:"examples",slug:"/examples/map-and-reduce",permalink:"/sdk/js/docs/3.0/examples/map-and-reduce",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/map_and_reduce.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"map-and-reduce",title:"Dataset Map and Reduce methods"},sidebar:"docs",previous:{title:"Forms",permalink:"/sdk/js/docs/3.0/examples/forms"},next:{title:"Playwright crawler",permalink:"/sdk/js/docs/3.0/examples/playwright-crawler"}},h={},f=[{value:"Map",id:"map",level:3},{value:"Reduce",id:"reduce",level:3}],y={toc:f},k="wrapper";function g(e){var t=e.components,a=(0,r.Z)(e,d);return(0,o.kt)(k,(0,n.Z)({},y,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example shows an easy use-case of the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#map",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"map")),"\nand ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"reduce"))," methods. Both methods can be used to simplify\nthe dataset results workflow process. Both can be called on the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},"dataset")," directly."),(0,o.kt)("p",null,"Important to mention is that both methods return a new result (",(0,o.kt)("inlineCode",{parentName:"p"},"map")," returns a new array and ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," can return any type) - neither method updates\nthe dataset in any way."),(0,o.kt)("p",null,"Examples for both methods are demonstrated on a simple dataset containing the results scraped from a page: the ",(0,o.kt)("inlineCode",{parentName:"p"},"URL")," and a hypothetical number of\n",(0,o.kt)("inlineCode",{parentName:"p"},"h1")," - ",(0,o.kt)("inlineCode",{parentName:"p"},"h3")," header elements under the ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," key."),(0,o.kt)("p",null,"This data structure is stored in the default dataset under ",(0,o.kt)("inlineCode",{parentName:"p"},"{PROJECT_FOLDER}/storage/datasets/default/"),". If you want to simulate the\nfunctionality, you can use the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()")),"\nmethod to save the example ",(0,o.kt)("inlineCode",{parentName:"p"},"JSON array")," to your dataset."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'[\n {\n "url": "https://apify.com/",\n "headingCount": 11\n },\n {\n "url": "https://apify.com/storage",\n "headingCount": 8\n },\n {\n "url": "https://apify.com/proxy",\n "headingCount": 4\n }\n]\n')),(0,o.kt)("h3",{id:"map"},"Map"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method is very similar to standard Array mapping methods. It produces a new array of values by mapping each value in the existing\narray through a transformation function and an options parameter."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method used to check if are there more than 5 header elements on each page:"),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},p),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"moreThan5headers")," variable is an array of ",(0,o.kt)("inlineCode",{parentName:"p"},"headingCount")," attributes where the number of headers is greater than 5."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"map")," method's result value saved to the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"[11, 8]\n")),(0,o.kt)("h3",{id:"reduce"},"Reduce"),(0,o.kt)("p",null,"The dataset ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through\nthe items in the dataset using the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset#reduce",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"memo")," argument"),". After performing the necessary\ncalculation, the ",(0,o.kt)("inlineCode",{parentName:"p"},"memo")," is sent to the next iteration, while the item just processed is reduced (removed)."),(0,o.kt)("p",null,"Using the ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method to get the total number of headers scraped (all items in the dataset):"),(0,o.kt)(i.Z,{className:"language-js",mdxType:"CodeBlock"},l),(0,o.kt)("p",null,"The original dataset will be reduced to a single value, ",(0,o.kt)("inlineCode",{parentName:"p"},"pagesHeadingCount"),", which contains the count of all headers for all scraped pages (all\ndataset items)."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"reduce")," method's result value saved to the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"key-value store"))," should be:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"23\n")))}g.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function s(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},d=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=l(a),c=r,h=u["".concat(p,".").concat(c)]||u[c]||m[c]||o;return a?n.createElement(h,i(i({ref:t},d),{},{components:a})):n.createElement(h,i({ref:t},d))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s[u]="string"==typeof e?e:r,i[1]=s;for(var l=2;l<o;l++)i[l]=a[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}c.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e0e5647f.a9351132.js b/assets/js/e0e5647f.a9351132.js new file mode 100644 index 0000000000..365950aeee --- /dev/null +++ b/assets/js/e0e5647f.a9351132.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5401],{48749:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var s=n(87462),r=n(63366),i=(n(67294),n(3905)),a=["components"],o={id_old:"version-2.3.0-request-list-options",title:"RequestListOptions",id:"request-list-options"},l=void 0,p={unversionedId:"typedefs/request-list-options",id:"version-2.3/typedefs/request-list-options",title:"RequestListOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/RequestListOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-options",permalink:"/sdk/js/docs/2.3/typedefs/request-list-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-request-list-options",title:"RequestListOptions",id:"request-list-options"},sidebar:"version-2.3/docs",previous:{title:"RequestOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-options"},next:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-options"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"<code>sources</code>",id:"sources",level:3},{value:"<code>sourcesFunction</code>",id:"sourcesfunction",level:3},{value:"<code>persistStateKey</code>",id:"persiststatekey",level:3},{value:"<code>persistRequestsKey</code>",id:"persistrequestskey",level:3},{value:"<code>state</code>",id:"state",level:3},{value:"<code>keepDuplicateUrls</code>",id:"keepduplicateurls",level:3}],c={toc:d},m="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,a);return(0,i.kt)(m,(0,s.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlistoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"sources"},(0,i.kt)("inlineCode",{parentName:"h3"},"sources")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|{requestsFromUrl: string}|string)>"))),(0,i.kt)("p",null,"An array of sources of URLs for the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the\n",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," initializes. This is a measure to prevent memory leaks in\nsituations when millions of sources are added."),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," to download the source URLs from a given\nremote location. The URLs will be parsed from the received response."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"[\n // A single URL\n 'http://example.com/a/b',\n\n // Modify Request options\n { method: PUT, 'https://example.com/put, payload: { foo: 'bar' }}\n\n // Batch import of URLs from a file hosted on the web,\n // where the URLs should be requested using the HTTP POST request\n { method: 'POST', requestsFromUrl: 'http://example.com/urls.txt' },\n\n // Batch import from remote file, using a specific regular expression to extract the URLs.\n { requestsFromUrl: 'http://example.com/urls.txt', regex: /https:\\/\\/example.com\\/.+/ },\n\n // Get list of URLs from a Google Sheets document. Just add \"/gviz/tq?tqx=out:csv\" to the Google Sheet URL.\n // For details, see https://help.apify.com/en/articles/2906022-scraping-a-list-of-urls-from-a-google-sheets-document\n { requestsFromUrl: 'https://docs.google.com/spreadsheets/d/1GA5sSQhQjB_REes8I5IKg31S-TuRcznWOPjcpNqtxmU/gviz/tq?tqx=out:csv' }\n]\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"sourcesfunction"},(0,i.kt)("inlineCode",{parentName:"h3"},"sourcesFunction")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-sources-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListSourcesFunction"))),(0,i.kt)("p",null,"A function that will be called to get the sources for the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", but only if ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," was not able to fetch their persisted version (see\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey")),"). It must return an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")," of\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," or ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestOptions")),"."),(0,i.kt)("p",null,"This is very useful in a scenario when getting the sources is a resource intensive or time consuming task, such as fetching URLs from multiple\nsitemaps or parsing URLs from large datasets. Using the ",(0,i.kt)("inlineCode",{parentName:"p"},"sourcesFunction")," in combination with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," will allow\nyou to fetch and parse those URLs only once, saving valuable time when your actor migrates or restarts."),(0,i.kt)("p",null,"If both ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sourcesfunction",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sourcesFunction"))," are provided, the sources returned by the function will be\nadded after the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Let's say we want to scrape URLs extracted from sitemaps.\n\nconst sourcesFunction = async () => {\n // With super large sitemaps, this operation could take very long\n // and big websites typically have multiple sitemaps.\n const sitemaps = await downloadHugeSitemaps();\n return parseUrlsFromSitemaps(sitemaps);\n};\n\n// Sitemaps can change in real-time, so it's important to persist\n// the URLs we collected. Otherwise we might lose our scraping\n// state in case of an actor migration / failure / time-out.\nconst requestList = new RequestList({\n sourcesFunction,\n persistStateKey: 'state-key',\n persistRequestsKey: 'requests-key',\n});\n\n// The sourcesFunction is called now and the Requests are persisted.\n// If something goes wrong and we need to start again, RequestList\n// will load the persisted Requests from storage and will NOT\n// call the sourcesFunction again, saving time and resources.\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persiststatekey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," periodically stores its state (i.e. which URLs were crawled and which\nnot). If the actor is restarted, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will read the state and continue where it left off."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is not set, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will always start from the beginning, and all the source URLs will be crawled again."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persistrequestskey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistRequestsKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," persists its Requests during the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," call. This is necessary if ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is set and the source URLs might potentially\nchange, to ensure consistency of the source URLs and state object. However, it comes with some storage and performance overheads."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," is not set, ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," will always fetch the sources from their origin,\ncheck that they are consistent with the restored state (if any) and throw an error if they are not."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"state"},(0,i.kt)("inlineCode",{parentName:"h3"},"state")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("p",null,"The state object that the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will be initialized from. It is in the form as returned by ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList.getState()"),", such as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true,\n },\n}\n")),(0,i.kt)("p",null,"Note that the preferred (and simpler) way to persist the state of crawling of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"stateKeyPrefix")," parameter instead."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"keepduplicateurls"},(0,i.kt)("inlineCode",{parentName:"h3"},"keepDuplicateUrls")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,i.kt)("code",null," = false")),(0,i.kt)("p",null,"By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will deduplicate the provided URLs. Default deduplication is based on the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property of passed source\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,"If the property is not present, it is generated by normalizing the URL. If present, it is kept intact. In any case, only one request per ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"\nis added to the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," resulting in removal of duplicate URLs / unique keys."),(0,i.kt)("p",null,"Setting ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," will append an additional identifier to the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of each request that does not already include a\n",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),". Therefore, duplicate URLs will be kept in the list. It does not protect the user from having duplicates in user set ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"s however.\nIt is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var s=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,s,r=function(e,t){if(null==e)return{};var n,s,r={},i=Object.keys(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},m=s.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,h=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?s.createElement(h,a(a({ref:t},u),{},{components:n})):s.createElement(h,a({ref:t},u))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:r,a[1]=o;for(var p=2;p<i;p++)a[p]=n[p];return s.createElement.apply(null,a)}return s.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e0e5647f.f2ca051f.js b/assets/js/e0e5647f.f2ca051f.js deleted file mode 100644 index 6e47acda54..0000000000 --- a/assets/js/e0e5647f.f2ca051f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5401],{48749:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>p,toc:()=>d});var s=n(87462),r=n(63366),i=(n(67294),n(3905)),a=["components"],o={id_old:"version-2.3.0-request-list-options",title:"RequestListOptions",id:"request-list-options"},l=void 0,p={unversionedId:"typedefs/request-list-options",id:"version-2.3/typedefs/request-list-options",title:"RequestListOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/RequestListOptions.md",sourceDirName:"typedefs",slug:"/typedefs/request-list-options",permalink:"/sdk/js/docs/2.3/typedefs/request-list-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-request-list-options",title:"RequestListOptions",id:"request-list-options"},sidebar:"version-2.3/docs",previous:{title:"RequestOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-options"},next:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-options"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"<code>sources</code>",id:"sources",level:3},{value:"<code>sourcesFunction</code>",id:"sourcesfunction",level:3},{value:"<code>persistStateKey</code>",id:"persiststatekey",level:3},{value:"<code>persistRequestsKey</code>",id:"persistrequestskey",level:3},{value:"<code>state</code>",id:"state",level:3},{value:"<code>keepDuplicateUrls</code>",id:"keepduplicateurls",level:3}],c={toc:d},m="wrapper";function h(e){var t=e.components,n=(0,r.Z)(e,a);return(0,i.kt)(m,(0,s.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"requestlistoptions"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"sources"},(0,i.kt)("inlineCode",{parentName:"h3"},"sources")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Array<(RequestOptions|Request|{requestsFromUrl: string}|string)>"))),(0,i.kt)("p",null,"An array of sources of URLs for the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList")),". It can be either an array of strings, plain objects that define at least the\n",(0,i.kt)("inlineCode",{parentName:"p"},"url")," property, or an array of ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," instances."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"IMPORTANT:")," The ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array will be consumed (left empty) after ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," initializes. This is a measure to prevent memory leaks in\nsituations when millions of sources are added."),(0,i.kt)("p",null,"Additionally, the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestsFromUrl")," property may be used instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"url"),", which will instruct ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," to download the source URLs from a given\nremote location. The URLs will be parsed from the received response."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"[\n // A single URL\n 'http://example.com/a/b',\n\n // Modify Request options\n { method: PUT, 'https://example.com/put, payload: { foo: 'bar' }}\n\n // Batch import of URLs from a file hosted on the web,\n // where the URLs should be requested using the HTTP POST request\n { method: 'POST', requestsFromUrl: 'http://example.com/urls.txt' },\n\n // Batch import from remote file, using a specific regular expression to extract the URLs.\n { requestsFromUrl: 'http://example.com/urls.txt', regex: /https:\\/\\/example.com\\/.+/ },\n\n // Get list of URLs from a Google Sheets document. Just add \"/gviz/tq?tqx=out:csv\" to the Google Sheet URL.\n // For details, see https://help.apify.com/en/articles/2906022-scraping-a-list-of-urls-from-a-google-sheets-document\n { requestsFromUrl: 'https://docs.google.com/spreadsheets/d/1GA5sSQhQjB_REes8I5IKg31S-TuRcznWOPjcpNqtxmU/gviz/tq?tqx=out:csv' }\n]\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"sourcesfunction"},(0,i.kt)("inlineCode",{parentName:"h3"},"sourcesFunction")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-sources-function",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListSourcesFunction"))),(0,i.kt)("p",null,"A function that will be called to get the sources for the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", but only if ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," was not able to fetch their persisted version (see\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#persistrequestskey",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.persistRequestsKey")),"). It must return an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array")," of\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," or ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestOptions")),"."),(0,i.kt)("p",null,"This is very useful in a scenario when getting the sources is a resource intensive or time consuming task, such as fetching URLs from multiple\nsitemaps or parsing URLs from large datasets. Using the ",(0,i.kt)("inlineCode",{parentName:"p"},"sourcesFunction")," in combination with ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," will allow\nyou to fetch and parse those URLs only once, saving valuable time when your actor migrates or restarts."),(0,i.kt)("p",null,"If both ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sources",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sources"))," and\n",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-options#sourcesfunction",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListOptions.sourcesFunction"))," are provided, the sources returned by the function will be\nadded after the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources"),"."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"// Let's say we want to scrape URLs extracted from sitemaps.\n\nconst sourcesFunction = async () => {\n // With super large sitemaps, this operation could take very long\n // and big websites typically have multiple sitemaps.\n const sitemaps = await downloadHugeSitemaps();\n return parseUrlsFromSitemaps(sitemaps);\n};\n\n// Sitemaps can change in real-time, so it's important to persist\n// the URLs we collected. Otherwise we might lose our scraping\n// state in case of an actor migration / failure / time-out.\nconst requestList = new RequestList({\n sourcesFunction,\n persistStateKey: 'state-key',\n persistRequestsKey: 'requests-key',\n});\n\n// The sourcesFunction is called now and the Requests are persisted.\n// If something goes wrong and we need to start again, RequestList\n// will load the persisted Requests from storage and will NOT\n// call the sourcesFunction again, saving time and resources.\nawait requestList.initialize();\n")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persiststatekey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," periodically stores its state (i.e. which URLs were crawled and which\nnot). If the actor is restarted, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will read the state and continue where it left off."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is not set, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will always start from the beginning, and all the source URLs will be crawled again."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"persistrequestskey"},(0,i.kt)("inlineCode",{parentName:"h3"},"persistRequestsKey")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("p",null,"Identifies the key in the default key-value store under which the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," persists its Requests during the\n",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," call. This is necessary if ",(0,i.kt)("inlineCode",{parentName:"p"},"persistStateKey")," is set and the source URLs might potentially\nchange, to ensure consistency of the source URLs and state object. However, it comes with some storage and performance overheads."),(0,i.kt)("p",null,"If ",(0,i.kt)("inlineCode",{parentName:"p"},"persistRequestsKey")," is not set, ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list#initialize",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList.initialize()"))," will always fetch the sources from their origin,\ncheck that they are consistent with the restored state (if any) and throw an error if they are not."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"state"},(0,i.kt)("inlineCode",{parentName:"h3"},"state")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("a",{parentName:"p",href:"../typedefs/request-list-state",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestListState"))),(0,i.kt)("p",null,"The state object that the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will be initialized from. It is in the form as returned by ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList.getState()"),", such as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{\n nextIndex: 5,\n nextUniqueKey: 'unique-key-5'\n inProgress: {\n 'unique-key-1': true,\n 'unique-key-4': true,\n },\n}\n")),(0,i.kt)("p",null,"Note that the preferred (and simpler) way to persist the state of crawling of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"stateKeyPrefix")," parameter instead."),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"keepduplicateurls"},(0,i.kt)("inlineCode",{parentName:"h3"},"keepDuplicateUrls")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Type"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,i.kt)("code",null," = false")),(0,i.kt)("p",null,"By default, ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," will deduplicate the provided URLs. Default deduplication is based on the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," property of passed source\n",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," objects."),(0,i.kt)("p",null,"If the property is not present, it is generated by normalizing the URL. If present, it is kept intact. In any case, only one request per ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"\nis added to the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," resulting in removal of duplicate URLs / unique keys."),(0,i.kt)("p",null,"Setting ",(0,i.kt)("inlineCode",{parentName:"p"},"keepDuplicateUrls")," to ",(0,i.kt)("inlineCode",{parentName:"p"},"true")," will append an additional identifier to the ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey")," of each request that does not already include a\n",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),". Therefore, duplicate URLs will be kept in the list. It does not protect the user from having duplicates in user set ",(0,i.kt)("inlineCode",{parentName:"p"},"uniqueKey"),"s however.\nIt is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>h});var s=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,s,r=function(e,t){if(null==e)return{};var n,s,r={},i=Object.keys(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=s.createContext({}),p=function(e){var t=s.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=p(e.components);return s.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return s.createElement(s.Fragment,{},t)}},m=s.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,h=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?s.createElement(h,a(a({ref:t},u),{},{components:n})):s.createElement(h,a({ref:t},u))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o[d]="string"==typeof e?e:r,a[1]=o;for(var p=2;p<i;p++)a[p]=n[p];return s.createElement.apply(null,a)}return s.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e15dee63.5c5af9cc.js b/assets/js/e15dee63.5c5af9cc.js deleted file mode 100644 index 7e62925fc1..0000000000 --- a/assets/js/e15dee63.5c5af9cc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1369],{12098:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>d,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var t=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id:"proxy-management",title:"Proxy Management"},p=void 0,l={unversionedId:"guides/proxy-management",id:"version-2.3/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-2.3/guides/proxy_management.md",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/2.3/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/proxy_management.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"version-2.3/docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/2.3/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/2.3/guides/session-management"}},u={},c=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],y={toc:c},f="wrapper";function d(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,t.Z)({},y,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class.\nYou create an instance using the ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration()")),"\nfunction. See the ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions"))," for all\nthe possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nand ",(0,a.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyConfiguration.newUrl()"))," allows you to pass\na ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair,\nand subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same\n",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression\nof a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class for more information on how keeping\na real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas\nApify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await Apify.openSessionPool({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember.\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#newurlfunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.newUrlFunction")),"\nenable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.\nVisit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}d.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>u,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){o(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}))}return e}function s(e,n){if(null==e)return{};var r,t,o=function(e,n){if(null==e)return{};var r,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},u=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},c="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(r),f=o,d=c["".concat(p,".").concat(f)]||c[f]||y[f]||a;return r?t.createElement(d,i(i({ref:n},u),{},{components:r})):t.createElement(d,i({ref:n},u))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[c]="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=r[l];return t.createElement.apply(null,i)}return t.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e15dee63.aef24d7c.js b/assets/js/e15dee63.aef24d7c.js new file mode 100644 index 0000000000..ca8d5ee29e --- /dev/null +++ b/assets/js/e15dee63.aef24d7c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1369],{12098:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>d,frontMatter:()=>s,metadata:()=>l,toc:()=>c});var t=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id:"proxy-management",title:"Proxy Management"},p=void 0,l={unversionedId:"guides/proxy-management",id:"version-2.3/guides/proxy-management",title:"Proxy Management",description:"IP address blocking is one of the oldest",source:"@site/versioned_docs/version-2.3/guides/proxy_management.md",sourceDirName:"guides",slug:"/guides/proxy-management",permalink:"/sdk/js/docs/2.3/guides/proxy-management",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/proxy_management.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"proxy-management",title:"Proxy Management"},sidebar:"version-2.3/docs",previous:{title:"Environment Variables",permalink:"/sdk/js/docs/2.3/guides/environment-variables"},next:{title:"Session Management",permalink:"/sdk/js/docs/2.3/guides/session-management"}},u={},c=[{value:"Quick start",id:"quick-start",level:2},{value:"Proxy Configuration",id:"proxy-configuration",level:2},{value:"Crawler integration",id:"crawler-integration",level:3},{value:"IP Rotation and session management",id:"ip-rotation-and-session-management",level:3},{value:"Apify Proxy vs. Your own proxies",id:"apify-proxy-vs-your-own-proxies",level:2},{value:"Apify Proxy Configuration",id:"apify-proxy-configuration",level:2},{value:"Inspecting current proxy in Crawlers",id:"inspecting-current-proxy-in-crawlers",level:2}],y={toc:c},f="wrapper";function d(e){var n=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(f,(0,t.Z)({},y,r,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/IP_address_blocking",target:"_blank",rel:"noopener"},"IP address blocking")," is one of the oldest\nand most effective ways of preventing access to a website. It is therefore paramount for\na good web scraping library to provide easy to use but powerful tools which can work around\nIP blocking. The most powerful weapon in your anti IP blocking arsenal is a\n",(0,a.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Proxy_server",target:"_blank",rel:"noopener"},"proxy server"),"."),(0,a.kt)("p",null,"With Apify SDK you can use your own proxy servers, proxy servers acquired from\nthird-party providers, or you can rely on ",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),"\nfor your scraping needs."),(0,a.kt)("h2",{id:"quick-start"},"Quick start"),(0,a.kt)("p",null,"If you already subscribed to Apify Proxy or have proxy URLs of your own, you can start using\nthem immediately in only a few lines of code."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"If you want to use Apify Proxy, make sure that your ",(0,a.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"scraper is logged in"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration();\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n proxyUrls: [\n 'http://proxy-1.com',\n 'http://proxy-2.com',\n ]\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("h2",{id:"proxy-configuration"},"Proxy Configuration"),(0,a.kt)("p",null,"All your proxy needs are managed by the ",(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class.\nYou create an instance using the ",(0,a.kt)("a",{parentName:"p",href:"../api/apify#createproxyconfiguration",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.createProxyConfiguration()")),"\nfunction. See the ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions"))," for all\nthe possible constructor options."),(0,a.kt)("h3",{id:"crawler-integration"},"Crawler integration"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," integrates seamlessly into ",(0,a.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),"\nand ",(0,a.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.CheerioCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* your proxy opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("p",null,"Your crawlers will now use the selected proxies for all connections."),(0,a.kt)("h3",{id:"ip-rotation-and-session-management"},"IP Rotation and session management"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"../api/proxy-configuration#newurl",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyConfiguration.newUrl()"))," allows you to pass\na ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," parameter. It will then be used to create a ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId"),"-",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl")," pair,\nand subsequent ",(0,a.kt)("inlineCode",{parentName:"p"},"newUrl()")," calls with the same ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," will always return the same\n",(0,a.kt)("inlineCode",{parentName:"p"},"proxyUrl"),". This is extremely useful in scraping, because you want to create the impression\nof a real user. See the ",(0,a.kt)("a",{parentName:"p",href:"../guides/session-management",target:null,rel:null},"session management guide")," and\n",(0,a.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class for more information on how keeping\na real session helps you avoid blocking."),(0,a.kt)("p",null,"When no ",(0,a.kt)("inlineCode",{parentName:"p"},"sessionId")," is provided, your proxy URLs are rotated round-robin, whereas\nApify Proxy manages their rotation using black magic to get the best performance."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst sessionPool = await Apify.openSessionPool({ /* opts */ });\nconst session = await sessionPool.getSession();\nconst proxyUrl = proxyConfiguration.newUrl(session.id);\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({ /* opts */ });\nconst crawler = new Apify.PuppeteerCrawler({\n useSessionPool: true,\n persistCookiesPerSession: true,\n proxyConfiguration,\n // ...\n});\n")),(0,a.kt)("h2",{id:"apify-proxy-vs-your-own-proxies"},"Apify Proxy vs. Your own proxies"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"ProxyConfiguration")," class covers both Apify Proxy and custom proxy URLs so that\nyou can easily switch between proxy providers, however, some features of the class\nare available only to Apify Proxy users, mainly because Apify Proxy is what\none would call a super-proxy. It's not a single proxy server, but an API endpoint\nthat allows connection through millions of different IP addresses. So the class\nessentially has two modes: Apify Proxy or Your proxy."),(0,a.kt)("p",null,"The difference is easy to remember.\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#proxyurls",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.proxyUrls"))," and\n",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-configuration-options#newurlfunction",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"ProxyConfigurationOptions.newUrlFunction")),"\nenable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.\nVisit the ",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy docs")," for more info on how these parameters work."),(0,a.kt)("h2",{id:"apify-proxy-configuration"},"Apify Proxy Configuration"),(0,a.kt)("p",null,"With Apify Proxy, you can select specific proxy groups to use, or countries to connect from.\nThis allows you to get better proxy performance after some initial research."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const proxyConfiguration = await Apify.createProxyConfiguration({\n groups: ['RESIDENTIAL'],\n countryCode: 'US',\n});\nconst proxyUrl = proxyConfiguration.newUrl();\n")),(0,a.kt)("p",null,"Now your crawlers will use only Residential proxies from the US. Note that you must first get access\nto a proxy group before you are able to use it. You can find your available proxy groups\nin the ",(0,a.kt)("a",{parentName:"p",href:"https://console.apify.com/proxy",target:"_blank",rel:"noopener"},"proxy dashboard"),"."),(0,a.kt)("h2",{id:"inspecting-current-proxy-in-crawlers"},"Inspecting current proxy in Crawlers"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," grant access to information about the currently used proxy\nin their ",(0,a.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," using a ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/proxy-info",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"proxyInfo"))," object.\nWith the object, you can easily access the proxy URL. If you're using Apify Proxy, the other\nconfiguration parameters will also be available in the ",(0,a.kt)("inlineCode",{parentName:"p"},"proxyInfo")," object."))}d.isMDXComponent=!0},3905:(e,n,r)=>{r.d(n,{Zo:()=>u,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function i(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?a(Object(r),!0).forEach((function(n){o(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))}))}return e}function s(e,n){if(null==e)return{};var r,t,o=function(e,n){if(null==e)return{};var r,t,o={},a=Object.keys(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)r=a[t],n.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):i(i({},n),e)),r},u=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},c="mdxType",y={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(r),f=o,d=c["".concat(p,".").concat(f)]||c[f]||y[f]||a;return r?t.createElement(d,i(i({ref:n},u),{},{components:r})):t.createElement(d,i({ref:n},u))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[c]="string"==typeof e?e:o,i[1]=s;for(var l=2;l<a;l++)i[l]=r[l];return t.createElement.apply(null,i)}return t.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e1d7336f.55d36668.js b/assets/js/e1d7336f.55d36668.js new file mode 100644 index 0000000000..e2b19a4ecf --- /dev/null +++ b/assets/js/e1d7336f.55d36668.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8303],{49959:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var a=n(87462),o=n(63366),i=(n(67294),n(3905)),r=["components"],l={id_old:"version-2.3.0-getting-started",title:"Getting Started",id:"getting-started"},s=void 0,u={unversionedId:"guides/getting-started",id:"version-2.3/guides/getting-started",title:"Getting Started",description:"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary",source:"@site/versioned_docs/version-2.3/guides/getting_started.md",sourceDirName:"guides",slug:"/guides/getting-started",permalink:"/sdk/js/docs/2.3/guides/getting-started",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/getting_started.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-getting-started",title:"Getting Started",id:"getting-started"},sidebar:"version-2.3/docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/2.3/guides/apify-platform"},next:{title:"Request Storage",permalink:"/sdk/js/docs/2.3/guides/request-storage"}},p={},d=[{value:"Intro",id:"intro",level:2},{value:"Setting up locally",id:"setting-up-locally",level:2},{value:"Creating a new project",id:"creating-a-new-project",level:3},{value:"Setting up on the Apify Platform",id:"setting-up-on-the-apify-platform",level:2},{value:"Creating a new project",id:"creating-a-new-project-1",level:3},{value:"First crawler",id:"first-crawler",level:2},{value:"The general idea",id:"the-general-idea",level:3},{value:"The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code>",id:"the-where---request-requestlist-and-requestqueue",level:3},{value:"The What - <code>handlePageFunction</code>",id:"the-what---handlepagefunction",level:3},{value:"Putting it all together",id:"putting-it-all-together",level:3},{value:"CheerioCrawler aka jQuery crawler",id:"cheeriocrawler-aka-jquery-crawler",level:2},{value:"Overview",id:"overview",level:3},{value:"When to use <code>CheerioCrawler</code>",id:"when-to-use-cheeriocrawler",level:3},{value:"Basic use of <code>CheerioCrawler</code>",id:"basic-use-of-cheeriocrawler",level:3},{value:"Refresher",id:"refresher",level:4},{value:"Finding new links",id:"finding-new-links",level:4},{value:"Filtering links to same domain",id:"filtering-links-to-same-domain",level:4},{value:"Enqueueing links to <code>RequestQueue</code>",id:"enqueueing-links-to-requestqueue",level:4},{value:"Scrape the newly enqueued links",id:"scrape-the-newly-enqueued-links",level:4},{value:"The <code>maxRequestsPerCrawl</code> limit",id:"the-maxrequestspercrawl-limit",level:5},{value:"Putting it all together",id:"putting-it-all-together-1",level:4},{value:"Using Apify SDK to enqueue links like a boss",id:"using-apify-sdk-to-enqueue-links-like-a-boss",level:2},{value:"Meet <code>Apify.utils</code>",id:"meet-apifyutils",level:3},{value:"Introduction to <code>Apify.utils.enqueueLinks()</code>",id:"introduction-to-apifyutilsenqueuelinks",level:3},{value:"Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code>",id:"basic-use-of-enqueuelinks-with-cheeriocrawler",level:3},{value:"Introduction to pseudo-URLs",id:"introduction-to-pseudo-urls",level:4},{value:"Structure of a pseudo-URL",id:"structure-of-a-pseudo-url",level:4},{value:"Using <code>enqueueLinks()</code> to filter links",id:"using-enqueuelinks-to-filter-links",level:4},{value:"Resolving relative URLs with <code>enqueueLinks()</code>",id:"resolving-relative-urls-with-enqueuelinks",level:4},{value:"Integrating <code>enqueueLinks()</code> into our crawler",id:"integrating-enqueuelinks-into-our-crawler",level:4},{value:"Getting some real-world data",id:"getting-some-real-world-data",level:2},{value:"The importance of having a plan",id:"the-importance-of-having-a-plan",level:3},{value:"Choosing the data we need",id:"choosing-the-data-we-need",level:4},{value:"Analyzing the target",id:"analyzing-the-target",level:4},{value:"The start URL(s)",id:"the-start-urls",level:4},{value:"The crawling strategy",id:"the-crawling-strategy",level:3},{value:"Using a <code>RequestList</code>",id:"using-a-requestlist",level:4},{value:"DevTools crash course",id:"devtools-crash-course",level:4},{value:"Enqueueing the detail links using a custom selector",id:"enqueueing-the-detail-links-using-a-custom-selector",level:4},{value:"The <code>selector</code> parameter of <code>enqueueLinks()</code>",id:"the-selector-parameter-of-enqueuelinks",level:5},{value:"The missing <code>pseudoUrls</code>",id:"the-missing-pseudourls",level:5},{value:"Finally, the <code>userData</code> of <code>enqueueLinks()</code>",id:"finally-the-userdata-of-enqueuelinks",level:5},{value:"Another sanity check",id:"another-sanity-check",level:4},{value:"Scraping data",id:"scraping-data",level:3},{value:"Scraping the URL, Owner and Unique identifier",id:"scraping-the-url-owner-and-unique-identifier",level:4},{value:"Scraping Title, Description, Last modification date and Number of runs",id:"scraping-title-description-last-modification-date-and-number-of-runs",level:4},{value:"Title",id:"title",level:5},{value:"Description",id:"description",level:5},{value:"Last modification date",id:"last-modification-date",level:5},{value:"Run count",id:"run-count",level:5},{value:"Trying it out (sanity check #3)",id:"trying-it-out-sanity-check-3",level:4},{value:"Saving the scraped data",id:"saving-the-scraped-data",level:3},{value:"What's <code>Apify.pushData()</code>",id:"whats-apifypushdata",level:4},{value:"Finding my saved data",id:"finding-my-saved-data",level:4},{value:"Dataset on the Apify platform",id:"dataset-on-the-apify-platform",level:5},{value:"Local Dataset",id:"local-dataset",level:5},{value:"Final touch",id:"final-touch",level:3},{value:"Meet the <code>INPUT</code>",id:"meet-the-input",level:4},{value:"Use <code>INPUT</code> to seed our actor with categories",id:"use-input-to-seed-our-actor-with-categories",level:4},{value:"Structuring the code better",id:"structuring-the-code-better",level:4},{value:"Splitting your code into multiple files",id:"splitting-your-code-into-multiple-files",level:4},{value:"Using <code>Apify.utils.log</code> instead of <code>console.log</code>",id:"using-apifyutilslog-instead-of-consolelog",level:4},{value:"Using a router to structure your crawling",id:"using-a-router-to-structure-your-crawling",level:4}],h={toc:d},c="wrapper";function m(e){var t=e.components,l=(0,o.Z)(e,r);return(0,i.kt)(c,(0,a.Z)({},h,l,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary\nrequests, but that only gets you raw HTML and sometimes not even that. Then you have to read this HTML and extract the data you're interested in. Once\nextracted, it must be stored in a machine-readable format and easily accessible for further processing, because it is the processed data that holds\nvalue."),(0,i.kt)("p",null,"Apify SDK covers the process end-to-end. From crawling the web for links and scraping the raw data to storing it in various machine readable formats,\nready for processing. With this guide in hand, you should have your own data extraction solutions up and running in a few hours."),(0,i.kt)("h2",{id:"intro"},"Intro"),(0,i.kt)("p",null,"The goal of this getting started guide is to provide a step-by-step introduction to all the features of the Apify SDK. It will walk you through\ncreating the simplest of crawlers that only prints text to console, all the way up to complex systems that crawl pages, interact with them as if a real\nuser were sitting in front of a real browser and output structured data."),(0,i.kt)("p",null,"Since Apify SDK is usable both locally on any computer and on the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you will be able\nto use the source code in both environments interchangeably. Nevertheless, some initial setup is still required, so choose your preferred starting\nenvironment and let's get into it."),(0,i.kt)("h2",{id:"setting-up-locally"},"Setting up locally"),(0,i.kt)("p",null,"To run Apify SDK on your own computer, you need to meet the following pre-requisites first:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Have Node.js version 15.10 or higher installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Visit ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/",target:"_blank",rel:"noopener"},"Node.js website")," to download or use\n",(0,i.kt)("a",{parentName:"li",href:"https://github.com/Schniz/fnm",target:"_blank",rel:"noopener"},"fnm")))),(0,i.kt)("li",{parentName:"ol"},"Have NPM installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"NPM comes bundled with Node.js so you should already have it. If not, reinstall Node.js.")))),(0,i.kt)("p",null,"If you're not certain, confirm the prerequisites by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"node -v\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm -v\n")),(0,i.kt)("h3",{id:"creating-a-new-project"},"Creating a new project"),(0,i.kt)("p",null,"The fastest and best way to create new projects with the Apify SDK is to use our own\n",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),". This command line tool allows you to create, run and manage Apify\nprojects with ease, including their deployment to the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," if you wish to run them in the\ncloud after developing them locally."),(0,i.kt)("p",null,"Let's install the Apify CLI with the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\n")),(0,i.kt)("p",null,"Once the installation finishes, all you need to do to set up an Apify SDK project is to run:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-new-project\n")),(0,i.kt)("p",null,"A prompt will be shown, asking you to choose a template. Disregard the different options for now and choose the template labeled ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello world"),". The\ncommand will now create a new directory in your current working directory, called ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project"),", create a ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json")," in this folder and install\nall the necessary dependencies. It will also add example source code that you can immediately run."),(0,i.kt)("p",null,"Let's try that!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-new-project\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify run -p\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"-p")," flag is great to remember, because it stands for ",(0,i.kt)("inlineCode",{parentName:"p"},"--purge")," and it clears out your persistent storages before starting the actor.\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," and named storages are kept. Whenever you're just restarting your actor and you're not interested in the data of the previous run, you\nshould use ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run -p")," to prevent the old state from messing with your current run. If this is confusing, don't worry. You'll learn about\nstorages and ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," soon.")),(0,i.kt)("p",null,"You should start seeing log messages in the terminal as the system boots up and after a second, a Chromium browser window should pop up. In the\nwindow, you'll see quickly changing pages and back in the terminal, you should see the titles (contents of the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," HTML tags) of the pages\nprinted."),(0,i.kt)("p",null,"You can always terminate the crawl with a keypress in the terminal:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"CTRL+C\n")),(0,i.kt)("p",null,"Did you see all that? If you did, congratulations! You're ready to go!"),(0,i.kt)("h2",{id:"setting-up-on-the-apify-platform"},"Setting up on the Apify Platform"),(0,i.kt)("p",null,"Maybe you don't have Node.js installed and don't want the hassle. Or you can't install anything on your computer because you're using one provided by your company. Or perhaps you'd just prefer to start working in the cloud right away. Well, no worries, we've got you covered."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," is the foundational product of\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify"),". It's a serverless cloud computing platform, specifically designed for any web automation jobs,\nthat may include crawling and scraping, but really works amazingly for any batch jobs and long-running tasks."),(0,i.kt)("p",null,"It comes with a free account, so let's go to our ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"sign-up page")," and create one, if you\nhaven't already. Don't forget to verify your email. Without it, you won't be able to run any projects."),(0,i.kt)("p",null,"Once you're in, you might be prompted by our in-app help to walk through a step-by-step guide to some of our new features. Feel free to finish that,\nif you'd like, but once you're done, click on the ",(0,i.kt)("strong",{parentName:"p"},"Actors")," tab in the left menu. To read more about ",(0,i.kt)("strong",{parentName:"p"},"Actors"),", see:\n",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#what-is-an-actor",target:null,rel:null},"What is an actor")),(0,i.kt)("h3",{id:"creating-a-new-project-1"},"Creating a new project"),(0,i.kt)("p",null,"In the page that shows after clicking on Actors in the left menu, choose ",(0,i.kt)("strong",{parentName:"p"},"Create new"),". Give it a name in the form that opens, let's say,\n",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-actor"),". Disregard all the available options for now and save your changes."),(0,i.kt)("p",null,"Now click on the ",(0,i.kt)("strong",{parentName:"p"},"Sources")," tab at the top. Disregard the version and environment variables inputs for now and proceed directly to ",(0,i.kt)("strong",{parentName:"p"},"Source code"),".\nThis is where you develop the actor, if you choose not to do it locally. Just press ",(0,i.kt)("strong",{parentName:"p"},"Run")," below the ",(0,i.kt)("strong",{parentName:"p"},"Source code")," panel. It will automatically\nbuild and run the example source code. You should start seeing log messages that represent the build and after the build is complete, the log messages of\nthe running actor. Feel free to check out the other ",(0,i.kt)("strong",{parentName:"p"},"Run")," tabs, such as ",(0,i.kt)("strong",{parentName:"p"},"Info"),", where you can find useful information about the run, or\n",(0,i.kt)("strong",{parentName:"p"},"Key-value-store"),", where the actor's ",(0,i.kt)("strong",{parentName:"p"},"INPUT"),"\xa0and ",(0,i.kt)("strong",{parentName:"p"},"OUTPUT")," are stored."),(0,i.kt)("p",null,"Good job. You're now ready to run your own source code on the Apify Platform. For more information, visit the\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Actor documentation page"),", where you'll find everything about the platform's various\noptions."),(0,i.kt)("h2",{id:"first-crawler"},"First crawler"),(0,i.kt)("p",null,"Whether you've chosen to develop locally or in the cloud, it's time to start writing some actual source code. But before we do, let's just briefly\nintroduce all the Apify SDK classes necessary to make it happen."),(0,i.kt)("h3",{id:"the-general-idea"},"The general idea"),(0,i.kt)("p",null,"There are 4 crawler classes available for use in the Apify SDK. ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),". We'll talk about their differences later. Now, let's talk about what they have in common."),(0,i.kt)("p",null,"The general idea of each crawler is to go to a web page, open it, do some stuff there, save some results and continue to the next page, until it's done\nits job. So the crawler always needs to find answers to two questions: ",(0,i.kt)("strong",{parentName:"p"},"Where should I go?")," and ",(0,i.kt)("strong",{parentName:"p"},"What should I do there?")," Answering those two\nquestions is the only setup mandatory for running the crawlers."),(0,i.kt)("h3",{id:"the-where---request-requestlist-and-requestqueue"},"The Where - ",(0,i.kt)("inlineCode",{parentName:"h3"},"Request"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestQueue")),(0,i.kt)("p",null,"All crawlers use instances of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class to determine where they need to go. Each request may hold a lot of information,\nbut at the very least, it must hold a URL - a web page to open. But having only one URL would not make sense for crawling. We need to either have a\npre-existing list of our own URLs that we wish to visit, perhaps a thousand, or a million, or we need to build this list dynamically as we crawl,\nadding more and more URLs to the list as we progress."),(0,i.kt)("p",null,"A representation of the pre-existing list is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class. It is a static, immutable list of URLs and\nother metadata (see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," object) that the crawler will visit, one by one, retrying whenever an error occurs, until there\nare no more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," on the other hand, represents a dynamic queue of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". One that can be updated at runtime by adding more\npages - ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process. This allows the crawler to open one page, extract interesting URLs, such as links to other pages on the same domain,\nadd them to the queue (called ",(0,i.kt)("em",{parentName:"p"},"enqueuing"),") and repeat this process to build a queue of tens of thousands or more URLs while knowing only a single one\nat the beginning."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are essential for the crawler's operation. There is no other way to supply ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),' = "pages to crawl" to the\ncrawlers. At least one of them always needs to be provided while setting up. You can also use both at the same time, if you wish.'),(0,i.kt)("h3",{id:"the-what---handlepagefunction"},"The What - ",(0,i.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is the brain of the crawler. It tells it what to do at each and every page it visits. Generally it handles extraction of data\nfrom the page, processing the data, saving it, calling APIs, doing calculations and whatever else you need it to do."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is provided by you, the user, and invoked automatically by the crawler for each ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," from either the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". It always receives a single argument and that is a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object"),". Its properties change depending on the crawler class used, but it\nalways includes at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, which represents the currently crawled ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance (i.e. the URL the crawler is visiting and\nrelated metadata) and the ",(0,i.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," property, which is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class and we'll talk about\nit in detail later."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// The object received as a single argument by the handlePageFunction\n{\n request: Request,\n autoscaledPool: AutoscaledPool\n}\n")),(0,i.kt)("h3",{id:"putting-it-all-together"},"Putting it all together"),(0,i.kt)("p",null,"Enough theory! Let's put some of those hard-learned facts into practice. We learned above that we need ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to setup\na crawler. We will also use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function. It's not mandatory, but it makes our life easier. We'll\nlearn about it in detail later on."),(0,i.kt)("p",null,"Let's start with something super easy. Visit a page, get its title and close. First of all we need to require Apify, to make all of its features available to us:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n")),(0,i.kt)("p",null,"Easy, right? It really doesn't get much more difficult than that. For the purposes of this tutorial, we'll be scraping our own webpage\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"https://apify.com"),". Now, to get there, we need a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," with the page's URL in one of our sources,\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". Let's go with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," for now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\n// This is how you use the Apify.main() function.\nApify.main(async () => {\n // First we create the request queue instance.\n const requestQueue = await Apify.openRequestQueue();\n // And then we add a request to it.\n await requestQueue.addRequest({ url: 'https://apify.com' });\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you're not familiar with the ",(0,i.kt)("inlineCode",{parentName:"p"},"async")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords used in the example, you should know that these are native syntax in modern JavaScript. You can\n",(0,i.kt)("a",{parentName:"p",href:"https://nikgrozev.com/2017/10/01/async-await/",target:"_blank",rel:"noopener"},"learn more about them here"),".")),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue#addrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"requestQueue.addRequest()"))," function automatically converts the plain object we passed to it to a\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance, so now we have a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," that holds one ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," which points to ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),". Now we need the\n",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// We'll define the function separately so it's more obvious.\nconst handlePageFunction = async ({ request, $ }) => {\n // This should look familiar if you ever worked with jQuery.\n // We're just getting the text content of the <title> HTML element.\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n};\n")),(0,i.kt)("p",null,"Wait, where did the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," come from? Remember what we learned about the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," earlier. It expects a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," as an argument that\nwill always have a ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, but it will also have other properties, depending on the chosen crawler class. Well, ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," is a property provided\nby the ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," class, which we'll set up right now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And we're done! You just created your first crawler from scratch. It will download the HTML of ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),", find the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," element, get\nits text content and print it to console. Good job!"),(0,i.kt)("p",null,"To run the code locally, copy and paste the code, if you haven't already typed it in yourself, to the ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file in the ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project")," we\ncreated earlier and run ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run")," from that project's directory."),(0,i.kt)("p",null,"To run the code on Apify Platform, just replace the original example with your new code and hit Run."),(0,i.kt)("p",null,"Whichever environment you choose, you should see the message\n",(0,i.kt)("inlineCode",{parentName:"p"},'The title of "https://apify.com" is: Web Scraping, Data Extraction and Automation - Apify.')," printed to the screen. If you do, congratulations and\nlet's move onto some bigger challenges! And if you feel like you don't really know what just happened there, no worries, it will all become clear when\nyou learn more about ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("h2",{id:"cheeriocrawler-aka-jquery-crawler"},"CheerioCrawler aka jQuery crawler"),(0,i.kt)("p",null,"This is the crawler that we used in our earlier example. Our simplest and also the fastest crawling solution. If you're familiar with ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", you'll\nunderstand ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," in minutes. ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," is\nessentially ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," for Node.js. It offers the same API, including the familiar ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object. You can use it, as you would ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", for manipulating\nthe DOM of a HTML page. In crawling, you'll mostly use it to select the right elements and extract their text values - the data you're interested in.\nBut ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," runs in a browser and attaches directly to the browser's DOM. Where does ",(0,i.kt)("inlineCode",{parentName:"p"},"cheerio")," get its HTML? This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"Crawler")," part of\n",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," comes in."),(0,i.kt)("h3",{id:"overview"},"Overview"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," crawls by making plain HTTP requests to the provided URLs. As you remember from the previous section, the\nURLs are fed to the crawler using either the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". The HTTP responses\nit gets back are HTML pages, the same pages you would get in your browser when you first load a URL."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note, however, that modern web pages often do not serve all of their content in the first HTML response, but rather the first HTML contains links to\nother resources such as CSS and JavaScript that get downloaded afterwards and together they create the final page. See our\n",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to crawl those.")),(0,i.kt)("p",null,"Once the page's HTML is retrieved, the crawler will pass it to ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," for\nparsing. The result is the typical ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function, which should be familiar to ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," users. You can use this ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," to do all sorts of lookups and\nmanipulation of the page's HTML, but in scraping, we will mostly use it to find specific HTML elements and extract their data."),(0,i.kt)("p",null,"Example use of Cheerio and its ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function in comparison to browser JavaScript:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Return the text content of the <title> element.\ndocument.querySelector('title').textContent; // plain JS\n$('title').text(); // Cheerio\n\n// Return an array of all 'href' links on the page.\nArray.from(document.querySelectorAll('[href]')).map(el => el.href); // plain JS\n$('[href]')\n .map((i, el) => $(el).attr('href'))\n .get(); // Cheerio\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"This is not to show that Cheerio is better than plain browser JavaScript. Some might actually prefer the more expressive way plain JS provides.\nUnfortunately, the browser JavaScript methods are not available in Node.js, so Cheerio is our best bet to do the parsing.")),(0,i.kt)("h3",{id:"when-to-use-cheeriocrawler"},"When to use ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Even though using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," is extremely easy, it probably will not be your first choice for most kinds of crawling or scraping in production\nenvironments. Since most websites nowadays use modern JavaScript to create rich, responsive and data-driven user experiences, the plain HTTP requests\nthe crawler uses may just fall short of your needs."),(0,i.kt)("p",null,"But ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," is far from useless! It really shines when you need to cope with extremely high workloads. With just 4 GBs of memory and a single CPU\ncore, you can scrape 500 or more pages a minute! ",(0,i.kt)("em",{parentName:"p"},"(assuming each page contains approximately 400KB of HTML)")," To scrape this fast with a full browser\nscraper, such as the ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", you'd need significantly more computing power."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Extremely fast"),(0,i.kt)("li",{parentName:"ul"},"Easy to set up"),(0,i.kt)("li",{parentName:"ul"},"Familiar for jQuery users"),(0,i.kt)("li",{parentName:"ul"},"Super cheap to run"),(0,i.kt)("li",{parentName:"ul"},"Each request can go through a different proxy")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Disadvantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Does not work for all websites"),(0,i.kt)("li",{parentName:"ul"},"May easily overload the target website with requests"),(0,i.kt)("li",{parentName:"ul"},"Does not enable any manipulation of the website before scraping")),(0,i.kt)("h3",{id:"basic-use-of-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Now that we have an idea of the crawler's inner workings, let's build one. We'll use the example from the previous section and improve on it by\nletting it truly crawl the page, finding new links as it goes, enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and then scraping them."),(0,i.kt)("h4",{id:"refresher"},"Refresher"),(0,i.kt)("p",null,"Just to refresh your memory, in the previous section we built a very simple crawler that downloads the HTML of a single page, reads its title and prints\nit to the console. This is the original source code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Earlier we said that we would let the crawler:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to the same hostname, in this case ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"So let's get to it!"),(0,i.kt)("h4",{id:"finding-new-links"},"Finding new links"),(0,i.kt)("p",null,"There are numerous approaches to finding links to follow when crawling the web. For our purposes, we will be looking for ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute. For example ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="https://apify.com/store">This is a link to Apify Store</a>'),". To do this, we need to update our Cheerio\nfunction."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n")),(0,i.kt)("p",null,"Our new function finds all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain the ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute and extracts the attributes into an array of strings. But there's a problem. There could be relative links in the list and those can't be used on their own. We need to resolve them using our domain as base URL and\nwe will use one of Node.js' standard libraries to do this."),(0,i.kt)("p",null,"Apify exposes two URL properties: ",(0,i.kt)("a",{parentName:"p",href:"../api/request#url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"request.url"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/request#loadedurl",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"request.loadedUrl")),". What's the difference? Well, ",(0,i.kt)("inlineCode",{parentName:"p"},"request.url")," is the URL of the first request. In case of redirects, the URL changes. The final one is stored as ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst { hostname } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n")),(0,i.kt)("h4",{id:"filtering-links-to-same-domain"},"Filtering links to same domain"),(0,i.kt)("p",null,"Websites typically contain a lot of links that lead away from the original page. This is normal, but when crawling a website, we usually want to crawl\nthat one site and not let our crawler wander away to Google, Facebook and Twitter. Therefore, we need to filter out the off-domain links and only\nkeep the ones that lead to the same domain."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Don't worry, we'll learn how to do this with a single function call using Apify in a few moments.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst { hostname } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.hostname.endsWith(hostname));\n\n// ...\n")),(0,i.kt)("p",null,"This includes subdomains. In order to filter the same origin, simply compare the ",(0,i.kt)("inlineCode",{parentName:"p"},"url.origin")," property instead:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { origin } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.origin === origin);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," class contains many other useful properties. You can read more about ",(0,i.kt)("inlineCode",{parentName:"p"},"url.origin")," ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/URL/origin",target:"_blank",rel:"noopener"},"here"),".")),(0,i.kt)("h4",{id:"enqueueing-links-to-requestqueue"},"Enqueueing links to ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestQueue")),(0,i.kt)("p",null,"This should be easy, because we already did that ",(0,i.kt)("a",{parentName:"p",href:"#putting-it-all-together",target:null,rel:null},"earlier"),", remember? Just call ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue.addRequest()")," for all the new\nlinks. This will add them to the end of the queue for processing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst { origin } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.origin === origin);\n\n// Add the requests in series. There's of course room for speed\n// improvement by parallelization. Try to implement it, if you wish.\nconsole.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\nfor (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n}\n\n// ...\n")),(0,i.kt)("h4",{id:"scrape-the-newly-enqueued-links"},"Scrape the newly enqueued links"),(0,i.kt)("p",null,"And we're approching the finishing line. All we need to do now is integrate the new code into our original crawler. It will be easy, because\nalmost everything needs to go into the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". But just before we do that, let's introduce the first crawler configuration option that\nis not a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". It's called ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl"),"."),(0,i.kt)("h5",{id:"the-maxrequestspercrawl-limit"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"maxRequestsPerCrawl")," limit"),(0,i.kt)("p",null,"This configuration option is available in all crawler classes and you can use it to limit the number of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," the crawler should process. It's\nvery useful when you're just testing your code or when your crawler could potentially crawl millions of pages and you want to save resources. You can\nadd it to the crawler options like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("p",null,"This limits the number of successfully handled ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to 20. Bear in mind that the actual number of processed requests might be a little higher\nand that's because usually there are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," processed at the same time and once the 20th ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," finishes, the other running ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),"\nwill be allowed to finish too."),(0,i.kt)("h4",{id:"putting-it-all-together-1"},"Putting it all together"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const { origin } = new URL(request.loadedUrl);\n const absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.origin === origin);\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"No matter if you followed along with our coding or just copy-pasted the resulting source, try running it now, perhaps even in both environments. You\nshould see the crawler log the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the first page, then the ",(0,i.kt)("strong",{parentName:"p"},"enqueueing")," message showing number of URLs, followed by the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the\nfirst enqueued page and so on and so on."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you need help with running the code, refer back to the chapters on environment setup: ",(0,i.kt)("a",{parentName:"p",href:"#setting-up-locally",target:null,rel:null},"Setting up locally")," and\n",(0,i.kt)("a",{parentName:"p",href:"#setting-up-on-the-apify-platform",target:null,rel:null},"Setting up on the Apify platform"),".")),(0,i.kt)("h2",{id:"using-apify-sdk-to-enqueue-links-like-a-boss"},"Using Apify SDK to enqueue links like a boss"),(0,i.kt)("p",null,"If you were paying attention carefully in the previous chapter, we said that we would show you a way to enqueue new ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," with a single function\ncall. You might be wondering why we had to go through the whole process of getting the individual links, filtering the same domain ones and then\nmanually enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),", when there is a simpler way."),(0,i.kt)("p",null,"Well, the obvious reason is practice. This is a tutorial after all. The other reason is to make you think about all the bits and pieces that come\ntogether, so that in the end, a new page, not previously entered in by you, can be scraped. We think that by seeing the bigger picture, you will be\nable to get the most out of Apify SDK."),(0,i.kt)("h3",{id:"meet-apifyutils"},"Meet ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils")),(0,i.kt)("p",null,"We will talk at length about them later, but in short, ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," is a namespace where you can find various helpful functions and constants that\nmake your life easier. One of the available functions is ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," which encapsulates the whole enqueueing process and even adds\nsome extra functionality."),(0,i.kt)("h3",{id:"introduction-to-apifyutilsenqueuelinks"},"Introduction to ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils.enqueueLinks()")),(0,i.kt)("p",null,"Since enqueuing new links to crawl is such an integral part of web crawling, we created a function that attempts to simplify this process as much as\npossible. With a single function call, it allows you to find all the links on a page that match specified criteria and add them to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),".\nIt also allows you to modify the resulting ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to match your crawling needs."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," is quite a powerful function so, like crawlers, it gets its arguments from an options object. This is useful, because you don't have to\nremember their order! But also because we can easily extend its API and add new features. You can\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},"find the full reference here"),"."),(0,i.kt)("p",null,"We suggest using ES6 destructuring to grab the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function off of the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils")," object, so you don't have to type ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," all the\ntime."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\n// Now you can use enqueueLinks like this:\nawait enqueueLinks({\n /* options */\n});\n")),(0,i.kt)("h3",{id:"basic-use-of-enqueuelinks-with-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"enqueueLinks()")," with ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"We already implemented logic that takes care of enqueueing new links to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," in the previous chapter on ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". Let's look at\nthat logic and implement the same functionality using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),"."),(0,i.kt)("p",null,"We found that the crawler needed to do these 4 things to crawl ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),":"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"Using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," we can squash the first 3 into a single function call, if we set the options correctly. For now, let's just stick to the\nbasics. At the very least, we need a source where to find the links and the queue to enqueue them to. The ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," Cheerio object is one of the sources the\nfunction accepts and we already know how to work with it in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". We also know how to get a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," instance."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nawait enqueueLinks({ $, requestQueue });\n")),(0,i.kt)("p",null,"That's all we need to do to enqueue all ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="...">')," links from the given page to the given queue. Easy, right? Scratch number 1 and 3 off the\nlist. Only number 2 remains and to tackle this one, we need to talk about yet another new concept, the pseudo-URL."),(0,i.kt)("h4",{id:"introduction-to-pseudo-urls"},"Introduction to pseudo-URLs"),(0,i.kt)("p",null,"Pseudo-URLs are represented by our ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class and even though the name sounds discouraging, they're a pretty simple concept. They're just URLs\nwith some parts replaced by wildcards (read ",(0,i.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions"},"regular\nexpressions"),"). They are matched against URLs to find specific links, domains, patterns, file extensions and so on."),(0,i.kt)("p",null,"In scraping, there are usually patterns to be found in website URLs that can be leveraged to scrape only the pages we're interested in. Imagine\na typical online store. It has different categories which list different items The URL for might looks something like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\n")),(0,i.kt)("p",null,"A category would then have a different URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\n")),(0,i.kt)("p",null,"Going to this page would produce a list of offered computers. Then, clicking on one of the computers might take us to a detail URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"As you can see, there's a structure to the links. In the real world, the structure might not always be perfectly obvious, but it's very often there.\nPseudo-URLs help to use this structure to select only the relevant links from a given page."),(0,i.kt)("h4",{id:"structure-of-a-pseudo-url"},"Structure of a pseudo-URL"),(0,i.kt)("p",null,"A pseudo-URL is a URL with ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions",target:"_blank",rel:"noopener"},"regular expressions"),") enclosed\nin ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Since we're running Node.js, the regular expressions should follow the JavaScript style."),(0,i.kt)("p",null,"For example, a pseudo-URL"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/[(\\w|-)+]\n")),(0,i.kt)("p",null,"will match all of the following URLs:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\nhttps://www.online-store.com/categories/mobile-phones\nhttps://www.online-store.com/categories/black-friday\n")),(0,i.kt)("p",null,"but it will not match"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\nhttps://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"This way, you can easily find just the URLs that you're looking for while ignoring the rest."),(0,i.kt)("p",null,"A pseudo-URL may include any number of bracketed regular expressions, so you can compose much more complex matching logic. The following Pseudo URL\nwill match the items in the store even if the links use the non-secure ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," protocol, omit the ",(0,i.kt)("inlineCode",{parentName:"p"},"www")," from the hostname or use a different TLD."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http[s?]://[(www)?\\.]online-store.[com|net|org]/items/[\\d+]\n")),(0,i.kt)("p",null,"will match any combination of:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://www.online-store.org/items/12345\nhttps://online-store.com/items/633423\nhttp://online-store.net/items/7003\n")),(0,i.kt)("p",null,"but it will not match:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://shop.online-store.org/items/12345\nhttps://www.online-store.com/items/calculator\nwww.online-store.org/items/7003\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pssst! Don't tell anyone, but you can create ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrls")," with plain old ",(0,i.kt)("inlineCode",{parentName:"p"},"RegExp")," instances instead of this brackety madness as well.")),(0,i.kt)("h4",{id:"using-enqueuelinks-to-filter-links"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," to filter links"),(0,i.kt)("p",null,"That's been quite a lot of theory and examples. We might as well put it to practice. Going back to our ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," exercise, we still have number\n2 left to cross off the list - filter links pointing to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),". We've already shown that at the very least, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function needs\ntwo arguments. The source, in our case the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object, and the destination - the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". To filter links, we need to add a third argument:\n",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls"),"."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"options.pseudoUrls")," argument is always an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array"),", but its contents can take on many forms. ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"See the reference"),"\nfor all of them. Since we just need to filter out same domain links, we'll keep it simple and use a pseudo-URL ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To break the pseudo-URL string down, we're looking for both ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," protocols and the links may only lead to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," domain. The\nfinal brackets ",(0,i.kt)("inlineCode",{parentName:"p"},"[.*]")," allow everything, so ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/contact")," as well as ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," will match. If this sounds complex to you, we suggest\n",(0,i.kt)("a",{parentName:"p",href:"https://www.regular-expressions.info/tutorial.html",target:"_blank",rel:"noopener"},"reading a tutorial")," or two on regular expression syntax.")),(0,i.kt)("h4",{id:"resolving-relative-urls-with-enqueuelinks"},"Resolving relative URLs with ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"TLDR;")," Just use ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl: request.loadedUrl")," when working with ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"This is probably the weirdest and most complicated addition to the list. This is not the place to talk at length about\n",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/2005079/absolute-vs-relative-urls",target:"_blank",rel:"noopener"},"absolute and relative paths"),", but in short, the\nlinks we encounter in a page can either be absolute, such as:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/john-doe/my-actor\n")),(0,i.kt)("p",null,"or relative:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"./john-doe/my-actor\n")),(0,i.kt)("p",null,"Browsers handle this automatically, but since we're only using plain HTTP requests, we need to tell the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function how to resolve the\nrelative links to the absolute ones, so we can use them for scraping. This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl")," comes into play, because it returns the\ncorrect URL to use as ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$', 'requestQueue' and 'request' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Even though it seems possible, we can't use the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.url")," of our ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances, because the page could have been redirected and the final\nURL would be different from the one we requested.")),(0,i.kt)("h4",{id:"integrating-enqueuelinks-into-our-crawler"},"Integrating ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," into our crawler"),(0,i.kt)("p",null,"That was fairly easy, wasn't it. That ticks number 2 off our list and we're done! Let's take a look at the original crawler code, where we\nenqueued all the links manually."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const ourDomain = 'https://apify.com';\n const absoluteUrls = links.map(link => new URL(link, ourDomain));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Since we've already prepared the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," options, we can just replace all the above enqueuing logic with a single function call, as promised."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Enqueue links\n const enqueued = await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n });\n console.log(`Enqueued ${enqueued.length} URLs.`);\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And that's it! No more parsing the links from HTML using Cheerio, filtering them and enqueueing them one by one It all gets done automatically!\n",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," is just one example of Apify SDK's powerful helper functions. They're all designed to make your life easier so you can focus on\ngetting your data, while leaving the mundane crawling management to your tools."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," has a lot more tricks up its sleeve. Make sure to check out the\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"reference documentation")," to see what else it can do for you. Namely the feature to prepopulate the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"\ninstances it creates with ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," of your choice is extremely useful!"),(0,i.kt)("h2",{id:"getting-some-real-world-data"},"Getting some real-world data"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Hey, guys, you know, it's cool that we can scrape the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," elements of web pages, but that's not very useful. Can we finally scrape some real\ndata and save it somewhere in a machine readable format? Because that's why you started reading this tutorial in the first place!")),(0,i.kt)("p",null,"We hear you, young padawan! First, learn how to crawl, you must. Only then, walk through data, you can!"),(0,i.kt)("p",null,"###\xa0Making a store crawler"),(0,i.kt)("p",null,"Fortunately, we don't have to travel to a galaxy far far away to find a good candidate for learning how to scrape\nstructured data. The ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," is a library of public actors that anyone can grab and use. You\ncan find ready-made solutions for crawling ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/drobnikj/crawler-google-places",target:"_blank",rel:"noopener"},"Google Places"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/vaclavrut/amazon-crawler",target:"_blank",rel:"noopener"},"Amazon"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/google-search-scraper",target:"_blank",rel:"noopener"},"Google Search"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/dtrungtin/booking-scraper",target:"_blank",rel:"noopener"},"Booking"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/jaroslavhejlek/instagram-scraper",target:"_blank",rel:"noopener"},"Instagram"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/maxcopell/tripadvisor",target:"_blank",rel:"noopener"},"Tripadvisor")," and many other websites. Feel free to check them out! It's also a great place to practice our Jedi scraping skills since it has categories, lists and details. That's almost like our imaginary\n",(0,i.kt)("inlineCode",{parentName:"p"},"online-store.com")," from the previous chapter."),(0,i.kt)("h3",{id:"the-importance-of-having-a-plan"},"The importance of having a plan"),(0,i.kt)("p",null,'Sometimes scraping is really straightforward, but most of the times, it really pays to do a little bit of research first. How is the website\nstructured? Can I scrape it only with HTTP requests (read "with ',(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"\") or would I need a full browser solution? Are there any\nanti-scraping protections in place? Do I need to parse the HTML or can I get the data otherwise, such as directly from the website's API. Jakub,\none of Apify's founders, wrote a\n",(0,i.kt)("a",{parentName:"p",href:"https://blog.apify.com/web-scraping-in-2018-forget-html-use-xhrs-metadata-or-javascript-variables-8167f252439c",target:"_blank",rel:"noopener"},"great article about all the different techniques"),"\nand tips and tricks, so make sure to check that out!"),(0,i.kt)("p",null,"For the purposes of this tutorial, let's just go ahead with HTTP requests and HTML parsing using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". The number one reason being: We\nalready know how to use it and we want to build on that knowledge to learn specific crawling and scraping techniques."),(0,i.kt)("h4",{id:"choosing-the-data-we-need"},"Choosing the data we need"),(0,i.kt)("p",null,"A good first step is always to figure out what it is we want to scrape and where to find it. For the time being, let's just agree that we want to\nscrape all actors (see the ",(0,i.kt)("inlineCode",{parentName:"p"},"Show")," dropdown) in all categories (which can be found on the left side of the page) and for each actor we want to get its"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,'We can see that some of the information is available directly on the list page, but for details such as "Last modification date" or "Number of runs" we\'ll also need\nto open the actor detail pages.'),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"analyzing-the-target"},"Analyzing the target"),(0,i.kt)("p",null,"Knowing that we will use plain HTTP requests, we immediately know that we won't be able to manipulate the website in any way. We will only be able to\ngo through the HTML it gives us and parse our data from there. This might sound like a huge limitation, but you might be surprised in how effective it\ncan be. Let's get to it!"),(0,i.kt)("h4",{id:"the-start-urls"},"The start URL(s)"),(0,i.kt)("p",null,"This is where we start our crawl. It's convenient to start as close to our data as possible. For example, it wouldn't make much sense to start at\n",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," and look for a ",(0,i.kt)("inlineCode",{parentName:"p"},"store")," link there, when we already know that everything we want to extract can be found at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page."),(0,i.kt)("p",null,"Once we look at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page more carefully, we see that the categories themselves produce URLs that we can use to access those\nindividual categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("p",null,"Should we write down all the category URLs down and use all of them as start URLs? It's definitely possible, but what if a new category appears on the\npage later? We would not learn about it unless we manually visit the page and inspect it again. So scraping the category links off the store page\ndefinitely makes sense. This way we always get an up to date list of categories."),(0,i.kt)("p",null,"But is it really that straightforward? By digging further into the store page's HTML we find that it does not actually contain the category links. The\nmenu on the left uses JavaScript to display the items from a given category and, as we've learned earlier, ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," cannot execute JavaScript."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We've deliberately chosen this scenario to show an example of the number one weakness of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". We will overcome this difficulty in our\n",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," tutorial, but at the cost of compute resources and speed. Always remember that no tool is best for everything!")),(0,i.kt)("p",null,"So we're back to the pre-selected list of URLs. Since we cannot scrape the list dynamically, we have to manually collect the links and then use them\nin our crawler. We lose the ability to scrape new categories, but we keep the low resource consumption and speed advantages of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"Therefore, after careful consideration, we've determined that we should use multiple start URLs and that they should look as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\nhttps://apify.com/store?category=ECOMMERCE\nhttps://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("h3",{id:"the-crawling-strategy"},"The crawling strategy"),(0,i.kt)("p",null,"Now that we know where to start, we need to figure out where to go next. Since we've eliminated one level of crawling by selecting the categories\nmanually, we now only need to crawl the actor detail pages. The algorithm therefore follows:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Visit the category list page (one of our start URLs)."),(0,i.kt)("li",{parentName:"ol"},"Enqueue all links to actor details."),(0,i.kt)("li",{parentName:"ol"},"Visit all actor details and extract data."),(0,i.kt)("li",{parentName:"ol"},"Repeat 1 - 3 for all categories.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Technically, this is a depth first crawl and the crawler will perform a breadth first crawl by default, but that's an implementation detail. We've\nchosen this notation since a breadth first crawl would be less readable.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will make sure to visit the pages for us, if we provide the correct ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and we already know how to enqueue pages, so this\nshould be fairly easy. Nevertheless, there are two more tricks that we'd like to show you."),(0,i.kt)("h4",{id:"using-a-requestlist"},"Using a ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestList")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is a perfect tool for scraping a pre-existing list of URLs and if you think about our start URLs, this is exactly what we have! A list\nof links to the different categories of the store. Let's see how we'd get them into a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n];\n\nconst requestList = await Apify.openRequestList('categories', sources);\n")),(0,i.kt)("p",null,"As you can see, similarly to the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestQueue()")," function, there is an ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestList()")," function that will create a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"\ninstance for you. The first argument is the name of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),". It is used to persist the crawling state of the list. This is useful when you\nwant to continue where you left off after an error or a process restart. The second argument is the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array, which is nothing more than a list\nof URLs you wish to crawl."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is a persistent store by default, so no name is needed, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," only lives in memory and giving it a name enables it\nto become persistent.")),(0,i.kt)("p",null,"You might now want to ask one of these questions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Can I enqueue into ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," too?"),(0,i.kt)("li",{parentName:"ul"},"How do I make ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," work together with ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")," since I need the queue to enqueue new ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests"),".")),(0,i.kt)("p",null,"The answer to the first one is a definitive no. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is immutable and once you create it, you cannot add or remove ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," from it. The\nanswer to the second one is simple. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are made to work together out of the box in crawlers, so all you need to do is\nuse them both and the crawlers will do the rest."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"For those wondering how this works, the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," are enqueued into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," right before their execution and only\nprocessed by the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," afterwards. You can, of course, enqueue the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to the queue manually, but that would take some boilerplate\ncode and perhaps quite a long time, if we were talking about tens of thousands or more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". The crawlers do it while running, so the time to\nenqueue is spread out and you won't even notice it.")),(0,i.kt)("p",null,"####\xa0Sanity check"),(0,i.kt)("p",null,"It's always useful to create some simple boilerplate code to see that we've got everything set up correctly before we start to write\nthe scraping logic itself. We might realize that something in our previous analysis doesn't quite add up, or the website might not behave exactly as we expected."),(0,i.kt)("p",null,"Let's use our newly acquired ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," knowledge and everything we know from the previous chapters to create a new crawler that'll just visit all\nthe category URLs we selected and print the text content of all the actors in the category. Try running the code below in your selected environment.\nYou should see, albeit very badly formatted, the text of the individual actor cards that are displayed in the selected categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ $, request }) => {\n // Select all the actor cards.\n $('.item').each((i, el) => {\n const text = $(el).text();\n console.log(`ITEM: ${text}\\n`);\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If there's anything you don't understand, refer to the previous chapters on setting up your environment, building your first crawler and\n",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),".")),(0,i.kt)("p",null,"You might be wondering how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. After analyzing the category pages using a browser's DevTools, we've determined that it's a\ngood selector to select all the currently displayed actor cards. DevTools and CSS selectors are quite a large topic, so we can't go into too much\ndetail now, but here are a few general pointers."),(0,i.kt)("h4",{id:"devtools-crash-course"},"DevTools crash course"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We'll use Chrome DevTools here, since it's the most common browser, but feel free to use any other, it's all very similar.")),(0,i.kt)("p",null,"We could pick any category, but let's just go with Travel because it includes some interesting actors. Go to"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\n")),(0,i.kt)("p",null,"and open DevTools either by right-clicking anywhere in the page and selecting ",(0,i.kt)("inlineCode",{parentName:"p"},"Inspect"),", or by pressing ",(0,i.kt)("inlineCode",{parentName:"p"},"F12")," or by any other means relevant to your\nsystem. Once you're there, you'll see a bunch of DevToolsy stuff and a view of the category page with the individual actor cards."),(0,i.kt)("p",null,"Now, find the ",(0,i.kt)("inlineCode",{parentName:"p"},"Select an element")," tool and use it to select one of the actor cards. Make sure to select the whole card, not just some of its contents, such\nas its title or description."),(0,i.kt)("p",null,"In the resulting HTML display, it will put your cursor somewhere. Inspect the HTML around it. You'll see that there are CSS classes attached to the\ndifferent HTML elements."),(0,i.kt)("p",null,"By hovering over the individual elements, you will see their placement in the page's view. It's easy to see the page's structure around the actor\ncards now. All the cards are displayed in a ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with a classname that starts with ",(0,i.kt)("inlineCode",{parentName:"p"},"ItemsGrid__StyledDiv"),", which holds another ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with some\ncomputer-generated class names and finally, inside this ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>"),", the individual cards are represented by other ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," elements with the class of\n",(0,i.kt)("inlineCode",{parentName:"p"},"item"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Yes, there are other HTML elements and other classes too. We can safely ignore them.")),(0,i.kt)("p",null,"It should now make sense how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. It's just a selector that finds all elements that are annotated with the ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," class and\nthose just happen to be the actor cards only."),(0,i.kt)("p",null,"It's always a good idea to double check that though, so go into the DevTools Console and run"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"document.querySelectorAll('.item');\n")),(0,i.kt)("p",null,"You will see that only the actor cards will be returned, and nothing else."),(0,i.kt)("h4",{id:"enqueueing-the-detail-links-using-a-custom-selector"},"Enqueueing the detail links using a custom selector"),(0,i.kt)("p",null,"In the previous chapter, we used the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," function like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n});\n")),(0,i.kt)("p",null,"While very useful in that scenario, we need something different now. Instead of finding all the ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="..">')," links that match the ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrl"),", we\nneed to find only the specific ones that will take us to the actor detail pages. Otherwise, we'd be visiting a lot of other pages that we're not\ninterested in. Using the power of DevTools and yet another ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameter, this becomes fairly easy."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n};\n")),(0,i.kt)("p",null,"The code should look pretty familiar to you. It's a very simple ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," where we log the currently processed URL to the console and\nenqueue more links. But there are also a few new, interesting additions. Let's break it down."),(0,i.kt)("h5",{id:"the-selector-parameter-of-enqueuelinks"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"selector")," parameter of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"When we previously used ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", we were not providing any ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," parameter and it was fine, because we wanted to use the default\nsetting, which is ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," - finds all ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements. But now, we need to be more specific. There are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," links on the given category page, but\nwe're only interested in those that will take us to item (actor) details. Using the DevTools, we found out that we can select the links we wanted\nusing the ",(0,i.kt)("inlineCode",{parentName:"p"},"div.item > a")," selector, which selects all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},'<div class="item ...">')," parent. And those are exactly the ones\nwe're interested in."),(0,i.kt)("h5",{id:"the-missing-pseudourls"},"The missing ",(0,i.kt)("inlineCode",{parentName:"h5"},"pseudoUrls")),(0,i.kt)("p",null,"Earlier we learned that ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," are not required and if omitted, all links matching the given ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," will be enqueued. This is exactly\nwhat we need, so we're skipping ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," this time. That does not mean that you can't use ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," together with a custom ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," though,\nbecause you absolutely can!"),(0,i.kt)("h5",{id:"finally-the-userdata-of-enqueuelinks"},"Finally, the ",(0,i.kt)("inlineCode",{parentName:"h5"},"userData")," of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"You will see ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," used often throughout Apify SDK and it's nothing more than a place to store your own data on a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance. You can\naccess it with ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData")," and it's a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," that can be used to store anything that needs to survive the full life-cycle of the\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"."),(0,i.kt)("p",null,"We can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"transformRequestFunction")," option of ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," to modify all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances it creates and enqueues. In our case, we\nuse it to set a ",(0,i.kt)("inlineCode",{parentName:"p"},"detailPage")," property to the enqueued ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to be able to easily differentiate between the category pages and the detail pages."),(0,i.kt)("h4",{id:"another-sanity-check"},"Another sanity check"),(0,i.kt)("p",null,"It's always good to work step by step. We have this new enqueueing logic in place and since the previous ",(0,i.kt)("a",{parentName:"p",href:"#sanity-check",target:null,rel:null},"Sanity check")," worked only\nwith a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", because we were not enqueueing anything, don't forget to add back the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl")," limit. Let's\ntest it out!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue(); // <----------------\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50, // <----------------------------------------\n requestList,\n requestQueue, // <---------------------------------------------------\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"We've added the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," with the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," logic from the previous section to the code we wrote earlier. As always, try\nrunning it in the environment of your choice. You should see the crawler output a number of links to the console, as it crawls the category pages first\nand then all the links to the actor detail pages it found."),(0,i.kt)("p",null,"This concludes our Crawling strategy section, because we have taught the crawler to visit all the pages we need. Let's continue with scraping the\ntasty data."),(0,i.kt)("h3",{id:"scraping-data"},"Scraping data"),(0,i.kt)("p",null,"At the beginning of this chapter, we created a list of the information we wanted to collect about the actors in the store. Let's review that and figure\nout ways to access it."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"scraping-the-url-owner-and-unique-identifier"},"Scraping the URL, Owner and Unique identifier"),(0,i.kt)("p",null,"Some information is lying right there in front of us without even having to touch the actor detail pages. The ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," we already have - the\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.url"),". And by looking at it carefully, we realize that it already includes the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," and the ",(0,i.kt)("inlineCode",{parentName:"p"},"unique identifier")," too. We can just split the\n",(0,i.kt)("inlineCode",{parentName:"p"},"string")," and be on our way then!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// request.url = https://apify.com/apify/web-scraper\n\nconst urlArr = request.url.split('/').slice(-2); // ['apify', 'web-scraper']\nconst uniqueIdentifier = urlArr.join('/'); // 'apify/web-scraper'\nconst owner = urlArr[0]; // 'apify'\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"It's always a matter of preference, whether to store this information separately in the resulting dataset, or not. Whoever uses the dataset can\neasily parse the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," from the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL"),", so should we duplicate the data unnecessarily? Our opinion is that unless the increased data consumption\nwould be too large to bear, it's always better to make the dataset as readable as possible. Someone might want to filter by ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," for example and\nkeeping only the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," in the dataset would make this complicated without using additional tools.")),(0,i.kt)("h4",{id:"scraping-title-description-last-modification-date-and-number-of-runs"},"Scraping Title, Description, Last modification date and Number of runs"),(0,i.kt)("p",null,"Now it's time to add more data to the results. Let's open one of the actor detail pages in the Store, for example the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/web-scraper",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"apify/web-scraper"))," page and use our DevTools-Fu to figure out how to get the title of the actor."),(0,i.kt)("h5",{id:"title"},"Title"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor title",src:n(67543).Z,title:"Finding actor title in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("p",null,"By using the element selector tool, we find out that the title is there under an ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, as titles should be.\nMaybe surprisingly, we find that there are actually two ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tags on the detail page. This should get us thinking.\nIs there any parent element that includes our ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, but not the other ones? Yes, there is! There is a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>"),"\nelement that we can use to select only the heading we're interested in."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Remember that you can press CTRL+F (CMD+F) in the Elements tab of DevTools to open the search bar where you can quickly search for elements using\ntheir selectors. And always make sure to use the DevTools to verify your scraping process and assumptions. It's faster than changing the crawler\ncode all the time.")),(0,i.kt)("p",null,"To get the title we just need to find it using ",(0,i.kt)("inlineCode",{parentName:"p"},"Cheerio")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"header h1")," selector, which selects all ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," ancestor.\nAnd as we already know, there's only one."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n};\n")),(0,i.kt)("h5",{id:"description"},"Description"),(0,i.kt)("p",null,"Getting the actor's description is a little more involved, but still pretty straightforward. We can't just simply search for a ",(0,i.kt)("inlineCode",{parentName:"p"},"<p>")," tag, because\nthere's a lot of them in the page. We need to narrow our search down a little. Using the DevTools we find that the actor description is nested within\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," element too, same as the title. Moreover, the actual description is nested inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"<span>")," tag with a class ",(0,i.kt)("inlineCode",{parentName:"p"},"actor-description"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor description selector",src:n(12872).Z,title:"Finding actor description in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n};\n")),(0,i.kt)("h5",{id:"last-modification-date"},"Last modification date"),(0,i.kt)("p",null,"The DevTools tell us that the ",(0,i.kt)("inlineCode",{parentName:"p"},"modifiedDate")," can be found in the ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element inside ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats">'),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor last modification date selector",src:n(56281).Z,title:"Finding actor last modification date in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n};\n")),(0,i.kt)("p",null,"It might look a little too complex at first glance, but let's walk through it. We find the right ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element,\nand then we read its ",(0,i.kt)("inlineCode",{parentName:"p"},"datetime")," attribute, because that's where a unix timestamp is stored as a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("p",null,"But we would much rather see a readable date in our results, not a unix timestamp, so we need to convert it. Unfortunately the ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),"\nconstructor will not accept a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we cast the ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," function before actually calling ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),".\nPhew!"),(0,i.kt)("h5",{id:"run-count"},"Run count"),(0,i.kt)("p",null,"And so we're finishing up with the ",(0,i.kt)("inlineCode",{parentName:"p"},"runCount"),". There's no specific element like ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>"),", so we need to create a complex selector and then do a\ntransformation on the result."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"ul.ActorHeader-stats > li:nth-of-type(3)")," looks complicated, but it only reads that we're looking for a ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats ...">')," element and within that\nelement we're looking for the third ",(0,i.kt)("inlineCode",{parentName:"p"},"<li>")," element. We grab its text, but we're only interested in the number of runs. So we parse the number out\nusing a regular expression, but its type is still a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we finally convert the result to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," by wrapping it with a ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," call."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The numbers are formatted with commas as thousands separators (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1,234,567'"),"), so to extract it, we\nfirst use regular expression ",(0,i.kt)("inlineCode",{parentName:"p"},"/[\\d,]+/")," - it will search for consecutive number or comma characters.\nThen we extract the match via ",(0,i.kt)("inlineCode",{parentName:"p"},".match(/[\\d,]+/)[0]")," and finally remove the commas by calling ",(0,i.kt)("inlineCode",{parentName:"p"},".replace(',', '')"),".\nThis will give us a string (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1234567'"),") that can be converted via ",(0,i.kt)("inlineCode",{parentName:"p"},"Number")," function.")),(0,i.kt)("p",null,"And there we have it! All the data we needed in a single object. For the sake of completeness, let's add the properties we parsed from the URL earlier\nand we're good to go."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const urlArr = request.url.split('/').slice(-2);\n\nconst results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n\nconsole.log('RESULTS: ', results);\n")),(0,i.kt)("h4",{id:"trying-it-out-sanity-check-3"},"Trying it out (sanity check #3)"),(0,i.kt)("p",null,"We have everything we need so just grab our newly created scraping logic, dump it into our original ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," and see the magic happen!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n console.log('RESULTS', results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notice again that we're scraping on the detail pages ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === true"),", but we're only enqueueing on the category pages\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === undefined"),".")),(0,i.kt)("p",null,"When running the actor in the environment of your choice, you should see the crawled URLs and their scraped data printed to the console."),(0,i.kt)("h3",{id:"saving-the-scraped-data"},"Saving the scraped data"),(0,i.kt)("p",null,"A data extraction job would not be complete without saving the data for later use and processing. We've come to the final and most difficult part of\nthis chapter so make sure to pay attention very carefully!"),(0,i.kt)("p",null,"First, replace the ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log('RESULTS', results)")," call with"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await Apify.pushData(results);\n")),(0,i.kt)("p",null,"and that's it. Unlike in the previous paragraph, I'm being serious now. That's it, we're done. The final code therefore looks exactly like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n await Apify.pushData(results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("h4",{id:"whats-apifypushdata"},"What's ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.pushData()")),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," is a helper function that saves data to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset")),". ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," is a\nstorage designed to hold virtually unlimited amount of data in a format similar to a table. Each time you call ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," a new row in the\ntable is created, with the property names serving as column titles."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Each actor run has one default ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," so no need to initialize it or create an instance first. It just gets done automatically for you. You can\nalso create named datasets at will.")),(0,i.kt)("h4",{id:"finding-my-saved-data"},"Finding my saved data"),(0,i.kt)("p",null,"It might not be perfectly obvious where the data we saved using the previous command went, so let's break it down by environment:"),(0,i.kt)("h5",{id:"dataset-on-the-apify-platform"},"Dataset on the Apify platform"),(0,i.kt)("p",null,"Open any Run of your actor on the Platform and you will see a Dataset as one of the available tabs. Clicking on it will reveal basic information about\nthe Dataset and a list of options that you can use to download your data. There are various formats such as JSON, XLSX or CSV available and there's\nalso the possibility of downloading only clean items, i.e. a filtered dataset with empty rows and hidden fields removed."),(0,i.kt)("h5",{id:"local-dataset"},"Local Dataset"),(0,i.kt)("p",null,"Unless you changed the environment variables that Apify SDK uses locally, which would suggest that you knew what you were doing and you didn't need\nthis tutorial anyway, you'll find your data in your local Apify Storage."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")),(0,i.kt)("p",null,"The above folder will hold all your saved data in numbered files, as they were pushed into the dataset. Each file represents one invocation of\n",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," or one table row."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Unfortunately, the local datasets don't yet support the export in various formats functionality that the Platform Dataset page offers, so for the\ntime being, we're stuck with JSON.")),(0,i.kt)("h3",{id:"final-touch"},"Final touch"),(0,i.kt)("p",null,"It may seem that the data are extracted and the actor is done, but honestly, this is just the beginning. For the sake of brevity, we've completely\nomitted error handling, proxies, debug logging, tests, documentation and other stuff that a reliable software should have. The good thing is, ",(0,i.kt)("strong",{parentName:"p"},"error\nhandling is mostly done by Apify SDK itself"),", so no worries on that front, unless you need some custom magic."),(0,i.kt)("p",null,"Anyway, to spark some ideas, let's look at two more things. First, passing an input to the actor, which will enable us to change the categories we\nwant to scrape without changing the source code itself! And then some refactoring, to show you how we reckon is preferable to structure and annotate\nactor code."),(0,i.kt)("h4",{id:"meet-the-input"},"Meet the ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is just a convention on how we call the actor's input. Because there's no magic in actors, just features, the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is actually nothing more\nthan a key in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," that's, by convention, used as input on the Apify platform. Also by convention, the\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is mostly expected to be of ",(0,i.kt)("inlineCode",{parentName:"p"},"Content-Type: application/json"),"."),(0,i.kt)("p",null,"We will not go into ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," details here, but for the sake of ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," you need to remember that there is a function that helps you get it."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"On the Apify Platform, the actor's input that you can set in the Console is automatically saved to the default ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," under the key ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),"\nand by calling ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," you retrieve the value from the ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore"),"."),(0,i.kt)("p",null,"Running locally, you need to place an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file in your default key value store for this to work."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,i.kt)("h4",{id:"use-input-to-seed-our-actor-with-categories"},"Use ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")," to seed our actor with categories"),(0,i.kt)("p",null,"Currently we're using the full URLs of categories as sources, but it's quite obvious that we only need the final parameters, the rest of the URL is\nalways the same. Knowing that, we can pass an array of those parameters on ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," and build the URLs dynamically, which would allow us to scrape\ndifferent categories without changing the source code. Let's get to it!"),(0,i.kt)("p",null,"First, we set up our ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),", either in the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," form of the actor on the Apify platform, or by creating an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," in our default key-value store\nlocally."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'["TRAVEL", "ECOMMERCE", "ENTERTAINMENT"]\n')),(0,i.kt)("p",null,"Once we have that, we can load it in the actor and populate the crawler's sources with it. In the following example, we're using the categories in the\ninput to construct the category URLs and we're also passing custom ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," to the sources. This means that the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," that get created will\nautomatically contain this ",(0,i.kt)("inlineCode",{parentName:"p"},"userData"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// ...\nconst input = await Apify.getInput();\n\nconst sources = input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n}));\n\nconst requestList = await Apify.openRequestList('categories', sources);\n// ...\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"userData.label")," is also a convention that we've been using for quite some time to label different ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". We know that this is a category URL\nso we ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," it ",(0,i.kt)("inlineCode",{parentName:"p"},"CATEGORY"),". This way, we can easily make decisions in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," without having to inspect the URL itself."),(0,i.kt)("p",null,"We can then refactor the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," for decision-making. This does not make much sense for a crawler\nwith only two different pages, because a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," would suffice, but for pages with multiple different views, it becomes very useful."),(0,i.kt)("h4",{id:"structuring-the-code-better"},"Structuring the code better"),(0,i.kt)("p",null,"But perhaps we should not stop at refactoring the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses. There are several ways we can make the actor look more elegant and - most\nimportantly - easier to reason about and make changes to."),(0,i.kt)("p",null,"In the following code we've made several changes."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Split the code into multiple files."),(0,i.kt)("li",{parentName:"ul"},"Added the ",(0,i.kt)("inlineCode",{parentName:"li"},"Apify.utils.log")," and replaced ",(0,i.kt)("inlineCode",{parentName:"li"},"console.log")," with it."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"getSources()")," function to encapsulate ",(0,i.kt)("inlineCode",{parentName:"li"},"INPUT")," consumption."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"createRouter()")," function to make our routing cleaner, without nested ",(0,i.kt)("inlineCode",{parentName:"li"},"if")," clauses."),(0,i.kt)("li",{parentName:"ul"},"Removed the ",(0,i.kt)("inlineCode",{parentName:"li"},"maxRequestsPerCrawl")," limit.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To create a multi-file actor on the Apify Platform, select ",(0,i.kt)("strong",{parentName:"p"},"Multiple source files")," in the ",(0,i.kt)("strong",{parentName:"p"},"Type")," dropdown on the ",(0,i.kt)("strong",{parentName:"p"},"Source")," screen.")),(0,i.kt)("p",null,"In our ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file, we place the general structure of the crawler:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// main.js\nconst Apify = require('apify');\nconst tools = require('./tools');\nconst {\n utils: { log },\n} = Apify;\n\nApify.main(async () => {\n log.info('Starting actor.');\n const requestList = await Apify.openRequestList('categories', await tools.getSources());\n const requestQueue = await Apify.openRequestQueue();\n const router = tools.createRouter({ requestQueue });\n\n log.debug('Setting up crawler.');\n const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction: async context => {\n const { request } = context;\n log.info(`Processing ${request.url}`);\n await router(request.userData.label, context);\n },\n });\n\n log.info('Starting the crawl.');\n await crawler.run();\n log.info('Actor finished.');\n});\n")),(0,i.kt)("p",null,"Then in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"tools.js"),", we add our helper functions:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// tools.js\nconst Apify = require('apify');\nconst routes = require('./routes');\nconst {\n utils: { log },\n} = Apify;\n\nexports.getSources = async () => {\n log.debug('Getting sources.');\n const input = await Apify.getInput();\n return input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n }));\n};\n\nexports.createRouter = globalContext => {\n return async function(routeName, requestContext) {\n const route = routes[routeName];\n if (!route) throw new Error(`No route for name: ${routeName}`);\n log.debug(`Invoking route: ${routeName}`);\n return route(requestContext, globalContext);\n };\n};\n")),(0,i.kt)("p",null,"And finally our routes in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"routes.js")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// routes.js\nconst Apify = require('apify');\nconst {\n utils: { log },\n} = Apify;\n\nexports.CATEGORY = async ({ $, request }, { requestQueue }) => {\n return Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.label = 'DETAIL';\n return req;\n },\n });\n};\n\nexports.DETAIL = async ({ $, request }) => {\n const urlArr = request.url.split('/').slice(-2);\n\n log.debug('Scraping results.');\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n\n log.debug('Pushing data to dataset.');\n await Apify.pushData(results);\n};\n")),(0,i.kt)("p",null,"Let us tell you a little bit more about the changes. We hope that in the end, you'll agree that this structure makes the actor more readable and\nmanageable."),(0,i.kt)("h4",{id:"splitting-your-code-into-multiple-files"},"Splitting your code into multiple files"),(0,i.kt)("p",null,"This was not always the case, but now that the Apify platform has a multifile editor, there's no reason not to split your code into multiple files and keep\nyour logic separate. Less code in a single file means less code you need to think about at any time, and that's a great thing!"),(0,i.kt)("h4",{id:"using-apifyutilslog-instead-of-consolelog"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"h4"},"console.log")),(0,i.kt)("p",null,"We wont go to great lengths here to talk about ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log"),", because you can read ",(0,i.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},"it all in the documentation"),", but there's just\none thing that we need to stress: ",(0,i.kt)("strong",{parentName:"p"},"log levels"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")," enables you to use different log levels, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"log.debug"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"log.info")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"log.warning"),". It not only makes your log more readable, but\nit also allows selective turning off of some levels by either calling the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log.setLevel()")," function or by setting an ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," variable.\nThis is huge! Because you can now add a lot of debug logs in your actor, which will help you when something goes wrong and turn them on or off with a\nsimple ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," change, or by setting an environment variable."),(0,i.kt)("p",null,"The punch line? Use ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log")," now and thank us later when something goes wrong!"),(0,i.kt)("h4",{id:"using-a-router-to-structure-your-crawling"},"Using a router to structure your crawling"),(0,i.kt)("p",null,"At first, it might seem more readable using just a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"if / else")," statement to select different logic based on the crawled pages, but trust me, it\nbecomes far less impressive when working with more than two different pages and it definitely starts to fall apart when the logic to handle each page\nspans tens or hundreds of lines of code."),(0,i.kt)("p",null,"It's good practice in any programming to split your logic into bite-sized chunks that are easy to read and reason about. Scrolling through a\nthousand line long ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," where everything interacts with everything and variables can be used everywhere is not a beautiful thing to\ndo and a pain to debug. That's why we prefer the separation of routes into a special file and with large routes, we would even suggest having one file\nper route."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"TO BE CONTINUED with details on ",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and other features...")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),c=o,m=d["".concat(s,".").concat(c)]||d[c]||h[c]||i;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:o,r[1]=l;for(var u=2;u<i;u++)r[u]=n[u];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},12872:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/description-f9aec3abf3d17de2239e058d5dce838e.jpg"},56281:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/modified-date-5516a5ec24f9b0ef2f6a69f196e005db.jpg"},35631:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/scraping-practice-c0dd0ead6c920dcf687f0bb9d09087a9.jpg"},67543:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/title-01-424dd1253b7b093145561728d490d202.jpg"}}]); \ No newline at end of file diff --git a/assets/js/e1d7336f.eda627d6.js b/assets/js/e1d7336f.eda627d6.js deleted file mode 100644 index f266c9490a..0000000000 --- a/assets/js/e1d7336f.eda627d6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8303],{49959:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>d});var a=n(87462),o=n(63366),i=(n(67294),n(3905)),r=["components"],l={id_old:"version-2.3.0-getting-started",title:"Getting Started",id:"getting-started"},s=void 0,u={unversionedId:"guides/getting-started",id:"version-2.3/guides/getting-started",title:"Getting Started",description:"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary",source:"@site/versioned_docs/version-2.3/guides/getting_started.md",sourceDirName:"guides",slug:"/guides/getting-started",permalink:"/sdk/js/docs/2.3/guides/getting-started",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/getting_started.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-getting-started",title:"Getting Started",id:"getting-started"},sidebar:"version-2.3/docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/2.3/guides/apify-platform"},next:{title:"Request Storage",permalink:"/sdk/js/docs/2.3/guides/request-storage"}},p={},d=[{value:"Intro",id:"intro",level:2},{value:"Setting up locally",id:"setting-up-locally",level:2},{value:"Creating a new project",id:"creating-a-new-project",level:3},{value:"Setting up on the Apify Platform",id:"setting-up-on-the-apify-platform",level:2},{value:"Creating a new project",id:"creating-a-new-project-1",level:3},{value:"First crawler",id:"first-crawler",level:2},{value:"The general idea",id:"the-general-idea",level:3},{value:"The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code>",id:"the-where---request-requestlist-and-requestqueue",level:3},{value:"The What - <code>handlePageFunction</code>",id:"the-what---handlepagefunction",level:3},{value:"Putting it all together",id:"putting-it-all-together",level:3},{value:"CheerioCrawler aka jQuery crawler",id:"cheeriocrawler-aka-jquery-crawler",level:2},{value:"Overview",id:"overview",level:3},{value:"When to use <code>CheerioCrawler</code>",id:"when-to-use-cheeriocrawler",level:3},{value:"Basic use of <code>CheerioCrawler</code>",id:"basic-use-of-cheeriocrawler",level:3},{value:"Refresher",id:"refresher",level:4},{value:"Finding new links",id:"finding-new-links",level:4},{value:"Filtering links to same domain",id:"filtering-links-to-same-domain",level:4},{value:"Enqueueing links to <code>RequestQueue</code>",id:"enqueueing-links-to-requestqueue",level:4},{value:"Scrape the newly enqueued links",id:"scrape-the-newly-enqueued-links",level:4},{value:"The <code>maxRequestsPerCrawl</code> limit",id:"the-maxrequestspercrawl-limit",level:5},{value:"Putting it all together",id:"putting-it-all-together-1",level:4},{value:"Using Apify SDK to enqueue links like a boss",id:"using-apify-sdk-to-enqueue-links-like-a-boss",level:2},{value:"Meet <code>Apify.utils</code>",id:"meet-apifyutils",level:3},{value:"Introduction to <code>Apify.utils.enqueueLinks()</code>",id:"introduction-to-apifyutilsenqueuelinks",level:3},{value:"Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code>",id:"basic-use-of-enqueuelinks-with-cheeriocrawler",level:3},{value:"Introduction to pseudo-URLs",id:"introduction-to-pseudo-urls",level:4},{value:"Structure of a pseudo-URL",id:"structure-of-a-pseudo-url",level:4},{value:"Using <code>enqueueLinks()</code> to filter links",id:"using-enqueuelinks-to-filter-links",level:4},{value:"Resolving relative URLs with <code>enqueueLinks()</code>",id:"resolving-relative-urls-with-enqueuelinks",level:4},{value:"Integrating <code>enqueueLinks()</code> into our crawler",id:"integrating-enqueuelinks-into-our-crawler",level:4},{value:"Getting some real-world data",id:"getting-some-real-world-data",level:2},{value:"The importance of having a plan",id:"the-importance-of-having-a-plan",level:3},{value:"Choosing the data we need",id:"choosing-the-data-we-need",level:4},{value:"Analyzing the target",id:"analyzing-the-target",level:4},{value:"The start URL(s)",id:"the-start-urls",level:4},{value:"The crawling strategy",id:"the-crawling-strategy",level:3},{value:"Using a <code>RequestList</code>",id:"using-a-requestlist",level:4},{value:"DevTools crash course",id:"devtools-crash-course",level:4},{value:"Enqueueing the detail links using a custom selector",id:"enqueueing-the-detail-links-using-a-custom-selector",level:4},{value:"The <code>selector</code> parameter of <code>enqueueLinks()</code>",id:"the-selector-parameter-of-enqueuelinks",level:5},{value:"The missing <code>pseudoUrls</code>",id:"the-missing-pseudourls",level:5},{value:"Finally, the <code>userData</code> of <code>enqueueLinks()</code>",id:"finally-the-userdata-of-enqueuelinks",level:5},{value:"Another sanity check",id:"another-sanity-check",level:4},{value:"Scraping data",id:"scraping-data",level:3},{value:"Scraping the URL, Owner and Unique identifier",id:"scraping-the-url-owner-and-unique-identifier",level:4},{value:"Scraping Title, Description, Last modification date and Number of runs",id:"scraping-title-description-last-modification-date-and-number-of-runs",level:4},{value:"Title",id:"title",level:5},{value:"Description",id:"description",level:5},{value:"Last modification date",id:"last-modification-date",level:5},{value:"Run count",id:"run-count",level:5},{value:"Trying it out (sanity check #3)",id:"trying-it-out-sanity-check-3",level:4},{value:"Saving the scraped data",id:"saving-the-scraped-data",level:3},{value:"What's <code>Apify.pushData()</code>",id:"whats-apifypushdata",level:4},{value:"Finding my saved data",id:"finding-my-saved-data",level:4},{value:"Dataset on the Apify platform",id:"dataset-on-the-apify-platform",level:5},{value:"Local Dataset",id:"local-dataset",level:5},{value:"Final touch",id:"final-touch",level:3},{value:"Meet the <code>INPUT</code>",id:"meet-the-input",level:4},{value:"Use <code>INPUT</code> to seed our actor with categories",id:"use-input-to-seed-our-actor-with-categories",level:4},{value:"Structuring the code better",id:"structuring-the-code-better",level:4},{value:"Splitting your code into multiple files",id:"splitting-your-code-into-multiple-files",level:4},{value:"Using <code>Apify.utils.log</code> instead of <code>console.log</code>",id:"using-apifyutilslog-instead-of-consolelog",level:4},{value:"Using a router to structure your crawling",id:"using-a-router-to-structure-your-crawling",level:4}],h={toc:d},c="wrapper";function m(e){var t=e.components,l=(0,o.Z)(e,r);return(0,i.kt)(c,(0,a.Z)({},h,l,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Without the right tools, crawling and scraping the web can be difficult. At the very least, you need an HTTP client to make the necessary\nrequests, but that only gets you raw HTML and sometimes not even that. Then you have to read this HTML and extract the data you're interested in. Once\nextracted, it must be stored in a machine-readable format and easily accessible for further processing, because it is the processed data that holds\nvalue."),(0,i.kt)("p",null,"Apify SDK covers the process end-to-end. From crawling the web for links and scraping the raw data to storing it in various machine readable formats,\nready for processing. With this guide in hand, you should have your own data extraction solutions up and running in a few hours."),(0,i.kt)("h2",{id:"intro"},"Intro"),(0,i.kt)("p",null,"The goal of this getting started guide is to provide a step-by-step introduction to all the features of the Apify SDK. It will walk you through\ncreating the simplest of crawlers that only prints text to console, all the way up to complex systems that crawl pages, interact with them as if a real\nuser were sitting in front of a real browser and output structured data."),(0,i.kt)("p",null,"Since Apify SDK is usable both locally on any computer and on the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you will be able\nto use the source code in both environments interchangeably. Nevertheless, some initial setup is still required, so choose your preferred starting\nenvironment and let's get into it."),(0,i.kt)("h2",{id:"setting-up-locally"},"Setting up locally"),(0,i.kt)("p",null,"To run Apify SDK on your own computer, you need to meet the following pre-requisites first:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Have Node.js version 15.10 or higher installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"Visit ",(0,i.kt)("a",{parentName:"li",href:"https://nodejs.org/en/download/",target:"_blank",rel:"noopener"},"Node.js website")," to download or use\n",(0,i.kt)("a",{parentName:"li",href:"https://github.com/Schniz/fnm",target:"_blank",rel:"noopener"},"fnm")))),(0,i.kt)("li",{parentName:"ol"},"Have NPM installed.",(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"NPM comes bundled with Node.js so you should already have it. If not, reinstall Node.js.")))),(0,i.kt)("p",null,"If you're not certain, confirm the prerequisites by running:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"node -v\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm -v\n")),(0,i.kt)("h3",{id:"creating-a-new-project"},"Creating a new project"),(0,i.kt)("p",null,"The fastest and best way to create new projects with the Apify SDK is to use our own\n",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI"),". This command line tool allows you to create, run and manage Apify\nprojects with ease, including their deployment to the ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," if you wish to run them in the\ncloud after developing them locally."),(0,i.kt)("p",null,"Let's install the Apify CLI with the following command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"npm install -g apify-cli\n")),(0,i.kt)("p",null,"Once the installation finishes, all you need to do to set up an Apify SDK project is to run:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify create my-new-project\n")),(0,i.kt)("p",null,"A prompt will be shown, asking you to choose a template. Disregard the different options for now and choose the template labeled ",(0,i.kt)("inlineCode",{parentName:"p"},"Hello world"),". The\ncommand will now create a new directory in your current working directory, called ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project"),", create a ",(0,i.kt)("inlineCode",{parentName:"p"},"package.json")," in this folder and install\nall the necessary dependencies. It will also add example source code that you can immediately run."),(0,i.kt)("p",null,"Let's try that!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"cd my-new-project\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"apify run -p\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"-p")," flag is great to remember, because it stands for ",(0,i.kt)("inlineCode",{parentName:"p"},"--purge")," and it clears out your persistent storages before starting the actor.\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," and named storages are kept. Whenever you're just restarting your actor and you're not interested in the data of the previous run, you\nshould use ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run -p")," to prevent the old state from messing with your current run. If this is confusing, don't worry. You'll learn about\nstorages and ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," soon.")),(0,i.kt)("p",null,"You should start seeing log messages in the terminal as the system boots up and after a second, a Chromium browser window should pop up. In the\nwindow, you'll see quickly changing pages and back in the terminal, you should see the titles (contents of the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," HTML tags) of the pages\nprinted."),(0,i.kt)("p",null,"You can always terminate the crawl with a keypress in the terminal:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"CTRL+C\n")),(0,i.kt)("p",null,"Did you see all that? If you did, congratulations! You're ready to go!"),(0,i.kt)("h2",{id:"setting-up-on-the-apify-platform"},"Setting up on the Apify Platform"),(0,i.kt)("p",null,"Maybe you don't have Node.js installed and don't want the hassle. Or you can't install anything on your computer because you're using one provided by your company. Or perhaps you'd just prefer to start working in the cloud right away. Well, no worries, we've got you covered."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," is the foundational product of\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"Apify"),". It's a serverless cloud computing platform, specifically designed for any web automation jobs,\nthat may include crawling and scraping, but really works amazingly for any batch jobs and long-running tasks."),(0,i.kt)("p",null,"It comes with a free account, so let's go to our ",(0,i.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"sign-up page")," and create one, if you\nhaven't already. Don't forget to verify your email. Without it, you won't be able to run any projects."),(0,i.kt)("p",null,"Once you're in, you might be prompted by our in-app help to walk through a step-by-step guide to some of our new features. Feel free to finish that,\nif you'd like, but once you're done, click on the ",(0,i.kt)("strong",{parentName:"p"},"Actors")," tab in the left menu. To read more about ",(0,i.kt)("strong",{parentName:"p"},"Actors"),", see:\n",(0,i.kt)("a",{parentName:"p",href:"../guides/apify-platform#what-is-an-actor",target:null,rel:null},"What is an actor")),(0,i.kt)("h3",{id:"creating-a-new-project-1"},"Creating a new project"),(0,i.kt)("p",null,"In the page that shows after clicking on Actors in the left menu, choose ",(0,i.kt)("strong",{parentName:"p"},"Create new"),". Give it a name in the form that opens, let's say,\n",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-actor"),". Disregard all the available options for now and save your changes."),(0,i.kt)("p",null,"Now click on the ",(0,i.kt)("strong",{parentName:"p"},"Sources")," tab at the top. Disregard the version and environment variables inputs for now and proceed directly to ",(0,i.kt)("strong",{parentName:"p"},"Source code"),".\nThis is where you develop the actor, if you choose not to do it locally. Just press ",(0,i.kt)("strong",{parentName:"p"},"Run")," below the ",(0,i.kt)("strong",{parentName:"p"},"Source code")," panel. It will automatically\nbuild and run the example source code. You should start seeing log messages that represent the build and after the build is complete, the log messages of\nthe running actor. Feel free to check out the other ",(0,i.kt)("strong",{parentName:"p"},"Run")," tabs, such as ",(0,i.kt)("strong",{parentName:"p"},"Info"),", where you can find useful information about the run, or\n",(0,i.kt)("strong",{parentName:"p"},"Key-value-store"),", where the actor's ",(0,i.kt)("strong",{parentName:"p"},"INPUT"),"\xa0and ",(0,i.kt)("strong",{parentName:"p"},"OUTPUT")," are stored."),(0,i.kt)("p",null,"Good job. You're now ready to run your own source code on the Apify Platform. For more information, visit the\n",(0,i.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Actor documentation page"),", where you'll find everything about the platform's various\noptions."),(0,i.kt)("h2",{id:"first-crawler"},"First crawler"),(0,i.kt)("p",null,"Whether you've chosen to develop locally or in the cloud, it's time to start writing some actual source code. But before we do, let's just briefly\nintroduce all the Apify SDK classes necessary to make it happen."),(0,i.kt)("h3",{id:"the-general-idea"},"The general idea"),(0,i.kt)("p",null,"There are 4 crawler classes available for use in the Apify SDK. ",(0,i.kt)("a",{parentName:"p",href:"../api/basic-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"BasicCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),". We'll talk about their differences later. Now, let's talk about what they have in common."),(0,i.kt)("p",null,"The general idea of each crawler is to go to a web page, open it, do some stuff there, save some results and continue to the next page, until it's done\nits job. So the crawler always needs to find answers to two questions: ",(0,i.kt)("strong",{parentName:"p"},"Where should I go?")," and ",(0,i.kt)("strong",{parentName:"p"},"What should I do there?")," Answering those two\nquestions is the only setup mandatory for running the crawlers."),(0,i.kt)("h3",{id:"the-where---request-requestlist-and-requestqueue"},"The Where - ",(0,i.kt)("inlineCode",{parentName:"h3"},"Request"),", ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"h3"},"RequestQueue")),(0,i.kt)("p",null,"All crawlers use instances of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," class to determine where they need to go. Each request may hold a lot of information,\nbut at the very least, it must hold a URL - a web page to open. But having only one URL would not make sense for crawling. We need to either have a\npre-existing list of our own URLs that we wish to visit, perhaps a thousand, or a million, or we need to build this list dynamically as we crawl,\nadding more and more URLs to the list as we progress."),(0,i.kt)("p",null,"A representation of the pre-existing list is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," class. It is a static, immutable list of URLs and\nother metadata (see the ",(0,i.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))," object) that the crawler will visit, one by one, retrying whenever an error occurs, until there\nare no more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process."),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," on the other hand, represents a dynamic queue of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". One that can be updated at runtime by adding more\npages - ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to process. This allows the crawler to open one page, extract interesting URLs, such as links to other pages on the same domain,\nadd them to the queue (called ",(0,i.kt)("em",{parentName:"p"},"enqueuing"),") and repeat this process to build a queue of tens of thousands or more URLs while knowing only a single one\nat the beginning."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are essential for the crawler's operation. There is no other way to supply ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),' = "pages to crawl" to the\ncrawlers. At least one of them always needs to be provided while setting up. You can also use both at the same time, if you wish.'),(0,i.kt)("h3",{id:"the-what---handlepagefunction"},"The What - ",(0,i.kt)("inlineCode",{parentName:"h3"},"handlePageFunction")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is the brain of the crawler. It tells it what to do at each and every page it visits. Generally it handles extraction of data\nfrom the page, processing the data, saving it, calling APIs, doing calculations and whatever else you need it to do."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," is provided by you, the user, and invoked automatically by the crawler for each ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," from either the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". It always receives a single argument and that is a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object"),". Its properties change depending on the crawler class used, but it\nalways includes at least the ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, which represents the currently crawled ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance (i.e. the URL the crawler is visiting and\nrelated metadata) and the ",(0,i.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," property, which is an instance of the ",(0,i.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class and we'll talk about\nit in detail later."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// The object received as a single argument by the handlePageFunction\n{\n request: Request,\n autoscaledPool: AutoscaledPool\n}\n")),(0,i.kt)("h3",{id:"putting-it-all-together"},"Putting it all together"),(0,i.kt)("p",null,"Enough theory! Let's put some of those hard-learned facts into practice. We learned above that we need ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to setup\na crawler. We will also use the ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#main",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.main()"))," function. It's not mandatory, but it makes our life easier. We'll\nlearn about it in detail later on."),(0,i.kt)("p",null,"Let's start with something super easy. Visit a page, get its title and close. First of all we need to require Apify, to make all of its features available to us:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n")),(0,i.kt)("p",null,"Easy, right? It really doesn't get much more difficult than that. For the purposes of this tutorial, we'll be scraping our own webpage\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"https://apify.com"),". Now, to get there, we need a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," with the page's URL in one of our sources,\n",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),". Let's go with ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," for now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\n// This is how you use the Apify.main() function.\nApify.main(async () => {\n // First we create the request queue instance.\n const requestQueue = await Apify.openRequestQueue();\n // And then we add a request to it.\n await requestQueue.addRequest({ url: 'https://apify.com' });\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you're not familiar with the ",(0,i.kt)("inlineCode",{parentName:"p"},"async")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"await")," keywords used in the example, you should know that these are native syntax in modern JavaScript. You can\n",(0,i.kt)("a",{parentName:"p",href:"https://nikgrozev.com/2017/10/01/async-await/",target:"_blank",rel:"noopener"},"learn more about them here"),".")),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"../api/request-queue#addrequest",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"requestQueue.addRequest()"))," function automatically converts the plain object we passed to it to a\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance, so now we have a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," that holds one ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," which points to ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),". Now we need the\n",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// We'll define the function separately so it's more obvious.\nconst handlePageFunction = async ({ request, $ }) => {\n // This should look familiar if you ever worked with jQuery.\n // We're just getting the text content of the <title> HTML element.\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n};\n")),(0,i.kt)("p",null,"Wait, where did the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," come from? Remember what we learned about the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," earlier. It expects a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," as an argument that\nwill always have a ",(0,i.kt)("inlineCode",{parentName:"p"},"request")," property, but it will also have other properties, depending on the chosen crawler class. Well, ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," is a property provided\nby the ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," class, which we'll set up right now."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And we're done! You just created your first crawler from scratch. It will download the HTML of ",(0,i.kt)("inlineCode",{parentName:"p"},"https://apify.com"),", find the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," element, get\nits text content and print it to console. Good job!"),(0,i.kt)("p",null,"To run the code locally, copy and paste the code, if you haven't already typed it in yourself, to the ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file in the ",(0,i.kt)("inlineCode",{parentName:"p"},"my-new-project")," we\ncreated earlier and run ",(0,i.kt)("inlineCode",{parentName:"p"},"apify run")," from that project's directory."),(0,i.kt)("p",null,"To run the code on Apify Platform, just replace the original example with your new code and hit Run."),(0,i.kt)("p",null,"Whichever environment you choose, you should see the message\n",(0,i.kt)("inlineCode",{parentName:"p"},'The title of "https://apify.com" is: Web Scraping, Data Extraction and Automation - Apify.')," printed to the screen. If you do, congratulations and\nlet's move onto some bigger challenges! And if you feel like you don't really know what just happened there, no worries, it will all become clear when\nyou learn more about ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("h2",{id:"cheeriocrawler-aka-jquery-crawler"},"CheerioCrawler aka jQuery crawler"),(0,i.kt)("p",null,"This is the crawler that we used in our earlier example. Our simplest and also the fastest crawling solution. If you're familiar with ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", you'll\nunderstand ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," in minutes. ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," is\nessentially ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," for Node.js. It offers the same API, including the familiar ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object. You can use it, as you would ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery"),", for manipulating\nthe DOM of a HTML page. In crawling, you'll mostly use it to select the right elements and extract their text values - the data you're interested in.\nBut ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," runs in a browser and attaches directly to the browser's DOM. Where does ",(0,i.kt)("inlineCode",{parentName:"p"},"cheerio")," get its HTML? This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"Crawler")," part of\n",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," comes in."),(0,i.kt)("h3",{id:"overview"},"Overview"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," crawls by making plain HTTP requests to the provided URLs. As you remember from the previous section, the\nURLs are fed to the crawler using either the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestList"))," or the ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"RequestQueue")),". The HTTP responses\nit gets back are HTML pages, the same pages you would get in your browser when you first load a URL."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Note, however, that modern web pages often do not serve all of their content in the first HTML response, but rather the first HTML contains links to\nother resources such as CSS and JavaScript that get downloaded afterwards and together they create the final page. See our\n",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," to crawl those.")),(0,i.kt)("p",null,"Once the page's HTML is retrieved, the crawler will pass it to ",(0,i.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio")," for\nparsing. The result is the typical ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function, which should be familiar to ",(0,i.kt)("inlineCode",{parentName:"p"},"jQuery")," users. You can use this ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," to do all sorts of lookups and\nmanipulation of the page's HTML, but in scraping, we will mostly use it to find specific HTML elements and extract their data."),(0,i.kt)("p",null,"Example use of Cheerio and its ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," function in comparison to browser JavaScript:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Return the text content of the <title> element.\ndocument.querySelector('title').textContent; // plain JS\n$('title').text(); // Cheerio\n\n// Return an array of all 'href' links on the page.\nArray.from(document.querySelectorAll('[href]')).map(el => el.href); // plain JS\n$('[href]')\n .map((i, el) => $(el).attr('href'))\n .get(); // Cheerio\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"This is not to show that Cheerio is better than plain browser JavaScript. Some might actually prefer the more expressive way plain JS provides.\nUnfortunately, the browser JavaScript methods are not available in Node.js, so Cheerio is our best bet to do the parsing.")),(0,i.kt)("h3",{id:"when-to-use-cheeriocrawler"},"When to use ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Even though using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," is extremely easy, it probably will not be your first choice for most kinds of crawling or scraping in production\nenvironments. Since most websites nowadays use modern JavaScript to create rich, responsive and data-driven user experiences, the plain HTTP requests\nthe crawler uses may just fall short of your needs."),(0,i.kt)("p",null,"But ",(0,i.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," is far from useless! It really shines when you need to cope with extremely high workloads. With just 4 GBs of memory and a single CPU\ncore, you can scrape 500 or more pages a minute! ",(0,i.kt)("em",{parentName:"p"},"(assuming each page contains approximately 400KB of HTML)")," To scrape this fast with a full browser\nscraper, such as the ",(0,i.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", you'd need significantly more computing power."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Advantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Extremely fast"),(0,i.kt)("li",{parentName:"ul"},"Easy to set up"),(0,i.kt)("li",{parentName:"ul"},"Familiar for jQuery users"),(0,i.kt)("li",{parentName:"ul"},"Super cheap to run"),(0,i.kt)("li",{parentName:"ul"},"Each request can go through a different proxy")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Disadvantages:")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Does not work for all websites"),(0,i.kt)("li",{parentName:"ul"},"May easily overload the target website with requests"),(0,i.kt)("li",{parentName:"ul"},"Does not enable any manipulation of the website before scraping")),(0,i.kt)("h3",{id:"basic-use-of-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"Now that we have an idea of the crawler's inner workings, let's build one. We'll use the example from the previous section and improve on it by\nletting it truly crawl the page, finding new links as it goes, enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and then scraping them."),(0,i.kt)("h4",{id:"refresher"},"Refresher"),(0,i.kt)("p",null,"Just to refresh your memory, in the previous section we built a very simple crawler that downloads the HTML of a single page, reads its title and prints\nit to the console. This is the original source code:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n };\n\n // Set up the crawler, passing a single options object as an argument.\n const crawler = new Apify.CheerioCrawler({\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Earlier we said that we would let the crawler:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to the same hostname, in this case ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"So let's get to it!"),(0,i.kt)("h4",{id:"finding-new-links"},"Finding new links"),(0,i.kt)("p",null,"There are numerous approaches to finding links to follow when crawling the web. For our purposes, we will be looking for ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute. For example ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="https://apify.com/store">This is a link to Apify Store</a>'),". To do this, we need to update our Cheerio\nfunction."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n")),(0,i.kt)("p",null,"Our new function finds all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that contain the ",(0,i.kt)("inlineCode",{parentName:"p"},"href")," attribute and extracts the attributes into an array of strings. But there's a problem. There could be relative links in the list and those can't be used on their own. We need to resolve them using our domain as base URL and\nwe will use one of Node.js' standard libraries to do this."),(0,i.kt)("p",null,"Apify exposes two URL properties: ",(0,i.kt)("a",{parentName:"p",href:"../api/request#url",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"request.url"))," and ",(0,i.kt)("a",{parentName:"p",href:"../api/request#loadedurl",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"request.loadedUrl")),". What's the difference? Well, ",(0,i.kt)("inlineCode",{parentName:"p"},"request.url")," is the URL of the first request. In case of redirects, the URL changes. The final one is stored as ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst { hostname } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n")),(0,i.kt)("h4",{id:"filtering-links-to-same-domain"},"Filtering links to same domain"),(0,i.kt)("p",null,"Websites typically contain a lot of links that lead away from the original page. This is normal, but when crawling a website, we usually want to crawl\nthat one site and not let our crawler wander away to Google, Facebook and Twitter. Therefore, we need to filter out the off-domain links and only\nkeep the ones that lead to the same domain."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Don't worry, we'll learn how to do this with a single function call using Apify in a few moments.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst { hostname } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.hostname.endsWith(hostname));\n\n// ...\n")),(0,i.kt)("p",null,"This includes subdomains. In order to filter the same origin, simply compare the ",(0,i.kt)("inlineCode",{parentName:"p"},"url.origin")," property instead:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { origin } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.origin === origin);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," class contains many other useful properties. You can read more about ",(0,i.kt)("inlineCode",{parentName:"p"},"url.origin")," ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/API/URL/origin",target:"_blank",rel:"noopener"},"here"),".")),(0,i.kt)("h4",{id:"enqueueing-links-to-requestqueue"},"Enqueueing links to ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestQueue")),(0,i.kt)("p",null,"This should be easy, because we already did that ",(0,i.kt)("a",{parentName:"p",href:"#putting-it-all-together",target:null,rel:null},"earlier"),", remember? Just call ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue.addRequest()")," for all the new\nlinks. This will add them to the end of the queue for processing."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// At the top of the file:\nconst { URL } = require('url');\n\n// ...\n\nconst links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\nconst { origin } = new URL(request.loadedUrl);\nconst absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\nconst sameDomainLinks = absoluteUrls.filter(url => url.origin === origin);\n\n// Add the requests in series. There's of course room for speed\n// improvement by parallelization. Try to implement it, if you wish.\nconsole.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\nfor (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n}\n\n// ...\n")),(0,i.kt)("h4",{id:"scrape-the-newly-enqueued-links"},"Scrape the newly enqueued links"),(0,i.kt)("p",null,"And we're approching the finishing line. All we need to do now is integrate the new code into our original crawler. It will be easy, because\nalmost everything needs to go into the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". But just before we do that, let's introduce the first crawler configuration option that\nis not a ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". It's called ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl"),"."),(0,i.kt)("h5",{id:"the-maxrequestspercrawl-limit"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"maxRequestsPerCrawl")," limit"),(0,i.kt)("p",null,"This configuration option is available in all crawler classes and you can use it to limit the number of ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," the crawler should process. It's\nvery useful when you're just testing your code or when your crawler could potentially crawl millions of pages and you want to save resources. You can\nadd it to the crawler options like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("p",null,"This limits the number of successfully handled ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to 20. Bear in mind that the actual number of processed requests might be a little higher\nand that's because usually there are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," processed at the same time and once the 20th ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," finishes, the other running ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),"\nwill be allowed to finish too."),(0,i.kt)("h4",{id:"putting-it-all-together-1"},"Putting it all together"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const { origin } = new URL(request.loadedUrl);\n const absoluteUrls = links.map(link => new URL(link, request.loadedUrl));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.origin === origin);\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"No matter if you followed along with our coding or just copy-pasted the resulting source, try running it now, perhaps even in both environments. You\nshould see the crawler log the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the first page, then the ",(0,i.kt)("strong",{parentName:"p"},"enqueueing")," message showing number of URLs, followed by the ",(0,i.kt)("strong",{parentName:"p"},"title")," of the\nfirst enqueued page and so on and so on."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If you need help with running the code, refer back to the chapters on environment setup: ",(0,i.kt)("a",{parentName:"p",href:"#setting-up-locally",target:null,rel:null},"Setting up locally")," and\n",(0,i.kt)("a",{parentName:"p",href:"#setting-up-on-the-apify-platform",target:null,rel:null},"Setting up on the Apify platform"),".")),(0,i.kt)("h2",{id:"using-apify-sdk-to-enqueue-links-like-a-boss"},"Using Apify SDK to enqueue links like a boss"),(0,i.kt)("p",null,"If you were paying attention carefully in the previous chapter, we said that we would show you a way to enqueue new ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," with a single function\ncall. You might be wondering why we had to go through the whole process of getting the individual links, filtering the same domain ones and then\nmanually enqueuing them into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),", when there is a simpler way."),(0,i.kt)("p",null,"Well, the obvious reason is practice. This is a tutorial after all. The other reason is to make you think about all the bits and pieces that come\ntogether, so that in the end, a new page, not previously entered in by you, can be scraped. We think that by seeing the bigger picture, you will be\nable to get the most out of Apify SDK."),(0,i.kt)("h3",{id:"meet-apifyutils"},"Meet ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils")),(0,i.kt)("p",null,"We will talk at length about them later, but in short, ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," is a namespace where you can find various helpful functions and constants that\nmake your life easier. One of the available functions is ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," which encapsulates the whole enqueueing process and even adds\nsome extra functionality."),(0,i.kt)("h3",{id:"introduction-to-apifyutilsenqueuelinks"},"Introduction to ",(0,i.kt)("inlineCode",{parentName:"h3"},"Apify.utils.enqueueLinks()")),(0,i.kt)("p",null,"Since enqueuing new links to crawl is such an integral part of web crawling, we created a function that attempts to simplify this process as much as\npossible. With a single function call, it allows you to find all the links on a page that match specified criteria and add them to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue"),".\nIt also allows you to modify the resulting ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to match your crawling needs."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," is quite a powerful function so, like crawlers, it gets its arguments from an options object. This is useful, because you don't have to\nremember their order! But also because we can easily extend its API and add new features. You can\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueuelinks",target:null,rel:null},"find the full reference here"),"."),(0,i.kt)("p",null,"We suggest using ES6 destructuring to grab the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function off of the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils")," object, so you don't have to type ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils")," all the\ntime."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\n// Now you can use enqueueLinks like this:\nawait enqueueLinks({\n /* options */\n});\n")),(0,i.kt)("h3",{id:"basic-use-of-enqueuelinks-with-cheeriocrawler"},"Basic use of ",(0,i.kt)("inlineCode",{parentName:"h3"},"enqueueLinks()")," with ",(0,i.kt)("inlineCode",{parentName:"h3"},"CheerioCrawler")),(0,i.kt)("p",null,"We already implemented logic that takes care of enqueueing new links to a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," in the previous chapter on ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". Let's look at\nthat logic and implement the same functionality using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),"."),(0,i.kt)("p",null,"We found that the crawler needed to do these 4 things to crawl ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),":"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Find new links on the page"),(0,i.kt)("li",{parentName:"ol"},"Filter only those pointing to ",(0,i.kt)("inlineCode",{parentName:"li"},"apify.com")),(0,i.kt)("li",{parentName:"ol"},"Enqueue them to the ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")),(0,i.kt)("li",{parentName:"ol"},"Scrape the newly enqueued links")),(0,i.kt)("p",null,"Using ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," we can squash the first 3 into a single function call, if we set the options correctly. For now, let's just stick to the\nbasics. At the very least, we need a source where to find the links and the queue to enqueue them to. The ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," Cheerio object is one of the sources the\nfunction accepts and we already know how to work with it in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction"),". We also know how to get a ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue")," instance."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nawait enqueueLinks({ $, requestQueue });\n")),(0,i.kt)("p",null,"That's all we need to do to enqueue all ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="...">')," links from the given page to the given queue. Easy, right? Scratch number 1 and 3 off the\nlist. Only number 2 remains and to tackle this one, we need to talk about yet another new concept, the pseudo-URL."),(0,i.kt)("h4",{id:"introduction-to-pseudo-urls"},"Introduction to pseudo-URLs"),(0,i.kt)("p",null,"Pseudo-URLs are represented by our ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrl")," class and even though the name sounds discouraging, they're a pretty simple concept. They're just URLs\nwith some parts replaced by wildcards (read ",(0,i.kt)("a",{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions"},"regular\nexpressions"),"). They are matched against URLs to find specific links, domains, patterns, file extensions and so on."),(0,i.kt)("p",null,"In scraping, there are usually patterns to be found in website URLs that can be leveraged to scrape only the pages we're interested in. Imagine\na typical online store. It has different categories which list different items The URL for might looks something like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\n")),(0,i.kt)("p",null,"A category would then have a different URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\n")),(0,i.kt)("p",null,"Going to this page would produce a list of offered computers. Then, clicking on one of the computers might take us to a detail URL:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"As you can see, there's a structure to the links. In the real world, the structure might not always be perfectly obvious, but it's very often there.\nPseudo-URLs help to use this structure to select only the relevant links from a given page."),(0,i.kt)("h4",{id:"structure-of-a-pseudo-url"},"Structure of a pseudo-URL"),(0,i.kt)("p",null,"A pseudo-URL is a URL with ",(0,i.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions",target:"_blank",rel:"noopener"},"regular expressions"),") enclosed\nin ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," brackets. Since we're running Node.js, the regular expressions should follow the JavaScript style."),(0,i.kt)("p",null,"For example, a pseudo-URL"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/[(\\w|-)+]\n")),(0,i.kt)("p",null,"will match all of the following URLs:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories/computers\nhttps://www.online-store.com/categories/mobile-phones\nhttps://www.online-store.com/categories/black-friday\n")),(0,i.kt)("p",null,"but it will not match"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://www.online-store.com/categories\nhttps://www.online-store.com/items/613804\n")),(0,i.kt)("p",null,"This way, you can easily find just the URLs that you're looking for while ignoring the rest."),(0,i.kt)("p",null,"A pseudo-URL may include any number of bracketed regular expressions, so you can compose much more complex matching logic. The following Pseudo URL\nwill match the items in the store even if the links use the non-secure ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," protocol, omit the ",(0,i.kt)("inlineCode",{parentName:"p"},"www")," from the hostname or use a different TLD."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http[s?]://[(www)?\\.]online-store.[com|net|org]/items/[\\d+]\n")),(0,i.kt)("p",null,"will match any combination of:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://www.online-store.org/items/12345\nhttps://online-store.com/items/633423\nhttp://online-store.net/items/7003\n")),(0,i.kt)("p",null,"but it will not match:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"http://shop.online-store.org/items/12345\nhttps://www.online-store.com/items/calculator\nwww.online-store.org/items/7003\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Pssst! Don't tell anyone, but you can create ",(0,i.kt)("inlineCode",{parentName:"p"},"PseudoUrls")," with plain old ",(0,i.kt)("inlineCode",{parentName:"p"},"RegExp")," instances instead of this brackety madness as well.")),(0,i.kt)("h4",{id:"using-enqueuelinks-to-filter-links"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," to filter links"),(0,i.kt)("p",null,"That's been quite a lot of theory and examples. We might as well put it to practice. Going back to our ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," exercise, we still have number\n2 left to cross off the list - filter links pointing to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com"),". We've already shown that at the very least, the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function needs\ntwo arguments. The source, in our case the ",(0,i.kt)("inlineCode",{parentName:"p"},"$")," object, and the destination - the ",(0,i.kt)("inlineCode",{parentName:"p"},"requestQueue"),". To filter links, we need to add a third argument:\n",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls"),"."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"options.pseudoUrls")," argument is always an ",(0,i.kt)("inlineCode",{parentName:"p"},"Array"),", but its contents can take on many forms. ",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"See the reference"),"\nfor all of them. Since we just need to filter out same domain links, we'll keep it simple and use a pseudo-URL ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$' and 'requestQueue' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To break the pseudo-URL string down, we're looking for both ",(0,i.kt)("inlineCode",{parentName:"p"},"http")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"https")," protocols and the links may only lead to ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," domain. The\nfinal brackets ",(0,i.kt)("inlineCode",{parentName:"p"},"[.*]")," allow everything, so ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/contact")," as well as ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," will match. If this sounds complex to you, we suggest\n",(0,i.kt)("a",{parentName:"p",href:"https://www.regular-expressions.info/tutorial.html",target:"_blank",rel:"noopener"},"reading a tutorial")," or two on regular expression syntax.")),(0,i.kt)("h4",{id:"resolving-relative-urls-with-enqueuelinks"},"Resolving relative URLs with ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"TLDR;")," Just use ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl: request.loadedUrl")," when working with ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"This is probably the weirdest and most complicated addition to the list. This is not the place to talk at length about\n",(0,i.kt)("a",{parentName:"p",href:"https://stackoverflow.com/questions/2005079/absolute-vs-relative-urls",target:"_blank",rel:"noopener"},"absolute and relative paths"),", but in short, the\nlinks we encounter in a page can either be absolute, such as:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/john-doe/my-actor\n")),(0,i.kt)("p",null,"or relative:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"./john-doe/my-actor\n")),(0,i.kt)("p",null,"Browsers handle this automatically, but since we're only using plain HTTP requests, we need to tell the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," function how to resolve the\nrelative links to the absolute ones, so we can use them for scraping. This is where the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.loadedUrl")," comes into play, because it returns the\ncorrect URL to use as ",(0,i.kt)("inlineCode",{parentName:"p"},"baseUrl"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// Assuming previous existence of the '$', 'requestQueue' and 'request' variables.\nconst options = {\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n};\n\nawait enqueueLinks(options);\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Even though it seems possible, we can't use the ",(0,i.kt)("inlineCode",{parentName:"p"},"request.url")," of our ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances, because the page could have been redirected and the final\nURL would be different from the one we requested.")),(0,i.kt)("h4",{id:"integrating-enqueuelinks-into-our-crawler"},"Integrating ",(0,i.kt)("inlineCode",{parentName:"h4"},"enqueueLinks()")," into our crawler"),(0,i.kt)("p",null,"That was fairly easy, wasn't it. That ticks number 2 off our list and we're done! Let's take a look at the original crawler code, where we\nenqueued all the links manually."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const { URL } = require('url'); // <------ This is new.\nconst Apify = require('apify');\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Here starts the new part of handlePageFunction.\n const links = $('a[href]')\n .map((i, el) => $(el).attr('href'))\n .get();\n\n const ourDomain = 'https://apify.com';\n const absoluteUrls = links.map(link => new URL(link, ourDomain));\n\n const sameDomainLinks = absoluteUrls.filter(url => url.href.startsWith(ourDomain));\n\n console.log(`Enqueueing ${sameDomainLinks.length} URLs.`);\n for (const url of sameDomainLinks) {\n await requestQueue.addRequest({ url: url.href });\n }\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20, // <------ This is new too.\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"Since we've already prepared the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," options, we can just replace all the above enqueuing logic with a single function call, as promised."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst {\n utils: { enqueueLinks },\n} = Apify;\n\nApify.main(async () => {\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://apify.com' });\n\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`The title of \"${request.url}\" is: ${title}.`);\n\n // Enqueue links\n const enqueued = await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n });\n console.log(`Enqueued ${enqueued.length} URLs.`);\n };\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 20,\n requestQueue,\n handlePageFunction,\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"And that's it! No more parsing the links from HTML using Cheerio, filtering them and enqueueing them one by one It all gets done automatically!\n",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," is just one example of Apify SDK's powerful helper functions. They're all designed to make your life easier so you can focus on\ngetting your data, while leaving the mundane crawling management to your tools."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," has a lot more tricks up its sleeve. Make sure to check out the\n",(0,i.kt)("a",{parentName:"p",href:"../api/utils#enqueueLinks",target:null,rel:null},"reference documentation")," to see what else it can do for you. Namely the feature to prepopulate the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"\ninstances it creates with ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," of your choice is extremely useful!"),(0,i.kt)("h2",{id:"getting-some-real-world-data"},"Getting some real-world data"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Hey, guys, you know, it's cool that we can scrape the ",(0,i.kt)("inlineCode",{parentName:"p"},"<title>")," elements of web pages, but that's not very useful. Can we finally scrape some real\ndata and save it somewhere in a machine readable format? Because that's why you started reading this tutorial in the first place!")),(0,i.kt)("p",null,"We hear you, young padawan! First, learn how to crawl, you must. Only then, walk through data, you can!"),(0,i.kt)("p",null,"###\xa0Making a store crawler"),(0,i.kt)("p",null,"Fortunately, we don't have to travel to a galaxy far far away to find a good candidate for learning how to scrape\nstructured data. The ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," is a library of public actors that anyone can grab and use. You\ncan find ready-made solutions for crawling ",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/drobnikj/crawler-google-places",target:"_blank",rel:"noopener"},"Google Places"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/vaclavrut/amazon-crawler",target:"_blank",rel:"noopener"},"Amazon"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/google-search-scraper",target:"_blank",rel:"noopener"},"Google Search"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/dtrungtin/booking-scraper",target:"_blank",rel:"noopener"},"Booking"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/jaroslavhejlek/instagram-scraper",target:"_blank",rel:"noopener"},"Instagram"),",\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/maxcopell/tripadvisor",target:"_blank",rel:"noopener"},"Tripadvisor")," and many other websites. Feel free to check them out! It's also a great place to practice our Jedi scraping skills since it has categories, lists and details. That's almost like our imaginary\n",(0,i.kt)("inlineCode",{parentName:"p"},"online-store.com")," from the previous chapter."),(0,i.kt)("h3",{id:"the-importance-of-having-a-plan"},"The importance of having a plan"),(0,i.kt)("p",null,'Sometimes scraping is really straightforward, but most of the times, it really pays to do a little bit of research first. How is the website\nstructured? Can I scrape it only with HTTP requests (read "with ',(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"\") or would I need a full browser solution? Are there any\nanti-scraping protections in place? Do I need to parse the HTML or can I get the data otherwise, such as directly from the website's API. Jakub,\none of Apify's founders, wrote a\n",(0,i.kt)("a",{parentName:"p",href:"https://blog.apify.com/web-scraping-in-2018-forget-html-use-xhrs-metadata-or-javascript-variables-8167f252439c",target:"_blank",rel:"noopener"},"great article about all the different techniques"),"\nand tips and tricks, so make sure to check that out!"),(0,i.kt)("p",null,"For the purposes of this tutorial, let's just go ahead with HTTP requests and HTML parsing using ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". The number one reason being: We\nalready know how to use it and we want to build on that knowledge to learn specific crawling and scraping techniques."),(0,i.kt)("h4",{id:"choosing-the-data-we-need"},"Choosing the data we need"),(0,i.kt)("p",null,"A good first step is always to figure out what it is we want to scrape and where to find it. For the time being, let's just agree that we want to\nscrape all actors (see the ",(0,i.kt)("inlineCode",{parentName:"p"},"Show")," dropdown) in all categories (which can be found on the left side of the page) and for each actor we want to get its"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,'We can see that some of the information is available directly on the list page, but for details such as "Last modification date" or "Number of runs" we\'ll also need\nto open the actor detail pages.'),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"analyzing-the-target"},"Analyzing the target"),(0,i.kt)("p",null,"Knowing that we will use plain HTTP requests, we immediately know that we won't be able to manipulate the website in any way. We will only be able to\ngo through the HTML it gives us and parse our data from there. This might sound like a huge limitation, but you might be surprised in how effective it\ncan be. Let's get to it!"),(0,i.kt)("h4",{id:"the-start-urls"},"The start URL(s)"),(0,i.kt)("p",null,"This is where we start our crawl. It's convenient to start as close to our data as possible. For example, it wouldn't make much sense to start at\n",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com")," and look for a ",(0,i.kt)("inlineCode",{parentName:"p"},"store")," link there, when we already know that everything we want to extract can be found at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page."),(0,i.kt)("p",null,"Once we look at the ",(0,i.kt)("inlineCode",{parentName:"p"},"apify.com/store")," page more carefully, we see that the categories themselves produce URLs that we can use to access those\nindividual categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("p",null,"Should we write down all the category URLs down and use all of them as start URLs? It's definitely possible, but what if a new category appears on the\npage later? We would not learn about it unless we manually visit the page and inspect it again. So scraping the category links off the store page\ndefinitely makes sense. This way we always get an up to date list of categories."),(0,i.kt)("p",null,"But is it really that straightforward? By digging further into the store page's HTML we find that it does not actually contain the category links. The\nmenu on the left uses JavaScript to display the items from a given category and, as we've learned earlier, ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," cannot execute JavaScript."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We've deliberately chosen this scenario to show an example of the number one weakness of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),". We will overcome this difficulty in our\n",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," tutorial, but at the cost of compute resources and speed. Always remember that no tool is best for everything!")),(0,i.kt)("p",null,"So we're back to the pre-selected list of URLs. Since we cannot scrape the list dynamically, we have to manually collect the links and then use them\nin our crawler. We lose the ability to scrape new categories, but we keep the low resource consumption and speed advantages of ",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),"."),(0,i.kt)("p",null,"Therefore, after careful consideration, we've determined that we should use multiple start URLs and that they should look as follows:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\nhttps://apify.com/store?category=ECOMMERCE\nhttps://apify.com/store?category=ENTERTAINMENT\n")),(0,i.kt)("h3",{id:"the-crawling-strategy"},"The crawling strategy"),(0,i.kt)("p",null,"Now that we know where to start, we need to figure out where to go next. Since we've eliminated one level of crawling by selecting the categories\nmanually, we now only need to crawl the actor detail pages. The algorithm therefore follows:"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Visit the category list page (one of our start URLs)."),(0,i.kt)("li",{parentName:"ol"},"Enqueue all links to actor details."),(0,i.kt)("li",{parentName:"ol"},"Visit all actor details and extract data."),(0,i.kt)("li",{parentName:"ol"},"Repeat 1 - 3 for all categories.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Technically, this is a depth first crawl and the crawler will perform a breadth first crawl by default, but that's an implementation detail. We've\nchosen this notation since a breadth first crawl would be less readable.")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")," will make sure to visit the pages for us, if we provide the correct ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," and we already know how to enqueue pages, so this\nshould be fairly easy. Nevertheless, there are two more tricks that we'd like to show you."),(0,i.kt)("h4",{id:"using-a-requestlist"},"Using a ",(0,i.kt)("inlineCode",{parentName:"h4"},"RequestList")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is a perfect tool for scraping a pre-existing list of URLs and if you think about our start URLs, this is exactly what we have! A list\nof links to the different categories of the store. Let's see how we'd get them into a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n];\n\nconst requestList = await Apify.openRequestList('categories', sources);\n")),(0,i.kt)("p",null,"As you can see, similarly to the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestQueue()")," function, there is an ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.openRequestList()")," function that will create a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),"\ninstance for you. The first argument is the name of the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),". It is used to persist the crawling state of the list. This is useful when you\nwant to continue where you left off after an error or a process restart. The second argument is the ",(0,i.kt)("inlineCode",{parentName:"p"},"sources")," array, which is nothing more than a list\nof URLs you wish to crawl."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," is a persistent store by default, so no name is needed, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," only lives in memory and giving it a name enables it\nto become persistent.")),(0,i.kt)("p",null,"You might now want to ask one of these questions:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Can I enqueue into ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," too?"),(0,i.kt)("li",{parentName:"ul"},"How do I make ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestList")," work together with ",(0,i.kt)("inlineCode",{parentName:"li"},"RequestQueue")," since I need the queue to enqueue new ",(0,i.kt)("inlineCode",{parentName:"li"},"Requests"),".")),(0,i.kt)("p",null,"The answer to the first one is a definitive no. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," is immutable and once you create it, you cannot add or remove ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," from it. The\nanswer to the second one is simple. ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," are made to work together out of the box in crawlers, so all you need to do is\nuse them both and the crawlers will do the rest."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction,\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"For those wondering how this works, the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," are enqueued into the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," right before their execution and only\nprocessed by the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," afterwards. You can, of course, enqueue the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to the queue manually, but that would take some boilerplate\ncode and perhaps quite a long time, if we were talking about tens of thousands or more ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". The crawlers do it while running, so the time to\nenqueue is spread out and you won't even notice it.")),(0,i.kt)("p",null,"####\xa0Sanity check"),(0,i.kt)("p",null,"It's always useful to create some simple boilerplate code to see that we've got everything set up correctly before we start to write\nthe scraping logic itself. We might realize that something in our previous analysis doesn't quite add up, or the website might not behave exactly as we expected."),(0,i.kt)("p",null,"Let's use our newly acquired ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList")," knowledge and everything we know from the previous chapters to create a new crawler that'll just visit all\nthe category URLs we selected and print the text content of all the actors in the category. Try running the code below in your selected environment.\nYou should see, albeit very badly formatted, the text of the individual actor cards that are displayed in the selected categories."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction: async ({ $, request }) => {\n // Select all the actor cards.\n $('.item').each((i, el) => {\n const text = $(el).text();\n console.log(`ITEM: ${text}\\n`);\n });\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"If there's anything you don't understand, refer to the previous chapters on setting up your environment, building your first crawler and\n",(0,i.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),".")),(0,i.kt)("p",null,"You might be wondering how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. After analyzing the category pages using a browser's DevTools, we've determined that it's a\ngood selector to select all the currently displayed actor cards. DevTools and CSS selectors are quite a large topic, so we can't go into too much\ndetail now, but here are a few general pointers."),(0,i.kt)("h4",{id:"devtools-crash-course"},"DevTools crash course"),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"We'll use Chrome DevTools here, since it's the most common browser, but feel free to use any other, it's all very similar.")),(0,i.kt)("p",null,"We could pick any category, but let's just go with Travel because it includes some interesting actors. Go to"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"https://apify.com/store?category=TRAVEL\n")),(0,i.kt)("p",null,"and open DevTools either by right-clicking anywhere in the page and selecting ",(0,i.kt)("inlineCode",{parentName:"p"},"Inspect"),", or by pressing ",(0,i.kt)("inlineCode",{parentName:"p"},"F12")," or by any other means relevant to your\nsystem. Once you're there, you'll see a bunch of DevToolsy stuff and a view of the category page with the individual actor cards."),(0,i.kt)("p",null,"Now, find the ",(0,i.kt)("inlineCode",{parentName:"p"},"Select an element")," tool and use it to select one of the actor cards. Make sure to select the whole card, not just some of its contents, such\nas its title or description."),(0,i.kt)("p",null,"In the resulting HTML display, it will put your cursor somewhere. Inspect the HTML around it. You'll see that there are CSS classes attached to the\ndifferent HTML elements."),(0,i.kt)("p",null,"By hovering over the individual elements, you will see their placement in the page's view. It's easy to see the page's structure around the actor\ncards now. All the cards are displayed in a ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with a classname that starts with ",(0,i.kt)("inlineCode",{parentName:"p"},"ItemsGrid__StyledDiv"),", which holds another ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," with some\ncomputer-generated class names and finally, inside this ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>"),", the individual cards are represented by other ",(0,i.kt)("inlineCode",{parentName:"p"},"<div>")," elements with the class of\n",(0,i.kt)("inlineCode",{parentName:"p"},"item"),"."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Yes, there are other HTML elements and other classes too. We can safely ignore them.")),(0,i.kt)("p",null,"It should now make sense how we got that ",(0,i.kt)("inlineCode",{parentName:"p"},".item")," selector. It's just a selector that finds all elements that are annotated with the ",(0,i.kt)("inlineCode",{parentName:"p"},"item")," class and\nthose just happen to be the actor cards only."),(0,i.kt)("p",null,"It's always a good idea to double check that though, so go into the DevTools Console and run"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"document.querySelectorAll('.item');\n")),(0,i.kt)("p",null,"You will see that only the actor cards will be returned, and nothing else."),(0,i.kt)("h4",{id:"enqueueing-the-detail-links-using-a-custom-selector"},"Enqueueing the detail links using a custom selector"),(0,i.kt)("p",null,"In the previous chapter, we used the ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.enqueueLinks()")," function like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await enqueueLinks({\n $,\n requestQueue,\n pseudoUrls: ['http[s?]://apify.com[.*]'],\n baseUrl: request.loadedUrl,\n});\n")),(0,i.kt)("p",null,"While very useful in that scenario, we need something different now. Instead of finding all the ",(0,i.kt)("inlineCode",{parentName:"p"},'<a href="..">')," links that match the ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrl"),", we\nneed to find only the specific ones that will take us to the actor detail pages. Otherwise, we'd be visiting a lot of other pages that we're not\ninterested in. Using the power of DevTools and yet another ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," parameter, this becomes fairly easy."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n};\n")),(0,i.kt)("p",null,"The code should look pretty familiar to you. It's a very simple ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," where we log the currently processed URL to the console and\nenqueue more links. But there are also a few new, interesting additions. Let's break it down."),(0,i.kt)("h5",{id:"the-selector-parameter-of-enqueuelinks"},"The ",(0,i.kt)("inlineCode",{parentName:"h5"},"selector")," parameter of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"When we previously used ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", we were not providing any ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," parameter and it was fine, because we wanted to use the default\nsetting, which is ",(0,i.kt)("inlineCode",{parentName:"p"},"a")," - finds all ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements. But now, we need to be more specific. There are multiple ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," links on the given category page, but\nwe're only interested in those that will take us to item (actor) details. Using the DevTools, we found out that we can select the links we wanted\nusing the ",(0,i.kt)("inlineCode",{parentName:"p"},"div.item > a")," selector, which selects all the ",(0,i.kt)("inlineCode",{parentName:"p"},"<a>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},'<div class="item ...">')," parent. And those are exactly the ones\nwe're interested in."),(0,i.kt)("h5",{id:"the-missing-pseudourls"},"The missing ",(0,i.kt)("inlineCode",{parentName:"h5"},"pseudoUrls")),(0,i.kt)("p",null,"Earlier we learned that ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," are not required and if omitted, all links matching the given ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," will be enqueued. This is exactly\nwhat we need, so we're skipping ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," this time. That does not mean that you can't use ",(0,i.kt)("inlineCode",{parentName:"p"},"pseudoUrls")," together with a custom ",(0,i.kt)("inlineCode",{parentName:"p"},"selector")," though,\nbecause you absolutely can!"),(0,i.kt)("h5",{id:"finally-the-userdata-of-enqueuelinks"},"Finally, the ",(0,i.kt)("inlineCode",{parentName:"h5"},"userData")," of ",(0,i.kt)("inlineCode",{parentName:"h5"},"enqueueLinks()")),(0,i.kt)("p",null,"You will see ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," used often throughout Apify SDK and it's nothing more than a place to store your own data on a ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instance. You can\naccess it with ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData")," and it's a plain ",(0,i.kt)("inlineCode",{parentName:"p"},"Object")," that can be used to store anything that needs to survive the full life-cycle of the\n",(0,i.kt)("inlineCode",{parentName:"p"},"Request"),"."),(0,i.kt)("p",null,"We can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"transformRequestFunction")," option of ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," to modify all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Request")," instances it creates and enqueues. In our case, we\nuse it to set a ",(0,i.kt)("inlineCode",{parentName:"p"},"detailPage")," property to the enqueued ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," to be able to easily differentiate between the category pages and the detail pages."),(0,i.kt)("h4",{id:"another-sanity-check"},"Another sanity check"),(0,i.kt)("p",null,"It's always good to work step by step. We have this new enqueueing logic in place and since the previous ",(0,i.kt)("a",{parentName:"p",href:"#sanity-check",target:null,rel:null},"Sanity check")," worked only\nwith a ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestList"),", because we were not enqueueing anything, don't forget to add back the ",(0,i.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"maxRequestsPerCrawl")," limit. Let's\ntest it out!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue(); // <----------------\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50, // <----------------------------------------\n requestList,\n requestQueue, // <---------------------------------------------------\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("p",null,"We've added the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," with the ",(0,i.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," logic from the previous section to the code we wrote earlier. As always, try\nrunning it in the environment of your choice. You should see the crawler output a number of links to the console, as it crawls the category pages first\nand then all the links to the actor detail pages it found."),(0,i.kt)("p",null,"This concludes our Crawling strategy section, because we have taught the crawler to visit all the pages we need. Let's continue with scraping the\ntasty data."),(0,i.kt)("h3",{id:"scraping-data"},"Scraping data"),(0,i.kt)("p",null,"At the beginning of this chapter, we created a list of the information we wanted to collect about the actors in the store. Let's review that and figure\nout ways to access it."),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"URL"),(0,i.kt)("li",{parentName:"ol"},"Owner"),(0,i.kt)("li",{parentName:"ol"},"Unique identifier (such as ",(0,i.kt)("inlineCode",{parentName:"li"},"apify/web-scraper"),")"),(0,i.kt)("li",{parentName:"ol"},"Title"),(0,i.kt)("li",{parentName:"ol"},"Description"),(0,i.kt)("li",{parentName:"ol"},"Last modification date"),(0,i.kt)("li",{parentName:"ol"},"Number of runs")),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"data to scrape",src:n(35631).Z,title:"Overview of data to be scraped.",width:"1600",height:"1215"})),(0,i.kt)("h4",{id:"scraping-the-url-owner-and-unique-identifier"},"Scraping the URL, Owner and Unique identifier"),(0,i.kt)("p",null,"Some information is lying right there in front of us without even having to touch the actor detail pages. The ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," we already have - the\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.url"),". And by looking at it carefully, we realize that it already includes the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," and the ",(0,i.kt)("inlineCode",{parentName:"p"},"unique identifier")," too. We can just split the\n",(0,i.kt)("inlineCode",{parentName:"p"},"string")," and be on our way then!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// request.url = https://apify.com/apify/web-scraper\n\nconst urlArr = request.url.split('/').slice(-2); // ['apify', 'web-scraper']\nconst uniqueIdentifier = urlArr.join('/'); // 'apify/web-scraper'\nconst owner = urlArr[0]; // 'apify'\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"It's always a matter of preference, whether to store this information separately in the resulting dataset, or not. Whoever uses the dataset can\neasily parse the ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," from the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL"),", so should we duplicate the data unnecessarily? Our opinion is that unless the increased data consumption\nwould be too large to bear, it's always better to make the dataset as readable as possible. Someone might want to filter by ",(0,i.kt)("inlineCode",{parentName:"p"},"owner")," for example and\nkeeping only the ",(0,i.kt)("inlineCode",{parentName:"p"},"URL")," in the dataset would make this complicated without using additional tools.")),(0,i.kt)("h4",{id:"scraping-title-description-last-modification-date-and-number-of-runs"},"Scraping Title, Description, Last modification date and Number of runs"),(0,i.kt)("p",null,"Now it's time to add more data to the results. Let's open one of the actor detail pages in the Store, for example the\n",(0,i.kt)("a",{parentName:"p",href:"https://apify.com/apify/web-scraper",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"apify/web-scraper"))," page and use our DevTools-Fu to figure out how to get the title of the actor."),(0,i.kt)("h5",{id:"title"},"Title"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor title",src:n(67543).Z,title:"Finding actor title in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("p",null,"By using the element selector tool, we find out that the title is there under an ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, as titles should be.\nMaybe surprisingly, we find that there are actually two ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tags on the detail page. This should get us thinking.\nIs there any parent element that includes our ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," tag, but not the other ones? Yes, there is! There is a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>"),"\nelement that we can use to select only the heading we're interested in."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Remember that you can press CTRL+F (CMD+F) in the Elements tab of DevTools to open the search bar where you can quickly search for elements using\ntheir selectors. And always make sure to use the DevTools to verify your scraping process and assumptions. It's faster than changing the crawler\ncode all the time.")),(0,i.kt)("p",null,"To get the title we just need to find it using ",(0,i.kt)("inlineCode",{parentName:"p"},"Cheerio")," and a ",(0,i.kt)("inlineCode",{parentName:"p"},"header h1")," selector, which selects all ",(0,i.kt)("inlineCode",{parentName:"p"},"<h1>")," elements that have a ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," ancestor.\nAnd as we already know, there's only one."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n};\n")),(0,i.kt)("h5",{id:"description"},"Description"),(0,i.kt)("p",null,"Getting the actor's description is a little more involved, but still pretty straightforward. We can't just simply search for a ",(0,i.kt)("inlineCode",{parentName:"p"},"<p>")," tag, because\nthere's a lot of them in the page. We need to narrow our search down a little. Using the DevTools we find that the actor description is nested within\nthe ",(0,i.kt)("inlineCode",{parentName:"p"},"<header>")," element too, same as the title. Moreover, the actual description is nested inside a ",(0,i.kt)("inlineCode",{parentName:"p"},"<span>")," tag with a class ",(0,i.kt)("inlineCode",{parentName:"p"},"actor-description"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor description selector",src:n(12872).Z,title:"Finding actor description in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n};\n")),(0,i.kt)("h5",{id:"last-modification-date"},"Last modification date"),(0,i.kt)("p",null,"The DevTools tell us that the ",(0,i.kt)("inlineCode",{parentName:"p"},"modifiedDate")," can be found in the ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element inside ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats">'),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"actor last modification date selector",src:n(56281).Z,title:"Finding actor last modification date in DevTools.",width:"1600",height:"1215"})),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n};\n")),(0,i.kt)("p",null,"It might look a little too complex at first glance, but let's walk through it. We find the right ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>")," element,\nand then we read its ",(0,i.kt)("inlineCode",{parentName:"p"},"datetime")," attribute, because that's where a unix timestamp is stored as a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),"."),(0,i.kt)("p",null,"But we would much rather see a readable date in our results, not a unix timestamp, so we need to convert it. Unfortunately the ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),"\nconstructor will not accept a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we cast the ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," function before actually calling ",(0,i.kt)("inlineCode",{parentName:"p"},"new Date()"),".\nPhew!"),(0,i.kt)("h5",{id:"run-count"},"Run count"),(0,i.kt)("p",null,"And so we're finishing up with the ",(0,i.kt)("inlineCode",{parentName:"p"},"runCount"),". There's no specific element like ",(0,i.kt)("inlineCode",{parentName:"p"},"<time>"),", so we need to create a complex selector and then do a\ntransformation on the result."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"return {\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"ul.ActorHeader-stats > li:nth-of-type(3)")," looks complicated, but it only reads that we're looking for a ",(0,i.kt)("inlineCode",{parentName:"p"},'<ul class="ActorHeader-stats ...">')," element and within that\nelement we're looking for the third ",(0,i.kt)("inlineCode",{parentName:"p"},"<li>")," element. We grab its text, but we're only interested in the number of runs. So we parse the number out\nusing a regular expression, but its type is still a ",(0,i.kt)("inlineCode",{parentName:"p"},"string"),", so we finally convert the result to a ",(0,i.kt)("inlineCode",{parentName:"p"},"number")," by wrapping it with a ",(0,i.kt)("inlineCode",{parentName:"p"},"Number()")," call."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"The numbers are formatted with commas as thousands separators (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1,234,567'"),"), so to extract it, we\nfirst use regular expression ",(0,i.kt)("inlineCode",{parentName:"p"},"/[\\d,]+/")," - it will search for consecutive number or comma characters.\nThen we extract the match via ",(0,i.kt)("inlineCode",{parentName:"p"},".match(/[\\d,]+/)[0]")," and finally remove the commas by calling ",(0,i.kt)("inlineCode",{parentName:"p"},".replace(',', '')"),".\nThis will give us a string (e.g. ",(0,i.kt)("inlineCode",{parentName:"p"},"'1234567'"),") that can be converted via ",(0,i.kt)("inlineCode",{parentName:"p"},"Number")," function.")),(0,i.kt)("p",null,"And there we have it! All the data we needed in a single object. For the sake of completeness, let's add the properties we parsed from the URL earlier\nand we're good to go."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const urlArr = request.url.split('/').slice(-2);\n\nconst results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n};\n\nconsole.log('RESULTS: ', results);\n")),(0,i.kt)("h4",{id:"trying-it-out-sanity-check-3"},"Trying it out (sanity check #3)"),(0,i.kt)("p",null,"We have everything we need so just grab our newly created scraping logic, dump it into our original ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," and see the magic happen!"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n console.log('RESULTS', results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Notice again that we're scraping on the detail pages ",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === true"),", but we're only enqueueing on the category pages\n",(0,i.kt)("inlineCode",{parentName:"p"},"request.userData.detailPage === undefined"),".")),(0,i.kt)("p",null,"When running the actor in the environment of your choice, you should see the crawled URLs and their scraped data printed to the console."),(0,i.kt)("h3",{id:"saving-the-scraped-data"},"Saving the scraped data"),(0,i.kt)("p",null,"A data extraction job would not be complete without saving the data for later use and processing. We've come to the final and most difficult part of\nthis chapter so make sure to pay attention very carefully!"),(0,i.kt)("p",null,"First, replace the ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log('RESULTS', results)")," call with"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"await Apify.pushData(results);\n")),(0,i.kt)("p",null,"and that's it. Unlike in the previous paragraph, I'm being serious now. That's it, we're done. The final code therefore looks exactly like this:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\n\nApify.main(async () => {\n const sources = [\n 'https://apify.com/store?category=TRAVEL',\n 'https://apify.com/store?category=ECOMMERCE',\n 'https://apify.com/store?category=ENTERTAINMENT',\n ];\n\n const requestList = await Apify.openRequestList('categories', sources);\n const requestQueue = await Apify.openRequestQueue();\n\n const crawler = new Apify.CheerioCrawler({\n maxRequestsPerCrawl: 50,\n requestList,\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n console.log(`Processing ${request.url}`);\n\n // This is our new scraping logic.\n if (request.userData.detailPage) {\n const urlArr = request.url.split('/').slice(-2);\n\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n await Apify.pushData(results);\n }\n\n // Only enqueue new links from the category pages.\n if (!request.userData.detailPage) {\n await Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.detailPage = true;\n return req;\n },\n });\n }\n },\n });\n\n await crawler.run();\n});\n")),(0,i.kt)("h4",{id:"whats-apifypushdata"},"What's ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.pushData()")),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"../api/apify#pushdata",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.pushData()"))," is a helper function that saves data to the default ",(0,i.kt)("a",{parentName:"p",href:"../api/dataset",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Dataset")),". ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," is a\nstorage designed to hold virtually unlimited amount of data in a format similar to a table. Each time you call ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," a new row in the\ntable is created, with the property names serving as column titles."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Each actor run has one default ",(0,i.kt)("inlineCode",{parentName:"p"},"Dataset")," so no need to initialize it or create an instance first. It just gets done automatically for you. You can\nalso create named datasets at will.")),(0,i.kt)("h4",{id:"finding-my-saved-data"},"Finding my saved data"),(0,i.kt)("p",null,"It might not be perfectly obvious where the data we saved using the previous command went, so let's break it down by environment:"),(0,i.kt)("h5",{id:"dataset-on-the-apify-platform"},"Dataset on the Apify platform"),(0,i.kt)("p",null,"Open any Run of your actor on the Platform and you will see a Dataset as one of the available tabs. Clicking on it will reveal basic information about\nthe Dataset and a list of options that you can use to download your data. There are various formats such as JSON, XLSX or CSV available and there's\nalso the possibility of downloading only clean items, i.e. a filtered dataset with empty rows and hidden fields removed."),(0,i.kt)("h5",{id:"local-dataset"},"Local Dataset"),(0,i.kt)("p",null,"Unless you changed the environment variables that Apify SDK uses locally, which would suggest that you knew what you were doing and you didn't need\nthis tutorial anyway, you'll find your data in your local Apify Storage."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")),(0,i.kt)("p",null,"The above folder will hold all your saved data in numbered files, as they were pushed into the dataset. Each file represents one invocation of\n",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.pushData()")," or one table row."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"Unfortunately, the local datasets don't yet support the export in various formats functionality that the Platform Dataset page offers, so for the\ntime being, we're stuck with JSON.")),(0,i.kt)("h3",{id:"final-touch"},"Final touch"),(0,i.kt)("p",null,"It may seem that the data are extracted and the actor is done, but honestly, this is just the beginning. For the sake of brevity, we've completely\nomitted error handling, proxies, debug logging, tests, documentation and other stuff that a reliable software should have. The good thing is, ",(0,i.kt)("strong",{parentName:"p"},"error\nhandling is mostly done by Apify SDK itself"),", so no worries on that front, unless you need some custom magic."),(0,i.kt)("p",null,"Anyway, to spark some ideas, let's look at two more things. First, passing an input to the actor, which will enable us to change the categories we\nwant to scrape without changing the source code itself! And then some refactoring, to show you how we reckon is preferable to structure and annotate\nactor code."),(0,i.kt)("h4",{id:"meet-the-input"},"Meet the ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is just a convention on how we call the actor's input. Because there's no magic in actors, just features, the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is actually nothing more\nthan a key in the default ",(0,i.kt)("a",{parentName:"p",href:"../api/key-value-store",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"KeyValueStore"))," that's, by convention, used as input on the Apify platform. Also by convention, the\n",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," is mostly expected to be of ",(0,i.kt)("inlineCode",{parentName:"p"},"Content-Type: application/json"),"."),(0,i.kt)("p",null,"We will not go into ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," details here, but for the sake of ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," you need to remember that there is a function that helps you get it."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"const input = await Apify.getInput();\n")),(0,i.kt)("p",null,"On the Apify Platform, the actor's input that you can set in the Console is automatically saved to the default ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," under the key ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),"\nand by calling ",(0,i.kt)("a",{parentName:"p",href:"../api/apify#getvalue",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Apify.getInput()"))," you retrieve the value from the ",(0,i.kt)("inlineCode",{parentName:"p"},"KeyValueStore"),"."),(0,i.kt)("p",null,"Running locally, you need to place an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file in your default key value store for this to work."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"{PROJECT_FOLDER}/apify_storage/key_value_stores/default/INPUT.json\n")),(0,i.kt)("h4",{id:"use-input-to-seed-our-actor-with-categories"},"Use ",(0,i.kt)("inlineCode",{parentName:"h4"},"INPUT")," to seed our actor with categories"),(0,i.kt)("p",null,"Currently we're using the full URLs of categories as sources, but it's quite obvious that we only need the final parameters, the rest of the URL is\nalways the same. Knowing that, we can pass an array of those parameters on ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," and build the URLs dynamically, which would allow us to scrape\ndifferent categories without changing the source code. Let's get to it!"),(0,i.kt)("p",null,"First, we set up our ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT"),", either in the ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," form of the actor on the Apify platform, or by creating an ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT.json")," in our default key-value store\nlocally."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-json"},'["TRAVEL", "ECOMMERCE", "ENTERTAINMENT"]\n')),(0,i.kt)("p",null,"Once we have that, we can load it in the actor and populate the crawler's sources with it. In the following example, we're using the categories in the\ninput to construct the category URLs and we're also passing custom ",(0,i.kt)("inlineCode",{parentName:"p"},"userData")," to the sources. This means that the ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests")," that get created will\nautomatically contain this ",(0,i.kt)("inlineCode",{parentName:"p"},"userData"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// ...\nconst input = await Apify.getInput();\n\nconst sources = input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n}));\n\nconst requestList = await Apify.openRequestList('categories', sources);\n// ...\n")),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"userData.label")," is also a convention that we've been using for quite some time to label different ",(0,i.kt)("inlineCode",{parentName:"p"},"Requests"),". We know that this is a category URL\nso we ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," it ",(0,i.kt)("inlineCode",{parentName:"p"},"CATEGORY"),". This way, we can easily make decisions in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," without having to inspect the URL itself."),(0,i.kt)("p",null,"We can then refactor the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses in the ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," to use the ",(0,i.kt)("inlineCode",{parentName:"p"},"label")," for decision-making. This does not make much sense for a crawler\nwith only two different pages, because a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," would suffice, but for pages with multiple different views, it becomes very useful."),(0,i.kt)("h4",{id:"structuring-the-code-better"},"Structuring the code better"),(0,i.kt)("p",null,"But perhaps we should not stop at refactoring the ",(0,i.kt)("inlineCode",{parentName:"p"},"if")," clauses. There are several ways we can make the actor look more elegant and - most\nimportantly - easier to reason about and make changes to."),(0,i.kt)("p",null,"In the following code we've made several changes."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Split the code into multiple files."),(0,i.kt)("li",{parentName:"ul"},"Added the ",(0,i.kt)("inlineCode",{parentName:"li"},"Apify.utils.log")," and replaced ",(0,i.kt)("inlineCode",{parentName:"li"},"console.log")," with it."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"getSources()")," function to encapsulate ",(0,i.kt)("inlineCode",{parentName:"li"},"INPUT")," consumption."),(0,i.kt)("li",{parentName:"ul"},"Added a ",(0,i.kt)("inlineCode",{parentName:"li"},"createRouter()")," function to make our routing cleaner, without nested ",(0,i.kt)("inlineCode",{parentName:"li"},"if")," clauses."),(0,i.kt)("li",{parentName:"ul"},"Removed the ",(0,i.kt)("inlineCode",{parentName:"li"},"maxRequestsPerCrawl")," limit.")),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"To create a multi-file actor on the Apify Platform, select ",(0,i.kt)("strong",{parentName:"p"},"Multiple source files")," in the ",(0,i.kt)("strong",{parentName:"p"},"Type")," dropdown on the ",(0,i.kt)("strong",{parentName:"p"},"Source")," screen.")),(0,i.kt)("p",null,"In our ",(0,i.kt)("inlineCode",{parentName:"p"},"main.js")," file, we place the general structure of the crawler:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// main.js\nconst Apify = require('apify');\nconst tools = require('./tools');\nconst {\n utils: { log },\n} = Apify;\n\nApify.main(async () => {\n log.info('Starting actor.');\n const requestList = await Apify.openRequestList('categories', await tools.getSources());\n const requestQueue = await Apify.openRequestQueue();\n const router = tools.createRouter({ requestQueue });\n\n log.debug('Setting up crawler.');\n const crawler = new Apify.CheerioCrawler({\n requestList,\n requestQueue,\n handlePageFunction: async context => {\n const { request } = context;\n log.info(`Processing ${request.url}`);\n await router(request.userData.label, context);\n },\n });\n\n log.info('Starting the crawl.');\n await crawler.run();\n log.info('Actor finished.');\n});\n")),(0,i.kt)("p",null,"Then in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"tools.js"),", we add our helper functions:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// tools.js\nconst Apify = require('apify');\nconst routes = require('./routes');\nconst {\n utils: { log },\n} = Apify;\n\nexports.getSources = async () => {\n log.debug('Getting sources.');\n const input = await Apify.getInput();\n return input.map(category => ({\n url: `https://apify.com/store?category=${category}`,\n userData: {\n label: 'CATEGORY',\n },\n }));\n};\n\nexports.createRouter = globalContext => {\n return async function(routeName, requestContext) {\n const route = routes[routeName];\n if (!route) throw new Error(`No route for name: ${routeName}`);\n log.debug(`Invoking route: ${routeName}`);\n return route(requestContext, globalContext);\n };\n};\n")),(0,i.kt)("p",null,"And finally our routes in a separate ",(0,i.kt)("inlineCode",{parentName:"p"},"routes.js")," file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-js"},"// routes.js\nconst Apify = require('apify');\nconst {\n utils: { log },\n} = Apify;\n\nexports.CATEGORY = async ({ $, request }, { requestQueue }) => {\n return Apify.utils.enqueueLinks({\n $,\n requestQueue,\n selector: 'div.item > a',\n baseUrl: request.loadedUrl,\n transformRequestFunction: req => {\n req.userData.label = 'DETAIL';\n return req;\n },\n });\n};\n\nexports.DETAIL = async ({ $, request }) => {\n const urlArr = request.url.split('/').slice(-2);\n\n log.debug('Scraping results.');\n const results = {\n url: request.url,\n uniqueIdentifier: urlArr.join('/'),\n owner: urlArr[0],\n title: $('header h1').text(),\n description: $('header span.actor-description').text(),\n modifiedDate: new Date(\n Number(\n $('ul.ActorHeader-stats time').attr('datetime'),\n ),\n ),\n runCount: Number(\n $('ul.ActorHeader-stats > li:nth-of-type(3)')\n .text()\n .match(/[\\d,]+/)[0]\n .replace(',', ''),\n ),\n };\n\n log.debug('Pushing data to dataset.');\n await Apify.pushData(results);\n};\n")),(0,i.kt)("p",null,"Let us tell you a little bit more about the changes. We hope that in the end, you'll agree that this structure makes the actor more readable and\nmanageable."),(0,i.kt)("h4",{id:"splitting-your-code-into-multiple-files"},"Splitting your code into multiple files"),(0,i.kt)("p",null,"This was not always the case, but now that the Apify platform has a multifile editor, there's no reason not to split your code into multiple files and keep\nyour logic separate. Less code in a single file means less code you need to think about at any time, and that's a great thing!"),(0,i.kt)("h4",{id:"using-apifyutilslog-instead-of-consolelog"},"Using ",(0,i.kt)("inlineCode",{parentName:"h4"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"h4"},"console.log")),(0,i.kt)("p",null,"We wont go to great lengths here to talk about ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log"),", because you can read ",(0,i.kt)("a",{parentName:"p",href:"../api/log",target:null,rel:null},"it all in the documentation"),", but there's just\none thing that we need to stress: ",(0,i.kt)("strong",{parentName:"p"},"log levels"),"."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"utils.log")," enables you to use different log levels, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"log.debug"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"log.info")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"log.warning"),". It not only makes your log more readable, but\nit also allows selective turning off of some levels by either calling the ",(0,i.kt)("inlineCode",{parentName:"p"},"utils.log.setLevel()")," function or by setting an ",(0,i.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," variable.\nThis is huge! Because you can now add a lot of debug logs in your actor, which will help you when something goes wrong and turn them on or off with a\nsimple ",(0,i.kt)("inlineCode",{parentName:"p"},"INPUT")," change, or by setting an environment variable."),(0,i.kt)("p",null,"The punch line? Use ",(0,i.kt)("inlineCode",{parentName:"p"},"Apify.utils.log")," instead of ",(0,i.kt)("inlineCode",{parentName:"p"},"console.log")," now and thank us later when something goes wrong!"),(0,i.kt)("h4",{id:"using-a-router-to-structure-your-crawling"},"Using a router to structure your crawling"),(0,i.kt)("p",null,"At first, it might seem more readable using just a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"if / else")," statement to select different logic based on the crawled pages, but trust me, it\nbecomes far less impressive when working with more than two different pages and it definitely starts to fall apart when the logic to handle each page\nspans tens or hundreds of lines of code."),(0,i.kt)("p",null,"It's good practice in any programming to split your logic into bite-sized chunks that are easy to read and reason about. Scrolling through a\nthousand line long ",(0,i.kt)("inlineCode",{parentName:"p"},"handlePageFunction()")," where everything interacts with everything and variables can be used everywhere is not a beautiful thing to\ndo and a pain to debug. That's why we prefer the separation of routes into a special file and with large routes, we would even suggest having one file\nper route."),(0,i.kt)("blockquote",null,(0,i.kt)("p",{parentName:"blockquote"},"TO BE CONTINUED with details on ",(0,i.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and other features...")))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),c=o,m=d["".concat(s,".").concat(c)]||d[c]||h[c]||i;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[d]="string"==typeof e?e:o,r[1]=l;for(var u=2;u<i;u++)r[u]=n[u];return a.createElement.apply(null,r)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"},12872:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/description-f9aec3abf3d17de2239e058d5dce838e.jpg"},56281:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/modified-date-5516a5ec24f9b0ef2f6a69f196e005db.jpg"},35631:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/scraping-practice-c0dd0ead6c920dcf687f0bb9d09087a9.jpg"},67543:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/title-01-424dd1253b7b093145561728d490d202.jpg"}}]); \ No newline at end of file diff --git a/assets/js/e23933fb.81764f75.js b/assets/js/e23933fb.81764f75.js deleted file mode 100644 index 48577f425a..0000000000 --- a/assets/js/e23933fb.81764f75.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2711],{68889:(e,r,t)=>{t.d(r,{Z:()=>p});var n=t(67294),a=t(88746),c=t(6141),o=t(6832);const p=function(e){var r=e.to,t=e.children,p=(0,c.E)(),i=p.version,l=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+r},t);var u=i+"/";return"current"===i?u="next/":l&&(u=""),n.createElement(a.default,{to:"/api/"+u+r},t)}},26569:(e,r,t)=>{t.d(r,{B:()=>p,T:()=>o});var n=t(67294),a=t(88746),c="https://crawlee.dev",o=function(e){var r=e.to,t=e.children,o=e.version;return n.createElement(a.default,{href:c+"/api"+(o?"/"+o:"")+"/"+r},t)},p=function(e){var r=e.to,t=e.children;return n.createElement(a.default,{href:c+"/"+r},t)}},11953:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>m,contentTitle:()=>s,default:()=>v,frontMatter:()=>u,metadata:()=>d,toc:()=>f});var n=t(87462),a=t(63366),c=(t(67294),t(3905)),o=(t(14563),t(68889),t(26569));const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page, enqueueLinks }) {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n await enqueueLinks({\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n});\n\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE"};var i,l=["components"],u={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},s=void 0,d={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-3.1/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/versioned_docs/version-3.1/examples/puppeteer_recursive_crawl.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_recursive_crawl.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/examples/puppeteer-with-proxy"}},m={},f=[],y=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:f},w="wrapper";function v(e){var r=e.components,t=(0,a.Z)(e,l);return(0,c.kt)(w,(0,n.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,c.kt)(o.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(y,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}v.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>f});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function p(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=n.createContext({}),l=function(e){var r=n.useContext(i),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},u=function(e){var r=l(e.components);return n.createElement(i.Provider,{value:r},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(t),m=a,f=s["".concat(i,".").concat(m)]||s[m]||d[m]||c;return t?n.createElement(f,o(o({ref:r},u),{},{components:t})):n.createElement(f,o({ref:r},u))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var c=t.length,o=new Array(c);o[0]=m;var p={};for(var i in r)hasOwnProperty.call(r,i)&&(p[i]=r[i]);p.originalType=e,p[s]="string"==typeof e?e:a,o[1]=p;for(var l=2;l<c;l++)o[l]=t[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e23933fb.9ce80101.js b/assets/js/e23933fb.9ce80101.js new file mode 100644 index 0000000000..06cf3416a3 --- /dev/null +++ b/assets/js/e23933fb.9ce80101.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2711],{68889:(e,r,t)=>{t.d(r,{Z:()=>p});var n=t(67294),a=t(88746),o=t(6141),c=t(6832);const p=function(e){var r=e.to,t=e.children,p=(0,o.E)(),i=p.version,l=p.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+r},t);var u=i+"/";return"current"===i?u="next/":l&&(u=""),n.createElement(a.default,{to:"/api/"+u+r},t)}},26569:(e,r,t)=>{t.d(r,{B:()=>p,T:()=>c});var n=t(67294),a=t(88746),o="https://crawlee.dev",c=function(e){var r=e.to,t=e.children,c=e.version;return n.createElement(a.default,{href:o+"/api"+(c?"/"+c:"")+"/"+r},t)},p=function(e){var r=e.to,t=e.children;return n.createElement(a.default,{href:o+"/"+r},t)}},11953:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>m,contentTitle:()=>s,default:()=>v,frontMatter:()=>u,metadata:()=>d,toc:()=>f});var n=t(87462),a=t(63366),o=(t(67294),t(3905)),c=(t(14563),t(68889),t(26569));const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page, enqueueLinks }) {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n await enqueueLinks({\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n});\n\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE"};var i,l=["components"],u={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},s=void 0,d={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-3.1/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/versioned_docs/version-3.1/examples/puppeteer_recursive_crawl.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_recursive_crawl.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/examples/puppeteer-with-proxy"}},m={},f=[],y=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),b={toc:f},w="wrapper";function v(e){var r=e.components,t=(0,a.Z)(e,l);return(0,o.kt)(w,(0,n.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,o.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(y,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}v.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>f});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function c(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function p(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var i=n.createContext({}),l=function(e){var r=n.useContext(i),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},u=function(e){var r=l(e.components);return n.createElement(i.Provider,{value:r},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(t),m=a,f=s["".concat(i,".").concat(m)]||s[m]||d[m]||o;return t?n.createElement(f,c(c({ref:r},u),{},{components:t})):n.createElement(f,c({ref:r},u))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,c=new Array(o);c[0]=m;var p={};for(var i in r)hasOwnProperty.call(r,i)&&(p[i]=r[i]);p.originalType=e,p[s]="string"==typeof e?e:a,c[1]=p;for(var l=2;l<o;l++)c[l]=t[l];return n.createElement.apply(null,c)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e257b45f.28f68b38.js b/assets/js/e257b45f.28f68b38.js new file mode 100644 index 0000000000..b8a651119c --- /dev/null +++ b/assets/js/e257b45f.28f68b38.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6554],{26389:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id:"compiled-script-params",title:"CompiledScriptParams"},s=void 0,c={unversionedId:"typedefs/compiled-script-params",id:"version-2.3/typedefs/compiled-script-params",title:"CompiledScriptParams",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CompiledScriptParams.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-params",permalink:"/sdk/js/docs/2.3/typedefs/compiled-script-params",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptParams.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"compiled-script-params",title:"CompiledScriptParams"}},l={},d=[{value:"Properties",id:"properties",level:2},{value:"<code>params.page</code>",id:"paramspage",level:3},{value:"<code>params.request</code>",id:"paramsrequest",level:3}],m={toc:d},u="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"compiledscriptparams"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"paramspage"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"paramsrequest"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(r),u=a,f=d["".concat(s,".").concat(u)]||d[u]||m[u]||p;return r?n.createElement(f,o(o({ref:t},l),{},{components:r})):n.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c<p;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e257b45f.4bd7d5c2.js b/assets/js/e257b45f.4bd7d5c2.js deleted file mode 100644 index f51342ca26..0000000000 --- a/assets/js/e257b45f.4bd7d5c2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6554],{26389:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>c,toc:()=>d});var n=r(87462),a=r(63366),p=(r(67294),r(3905)),o=["components"],i={id:"compiled-script-params",title:"CompiledScriptParams"},s=void 0,c={unversionedId:"typedefs/compiled-script-params",id:"version-2.3/typedefs/compiled-script-params",title:"CompiledScriptParams",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/CompiledScriptParams.md",sourceDirName:"typedefs",slug:"/typedefs/compiled-script-params",permalink:"/sdk/js/docs/2.3/typedefs/compiled-script-params",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptParams.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"compiled-script-params",title:"CompiledScriptParams"}},l={},d=[{value:"Properties",id:"properties",level:2},{value:"<code>params.page</code>",id:"paramspage",level:3},{value:"<code>params.request</code>",id:"paramsrequest",level:3}],m={toc:d},u="wrapper";function f(e){var t=e.components,r=(0,a.Z)(e,o);return(0,p.kt)(u,(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"compiledscriptparams"}),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"paramspage"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.page")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"Page")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"paramsrequest"},(0,p.kt)("inlineCode",{parentName:"h3"},"params.request")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"Request"))),(0,p.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,p=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(r),u=a,f=d["".concat(s,".").concat(u)]||d[u]||m[u]||p;return r?n.createElement(f,o(o({ref:t},l),{},{components:r})):n.createElement(f,o({ref:t},l))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var p=r.length,o=new Array(p);o[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[d]="string"==typeof e?e:a,o[1]=i;for(var c=2;c<p;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e332cb1d.d171870f.js b/assets/js/e332cb1d.d171870f.js deleted file mode 100644 index 63e36cf52f..0000000000 --- a/assets/js/e332cb1d.d171870f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3707],{26358:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>m});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,s={unversionedId:"examples/call-actor",id:"version-3.0/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/versioned_docs/version-3.0/examples/call_actor.mdx",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/3.0/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/call_actor.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/3.0/examples/basic-crawler"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/3.0/examples/cheerio-crawler"}},p={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(u,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#newClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.newClient()")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Settings - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on Apify Platform, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\nconsole.log('Obtaining own email address...');\nconst apifyClient = Actor.newClient();\nconst { email } = await apifyClient.user().get();\n\n// Load randomword.com and get a random word\nconsole.log('Fetching a random word.');\nconst page = await browser.newPage();\nawait page.goto('https://randomword.com/');\nconst randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n// Send random word to your email. For that, you can use an actor we already\n// have available on the platform under the name: apify/send-mail.\n// The second parameter to the Actor.call() invocation is the actor's\n// desired input. You can find the required input parameters by checking\n// the actor's documentation page: https://apify.com/apify/send-mail\nconsole.log(`Sending email to ${user.email}...`);\nawait Actor.call('apify/send-mail', {\n to: email,\n subject: 'Random Word',\n html: `<h1>Random Word</h1>${randomWord}`,\n});\nconsole.log('Email sent. Good luck!');\n\n// Close Browser\nawait browser.close();\n\nawait Actor.exit();\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:a,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e332cb1d.d2db8219.js b/assets/js/e332cb1d.d2db8219.js new file mode 100644 index 0000000000..78684a6e81 --- /dev/null +++ b/assets/js/e332cb1d.d2db8219.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3707],{26358:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>m});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,s={unversionedId:"examples/call-actor",id:"version-3.0/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/versioned_docs/version-3.0/examples/call_actor.mdx",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/3.0/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/call_actor.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/3.0/examples/basic-crawler"},next:{title:"Cheerio crawler",permalink:"/sdk/js/docs/3.0/examples/cheerio-crawler"}},p={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,l);return(0,o.kt)(u,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/reference/class/Actor#newClient",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Actor.newClient()")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account?tab=integrations",target:"_blank",rel:"noopener"},"Settings - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on Apify Platform, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\nconsole.log('Obtaining own email address...');\nconst apifyClient = Actor.newClient();\nconst { email } = await apifyClient.user().get();\n\n// Load randomword.com and get a random word\nconsole.log('Fetching a random word.');\nconst page = await browser.newPage();\nawait page.goto('https://randomword.com/');\nconst randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n// Send random word to your email. For that, you can use an actor we already\n// have available on the platform under the name: apify/send-mail.\n// The second parameter to the Actor.call() invocation is the actor's\n// desired input. You can find the required input parameters by checking\n// the actor's documentation page: https://apify.com/apify/send-mail\nconsole.log(`Sending email to ${user.email}...`);\nawait Actor.call('apify/send-mail', {\n to: email,\n subject: 'Random Word',\n html: `<h1>Random Word</h1>${randomWord}`,\n});\nconsole.log('Email sent. Good luck!');\n\n// Close Browser\nawait browser.close();\n\nawait Actor.exit();\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:a,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e382198a.a54988d3.js b/assets/js/e382198a.cd2ab781.js similarity index 65% rename from assets/js/e382198a.a54988d3.js rename to assets/js/e382198a.cd2ab781.js index 704cfc4ff8..6e179c50c9 100644 --- a/assets/js/e382198a.a54988d3.js +++ b/assets/js/e382198a.cd2ab781.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6552],{68889:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(67294),a=n(88746),c=n(6141),l=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,c.E)(),i=o.version,s=o.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var p=i+"/";return"current"===i?p="next/":s&&(p=""),r.createElement(a.default,{to:"/api/"+p+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>l});var r=n(67294),a=n(88746),c="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return r.createElement(a.default,{href:c+"/api"+(l?"/"+l:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:c+"/"+t},n)}},3463:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>d,default:()=>G,frontMatter:()=>g,metadata:()=>u,toc:()=>C});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=(n(14563),n(68889)),o=n(26569);const i={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PuppeteerCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Puppeteer.\nconst crawler = new PuppeteerCrawler({\n // Here you can set options that are passed to the launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U"};var s,p=["components"],g={id:"puppeteer-crawler",title:"Puppeteer crawler"},d=void 0,u={unversionedId:"examples/puppeteer-crawler",id:"examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination",source:"@site/../docs/examples/puppeteer_crawler.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/next/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"docs",previous:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/next/examples/capture-screenshot"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/next/examples/puppeteer-recursive-crawl"}},I={},C=[],m=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:C},h="wrapper";function G(e){var t=e.components,n=(0,a.Z)(e,p);return(0,c.kt)(h,(0,r.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"This example demonstrates how to use ",(0,c.kt)(o.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," in combination\nwith ",(0,c.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"\nto recursively scrape the ",(0,c.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer."),(0,c.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,c.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))}G.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>I});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},g="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),g=s(n),u=a,I=g["".concat(i,".").concat(u)]||g[u]||d[u]||c;return n?r.createElement(I,l(l({ref:t},p),{},{components:n})):r.createElement(I,l({ref:t},p))}));function I(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[g]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<c;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6552],{68889:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(67294),a=n(88746),c=n(6141),l=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,c.E)(),i=o.version,s=o.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var p=i+"/";return"current"===i?p="next/":s&&(p=""),r.createElement(a.default,{to:"/api/"+p+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>l});var r=n(67294),a=n(88746),c="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return r.createElement(a.default,{href:c+"/api"+(l?"/"+l:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:c+"/"+t},n)}},3463:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>d,default:()=>G,frontMatter:()=>g,metadata:()=>u,toc:()=>C});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=(n(14563),n(68889)),o=n(26569);const i={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PuppeteerCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Puppeteer.\nconst crawler = new PuppeteerCrawler({\n // Here you can set options that are passed to the launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U"};var s,p=["components"],g={id:"puppeteer-crawler",title:"Puppeteer crawler"},d=void 0,u={unversionedId:"examples/puppeteer-crawler",id:"examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination",source:"@site/../docs/examples/puppeteer_crawler.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/next/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"docs",previous:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/next/examples/capture-screenshot"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/next/examples/puppeteer-recursive-crawl"}},I={},C=[],m=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:C},h="wrapper";function G(e){var t=e.components,n=(0,a.Z)(e,p);return(0,c.kt)(h,(0,r.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"This example demonstrates how to use ",(0,c.kt)(o.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," in combination\nwith ",(0,c.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"\nto recursively scrape the ",(0,c.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer."),(0,c.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,c.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))}G.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>I});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},g="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),g=s(n),u=a,I=g["".concat(i,".").concat(u)]||g[u]||d[u]||c;return n?r.createElement(I,l(l({ref:t},p),{},{components:n})):r.createElement(I,l({ref:t},p))}));function I(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[g]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<c;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e49bebe0.027c3b2b.js b/assets/js/e49bebe0.7bcb9a76.js similarity index 66% rename from assets/js/e49bebe0.027c3b2b.js rename to assets/js/e49bebe0.7bcb9a76.js index b7823cd67c..de376d9b51 100644 --- a/assets/js/e49bebe0.027c3b2b.js +++ b/assets/js/e49bebe0.7bcb9a76.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8695],{68889:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(67294),a=n(88746),c=n(6141),l=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,c.E)(),i=o.version,s=o.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var p=i+"/";return"current"===i?p="next/":s&&(p=""),r.createElement(a.default,{to:"/api/"+p+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>l});var r=n(67294),a=n(88746),c="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return r.createElement(a.default,{href:c+"/api"+(l?"/"+l:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:c+"/"+t},n)}},38145:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>d,default:()=>G,frontMatter:()=>g,metadata:()=>u,toc:()=>C});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=(n(14563),n(68889)),o=n(26569);const i={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PuppeteerCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Puppeteer.\nconst crawler = new PuppeteerCrawler({\n // Here you can set options that are passed to the launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U"};var s,p=["components"],g={id:"puppeteer-crawler",title:"Puppeteer crawler"},d=void 0,u={unversionedId:"examples/puppeteer-crawler",id:"version-3.1/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination",source:"@site/versioned_docs/version-3.1/examples/puppeteer_crawler.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"docs",previous:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/examples/capture-screenshot"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/examples/puppeteer-recursive-crawl"}},I={},C=[],m=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:C},h="wrapper";function G(e){var t=e.components,n=(0,a.Z)(e,p);return(0,c.kt)(h,(0,r.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"This example demonstrates how to use ",(0,c.kt)(o.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," in combination\nwith ",(0,c.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"\nto recursively scrape the ",(0,c.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer."),(0,c.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,c.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))}G.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>I});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},g="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),g=s(n),u=a,I=g["".concat(i,".").concat(u)]||g[u]||d[u]||c;return n?r.createElement(I,l(l({ref:t},p),{},{components:n})):r.createElement(I,l({ref:t},p))}));function I(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[g]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<c;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8695],{68889:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(67294),a=n(88746),c=n(6141),l=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,c.E)(),i=o.version,s=o.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var p=i+"/";return"current"===i?p="next/":s&&(p=""),r.createElement(a.default,{to:"/api/"+p+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>l});var r=n(67294),a=n(88746),c="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return r.createElement(a.default,{href:c+"/api"+(l?"/"+l:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:c+"/"+t},n)}},38145:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>d,default:()=>G,frontMatter:()=>g,metadata:()=>u,toc:()=>C});var r=n(87462),a=n(63366),c=(n(67294),n(3905)),l=(n(14563),n(68889)),o=n(26569);const i={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PuppeteerCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Puppeteer.\nconst crawler = new PuppeteerCrawler({\n // Here you can set options that are passed to the launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U"};var s,p=["components"],g={id:"puppeteer-crawler",title:"Puppeteer crawler"},d=void 0,u={unversionedId:"examples/puppeteer-crawler",id:"version-3.1/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler in combination",source:"@site/versioned_docs/version-3.1/examples/puppeteer_crawler.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"docs",previous:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/examples/capture-screenshot"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/examples/puppeteer-recursive-crawl"}},I={},C=[],m=(s="RunnableCodeBlock",function(e){return console.warn("Component "+s+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:C},h="wrapper";function G(e){var t=e.components,n=(0,a.Z)(e,p);return(0,c.kt)(h,(0,r.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"This example demonstrates how to use ",(0,c.kt)(o.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," in combination\nwith ",(0,c.kt)(l.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"\nto recursively scrape the ",(0,c.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer."),(0,c.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,c.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(m,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},i))}G.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>I});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},g="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),g=s(n),u=a,I=g["".concat(i,".").concat(u)]||g[u]||d[u]||c;return n?r.createElement(I,l(l({ref:t},p),{},{components:n})):r.createElement(I,l({ref:t},p))}));function I(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,l=new Array(c);l[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[g]="string"==typeof e?e:a,l[1]=o;for(var s=2;s<c;s++)l[s]=n[s];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e517eaf8.7cfc5c9c.js b/assets/js/e517eaf8.7cfc5c9c.js new file mode 100644 index 0000000000..5963825128 --- /dev/null +++ b/assets/js/e517eaf8.7cfc5c9c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4259],{68889:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const l=function(e){var t=e.to,r=e.children,l=(0,o.E)(),p=l.version,s=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var c=p+"/";return"current"===p?c="next/":s&&(c=""),n.createElement(a.default,{to:"/api/"+c+t},r)}},40830:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=(r(68889),["components"]),l={id:"apify-platform",title:"Apify Platform"},p=void 0,s={unversionedId:"guides/apify-platform",id:"version-3.0/guides/apify-platform",title:"Apify Platform",description:"Apify is a platform built to serve large-scale and high-performance web scraping",source:"@site/versioned_docs/version-3.0/guides/apify_platform.mdx",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/3.0/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/apify_platform.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform"},sidebar:"docs",previous:{title:"Guides",permalink:"/sdk/js/docs/3.0/guides"},next:{title:"Request Storage",permalink:"/sdk/js/docs/3.0/guides/request-storage"}},c={},u=[{value:"Logging into Apify platform from Apify SDK",id:"logging-into-apify-platform-from-apify-sdk",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2}],f={toc:u},m="wrapper";function d(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"./request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"./result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"./proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and you should definitely sign up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Apify SDK is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Note that we do not test Apify SDK in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-apify-sdk"},"Logging into Apify platform from Apify SDK"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from the SDK, you must provide\ncredentials - ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"your API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures of the SDK, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"npm install -g apify-cli\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify login -t YOUR_API_TOKEN\n")),(0,o.kt)("p",null,"In your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify run -p\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"If you prefer not to use Apify CLI, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"./environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"./environment-variables#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. It is automatically inferred from your token by the SDK, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,d=u["".concat(p,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(d,i(i({ref:t},c),{},{components:r})):n.createElement(d,i({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e517eaf8.cebfb001.js b/assets/js/e517eaf8.cebfb001.js deleted file mode 100644 index a5fc6024a3..0000000000 --- a/assets/js/e517eaf8.cebfb001.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4259],{68889:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(67294),a=r(88746),o=r(6141),i=r(6832);const l=function(e){var t=e.to,r=e.children,l=(0,o.E)(),p=l.version,s=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var c=p+"/";return"current"===p?c="next/":s&&(c=""),n.createElement(a.default,{to:"/api/"+c+t},r)}},40830:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=(r(68889),["components"]),l={id:"apify-platform",title:"Apify Platform"},p=void 0,s={unversionedId:"guides/apify-platform",id:"version-3.0/guides/apify-platform",title:"Apify Platform",description:"Apify is a platform built to serve large-scale and high-performance web scraping",source:"@site/versioned_docs/version-3.0/guides/apify_platform.mdx",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/3.0/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/apify_platform.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform"},sidebar:"docs",previous:{title:"Guides",permalink:"/sdk/js/docs/3.0/guides"},next:{title:"Request Storage",permalink:"/sdk/js/docs/3.0/guides/request-storage"}},c={},u=[{value:"Logging into Apify platform from Apify SDK",id:"logging-into-apify-platform-from-apify-sdk",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2}],f={toc:u},m="wrapper";function d(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"./request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"./result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"./proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and you should definitely sign up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Apify SDK is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Note that we do not test Apify SDK in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-apify-sdk"},"Logging into Apify platform from Apify SDK"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from the SDK, you must provide\ncredentials - ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"your API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures of the SDK, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"npm install -g apify-cli\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify login -t YOUR_API_TOKEN\n")),(0,o.kt)("p",null,"In your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify run -p\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"If you prefer not to use Apify CLI, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"./environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"./environment-variables#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. It is automatically inferred from your token by the SDK, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,d=u["".concat(p,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(d,i(i({ref:t},c),{},{components:r})):n.createElement(d,i({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e57ce3fc.0a786bd9.js b/assets/js/e57ce3fc.0a786bd9.js new file mode 100644 index 0000000000..c07b08062a --- /dev/null +++ b/assets/js/e57ce3fc.0a786bd9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9329],{68889:(e,t,a)=>{a.d(t,{Z:()=>d});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const d=function(e){var t=e.to,a=e.children,d=(0,o.E)(),i=d.version,l=d.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var c=i+"/";return"current"===i?c="next/":l&&(c=""),r.createElement(n.default,{to:"/api/"+c+t},a)}},5982:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>v,frontMatter:()=>c,metadata:()=>u,toc:()=>f});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(14563),d=a(68889);const i="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, body }) {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n";var l=["components"],c={id:"add-data-to-dataset",title:"Add data to dataset"},p=void 0,u={unversionedId:"examples/add-data-to-dataset",id:"version-3.0/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/versioned_docs/version-3.0/examples/add_data_to_dataset.mdx",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/3.0/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/add_data_to_dataset.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/3.0/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/3.0/examples/basic-crawler"}},m={},f=[],y={toc:f},w="wrapper";function v(e){var t=e.components,a=(0,n.Z)(e,l);return(0,o.kt)(w,(0,r.Z)({},y,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)(d.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.openDataset()"))),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/datasets/default/\n")))}v.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>f});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function d(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var i=r.createContext({}),l=function(e){var t=r.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,i=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),p=l(a),m=n,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||o;return a?r.createElement(f,s(s({ref:t},c),{},{components:a})):r.createElement(f,s({ref:t},c))}));function f(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=m;var d={};for(var i in t)hasOwnProperty.call(t,i)&&(d[i]=t[i]);d.originalType=e,d[p]="string"==typeof e?e:n,s[1]=d;for(var l=2;l<o;l++)s[l]=a[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e57ce3fc.c33dde04.js b/assets/js/e57ce3fc.c33dde04.js deleted file mode 100644 index 35aeb0cdd2..0000000000 --- a/assets/js/e57ce3fc.c33dde04.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9329],{68889:(e,t,a)=>{a.d(t,{Z:()=>d});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const d=function(e){var t=e.to,a=e.children,d=(0,o.E)(),i=d.version,l=d.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var c=i+"/";return"current"===i?c="next/":l&&(c=""),r.createElement(n.default,{to:"/api/"+c+t},a)}},5982:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>m,contentTitle:()=>p,default:()=>v,frontMatter:()=>c,metadata:()=>u,toc:()=>f});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(14563),d=a(68889);const i="import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create a dataset where we will store the results.\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, body }) {\n // Save data to default dataset\n await Actor.pushData({\n url: request.url,\n html: body,\n });\n },\n});\n\n// Run the crawler\nawait crawler.run([\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n]);\n\nawait Actor.exit();\n";var l=["components"],c={id:"add-data-to-dataset",title:"Add data to dataset"},p=void 0,u={unversionedId:"examples/add-data-to-dataset",id:"version-3.0/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.",source:"@site/versioned_docs/version-3.0/examples/add_data_to_dataset.mdx",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/3.0/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/add_data_to_dataset.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"add-data-to-dataset",title:"Add data to dataset"},sidebar:"docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/3.0/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/3.0/examples/basic-crawler"}},m={},f=[],y={toc:f},w="wrapper";function v(e){var t=e.components,a=(0,n.Z)(e,l);return(0,o.kt)(w,(0,r.Z)({},y,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created.\nYou can save data to custom datasets by using ",(0,o.kt)(d.Z,{to:"apify/class/Dataset#open",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.openDataset()"))),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},i),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/storage/datasets/default/\n")))}v.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>f});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function d(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var i=r.createContext({}),l=function(e){var t=r.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},c=function(e){var t=l(e.components);return r.createElement(i.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,i=e.parentName,c=d(e,["components","mdxType","originalType","parentName"]),p=l(a),m=n,f=p["".concat(i,".").concat(m)]||p[m]||u[m]||o;return a?r.createElement(f,s(s({ref:t},c),{},{components:a})):r.createElement(f,s({ref:t},c))}));function f(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=m;var d={};for(var i in t)hasOwnProperty.call(t,i)&&(d[i]=t[i]);d.originalType=e,d[p]="string"==typeof e?e:n,s[1]=d;for(var l=2;l<o;l++)s[l]=a[l];return r.createElement.apply(null,s)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e58ed2d9.b1824340.js b/assets/js/e58ed2d9.b1824340.js new file mode 100644 index 0000000000..6982d7bf59 --- /dev/null +++ b/assets/js/e58ed2d9.b1824340.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8306],{50683:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"migration-to-v1",title:"Migration to version 1"},p=void 0,s={unversionedId:"guides/migration-to-v1",id:"version-2.3/guides/migration-to-v1",title:"Migration to version 1",description:"- Summary",source:"@site/versioned_docs/version-2.3/guides/migration_to_v1.md",sourceDirName:"guides",slug:"/guides/migration-to-v1",permalink:"/sdk/js/docs/2.3/guides/migration-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/migration_to_v1.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"migration-to-v1",title:"Migration to version 1"},sidebar:"version-2.3/docs",previous:{title:"Running in Docker",permalink:"/sdk/js/docs/2.3/guides/docker-images"},next:{title:"Avoid getting blocked",permalink:"/sdk/js/docs/2.3/guides/avoid-blocking"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"<code>Map</code> of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"<code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code>",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code>",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running <code>BrowserPool</code>",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of <code>BrowserController</code>",id:"introduction-of-browsercontroller",level:3},{value:"<code>BrowserPool</code> methods vs <code>PuppeteerPool</code>",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated <code>PuppeteerCrawlerOptions</code>",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of <code>gotoFunction</code>",id:"removal-of-gotofunction",level:3},{value:"<code>launchPuppeteerOptions</code> => <code>launchContext</code>",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of <code>launchPuppeteerFunction</code>",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},m="wrapper";function h(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(m,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#summary",target:null,rel:null},"Summary")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#migration-guide",target:null,rel:null},"Migration Guide")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#installation",target:null,rel:null},"Installation")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#running-on-apify-platform",target:null,rel:null},"Running on Apify Platform")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},"Handler arguments are now Crawling Context"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#map-of-crawling-contexts-and-their-ids",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Map")," of crawling contexts and their IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#autoscaledpool-was-moved-under-crawlingcontextcrawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"a"},"crawlingContext.crawler"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#replacement-of-puppeteerpool-with-browserpool",target:null,rel:null},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#access-to-running-browserpool",target:null,rel:null},"Access to running ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#pages-now-have-ids",target:null,rel:null},"Pages now have IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Configuration and lifecycle hooks")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#introduction-of-browsercontroller",target:null,rel:null},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#browserpool-methods-vs-puppeteerpool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-puppeteercrawleroptions",target:null,rel:null},"Updated ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-gotofunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"gotoFunction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"a"},"launchContext"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-launchpuppeteerfunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerFunction"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launch-functions",target:null,rel:null},"Launch functions"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-arguments",target:null,rel:null},"Updated arguments")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#custom-modules",target:null,rel:null},"Custom modules"))))),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}h.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>h});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,h=c["".concat(p,".").concat(m)]||c[m]||d[m]||r;return t?a.createElement(h,l(l({ref:n},u),{},{components:t})):a.createElement(h,l({ref:n},u))}));function h(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=m;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s<r;s++)l[s]=t[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e58ed2d9.e4b26ce2.js b/assets/js/e58ed2d9.e4b26ce2.js deleted file mode 100644 index 6f01811a71..0000000000 --- a/assets/js/e58ed2d9.e4b26ce2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8306],{50683:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id:"migration-to-v1",title:"Migration to version 1"},p=void 0,s={unversionedId:"guides/migration-to-v1",id:"version-2.3/guides/migration-to-v1",title:"Migration to version 1",description:"- Summary",source:"@site/versioned_docs/version-2.3/guides/migration_to_v1.md",sourceDirName:"guides",slug:"/guides/migration-to-v1",permalink:"/sdk/js/docs/2.3/guides/migration-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/migration_to_v1.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"migration-to-v1",title:"Migration to version 1"},sidebar:"version-2.3/docs",previous:{title:"Running in Docker",permalink:"/sdk/js/docs/2.3/guides/docker-images"},next:{title:"Avoid getting blocked",permalink:"/sdk/js/docs/2.3/guides/avoid-blocking"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"<code>Map</code> of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"<code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code>",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code>",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running <code>BrowserPool</code>",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of <code>BrowserController</code>",id:"introduction-of-browsercontroller",level:3},{value:"<code>BrowserPool</code> methods vs <code>PuppeteerPool</code>",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated <code>PuppeteerCrawlerOptions</code>",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of <code>gotoFunction</code>",id:"removal-of-gotofunction",level:3},{value:"<code>launchPuppeteerOptions</code> => <code>launchContext</code>",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of <code>launchPuppeteerFunction</code>",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},m="wrapper";function h(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(m,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#summary",target:null,rel:null},"Summary")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#migration-guide",target:null,rel:null},"Migration Guide")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#installation",target:null,rel:null},"Installation")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#running-on-apify-platform",target:null,rel:null},"Running on Apify Platform")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},"Handler arguments are now Crawling Context"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#map-of-crawling-contexts-and-their-ids",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Map")," of crawling contexts and their IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#autoscaledpool-was-moved-under-crawlingcontextcrawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"a"},"crawlingContext.crawler"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#replacement-of-puppeteerpool-with-browserpool",target:null,rel:null},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#access-to-running-browserpool",target:null,rel:null},"Access to running ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#pages-now-have-ids",target:null,rel:null},"Pages now have IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Configuration and lifecycle hooks")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#introduction-of-browsercontroller",target:null,rel:null},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#browserpool-methods-vs-puppeteerpool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-puppeteercrawleroptions",target:null,rel:null},"Updated ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-gotofunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"gotoFunction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"a"},"launchContext"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-launchpuppeteerfunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerFunction"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launch-functions",target:null,rel:null},"Launch functions"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-arguments",target:null,rel:null},"Updated arguments")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#custom-modules",target:null,rel:null},"Custom modules"))))),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}h.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>h});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,h=c["".concat(p,".").concat(m)]||c[m]||d[m]||r;return t?a.createElement(h,l(l({ref:n},u),{},{components:t})):a.createElement(h,l({ref:n},u))}));function h(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=m;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s<r;s++)l[s]=t[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e64029a2.aa712dab.js b/assets/js/e64029a2.aa712dab.js new file mode 100644 index 0000000000..e27dfdfc9c --- /dev/null +++ b/assets/js/e64029a2.aa712dab.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4360],{4440:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),i=["components"],a={id:"session-options",title:"SessionOptions"},l=void 0,p={unversionedId:"typedefs/session-options",id:"version-2.3/typedefs/session-options",title:"SessionOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SessionOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-options",permalink:"/sdk/js/docs/2.3/typedefs/session-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionOptions.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"session-options",title:"SessionOptions"},sidebar:"version-2.3/docs",previous:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-options"},next:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-pool-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>id</code>",id:"id",level:3},{value:"<code>maxAgeSecs</code>",id:"maxagesecs",level:3},{value:"<code>userData</code>",id:"userdata",level:3},{value:"<code>maxErrorScore</code>",id:"maxerrorscore",level:3},{value:"<code>errorScoreDecrement</code>",id:"errorscoredecrement",level:3},{value:"<code>createdAt</code>",id:"createdat",level:3},{value:"<code>expiresAt</code>",id:"expiresat",level:3},{value:"<code>usageCount</code>",id:"usagecount",level:3},{value:"<code>errorCount</code>",id:"errorcount",level:3},{value:"<code>maxUsageCount</code>",id:"maxusagecount",level:3},{value:"<code>sessionPool</code>",id:"sessionpool",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,s.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"sessionoptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"id"},(0,s.kt)("inlineCode",{parentName:"h3"},"id")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"Id of session used for generating fingerprints. It is used as proxy session name."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxagesecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxAgeSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3000")),(0,s.kt)("p",null,"Number of seconds after which the session is considered as expired."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"userdata"},(0,s.kt)("inlineCode",{parentName:"h3"},"userData")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Object<string, *>")),(0,s.kt)("p",null,"Object where custom user data can be stored. For example custom headers."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxerrorscore"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3")),(0,s.kt)("p",null,"Maximum number of marking session as blocked usage. If the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," reaches the ",(0,s.kt)("inlineCode",{parentName:"p"},"maxErrorScore")," session is marked as block and it is thrown away.\nIt starts at 0. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markBad")," function increases the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by 1. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markGood")," will decrease the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by\n",(0,s.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement")),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorscoredecrement"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.5")),(0,s.kt)("p",null,"It is used for healing the session. For example: if your session is marked bad two times, but it is successful on the third attempt it's errorScore is\ndecremented by this number."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"createdat"},(0,s.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of creation."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"expiresat"},(0,s.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of expiration."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session has been used."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorcount"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session is marked bad."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 50")),(0,s.kt)("p",null,"Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"sessionpool"},(0,s.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,s.kt)("p",null,"SessionPool instance. Session will emit the ",(0,s.kt)("inlineCode",{parentName:"p"},"sessionRetired")," event on this instance."),(0,s.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||s;return n?r.createElement(k,i(i({ref:t},d),{},{components:n})):r.createElement(k,i({ref:t},d))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p<s;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e64029a2.de377845.js b/assets/js/e64029a2.de377845.js deleted file mode 100644 index 4a31b80999..0000000000 --- a/assets/js/e64029a2.de377845.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4360],{4440:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var r=n(87462),o=n(63366),s=(n(67294),n(3905)),i=["components"],a={id:"session-options",title:"SessionOptions"},l=void 0,p={unversionedId:"typedefs/session-options",id:"version-2.3/typedefs/session-options",title:"SessionOptions",description:"Properties",source:"@site/versioned_docs/version-2.3/typedefs/SessionOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-options",permalink:"/sdk/js/docs/2.3/typedefs/session-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionOptions.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"session-options",title:"SessionOptions"},sidebar:"version-2.3/docs",previous:{title:"RequestAsBrowserOptions",permalink:"/sdk/js/docs/2.3/typedefs/request-as-browser-options"},next:{title:"SessionPoolOptions",permalink:"/sdk/js/docs/2.3/typedefs/session-pool-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>id</code>",id:"id",level:3},{value:"<code>maxAgeSecs</code>",id:"maxagesecs",level:3},{value:"<code>userData</code>",id:"userdata",level:3},{value:"<code>maxErrorScore</code>",id:"maxerrorscore",level:3},{value:"<code>errorScoreDecrement</code>",id:"errorscoredecrement",level:3},{value:"<code>createdAt</code>",id:"createdat",level:3},{value:"<code>expiresAt</code>",id:"expiresat",level:3},{value:"<code>usageCount</code>",id:"usagecount",level:3},{value:"<code>errorCount</code>",id:"errorcount",level:3},{value:"<code>maxUsageCount</code>",id:"maxusagecount",level:3},{value:"<code>sessionPool</code>",id:"sessionpool",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,n=(0,o.Z)(e,i);return(0,s.kt)(m,(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"sessionoptions"}),(0,s.kt)("h2",{id:"properties"},"Properties"),(0,s.kt)("h3",{id:"id"},(0,s.kt)("inlineCode",{parentName:"h3"},"id")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"string")),(0,s.kt)("p",null,"Id of session used for generating fingerprints. It is used as proxy session name."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxagesecs"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxAgeSecs")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3000")),(0,s.kt)("p",null,"Number of seconds after which the session is considered as expired."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"userdata"},(0,s.kt)("inlineCode",{parentName:"h3"},"userData")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Object<string, *>")),(0,s.kt)("p",null,"Object where custom user data can be stored. For example custom headers."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxerrorscore"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 3")),(0,s.kt)("p",null,"Maximum number of marking session as blocked usage. If the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," reaches the ",(0,s.kt)("inlineCode",{parentName:"p"},"maxErrorScore")," session is marked as block and it is thrown away.\nIt starts at 0. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markBad")," function increases the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by 1. Calling the ",(0,s.kt)("inlineCode",{parentName:"p"},"markGood")," will decrease the ",(0,s.kt)("inlineCode",{parentName:"p"},"errorScore")," by\n",(0,s.kt)("inlineCode",{parentName:"p"},"errorScoreDecrement")),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorscoredecrement"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0.5")),(0,s.kt)("p",null,"It is used for healing the session. For example: if your session is marked bad two times, but it is successful on the third attempt it's errorScore is\ndecremented by this number."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"createdat"},(0,s.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of creation."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"expiresat"},(0,s.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"Date")),(0,s.kt)("p",null,"Date of expiration."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"usagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session has been used."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"errorcount"},(0,s.kt)("inlineCode",{parentName:"h3"},"errorCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 0")),(0,s.kt)("p",null,"Indicates how many times the session is marked bad."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"maxusagecount"},(0,s.kt)("inlineCode",{parentName:"h3"},"maxUsageCount")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("inlineCode",{parentName:"p"},"number")," ",(0,s.kt)("code",null," = 50")),(0,s.kt)("p",null,"Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away."),(0,s.kt)("hr",null),(0,s.kt)("h3",{id:"sessionpool"},(0,s.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Type"),": ",(0,s.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,s.kt)("p",null,"SessionPool instance. Session will emit the ",(0,s.kt)("inlineCode",{parentName:"p"},"sessionRetired")," event on this instance."),(0,s.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,s=e.originalType,l=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=p(n),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||s;return n?r.createElement(k,i(i({ref:t},d),{},{components:n})):r.createElement(k,i({ref:t},d))}));function k(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=n.length,i=new Array(s);i[0]=m;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a[c]="string"==typeof e?e:o,i[1]=a;for(var p=2;p<s;p++)i[p]=n[p];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e69236dc.1aa49dca.js b/assets/js/e69236dc.b5391d29.js similarity index 53% rename from assets/js/e69236dc.1aa49dca.js rename to assets/js/e69236dc.b5391d29.js index ba34766cae..5e3fbba07f 100644 --- a/assets/js/e69236dc.1aa49dca.js +++ b/assets/js/e69236dc.b5391d29.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6862],{68889:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(67294),a=n(88746),o=n(6141),l=n(6832);const c=function(e){var t=e.to,n=e.children,c=(0,o.E)(),s=c.version,i=c.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":i&&(d=""),r.createElement(a.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>c,T:()=>l});var r=n(67294),a=n(88746),o="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return r.createElement(a.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},n)},c=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:o+"/"+t},n)}},69653:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>b,contentTitle:()=>m,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>h});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\n// Create and navigate new page\nconsole.log('Open target page');\nconst page = await browser.newPage();\nawait page.goto('https://github.com/search/advanced');\n\n// Fill form fields and select desired search options\nconsole.log('Fill in search form');\nawait page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\nawait page.type('#search_from', 'apify');\nawait page.type('#search_date', '>2015');\nawait page.select('select#search_language', 'JavaScript');\n\n// Submit the form and wait for full load of next page\nconsole.log('Submit search form');\nawait Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n]);\n\n// Obtain and print list of search results\nconst results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n})));\n\nconsole.log('Results:', results);\n\n// Store data in default dataset\nawait Actor.pushData(results);\n\n// Close browser\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E"};var i,d=["components"],p={id:"forms",title:"Forms"},m=void 0,u={unversionedId:"examples/forms",id:"version-3.1/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to",source:"@site/versioned_docs/version-3.1/examples/forms.mdx",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/forms.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/examples/map-and-reduce"}},b={},h=[],f=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),y={toc:h},g="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,d);return(0,o.kt)(g,(0,r.Z)({},y,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," to\nautomatically fill and submit a search form to look up repositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and language of the repository, then submits the form\nand prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(f,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),i=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=i(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),p=i(n),u=a,b=p["".concat(s,".").concat(u)]||p[u]||m[u]||o;return n?r.createElement(b,l(l({ref:t},d),{},{components:n})):r.createElement(b,l({ref:t},d))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:a,l[1]=c;for(var i=2;i<o;i++)l[i]=n[i];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6862],{68889:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(67294),a=n(88746),o=n(6141),l=n(6832);const c=function(e){var t=e.to,n=e.children,c=(0,o.E)(),s=c.version,i=c.isLast;if((0,l.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(a.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":i&&(d=""),r.createElement(a.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>c,T:()=>l});var r=n(67294),a=n(88746),o="https://crawlee.dev",l=function(e){var t=e.to,n=e.children,l=e.version;return r.createElement(a.default,{href:o+"/api"+(l?"/"+l:"")+"/"+t},n)},c=function(e){var t=e.to,n=e.children;return r.createElement(a.default,{href:o+"/"+t},n)}},69653:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>b,contentTitle:()=>m,default:()=>v,frontMatter:()=>p,metadata:()=>u,toc:()=>h});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),l=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\n// Create and navigate new page\nconsole.log('Open target page');\nconst page = await browser.newPage();\nawait page.goto('https://github.com/search/advanced');\n\n// Fill form fields and select desired search options\nconsole.log('Fill in search form');\nawait page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\nawait page.type('#search_from', 'apify');\nawait page.type('#search_date', '>2015');\nawait page.select('select#search_language', 'JavaScript');\n\n// Submit the form and wait for full load of next page\nconsole.log('Submit search form');\nawait Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n]);\n\n// Obtain and print list of search results\nconst results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n})));\n\nconsole.log('Results:', results);\n\n// Store data in default dataset\nawait Actor.pushData(results);\n\n// Close browser\nawait browser.close();\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E"};var i,d=["components"],p={id:"forms",title:"Forms"},m=void 0,u={unversionedId:"examples/forms",id:"version-3.1/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to",source:"@site/versioned_docs/version-3.1/examples/forms.mdx",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/forms.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/examples/map-and-reduce"}},b={},h=[],f=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),y={toc:h},g="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,d);return(0,o.kt)(g,(0,r.Z)({},y,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," to\nautomatically fill and submit a search form to look up repositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and language of the repository, then submits the form\nand prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)(l.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(f,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},s))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),i=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=i(e.components);return r.createElement(s.Provider,{value:t},e.children)},p="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),p=i(n),u=a,b=p["".concat(s,".").concat(u)]||p[u]||m[u]||o;return n?r.createElement(b,l(l({ref:t},d),{},{components:n})):r.createElement(b,l({ref:t},d))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c[p]="string"==typeof e?e:a,l[1]=c;for(var i=2;i<o;i++)l[i]=n[i];return r.createElement.apply(null,l)}return r.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e805786e.7cac59f4.js b/assets/js/e805786e.3bbb072c.js similarity index 69% rename from assets/js/e805786e.7cac59f4.js rename to assets/js/e805786e.3bbb072c.js index b0d6e90d35..a344c72f2f 100644 --- a/assets/js/e805786e.7cac59f4.js +++ b/assets/js/e805786e.3bbb072c.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2157],{68889:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(67294),a=r(88746),l=r(6141),c=r(6832);const o=function(e){var t=e.to,r=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var g=i+"/";return"current"===i?g="next/":s&&(g=""),n.createElement(a.default,{to:"/api/"+g+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>o,T:()=>c});var n=r(67294),a=r(88746),l="https://crawlee.dev",c=function(e){var t=e.to,r=e.children,c=e.version;return n.createElement(a.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},r)},o=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:l+"/"+t},r)}},49144:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>C,frontMatter:()=>g,metadata:()=>I,toc:()=>m});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),c=(r(14563),r(68889),r(26569));const o={code:"import { CheerioCrawler, log, LogLevel } from 'crawlee';\n\n// Crawlers come with various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nlog.setLevel(LogLevel.DEBUG);\n\n// Create an instance of the CheerioCrawler class - a crawler\n// that automatically loads the URLs and parses their HTML using the cheerio library.\nconst crawler = new CheerioCrawler({\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n requestHandlerTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n async requestHandler({ request, $ }) {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the dataset. In local configuration,\n // the data will be stored as JSON files in ./storage/datasets/default\n await Actor.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n log.debug(`Request ${request.url} failed twice.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run();\n\nlog.debug('Crawler finished.');\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s"};var i,s=["components"],g={id:"cheerio-crawler",title:"Cheerio crawler"},d=void 0,I={unversionedId:"examples/cheerio-crawler",id:"version-3.1/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.",source:"@site/versioned_docs/version-3.1/examples/cheerio_crawler.mdx",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/cheerio_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/examples/call-actor"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/examples/crawl-all-links"}},u={},m=[],b=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),p={toc:m},h="wrapper";function C(e){var t=e.components,r=(0,a.Z)(e,s);return(0,l.kt)(h,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title and all ",(0,l.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,l.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}C.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>g,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},g=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,g=o(e,["components","mdxType","originalType","parentName"]),d=s(r),u=a,m=d["".concat(i,".").concat(u)]||d[u]||I[u]||l;return r?n.createElement(m,c(c({ref:t},g),{},{components:r})):n.createElement(m,c({ref:t},g))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var s=2;s<l;s++)c[s]=r[s];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2157],{68889:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(67294),a=r(88746),l=r(6141),c=r(6832);const o=function(e){var t=e.to,r=e.children,o=(0,l.E)(),i=o.version,s=o.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var g=i+"/";return"current"===i?g="next/":s&&(g=""),n.createElement(a.default,{to:"/api/"+g+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>o,T:()=>c});var n=r(67294),a=r(88746),l="https://crawlee.dev",c=function(e){var t=e.to,r=e.children,c=e.version;return n.createElement(a.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},r)},o=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:l+"/"+t},r)}},49144:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>C,frontMatter:()=>g,metadata:()=>I,toc:()=>m});var n=r(87462),a=r(63366),l=(r(67294),r(3905)),c=(r(14563),r(68889),r(26569));const o={code:"import { CheerioCrawler, log, LogLevel } from 'crawlee';\n\n// Crawlers come with various utilities, e.g. for logging.\n// Here we use debug level of logging to improve the debugging experience.\n// This functionality is optional!\nlog.setLevel(LogLevel.DEBUG);\n\n// Create an instance of the CheerioCrawler class - a crawler\n// that automatically loads the URLs and parses their HTML using the cheerio library.\nconst crawler = new CheerioCrawler({\n // The crawler downloads and processes the web pages in parallel, with a concurrency\n // automatically managed based on the available system memory and CPU (see AutoscaledPool class).\n // Here we define some hard limits for the concurrency.\n minConcurrency: 10,\n maxConcurrency: 50,\n\n // On error, retry each page at most once.\n maxRequestRetries: 1,\n\n // Increase the timeout for processing of each page.\n requestHandlerTimeoutSecs: 30,\n\n // Limit to 10 requests per one crawl\n maxRequestsPerCrawl: 10,\n\n // This function will be called for each URL to crawl.\n // It accepts a single parameter, which is an object with options as:\n // https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction\n // We use for demonstration only 2 of them:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - $: the cheerio object containing parsed HTML\n async requestHandler({ request, $ }) {\n log.debug(`Processing ${request.url}...`);\n\n // Extract data from the page using cheerio.\n const title = $('title').text();\n const h1texts = [];\n $('h1').each((index, el) => {\n h1texts.push({\n text: $(el).text(),\n });\n });\n\n // Store the results to the dataset. In local configuration,\n // the data will be stored as JSON files in ./storage/datasets/default\n await Actor.pushData({\n url: request.url,\n title,\n h1texts,\n });\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n log.debug(`Request ${request.url} failed twice.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run();\n\nlog.debug('Crawler finished.');\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s"};var i,s=["components"],g={id:"cheerio-crawler",title:"Cheerio crawler"},d=void 0,I={unversionedId:"examples/cheerio-crawler",id:"version-3.1/examples/cheerio-crawler",title:"Cheerio crawler",description:"This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.",source:"@site/versioned_docs/version-3.1/examples/cheerio_crawler.mdx",sourceDirName:"examples",slug:"/examples/cheerio-crawler",permalink:"/sdk/js/docs/examples/cheerio-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/cheerio_crawler.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"cheerio-crawler",title:"Cheerio crawler"},sidebar:"docs",previous:{title:"Call actor",permalink:"/sdk/js/docs/examples/call-actor"},next:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/examples/crawl-all-links"}},u={},m=[],b=(i="RunnableCodeBlock",function(e){return console.warn("Component "+i+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),p={toc:m},h="wrapper";function C(e){var t=e.components,r=(0,a.Z)(e,s);return(0,l.kt)(h,(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the ",(0,l.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/cheerio",target:"_blank",rel:"noopener"},"Cheerio library")," and extract some data from it: the page title and all ",(0,l.kt)("inlineCode",{parentName:"p"},"h1")," tags."),(0,l.kt)(b,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o))}C.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>g,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},g=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,g=o(e,["components","mdxType","originalType","parentName"]),d=s(r),u=a,m=d["".concat(i,".").concat(u)]||d[u]||I[u]||l;return r?n.createElement(m,c(c({ref:t},g),{},{components:r})):n.createElement(m,c({ref:t},g))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,c=new Array(l);c[0]=u;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var s=2;s<l;s++)c[s]=r[s];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e871a034.832ae7d6.js b/assets/js/e871a034.832ae7d6.js new file mode 100644 index 0000000000..36cb78fd49 --- /dev/null +++ b/assets/js/e871a034.832ae7d6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5139],{68889:(e,t,a)=>{a.d(t,{Z:()=>i});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const i=function(e){var t=e.to,a=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var d=l+"/";return"current"===l?d="next/":p&&(d=""),r.createElement(n.default,{to:"/api/"+d+t},a)}},7007:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>c});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(68889),i=["components"],l={id:"result-storage",title:"Result Storage"},p=void 0,d={unversionedId:"guides/result-storage",id:"version-3.1/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.1/guides/result_storage.mdx",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/result_storage.mdx",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/guides/environment-variables"}},u={},c=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],f={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)(s.Z,{to:"apify/class/Actor#getValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.getValue()"))," and ",(0,o.kt)(s.Z,{to:"apify/class/Actor#setValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Actor.getInput();\n\n// Write actor output to the default key-value store.\nawait Actor.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Actor.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/capture-screenshot",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)(s.Z,{to:"apify/class/Actor#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Actor.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Actor.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(a),f=n,h=u["".concat(l,".").concat(f)]||u[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},d),{},{components:a})):r.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p<o;p++)s[p]=a[p];return r.createElement.apply(null,s)}return r.createElement.apply(null,a)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e871a034.feea5877.js b/assets/js/e871a034.feea5877.js deleted file mode 100644 index 5950c50191..0000000000 --- a/assets/js/e871a034.feea5877.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5139],{68889:(e,t,a)=>{a.d(t,{Z:()=>i});var r=a(67294),n=a(88746),o=a(6141),s=a(6832);const i=function(e){var t=e.to,a=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return r.createElement(n.default,{to:"/api/"+t},a);var d=l+"/";return"current"===l?d="next/":p&&(d=""),r.createElement(n.default,{to:"/api/"+d+t},a)}},7007:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>c});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),s=a(68889),i=["components"],l={id:"result-storage",title:"Result Storage"},p=void 0,d={unversionedId:"guides/result-storage",id:"version-3.1/guides/result-storage",title:"Result Storage",description:"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the",source:"@site/versioned_docs/version-3.1/guides/result_storage.mdx",sourceDirName:"guides",slug:"/guides/result-storage",permalink:"/sdk/js/docs/guides/result-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/result_storage.mdx",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"result-storage",title:"Result Storage"},sidebar:"docs",previous:{title:"Request Storage",permalink:"/sdk/js/docs/guides/request-storage"},next:{title:"Environment Variables",permalink:"/sdk/js/docs/guides/environment-variables"}},u={},c=[{value:"Key-value store",id:"key-value-store",level:2},{value:"Dataset",id:"dataset",level:2}],f={toc:c},h="wrapper";function m(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(h,(0,r.Z)({},f,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account\nidentified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is\nready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No\ncode changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/key-value-stores",target:"_blank",rel:"noopener"},"Key-value stores API reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/datasets",target:"_blank",rel:"noopener"},"Datasets API reference"))),(0,o.kt)("h2",{id:"key-value-store"},"Key-value store"),(0,o.kt)("p",null,"The key-value store is used for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME\ncontent type. Key-value stores are ideal for saving screenshots of web pages, PDFs or to persist the state of crawlers."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default key-value store"),", which is created exclusively for the actor run. By convention, the actor run input\nand output is stored in the default key-value store under the ",(0,o.kt)("inlineCode",{parentName:"p"},"INPUT")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"OUTPUT")," key, respectively. Typically the input and output is a JSON file,\nalthough it can be any other format."),(0,o.kt)("p",null,"In the Apify SDK, the key-value store is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/KeyValueStore",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"KeyValueStore"))," class. In order to simplify access to the default\nkey-value store, the SDK also provides ",(0,o.kt)(s.Z,{to:"apify/class/Actor#getValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.getValue()"))," and ",(0,o.kt)(s.Z,{to:"apify/class/Actor#setValue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.setValue()"))," functions."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/key_value_stores/{STORE_ID}/{KEY}.{EXT}\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{STORE_ID}")," is the name or ID of the key-value store. The default key value store has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_KEY_VALUE_STORE_ID")," environment variable. The ",(0,o.kt)("inlineCode",{parentName:"p"},"{KEY}")," is the key of the record and ",(0,o.kt)("inlineCode",{parentName:"p"},"{EXT}")," corresponds to the MIME content type of the\ndata value."),(0,o.kt)("p",null,"The following code demonstrates basic operations of key-value stores:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Get actor input from the default key-value store\nconst input = await Actor.getInput();\n\n// Write actor output to the default key-value store.\nawait Actor.setValue('OUTPUT', { myResult: 123 });\n\n// Open a named key-value store\nconst store = await Actor.openKeyValueStore('some-name');\n\n// Write record. JavaScript object is automatically converted to JSON,\n// strings and binary buffers are stored as they are\nawait store.setValue('some-key', { foo: 'bar' });\n\n// Read record. Note that JSON is automatically parsed to a JavaScript object,\n// text data returned as a string and other data is returned as binary buffer\nconst value = await store.getValue('some-key');\n\n// Delete record\nawait store.setValue('some-key', null);\n")),(0,o.kt)("p",null,"To see a real-world example of how to get the input from the key-value store, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/capture-screenshot",target:null,rel:null},"Screenshots")," example."),(0,o.kt)("h2",{id:"dataset"},"Dataset"),(0,o.kt)("p",null,"Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. You\ncan imagine a dataset as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new\nrecords to it but you cannot modify or remove existing records."),(0,o.kt)("p",null,"When the dataset is stored on the ",(0,o.kt)("a",{parentName:"p",href:"../guides/apify-platform",target:null,rel:null},"Apify platform"),", you can export its data to the following formats: HTML,\nJSON, CSV, Excel, XML and RSS. The datasets are displayed on the actor run details page and in the\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"Storage")," section in the Apify Console. The actual data is exported using the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/item-collection/get-items",target:"_blank",rel:"noopener"},"Get dataset items")," Apify API endpoint. This\nway you can easily share crawling results."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default dataset"),", which is created exclusively for the actor run. Typically, it is used to store crawling\nresults specific for the actor run. Its usage is optional."),(0,o.kt)("p",null,"In the Apify SDK, the dataset is represented by the ",(0,o.kt)(s.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Dataset"))," class. In order to simplify writes to the default dataset, the SDK\nalso provides the ",(0,o.kt)(s.Z,{to:"apify/class/Actor#pushData",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"Actor.pushData()"))," function."),(0,o.kt)("p",null,"In local configuration, the data is stored in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,o.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the dataset:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Actor.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Actor.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,o.kt)("p",null,"To see how to use the dataset to store crawler results, see the ",(0,o.kt)("a",{parentName:"p",href:"../examples/cheerio-crawler",target:null,rel:null},"Cheerio Crawler")," example."))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var l=r.createContext({}),p=function(e){var t=r.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(a),f=n,h=u["".concat(l,".").concat(f)]||u[f]||c[f]||o;return a?r.createElement(h,s(s({ref:t},d),{},{components:a})):r.createElement(h,s({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:n,s[1]=i;for(var p=2;p<o;p++)s[p]=a[p];return r.createElement.apply(null,s)}return r.createElement.apply(null,a)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e90d91d8.9f84abf2.js b/assets/js/e90d91d8.9f84abf2.js deleted file mode 100644 index c999f2c702..0000000000 --- a/assets/js/e90d91d8.9f84abf2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5640],{84186:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var r=n(87462),o=n(63366),p=(n(67294),n(3905)),a=["components"],l={id_old:"version-1.3-puppeteer-launch-context",title:"PuppeteerLaunchContext",id:"puppeteer-launch-context"},i=void 0,s={unversionedId:"typedefs/puppeteer-launch-context",id:"version-1.3/typedefs/puppeteer-launch-context",title:"PuppeteerLaunchContext",description:"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-launch-context",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerLaunchContext.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-launch-context",title:"PuppeteerLaunchContext",id:"puppeteer-launch-context"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"},next:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>launchOptions</code>",id:"launchoptions",level:3},{value:"<code>proxyUrl</code>",id:"proxyurl",level:3},{value:"<code>userAgent</code>",id:"useragent",level:3},{value:"<code>useChrome</code>",id:"usechrome",level:3},{value:"<code>launcher</code>",id:"launcher",level:3},{value:"<code>stealth</code>",id:"stealth",level:3},{value:"<code>stealthOptions</code>",id:"stealthoptions",level:3}],d={toc:c},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,p.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerlaunchcontext"}),(0,p.kt)("p",null,"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible\n",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,p.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Example:")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Puppeteer options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"launchoptions"},(0,p.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"LaunchOptions")),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"puppeteer.launch")," ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v5.5.0&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},"options")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyurl"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"string")),(0,p.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,p.kt)("p",null,"Example: ",(0,p.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"useragent"},(0,p.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"string")),(0,p.kt)("p",null,"The ",(0,p.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,p.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"usechrome"},(0,p.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,p.kt)("code",null," = false")),(0,p.kt)("p",null,"If ",(0,p.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,p.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Puppeteer will launch full Google Chrome browser available on the machine rather than the bundled Chromium.\nThe path to Chrome executable is taken from the ",(0,p.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical Google\nChrome executable location specific for the operating system. By default, this option is ",(0,p.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"launcher"},(0,p.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"*")),(0,p.kt)("p",null,"Already required module (",(0,p.kt)("inlineCode",{parentName:"p"},"Object"),"). This enables usage of various Puppeteer wrappers such as ",(0,p.kt)("inlineCode",{parentName:"p"},"puppeteer-extra"),"."),(0,p.kt)("p",null,"Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides\n",(0,p.kt)("inlineCode",{parentName:"p"},"puppeteer")," itself."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"stealth"},(0,p.kt)("inlineCode",{parentName:"h3"},"stealth")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"boolean")),(0,p.kt)("p",null,"This setting hides most of the known properties that identify headless Chrome and makes it nearly undetectable. It is recommended to use it together\nwith the ",(0,p.kt)("inlineCode",{parentName:"p"},"useChrome")," set to ",(0,p.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"stealthoptions"},(0,p.kt)("inlineCode",{parentName:"h3"},"stealthOptions")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/stealth-options",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"StealthOptions"))),(0,p.kt)("p",null,"Using this configuration, you can disable some of the hiding tricks. For these settings to take effect ",(0,p.kt)("inlineCode",{parentName:"p"},"stealth")," must be set to true"),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},p=Object.keys(e);for(r=0;r<p.length;r++)n=p[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r<p.length;r++)n=p[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,p=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(n),h=o,m=c["".concat(i,".").concat(h)]||c[h]||d[h]||p;return n?r.createElement(m,a(a({ref:t},u),{},{components:n})):r.createElement(m,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=n.length,a=new Array(p);a[0]=h;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[c]="string"==typeof e?e:o,a[1]=l;for(var s=2;s<p;s++)a[s]=n[s];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e90d91d8.d916c4e7.js b/assets/js/e90d91d8.d916c4e7.js new file mode 100644 index 0000000000..de3090f499 --- /dev/null +++ b/assets/js/e90d91d8.d916c4e7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5640],{84186:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var r=n(87462),o=n(63366),p=(n(67294),n(3905)),a=["components"],l={id_old:"version-1.3-puppeteer-launch-context",title:"PuppeteerLaunchContext",id:"puppeteer-launch-context"},i=void 0,s={unversionedId:"typedefs/puppeteer-launch-context",id:"version-1.3/typedefs/puppeteer-launch-context",title:"PuppeteerLaunchContext",description:"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible",source:"@site/versioned_docs/version-1.3/typedefs/PuppeteerLaunchContext.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-launch-context",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-launch-context",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerLaunchContext.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-launch-context",title:"PuppeteerLaunchContext",id:"puppeteer-launch-context"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerCrawlerOptions",permalink:"/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"},next:{title:"ProxyConfigurationOptions",permalink:"/sdk/js/docs/1.3/typedefs/proxy-configuration-options"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>launchOptions</code>",id:"launchoptions",level:3},{value:"<code>proxyUrl</code>",id:"proxyurl",level:3},{value:"<code>userAgent</code>",id:"useragent",level:3},{value:"<code>useChrome</code>",id:"usechrome",level:3},{value:"<code>launcher</code>",id:"launcher",level:3},{value:"<code>stealth</code>",id:"stealth",level:3},{value:"<code>stealthOptions</code>",id:"stealthoptions",level:3}],d={toc:c},h="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,a);return(0,p.kt)(h,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteerlaunchcontext"}),(0,p.kt)("p",null,"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible\n",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},(0,p.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options by providing the ",(0,p.kt)("inlineCode",{parentName:"p"},"launchOptions")," property."),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Example:")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-js"},"// launch a headless Chrome (not Chromium)\nconst launchContext = {\n // Apify helpers\n useChrome: true,\n proxyUrl: 'http://user:password@some.proxy.com'\n // Native Puppeteer options\n launchOptions: {\n headless: true,\n args: ['--some-flag'],\n }\n}\n")),(0,p.kt)("h2",{id:"properties"},"Properties"),(0,p.kt)("h3",{id:"launchoptions"},(0,p.kt)("inlineCode",{parentName:"h3"},"launchOptions")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"LaunchOptions")),(0,p.kt)("p",null,(0,p.kt)("inlineCode",{parentName:"p"},"puppeteer.launch")," ",(0,p.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&version=v5.5.0&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},"options")),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"proxyurl"},(0,p.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"string")),(0,p.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,p.kt)("p",null,"Example: ",(0,p.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"useragent"},(0,p.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"string")),(0,p.kt)("p",null,"The ",(0,p.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,p.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"usechrome"},(0,p.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,p.kt)("code",null," = false")),(0,p.kt)("p",null,"If ",(0,p.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,p.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Puppeteer will launch full Google Chrome browser available on the machine rather than the bundled Chromium.\nThe path to Chrome executable is taken from the ",(0,p.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical Google\nChrome executable location specific for the operating system. By default, this option is ",(0,p.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"launcher"},(0,p.kt)("inlineCode",{parentName:"h3"},"launcher")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"*")),(0,p.kt)("p",null,"Already required module (",(0,p.kt)("inlineCode",{parentName:"p"},"Object"),"). This enables usage of various Puppeteer wrappers such as ",(0,p.kt)("inlineCode",{parentName:"p"},"puppeteer-extra"),"."),(0,p.kt)("p",null,"Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides\n",(0,p.kt)("inlineCode",{parentName:"p"},"puppeteer")," itself."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"stealth"},(0,p.kt)("inlineCode",{parentName:"h3"},"stealth")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("inlineCode",{parentName:"p"},"boolean")),(0,p.kt)("p",null,"This setting hides most of the known properties that identify headless Chrome and makes it nearly undetectable. It is recommended to use it together\nwith the ",(0,p.kt)("inlineCode",{parentName:"p"},"useChrome")," set to ",(0,p.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,p.kt)("hr",null),(0,p.kt)("h3",{id:"stealthoptions"},(0,p.kt)("inlineCode",{parentName:"h3"},"stealthOptions")),(0,p.kt)("p",null,(0,p.kt)("strong",{parentName:"p"},"Type"),": ",(0,p.kt)("a",{parentName:"p",href:"../typedefs/stealth-options",target:null,rel:null},(0,p.kt)("inlineCode",{parentName:"a"},"StealthOptions"))),(0,p.kt)("p",null,"Using this configuration, you can disable some of the hiding tricks. For these settings to take effect ",(0,p.kt)("inlineCode",{parentName:"p"},"stealth")," must be set to true"),(0,p.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},p=Object.keys(e);for(r=0;r<p.length;r++)n=p[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(r=0;r<p.length;r++)n=p[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,p=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(n),h=o,m=c["".concat(i,".").concat(h)]||c[h]||d[h]||p;return n?r.createElement(m,a(a({ref:t},u),{},{components:n})):r.createElement(m,a({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=n.length,a=new Array(p);a[0]=h;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[c]="string"==typeof e?e:o,a[1]=l;for(var s=2;s<p;s++)a[s]=n[s];return r.createElement.apply(null,a)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e9e17c4b.e1e142f2.js b/assets/js/e9e17c4b.e1e142f2.js deleted file mode 100644 index 73e2bcff4e..0000000000 --- a/assets/js/e9e17c4b.e1e142f2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9932],{39174:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),s=(r(67294),r(3905)),o=["components"],i={id:"puppeteer-crawler",title:"Puppeteer crawler"},p=void 0,l={unversionedId:"examples/puppeteer-crawler",id:"version-2.3/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler",source:"@site/versioned_docs/version-2.3/examples/puppeteer_crawler.md",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/2.3/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"version-2.3/docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/2.3/examples/playwright-crawler"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"}},u={},c=[],d={toc:c},f="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,o);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example demonstrates how to use ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"\nin combination with ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," to recursively scrape the\n",(0,s.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer.\nThe crawler starts with a single URL, finds links to next pages,\nenqueues them and continues until no more desired links are available.\nThe results are stored to the default dataset. In local configuration, the results are stored as\nJSON files in ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PuppeteerCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Puppeteer.\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n\n // Here you can set options that are passed to the Apify.launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,h=c["".concat(p,".").concat(f)]||c[f]||d[f]||s;return r?n.createElement(h,o(o({ref:t},u),{},{components:r})):n.createElement(h,o({ref:t},u))}));function h(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/e9e17c4b.f2b36d48.js b/assets/js/e9e17c4b.f2b36d48.js new file mode 100644 index 0000000000..8476c882e5 --- /dev/null +++ b/assets/js/e9e17c4b.f2b36d48.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9932],{39174:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(87462),a=r(63366),s=(r(67294),r(3905)),o=["components"],i={id:"puppeteer-crawler",title:"Puppeteer crawler"},p=void 0,l={unversionedId:"examples/puppeteer-crawler",id:"version-2.3/examples/puppeteer-crawler",title:"Puppeteer crawler",description:"This example demonstrates how to use PuppeteerCrawler",source:"@site/versioned_docs/version-2.3/examples/puppeteer_crawler.md",sourceDirName:"examples",slug:"/examples/puppeteer-crawler",permalink:"/sdk/js/docs/2.3/examples/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_crawler.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-crawler",title:"Puppeteer crawler"},sidebar:"version-2.3/docs",previous:{title:"Playwright crawler",permalink:"/sdk/js/docs/2.3/examples/playwright-crawler"},next:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"}},u={},c=[],d={toc:c},f="wrapper";function h(e){var t=e.components,r=(0,a.Z)(e,o);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"This example demonstrates how to use ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/puppeteer-crawler",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"\nin combination with ",(0,s.kt)("a",{parentName:"p",href:"/docs/api/request-queue",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," to recursively scrape the\n",(0,s.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Puppeteer.\nThe crawler starts with a single URL, finds links to next pages,\nenqueues them and continues until no more desired links are available.\nThe results are stored to the default dataset. In local configuration, the results are stored as\nJSON files in ",(0,s.kt)("inlineCode",{parentName:"p"},"./apify_storage/datasets/default")),(0,s.kt)("blockquote",null,(0,s.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,s.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,s.kt)("pre",null,(0,s.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Apify.openRequestQueue() creates a preconfigured RequestQueue instance.\n // We add our first request to it - the initial page the crawler will visit.\n const requestQueue = await Apify.openRequestQueue();\n await requestQueue.addRequest({ url: 'https://news.ycombinator.com/' });\n\n // Create an instance of the PuppeteerCrawler class - a crawler\n // that automatically loads the URLs in headless Chrome / Puppeteer.\n const crawler = new Apify.PuppeteerCrawler({\n requestQueue,\n\n // Here you can set options that are passed to the Apify.launchPuppeteer() function.\n launchContext: {\n launchOptions: {\n headless: true,\n // Other Puppeteer options\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Puppeteer scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with the following fields:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)\n handlePageFunction: async ({ request, page }) => {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Puppeteer within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Apify.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await Apify.utils.enqueueLinks({\n page,\n requestQueue,\n selector: '.morelink',\n });\n\n if (infos.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n handleFailedRequestFunction: async ({ request }) => {\n console.log(`Request ${request.url} failed too many times.`);\n },\n });\n\n // Run the crawler and wait for it to finish.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=l(r),f=a,h=c["".concat(p,".").concat(f)]||c[f]||d[f]||s;return r?n.createElement(h,o(o({ref:t},u),{},{components:r})):n.createElement(h,o({ref:t},u))}));function h(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=f;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eab91185.6675a3d7.js b/assets/js/eab91185.6675a3d7.js deleted file mode 100644 index a02fdb2310..0000000000 --- a/assets/js/eab91185.6675a3d7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2299],{80986:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var n=a(87462),i=a(63366),r=(a(67294),a(3905)),o=["components"],l={id:"dataset",title:"Dataset"},s=void 0,p={unversionedId:"api/dataset",id:"version-2.3/api/dataset",title:"Dataset",description:"The Dataset class represents a store for structured data where each object stored has the same attributes, such as online store products or real",source:"@site/versioned_docs/version-2.3/api/Dataset.md",sourceDirName:"api",slug:"/api/dataset",permalink:"/sdk/js/docs/2.3/api/dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Dataset.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"dataset",title:"Dataset"},sidebar:"version-2.3/docs",previous:{title:"Statistics",permalink:"/sdk/js/docs/2.3/api/statistics"},next:{title:"KeyValueStore",permalink:"/sdk/js/docs/2.3/api/key-value-store"}},d={},m=[{value:"<code>dataset.pushData(data)</code>",id:"datasetpushdatadata",level:2},{value:"<code>dataset.getData([options])</code>",id:"datasetgetdataoptions",level:2},{value:"<code>dataset.getInfo()</code>",id:"datasetgetinfo",level:2},{value:"<code>dataset.forEach(iteratee, [options], [index])</code>",id:"datasetforeachiteratee-options-index",level:2},{value:"<code>dataset.map(iteratee, [options])</code>",id:"datasetmapiteratee-options",level:2},{value:"<code>dataset.reduce(iteratee, memo, [options])</code>",id:"datasetreduceiteratee-memo-options",level:2},{value:"<code>dataset.drop()</code>",id:"datasetdrop",level:2}],u={toc:m},k="wrapper";function c(e){var t=e.components,a=(0,i.Z)(e,o);return(0,r.kt)(k,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"dataset"}),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," class represents a store for structured data where each object stored has the same attributes, such as online store products or real\nestate offers. You can imagine it as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can\nonly add new records to it but you cannot modify or remove existing records. Typically it is used to store crawling results."),(0,r.kt)("p",null,"Do not instantiate this class directly, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function instead."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," stores its data either on local disk or in the Apify cloud, depending on whether the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment\nvariables are set."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,r.kt)("p",null,"Note that ",(0,r.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID: ",(0,r.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,r.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," not, the data is stored in the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify Dataset")," cloud storage. Note that you can force usage of the cloud storage also by passing the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function, even if the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is set."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"pushdata"}),(0,r.kt)("h2",{id:"datasetpushdatadata"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.pushData(data)")),(0,r.kt)("p",null,"Stores an object or an array of objects to the dataset. The function returns a promise that resolves when the operation finishes. It has no result,\nbut throws on invalid args or other errors."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data is stored!"),(0,r.kt)("p",null,"The size of the data is limited by the receiving API and therefore ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()")," will only allow objects whose JSON representation is smaller than 9MB.\nWhen an array is passed, none of the included objects may be larger than 9MB, but the array itself may be of any size."),(0,r.kt)("p",null,"The function internally chunks the array into separate items and pushes them sequentially. The chunking process is stable (keeps order of data), but\nit does not provide a transaction safety mechanism. Therefore, in the event of an uploading error (after several automatic retries), the function's\nPromise will reject and the dataset will be left in a state where some of the items have already been saved to the dataset while other items from the\nsource array were not. To overcome this limitation, the developer may, for example, read the last item saved in the dataset and re-attempt the save of\nthe data from this item onwards to prevent duplicates."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"data")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<object>")," - Object or array of objects containing data to be stored in the default dataset. The objects must be\nserializable to JSON and the JSON representation of each object must be smaller than 9MB.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getdata"}),(0,r.kt)("h2",{id:"datasetgetdataoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getData([options])")),(0,r.kt)("p",null,"Returns ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetContent"))," object holding the items in the dataset based on the provided parameters."),(0,r.kt)("p",null,"If you need to get data in an unparsed format, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#newclient",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.newClient()"))," function to get a new ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-client")," instance and\ncall ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-client-js#DatasetClient+downloadItems",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"datasetClient.downloadItems()"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"getData()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[offset]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Number of array elements that should be skipped at the start."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 250000")," - Maximum number of array elements to return."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order. Otherwise they are\nsorted in ascending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - An array of field names that will be included in the result. If omitted, all fields are included in the\nresults."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default,\nthe results are returned as they are."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[clean]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function returns only non-empty items and skips hidden fields (i.e. fields\nstarting with ",(0,r.kt)("inlineCode",{parentName:"li"},"#")," character). Note that the ",(0,r.kt)("inlineCode",{parentName:"li"},"clean")," parameter is a shortcut for ",(0,r.kt)("inlineCode",{parentName:"li"},"skipHidden: true")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"skipEmpty: true")," options."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipHidden]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),' then the function doesn\'t return hidden fields (fields starting with "#"\ncharacter).'),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipEmpty]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function doesn't return empty items. Note that in this case the\nreturned number of items might be lower than limit parameter and pagination must be done using the ",(0,r.kt)("inlineCode",{parentName:"li"},"limit")," value.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Promise<DatasetContent>"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getinfo"}),(0,r.kt)("h2",{id:"datasetgetinfo"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getInfo()")),(0,r.kt)("p",null,"Returns an object containing general information about the dataset."),(0,r.kt)("p",null,"The function returns the same object as the Apify API Client's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/apify-client-js#datasetclient-get",target:"_blank",rel:"noopener"},"datasetClient.get")," function,\nwhich in turn calls the ",(0,r.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset",target:"_blank",rel:"noopener"},"Get dataset")," API endpoint."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-dataset",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n itemCount: 14,\n cleanItemCount: 10\n}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<object>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"foreach"}),(0,r.kt)("h2",{id:"datasetforeachiteratee-options-index"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.forEach(iteratee, [options], [index])")),(0,r.kt)("p",null,"Iterates over dataset items, yielding each in turn to an ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with two arguments:\n",(0,r.kt)("inlineCode",{parentName:"p"},"(item, index)"),"."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forEach")," function throws the error."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset('my-results');\nawait dataset.forEach(async (item, index) => {\n console.log(`Item at ${index}: ${JSON.stringify(item)}`);\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-consumer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetConsumer"))," - A function that is called for every item in the dataset."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"forEach()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - If provided then returned objects will only contain specified keys."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[index]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Specifies the initial index number passed to the ",(0,r.kt)("inlineCode",{parentName:"li"},"iteratee")," function.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"map"}),(0,r.kt)("h2",{id:"datasetmapiteratee-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.map(iteratee, [options])")),(0,r.kt)("p",null,"Produces a new array of values by mapping each value in list through a transformation function ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is called\nwith two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"(element, index)"),"."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-mapper",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetMapper"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"map()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<Array<object>>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reduce"}),(0,r.kt)("h2",{id:"datasetreduceiteratee-memo-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.reduce(iteratee, memo, [options])")),(0,r.kt)("p",null,"Reduces a list of values down to a single value."),(0,r.kt)("p",null,"Memo is the initial state of the reduction, and each successive step of it should be returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". The ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is passed three\narguments: the ",(0,r.kt)("inlineCode",{parentName:"p"},"memo"),", then the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"index")," of the iteration."),(0,r.kt)("p",null,"If no ",(0,r.kt)("inlineCode",{parentName:"p"},"memo")," is passed to the initial invocation of reduce, the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is not invoked on the first element of the list. The first element is\ninstead passed as the memo in the invocation of the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," on the next element in the list."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-reducer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetReducer"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," - Initial state of the reduction."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"reduce()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<object>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"drop"}),(0,r.kt)("h2",{id:"datasetdrop"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.drop()")),(0,r.kt)("p",null,"Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,r.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>c});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(a),k=i,c=m["".concat(s,".").concat(k)]||m[k]||u[k]||r;return a?n.createElement(c,o(o({ref:t},d),{},{components:a})):n.createElement(c,o({ref:t},d))}));function c(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,o=new Array(r);o[0]=k;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<r;p++)o[p]=a[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,a)}k.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eab91185.d32f9132.js b/assets/js/eab91185.d32f9132.js new file mode 100644 index 0000000000..f77f801c33 --- /dev/null +++ b/assets/js/eab91185.d32f9132.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2299],{80986:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var n=a(87462),i=a(63366),r=(a(67294),a(3905)),o=["components"],l={id:"dataset",title:"Dataset"},s=void 0,p={unversionedId:"api/dataset",id:"version-2.3/api/dataset",title:"Dataset",description:"The Dataset class represents a store for structured data where each object stored has the same attributes, such as online store products or real",source:"@site/versioned_docs/version-2.3/api/Dataset.md",sourceDirName:"api",slug:"/api/dataset",permalink:"/sdk/js/docs/2.3/api/dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Dataset.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"dataset",title:"Dataset"},sidebar:"version-2.3/docs",previous:{title:"Statistics",permalink:"/sdk/js/docs/2.3/api/statistics"},next:{title:"KeyValueStore",permalink:"/sdk/js/docs/2.3/api/key-value-store"}},d={},m=[{value:"<code>dataset.pushData(data)</code>",id:"datasetpushdatadata",level:2},{value:"<code>dataset.getData([options])</code>",id:"datasetgetdataoptions",level:2},{value:"<code>dataset.getInfo()</code>",id:"datasetgetinfo",level:2},{value:"<code>dataset.forEach(iteratee, [options], [index])</code>",id:"datasetforeachiteratee-options-index",level:2},{value:"<code>dataset.map(iteratee, [options])</code>",id:"datasetmapiteratee-options",level:2},{value:"<code>dataset.reduce(iteratee, memo, [options])</code>",id:"datasetreduceiteratee-memo-options",level:2},{value:"<code>dataset.drop()</code>",id:"datasetdrop",level:2}],u={toc:m},k="wrapper";function c(e){var t=e.components,a=(0,i.Z)(e,o);return(0,r.kt)(k,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"dataset"}),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," class represents a store for structured data where each object stored has the same attributes, such as online store products or real\nestate offers. You can imagine it as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can\nonly add new records to it but you cannot modify or remove existing records. Typically it is used to store crawling results."),(0,r.kt)("p",null,"Do not instantiate this class directly, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function instead."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Dataset")," stores its data either on local disk or in the Apify cloud, depending on whether the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment\nvariables are set."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable is set, the data is stored in the local directory in the following files:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/datasets/{DATASET_ID}/{INDEX}.json\n")),(0,r.kt)("p",null,"Note that ",(0,r.kt)("inlineCode",{parentName:"p"},"{DATASET_ID}")," is the name or ID of the dataset. The default dataset has ID: ",(0,r.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the\n",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_DATASET_ID")," environment variable. Each dataset item is stored as a separate JSON file, where ",(0,r.kt)("inlineCode",{parentName:"p"},"{INDEX}")," is a zero-based index of the\nitem in the dataset."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable is set but ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," not, the data is stored in the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/storage/dataset",target:"_blank",rel:"noopener"},"Apify Dataset")," cloud storage. Note that you can force usage of the cloud storage also by passing the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forceCloud")," option to ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))," function, even if the ",(0,r.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," variable is set."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"// Write a single row to the default dataset\nawait Apify.pushData({ col1: 123, col2: 'val2' });\n\n// Open a named dataset\nconst dataset = await Apify.openDataset('some-name');\n\n// Write a single row\nawait dataset.pushData({ foo: 'bar' });\n\n// Write multiple rows\nawait dataset.pushData([{ foo: 'bar2', col2: 'val2' }, { col3: 123 }]);\n")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"pushdata"}),(0,r.kt)("h2",{id:"datasetpushdatadata"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.pushData(data)")),(0,r.kt)("p",null,"Stores an object or an array of objects to the dataset. The function returns a promise that resolves when the operation finishes. It has no result,\nbut throws on invalid args or other errors."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"IMPORTANT"),": Make sure to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"await")," keyword when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()"),", otherwise the actor process might finish before the data is stored!"),(0,r.kt)("p",null,"The size of the data is limited by the receiving API and therefore ",(0,r.kt)("inlineCode",{parentName:"p"},"pushData()")," will only allow objects whose JSON representation is smaller than 9MB.\nWhen an array is passed, none of the included objects may be larger than 9MB, but the array itself may be of any size."),(0,r.kt)("p",null,"The function internally chunks the array into separate items and pushes them sequentially. The chunking process is stable (keeps order of data), but\nit does not provide a transaction safety mechanism. Therefore, in the event of an uploading error (after several automatic retries), the function's\nPromise will reject and the dataset will be left in a state where some of the items have already been saved to the dataset while other items from the\nsource array were not. To overcome this limitation, the developer may, for example, read the last item saved in the dataset and re-attempt the save of\nthe data from this item onwards to prevent duplicates."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"data")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," | ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<object>")," - Object or array of objects containing data to be stored in the default dataset. The objects must be\nserializable to JSON and the JSON representation of each object must be smaller than 9MB.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getdata"}),(0,r.kt)("h2",{id:"datasetgetdataoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getData([options])")),(0,r.kt)("p",null,"Returns ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetContent"))," object holding the items in the dataset based on the provided parameters."),(0,r.kt)("p",null,"If you need to get data in an unparsed format, use the ",(0,r.kt)("a",{parentName:"p",href:"../api/apify#newclient",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Apify.newClient()"))," function to get a new ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-client")," instance and\ncall ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-client-js#DatasetClient+downloadItems",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"datasetClient.downloadItems()"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"getData()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[offset]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Number of array elements that should be skipped at the start."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[limit]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 250000")," - Maximum number of array elements to return."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order. Otherwise they are\nsorted in ascending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - An array of field names that will be included in the result. If omitted, all fields are included in the\nresults."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default,\nthe results are returned as they are."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[clean]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function returns only non-empty items and skips hidden fields (i.e. fields\nstarting with ",(0,r.kt)("inlineCode",{parentName:"li"},"#")," character). Note that the ",(0,r.kt)("inlineCode",{parentName:"li"},"clean")," parameter is a shortcut for ",(0,r.kt)("inlineCode",{parentName:"li"},"skipHidden: true")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"skipEmpty: true")," options."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipHidden]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true"),' then the function doesn\'t return hidden fields (fields starting with "#"\ncharacter).'),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[skipEmpty]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the function doesn't return empty items. Note that in this case the\nreturned number of items might be lower than limit parameter and pagination must be done using the ",(0,r.kt)("inlineCode",{parentName:"li"},"limit")," value.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/dataset-content",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Promise<DatasetContent>"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getinfo"}),(0,r.kt)("h2",{id:"datasetgetinfo"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.getInfo()")),(0,r.kt)("p",null,"Returns an object containing general information about the dataset."),(0,r.kt)("p",null,"The function returns the same object as the Apify API Client's ",(0,r.kt)("a",{parentName:"p",href:"https://docs.apify.com/apify-client-js#datasetclient-get",target:"_blank",rel:"noopener"},"datasetClient.get")," function,\nwhich in turn calls the ",(0,r.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/datasets/dataset/get-dataset",target:"_blank",rel:"noopener"},"Get dataset")," API endpoint."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n id: "WkzbQMuFYuamGv3YF",\n name: "my-dataset",\n userId: "wRsJZtadYvn4mBZmm",\n createdAt: new Date("2015-12-12T07:34:14.202Z"),\n modifiedAt: new Date("2015-12-13T08:36:13.202Z"),\n accessedAt: new Date("2015-12-14T08:36:13.202Z"),\n itemCount: 14,\n cleanItemCount: 10\n}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<object>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"foreach"}),(0,r.kt)("h2",{id:"datasetforeachiteratee-options-index"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.forEach(iteratee, [options], [index])")),(0,r.kt)("p",null,"Iterates over dataset items, yielding each in turn to an ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function. Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," is called with two arguments:\n",(0,r.kt)("inlineCode",{parentName:"p"},"(item, index)"),"."),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the\n",(0,r.kt)("inlineCode",{parentName:"p"},"forEach")," function throws the error."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example usage")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const dataset = await Apify.openDataset('my-results');\nawait dataset.forEach(async (item, index) => {\n console.log(`Item at ${index}: ${JSON.stringify(item)}`);\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-consumer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetConsumer"))," - A function that is called for every item in the dataset."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"forEach()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by ",(0,r.kt)("inlineCode",{parentName:"li"},"createdAt")," in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - If provided then returned objects will only contain specified keys."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field."))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[index]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"number")," ",(0,r.kt)("code",null," = 0")," - Specifies the initial index number passed to the ",(0,r.kt)("inlineCode",{parentName:"li"},"iteratee")," function.")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"map"}),(0,r.kt)("h2",{id:"datasetmapiteratee-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.map(iteratee, [options])")),(0,r.kt)("p",null,"Produces a new array of values by mapping each value in list through a transformation function ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". Each invocation of ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is called\nwith two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"(element, index)"),"."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-mapper",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetMapper"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"map()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<Array<object>>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reduce"}),(0,r.kt)("h2",{id:"datasetreduceiteratee-memo-options"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.reduce(iteratee, memo, [options])")),(0,r.kt)("p",null,"Reduces a list of values down to a single value."),(0,r.kt)("p",null,"Memo is the initial state of the reduction, and each successive step of it should be returned by ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()"),". The ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is passed three\narguments: the ",(0,r.kt)("inlineCode",{parentName:"p"},"memo"),", then the ",(0,r.kt)("inlineCode",{parentName:"p"},"value")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"index")," of the iteration."),(0,r.kt)("p",null,"If no ",(0,r.kt)("inlineCode",{parentName:"p"},"memo")," is passed to the initial invocation of reduce, the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," is not invoked on the first element of the list. The first element is\ninstead passed as the memo in the invocation of the ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," on the next element in the list."),(0,r.kt)("p",null,"If ",(0,r.kt)("inlineCode",{parentName:"p"},"iteratee()")," returns a ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise")," then it's awaited before a next call."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"iteratee")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/dataset-reducer",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"DatasetReducer"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"memo")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"object")," - Initial state of the reduction."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Object")," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"reduce()")," parameters are passed via an options object with the following keys:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[desc]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"boolean")," ",(0,r.kt)("code",null," = false")," - If ",(0,r.kt)("inlineCode",{parentName:"li"},"true")," then the objects are sorted by createdAt in descending order."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[fields]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"Array<string>")," - If provided then returned objects will only contain specified keys"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[unwind]")),": ",(0,r.kt)("inlineCode",{parentName:"li"},"string")," - If provided then objects will be unwound based on provided field.")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<object>")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"drop"}),(0,r.kt)("h2",{id:"datasetdrop"},(0,r.kt)("inlineCode",{parentName:"h2"},"dataset.drop()")),(0,r.kt)("p",null,"Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,r.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>c});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,i=function(e,t){if(null==e)return{};var a,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)a=r[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var s=n.createContext({}),p=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},m="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(a),k=i,c=m["".concat(s,".").concat(k)]||m[k]||u[k]||r;return a?n.createElement(c,o(o({ref:t},d),{},{components:a})):n.createElement(c,o({ref:t},d))}));function c(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,o=new Array(r);o[0]=k;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[m]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<r;p++)o[p]=a[p];return n.createElement.apply(null,o)}return n.createElement.apply(null,a)}k.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eb6ab2a9.e7827eba.js b/assets/js/eb6ab2a9.65be5c96.js similarity index 66% rename from assets/js/eb6ab2a9.e7827eba.js rename to assets/js/eb6ab2a9.65be5c96.js index 61c749438f..3c2e6227d6 100644 --- a/assets/js/eb6ab2a9.e7827eba.js +++ b/assets/js/eb6ab2a9.65be5c96.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7833],{68889:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(67294),r=n(88746),l=n(6141),c=n(6832);const i=function(e){var t=e.to,n=e.children,i=(0,l.E)(),o=i.version,g=i.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var s=o+"/";return"current"===o?s="next/":g&&(s=""),a.createElement(r.default,{to:"/api/"+s+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>i,T:()=>c});var a=n(67294),r=n(88746),l="https://crawlee.dev",c=function(e){var t=e.to,n=e.children,c=e.version;return a.createElement(r.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},n)},i=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},70625:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>I,default:()=>y,frontMatter:()=>d,metadata:()=>p,toc:()=>h});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),c=(n(14563),n(68889)),i=n(26569);const o={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PlaywrightCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Playwright.\nconst crawler = new PlaywrightCrawler({\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.processedRequests.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs"};var g,s=["components"],d={id:"playwright-crawler",title:"Playwright crawler"},I=void 0,p={unversionedId:"examples/playwright-crawler",id:"examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/../docs/examples/playwright_crawler.mdx",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/next/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/playwright_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/next/examples/map-and-reduce"},next:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/next/examples/capture-screenshot"}},u={},h=[],C=(g="RunnableCodeBlock",function(e){return console.warn("Component "+g+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),b={toc:h},m="wrapper";function y(e){var t=e.components,n=(0,r.Z)(e,s);return(0,l.kt)(m,(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"\nin combination with ",(0,l.kt)(c.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," to\nrecursively scrape the ",(0,l.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,l.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(C,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},o))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),g=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=g(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=g(n),p=r,u=d["".concat(o,".").concat(p)]||d[p]||I[p]||l;return n?a.createElement(u,c(c({ref:t},s),{},{components:n})):a.createElement(u,c({ref:t},s))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,c=new Array(l);c[0]=p;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:r,c[1]=i;for(var g=2;g<l;g++)c[g]=n[g];return a.createElement.apply(null,c)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7833],{68889:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(67294),r=n(88746),l=n(6141),c=n(6832);const i=function(e){var t=e.to,n=e.children,i=(0,l.E)(),o=i.version,g=i.isLast;if((0,c.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var s=o+"/";return"current"===o?s="next/":g&&(s=""),a.createElement(r.default,{to:"/api/"+s+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>i,T:()=>c});var a=n(67294),r=n(88746),l="https://crawlee.dev",c=function(e){var t=e.to,n=e.children,c=e.version;return a.createElement(r.default,{href:l+"/api"+(c?"/"+c:"")+"/"+t},n)},i=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},70625:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>I,default:()=>y,frontMatter:()=>d,metadata:()=>p,toc:()=>h});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),c=(n(14563),n(68889)),i=n(26569);const o={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\n// Create an instance of the PlaywrightCrawler class - a crawler\n// that automatically loads the URLs in headless Chrome / Playwright.\nconst crawler = new PlaywrightCrawler({\n launchContext: {\n // Here you can set options that are passed to the playwright .launch() function.\n launchOptions: {\n headless: true,\n },\n },\n\n // Stop crawling after several pages\n maxRequestsPerCrawl: 50,\n\n // This function will be called for each URL to crawl.\n // Here you can write the Playwright scripts you are familiar with,\n // with the exception that browsers and pages are automatically managed by the Apify SDK.\n // The function accepts a single parameter, which is an object with a lot of properties,\n // the most important being:\n // - request: an instance of the Request class with information such as URL and HTTP method\n // - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)\n async requestHandler({ request, page, enqueueLinks }) {\n console.log(`Processing ${request.url}...`);\n\n // A function to be evaluated by Playwright within the browser context.\n const data = await page.$$eval('.athing', ($posts) => {\n const scrapedData = [];\n\n // We're getting the title, rank and URL of each post on Hacker News.\n $posts.forEach(($post) => {\n scrapedData.push({\n title: $post.querySelector('.title a').innerText,\n rank: $post.querySelector('.rank').innerText,\n href: $post.querySelector('.title a').href,\n });\n });\n\n return scrapedData;\n });\n\n // Store the results to the default dataset.\n await Actor.pushData(data);\n\n // Find a link to the next page and enqueue it if it exists.\n const infos = await enqueueLinks({\n selector: '.morelink',\n });\n\n if (infos.processedRequests.length === 0) console.log(`${request.url} is the last page!`);\n },\n\n // This function is called if the page processing failed more than maxRequestRetries+1 times.\n failedRequestHandler({ request }) {\n console.log(`Request ${request.url} failed too many times.`);\n },\n});\n\n// Run the crawler and wait for it to finish.\nawait crawler.run(['https://news.ycombinator.com/']);\n\nconsole.log('Crawler finished.');\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs"};var g,s=["components"],d={id:"playwright-crawler",title:"Playwright crawler"},I=void 0,p={unversionedId:"examples/playwright-crawler",id:"examples/playwright-crawler",title:"Playwright crawler",description:"This example demonstrates how to use PlaywrightCrawler",source:"@site/../docs/examples/playwright_crawler.mdx",sourceDirName:"examples",slug:"/examples/playwright-crawler",permalink:"/sdk/js/docs/next/examples/playwright-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/playwright_crawler.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright-crawler",title:"Playwright crawler"},sidebar:"docs",previous:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/next/examples/map-and-reduce"},next:{title:"Capture a screenshot using Puppeteer",permalink:"/sdk/js/docs/next/examples/capture-screenshot"}},u={},h=[],C=(g="RunnableCodeBlock",function(e){return console.warn("Component "+g+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),b={toc:h},m="wrapper";function y(e){var t=e.components,n=(0,r.Z)(e,s);return(0,l.kt)(m,(0,a.Z)({},b,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example demonstrates how to use ",(0,l.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"\nin combination with ",(0,l.kt)(c.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," to\nrecursively scrape the ",(0,l.kt)("a",{parentName:"p",href:"https://news.ycombinator.com",target:"_blank",rel:"noopener"},"Hacker News website")," using headless Chrome / Playwright."),(0,l.kt)("p",null,"The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results\nare stored to the default dataset. In local configuration, the results are stored as JSON files in ",(0,l.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(C,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},o))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var o=a.createContext({}),g=function(e){var t=a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=g(e.components);return a.createElement(o.Provider,{value:t},e.children)},d="mdxType",I={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=g(n),p=r,u=d["".concat(o,".").concat(p)]||d[p]||I[p]||l;return n?a.createElement(u,c(c({ref:t},s),{},{components:n})):a.createElement(u,c({ref:t},s))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,c=new Array(l);c[0]=p;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:r,c[1]=i;for(var g=2;g<l;g++)c[g]=n[g];return a.createElement.apply(null,c)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eb8556aa.57b16900.js b/assets/js/eb8556aa.57b16900.js new file mode 100644 index 0000000000..b4c65f5bae --- /dev/null +++ b/assets/js/eb8556aa.57b16900.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6659],{1212:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),p=["components"],a={id_old:"version-1.3-post-response",title:"PostResponse",id:"post-response"},i=void 0,l={unversionedId:"typedefs/post-response",id:"version-1.3/typedefs/post-response",title:"PostResponse",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PostResponse.md",sourceDirName:"typedefs",slug:"/typedefs/post-response",permalink:"/sdk/js/docs/1.3/typedefs/post-response",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponse.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-post-response",title:"PostResponse",id:"post-response"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"postresponse"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/post-response-inputs",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PostResponseInputs"))," - Arguments passed to this callback.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(i,".").concat(f)]||u[f]||d[f]||s;return r?n.createElement(m,p(p({ref:t},c),{},{components:r})):n.createElement(m,p({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,p=new Array(s);p[0]=f;var a={};for(var i in t)hasOwnProperty.call(t,i)&&(a[i]=t[i]);a.originalType=e,a[u]="string"==typeof e?e:o,p[1]=a;for(var l=2;l<s;l++)p[l]=r[l];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eb8556aa.f07ddac8.js b/assets/js/eb8556aa.f07ddac8.js deleted file mode 100644 index 55db43ec7d..0000000000 --- a/assets/js/eb8556aa.f07ddac8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6659],{1212:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),s=(r(67294),r(3905)),p=["components"],a={id_old:"version-1.3-post-response",title:"PostResponse",id:"post-response"},i=void 0,l={unversionedId:"typedefs/post-response",id:"version-1.3/typedefs/post-response",title:"PostResponse",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/PostResponse.md",sourceDirName:"typedefs",slug:"/typedefs/post-response",permalink:"/sdk/js/docs/1.3/typedefs/post-response",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponse.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-post-response",title:"PostResponse",id:"post-response"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,p);return(0,s.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,s.kt)("a",{name:"postresponse"}),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,s.kt)("ul",null,(0,s.kt)("li",{parentName:"ul"},(0,s.kt)("strong",{parentName:"li"},(0,s.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,s.kt)("a",{parentName:"li",href:"../typedefs/post-response-inputs",target:null,rel:null},(0,s.kt)("inlineCode",{parentName:"a"},"PostResponseInputs"))," - Arguments passed to this callback.")),(0,s.kt)("p",null,(0,s.kt)("strong",{parentName:"p"},"Returns"),":"),(0,s.kt)("p",null,(0,s.kt)("inlineCode",{parentName:"p"},"void")," ","|"," ",(0,s.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,s.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),l=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,i=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(i,".").concat(f)]||u[f]||d[f]||s;return r?n.createElement(m,p(p({ref:t},c),{},{components:r})):n.createElement(m,p({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,p=new Array(s);p[0]=f;var a={};for(var i in t)hasOwnProperty.call(t,i)&&(a[i]=t[i]);a.originalType=e,a[u]="string"==typeof e?e:o,p[1]=a;for(var l=2;l<s;l++)p[l]=r[l];return n.createElement.apply(null,p)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ed3555df.54743de7.js b/assets/js/ed3555df.54743de7.js deleted file mode 100644 index 664f2b0187..0000000000 --- a/assets/js/ed3555df.54743de7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2503],{75076:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var a=n(87462),s=n(63366),r=(n(67294),n(3905)),o=["components"],l={id:"system-status",title:"SystemStatus"},i=void 0,p={unversionedId:"api/system-status",id:"version-2.3/api/system-status",title:"SystemStatus",description:"Provides a simple interface to reading system status from a Snapshotter instance. It only exposes two functions",source:"@site/versioned_docs/version-2.3/api/SystemStatus.md",sourceDirName:"api",slug:"/api/system-status",permalink:"/sdk/js/docs/2.3/api/system-status",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SystemStatus.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"system-status",title:"SystemStatus"},sidebar:"version-2.3/docs",previous:{title:"Snapshotter",permalink:"/sdk/js/docs/2.3/api/snapshotter"},next:{title:"Request",permalink:"/sdk/js/docs/2.3/api/request"}},u={},m=[{value:"<code>new SystemStatus([options])</code>",id:"new-systemstatusoptions",level:2},{value:"<code>systemStatus.getCurrentStatus()</code>",id:"systemstatusgetcurrentstatus",level:2},{value:"<code>systemStatus.getHistoricalStatus()</code>",id:"systemstatusgethistoricalstatus",level:2}],c={toc:m},d="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,o);return(0,r.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("p",null,"Provides a simple interface to reading system status from a ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance. It only exposes two functions\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," and\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()")),". The system status is calculated using a weighted average of\noverloaded messages in the snapshots, with the weights being the time intervals between the snapshots. Each resource is calculated separately and the\nsystem is overloaded whenever at least one resource is overloaded. The class is used by the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," returns a boolean that represents the current status of the system. The\nlength of the current timeframe in seconds is configurable by the ",(0,r.kt)("inlineCode",{parentName:"p"},"currentHistorySecs")," option and represents the max age of snapshots to be considered\nfor the calculation."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()"))," returns a boolean that represents the long-term status of the system.\nIt considers the full snapshot history available in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance."),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("h2",{id:"new-systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new SystemStatus([options])")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"SystemStatus")," configuration options.")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getcurrentstatus"}),(0,r.kt)("h2",{id:"systemstatusgetcurrentstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getCurrentStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the last ",(0,r.kt)("inlineCode",{parentName:"p"},"options.currentHistorySecs")," seconds, and ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),"\notherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"gethistoricalstatus"}),(0,r.kt)("h2",{id:"systemstatusgethistoricalstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getHistoricalStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the full history of the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),"\n(which is configurable in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),") and ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," otherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var a=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,s=function(e,t){if(null==e)return{};var n,a,s={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=p(n),d=s,y=m["".concat(i,".").concat(d)]||m[d]||c[d]||r;return n?a.createElement(y,o(o({ref:t},u),{},{components:n})):a.createElement(y,o({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[m]="string"==typeof e?e:s,o[1]=l;for(var p=2;p<r;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ed3555df.da43292b.js b/assets/js/ed3555df.da43292b.js new file mode 100644 index 0000000000..e03d591ec4 --- /dev/null +++ b/assets/js/ed3555df.da43292b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2503],{75076:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>y,frontMatter:()=>l,metadata:()=>p,toc:()=>m});var a=n(87462),s=n(63366),r=(n(67294),n(3905)),o=["components"],l={id:"system-status",title:"SystemStatus"},i=void 0,p={unversionedId:"api/system-status",id:"version-2.3/api/system-status",title:"SystemStatus",description:"Provides a simple interface to reading system status from a Snapshotter instance. It only exposes two functions",source:"@site/versioned_docs/version-2.3/api/SystemStatus.md",sourceDirName:"api",slug:"/api/system-status",permalink:"/sdk/js/docs/2.3/api/system-status",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SystemStatus.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"system-status",title:"SystemStatus"},sidebar:"version-2.3/docs",previous:{title:"Snapshotter",permalink:"/sdk/js/docs/2.3/api/snapshotter"},next:{title:"Request",permalink:"/sdk/js/docs/2.3/api/request"}},u={},m=[{value:"<code>new SystemStatus([options])</code>",id:"new-systemstatusoptions",level:2},{value:"<code>systemStatus.getCurrentStatus()</code>",id:"systemstatusgetcurrentstatus",level:2},{value:"<code>systemStatus.getHistoricalStatus()</code>",id:"systemstatusgethistoricalstatus",level:2}],c={toc:m},d="wrapper";function y(e){var t=e.components,n=(0,s.Z)(e,o);return(0,r.kt)(d,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("p",null,"Provides a simple interface to reading system status from a ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance. It only exposes two functions\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," and\n",(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()")),". The system status is calculated using a weighted average of\noverloaded messages in the snapshots, with the weights being the time intervals between the snapshots. Each resource is calculated separately and the\nsystem is overloaded whenever at least one resource is overloaded. The class is used by the ",(0,r.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#getcurrentstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getCurrentStatus()"))," returns a boolean that represents the current status of the system. The\nlength of the current timeframe in seconds is configurable by the ",(0,r.kt)("inlineCode",{parentName:"p"},"currentHistorySecs")," option and represents the max age of snapshots to be considered\nfor the calculation."),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../api/system-status#gethistoricalstatus",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatus.getHistoricalStatus()"))," returns a boolean that represents the long-term status of the system.\nIt considers the full snapshot history available in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter"))," instance."),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"systemstatus"}),(0,r.kt)("h2",{id:"new-systemstatusoptions"},(0,r.kt)("inlineCode",{parentName:"h2"},"new SystemStatus([options])")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,r.kt)("a",{parentName:"li",href:"../typedefs/system-status-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemStatusOptions"))," - All ",(0,r.kt)("inlineCode",{parentName:"li"},"SystemStatus")," configuration options.")),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"getcurrentstatus"}),(0,r.kt)("h2",{id:"systemstatusgetcurrentstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getCurrentStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the last ",(0,r.kt)("inlineCode",{parentName:"p"},"options.currentHistorySecs")," seconds, and ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),"\notherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"gethistoricalstatus"}),(0,r.kt)("h2",{id:"systemstatusgethistoricalstatus"},(0,r.kt)("inlineCode",{parentName:"h2"},"systemStatus.getHistoricalStatus()")),(0,r.kt)("p",null,"Returns an ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))," object with the following structure:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n isSystemIdle: Boolean,\n memInfo: Object,\n eventLoopInfo: Object,\n cpuInfo: Object\n}\n")),(0,r.kt)("p",null,"Where the ",(0,r.kt)("inlineCode",{parentName:"p"},"isSystemIdle")," property is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," if the system has been overloaded in the full history of the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),"\n(which is configurable in the ",(0,r.kt)("a",{parentName:"p",href:"../api/snapshotter",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Snapshotter")),") and ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," otherwise."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/system-info",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SystemInfo"))),(0,r.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>y});var a=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,s=function(e,t){if(null==e)return{};var n,a,s={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=p(n),d=s,y=m["".concat(i,".").concat(d)]||m[d]||c[d]||r;return n?a.createElement(y,o(o({ref:t},u),{},{components:n})):a.createElement(y,o({ref:t},u))}));function y(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[m]="string"==typeof e?e:s,o[1]=l;for(var p=2;p<r;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eeab08e0.0aa3f4dc.js b/assets/js/eeab08e0.0aa3f4dc.js new file mode 100644 index 0000000000..e5ea20cae6 --- /dev/null +++ b/assets/js/eeab08e0.0aa3f4dc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5123],{93922:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-session-state",title:"SessionState",id:"session-state"},l=void 0,p={unversionedId:"typedefs/session-state",id:"version-1.3/typedefs/session-state",title:"SessionState",description:"Persistable Session state.",source:"@site/versioned_docs/version-1.3/typedefs/SessionState.md",sourceDirName:"typedefs",slug:"/typedefs/session-state",permalink:"/sdk/js/docs/1.3/typedefs/session-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionState.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-session-state",title:"SessionState",id:"session-state"},sidebar:"version-1.3/docs",previous:{title:"RequestListState",permalink:"/sdk/js/docs/1.3/typedefs/request-list-state"},next:{title:"SocialHandles",permalink:"/sdk/js/docs/1.3/typedefs/social-handles"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>id</code>",id:"id",level:3},{value:"<code>cookieJar</code>",id:"cookiejar",level:3},{value:"<code>userData</code>",id:"userdata",level:3},{value:"<code>errorScore</code>",id:"errorscore",level:3},{value:"<code>maxErrorScore</code>",id:"maxerrorscore",level:3},{value:"<code>errorScoreDecrement</code>",id:"errorscoredecrement",level:3},{value:"<code>usageCount</code>",id:"usagecount",level:3},{value:"<code>expiresAt</code>",id:"expiresat",level:3},{value:"<code>createdAt</code>",id:"createdat",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"sessionstate"}),(0,a.kt)("p",null,"Persistable ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," state."),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"cookiejar"},(0,a.kt)("inlineCode",{parentName:"h3"},"cookieJar")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"CookieJar")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userdata"},(0,a.kt)("inlineCode",{parentName:"h3"},"userData")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"object")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"errorscore"},(0,a.kt)("inlineCode",{parentName:"h3"},"errorScore")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxerrorscore"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"errorscoredecrement"},(0,a.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usagecount"},(0,a.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"expiresat"},(0,a.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||a;return r?n.createElement(k,i(i({ref:t},d),{},{components:r})):n.createElement(k,i({ref:t},d))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eeab08e0.841d2298.js b/assets/js/eeab08e0.841d2298.js deleted file mode 100644 index aec5bb7ed9..0000000000 --- a/assets/js/eeab08e0.841d2298.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5123],{93922:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id_old:"version-1.3-session-state",title:"SessionState",id:"session-state"},l=void 0,p={unversionedId:"typedefs/session-state",id:"version-1.3/typedefs/session-state",title:"SessionState",description:"Persistable Session state.",source:"@site/versioned_docs/version-1.3/typedefs/SessionState.md",sourceDirName:"typedefs",slug:"/typedefs/session-state",permalink:"/sdk/js/docs/1.3/typedefs/session-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionState.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-session-state",title:"SessionState",id:"session-state"},sidebar:"version-1.3/docs",previous:{title:"RequestListState",permalink:"/sdk/js/docs/1.3/typedefs/request-list-state"},next:{title:"SocialHandles",permalink:"/sdk/js/docs/1.3/typedefs/social-handles"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>id</code>",id:"id",level:3},{value:"<code>cookieJar</code>",id:"cookiejar",level:3},{value:"<code>userData</code>",id:"userdata",level:3},{value:"<code>errorScore</code>",id:"errorscore",level:3},{value:"<code>maxErrorScore</code>",id:"maxerrorscore",level:3},{value:"<code>errorScoreDecrement</code>",id:"errorscoredecrement",level:3},{value:"<code>usageCount</code>",id:"usagecount",level:3},{value:"<code>expiresAt</code>",id:"expiresat",level:3},{value:"<code>createdAt</code>",id:"createdat",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"sessionstate"}),(0,a.kt)("p",null,"Persistable ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," state."),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"cookiejar"},(0,a.kt)("inlineCode",{parentName:"h3"},"cookieJar")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"CookieJar")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userdata"},(0,a.kt)("inlineCode",{parentName:"h3"},"userData")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"object")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"errorscore"},(0,a.kt)("inlineCode",{parentName:"h3"},"errorScore")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxerrorscore"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"errorscoredecrement"},(0,a.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usagecount"},(0,a.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"expiresat"},(0,a.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||a;return r?n.createElement(k,i(i({ref:t},d),{},{components:r})):n.createElement(k,i({ref:t},d))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eeaf0494.661ebee1.js b/assets/js/eeaf0494.661ebee1.js new file mode 100644 index 0000000000..9920a0a77a --- /dev/null +++ b/assets/js/eeaf0494.661ebee1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9304],{86957:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-browser-handle-page-function",title:"BrowserHandlePageFunction",id:"browser-handle-page-function"},p=void 0,s={unversionedId:"typedefs/browser-handle-page-function",id:"version-1.3/typedefs/browser-handle-page-function",title:"BrowserHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/BrowserHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/browser-handle-page-function",permalink:"/sdk/js/docs/1.3/typedefs/browser-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserHandlePageFunction.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-browser-handle-page-function",title:"BrowserHandlePageFunction",id:"browser-handle-page-function"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,n=(0,o.Z)(e,i);return(0,a.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"browserhandlepagefunction"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,a.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),f=o,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:o,i[1]=l;for(var s=2;s<a;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/eeaf0494.7a95bc48.js b/assets/js/eeaf0494.7a95bc48.js deleted file mode 100644 index a95c051d6c..0000000000 --- a/assets/js/eeaf0494.7a95bc48.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9304],{86957:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),i=["components"],l={id_old:"version-1.3-browser-handle-page-function",title:"BrowserHandlePageFunction",id:"browser-handle-page-function"},p=void 0,s={unversionedId:"typedefs/browser-handle-page-function",id:"version-1.3/typedefs/browser-handle-page-function",title:"BrowserHandlePageFunction",description:"Parameters:",source:"@site/versioned_docs/version-1.3/typedefs/BrowserHandlePageFunction.md",sourceDirName:"typedefs",slug:"/typedefs/browser-handle-page-function",permalink:"/sdk/js/docs/1.3/typedefs/browser-handle-page-function",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserHandlePageFunction.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-browser-handle-page-function",title:"BrowserHandlePageFunction",id:"browser-handle-page-function"}},c={},u=[],d={toc:u},f="wrapper";function m(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"browserhandlepagefunction"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"context")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/browser-crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"BrowserCrawlingContext"))," | ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/crawling-context",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CrawlingContext")))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||o;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f05eaad1.37af536b.js b/assets/js/f05eaad1.37af536b.js deleted file mode 100644 index 445ea7fd30..0000000000 --- a/assets/js/f05eaad1.37af536b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1308],{50419:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>k,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),p=r(63366),o=(r(67294),r(3905)),a=["components"],l={id_old:"version-1.3-puppeteer-pool",title:"PuppeteerPool",id:"puppeteer-pool"},i=void 0,s={unversionedId:"api/puppeteer-pool",id:"version-1.3/api/puppeteer-pool",title:"PuppeteerPool",description:"Manages a pool of Chrome browser instances controlled using Puppeteer.",source:"@site/versioned_docs/version-1.3/api/PuppeteerPool.md",sourceDirName:"api",slug:"/api/puppeteer-pool",permalink:"/sdk/js/docs/1.3/api/puppeteer-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerPool.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-pool",title:"PuppeteerPool",id:"puppeteer-pool"}},u={},c=[{value:"<code>new PuppeteerPool([options])</code>",id:"new-puppeteerpooloptions",level:2},{value:"<code>puppeteerPool.newPage()</code>",id:"puppeteerpoolnewpage",level:2},{value:"<code>puppeteerPool.destroy()</code>",id:"puppeteerpooldestroy",level:2},{value:"<code>puppeteerPool.retire(browser)</code>",id:"puppeteerpoolretirebrowser",level:2},{value:"<code>puppeteerPool.recyclePage(page)</code>",id:"puppeteerpoolrecyclepagepage",level:2},{value:"<code>puppeteerPool.serveLiveViewSnapshot(page)</code>",id:"puppeteerpoolserveliveviewsnapshotpage",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,r=(0,p.Z)(e,a);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"puppeteerpool"}),(0,o.kt)("p",null,"Manages a pool of Chrome browser instances controlled using ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),"."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," reuses Chrome instances and tabs using specific browser rotation and retirement policies. This is useful in order to facilitate\nrotation of proxies, cookies or other settings in order to prevent detection of your web scraping bot, access web pages from various countries etc."),(0,o.kt)("p",null,"Additionally, the reuse of browser instances instances speeds up crawling, and the retirement of instances helps mitigate effects of memory leaks in\nChrome."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," is internally used by the ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," class."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const puppeteerPool = new PuppeteerPool({\n launchPuppeteerOptions: {\n // Use Chrome instead of Chromium\n useChrome: true,\n // Hide from bot detection\n stealth: true,\n },\n});\n\nconst page1 = await puppeteerPool.newPage();\nconst page2 = await puppeteerPool.newPage();\n\n// ... do something with the pages ...\n\n// Close all browsers.\nawait puppeteerPool.destroy();\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"puppeteerpool"}),(0,o.kt)("h2",{id:"new-puppeteerpooloptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"new PuppeteerPool([options])")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerPoolOptions"))," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"PuppeteerPool")," parameters are passed via an options object.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"newpage"}),(0,o.kt)("h2",{id:"puppeteerpoolnewpage"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.newPage()")),(0,o.kt)("p",null,"Produces a new page instance either by reusing an idle page that currently isn't processing any request or by spawning a new page (new browser tab) in\none of the available browsers when no idle pages are available."),(0,o.kt)("p",null,"To spawn a new browser tab for each page, set the ",(0,o.kt)("inlineCode",{parentName:"p"},"reusePages")," constructor option to false."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<Page>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"destroy"}),(0,o.kt)("h2",{id:"puppeteerpooldestroy"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.destroy()")),(0,o.kt)("p",null,"Closes all open browsers."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"retire"}),(0,o.kt)("h2",{id:"puppeteerpoolretirebrowser"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.retire(browser)")),(0,o.kt)("p",null,"Manually retires a Puppeteer ",(0,o.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-browser",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Browser"))," instance from the pool. The browser will\ncontinue to process open pages so that they may gracefully finish. This is unlike ",(0,o.kt)("inlineCode",{parentName:"p"},"browser.close()")," which will forcibly terminate the browser and all\nopen pages will be closed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"browser")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Browser"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"recyclepage"}),(0,o.kt)("h2",{id:"puppeteerpoolrecyclepagepage"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.recyclePage(page)")),(0,o.kt)("p",null,"Closes the page, unless the ",(0,o.kt)("inlineCode",{parentName:"p"},"reuseTabs")," option is set to true. Then it would only flag the page for a future reuse, without actually closing it."),(0,o.kt)("p",null,"NOTE: LiveView snapshotting is tied to this function. When ",(0,o.kt)("inlineCode",{parentName:"p"},"useLiveView")," option is set to true, a snapshot of the page will be taken just before\nclosing the page or flagging it for reuse."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Page"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"serveliveviewsnapshot"}),(0,o.kt)("h2",{id:"puppeteerpoolserveliveviewsnapshotpage"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.serveLiveViewSnapshot(page)")),(0,o.kt)("p",null,"Tells the connected LiveViewServer to serve a snapshot when available."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Page"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(67294);function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,p=function(e,t){if(null==e)return{};var r,n,p={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(p[r]=e[r]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(p[r]=e[r])}return p}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,p=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(r),m=p,k=c["".concat(i,".").concat(m)]||c[m]||d[m]||o;return r?n.createElement(k,a(a({ref:t},u),{},{components:r})):n.createElement(k,a({ref:t},u))}));function k(e,t){var r=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var o=r.length,a=new Array(o);a[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[c]="string"==typeof e?e:p,a[1]=l;for(var s=2;s<o;s++)a[s]=r[s];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f05eaad1.c1263122.js b/assets/js/f05eaad1.c1263122.js new file mode 100644 index 0000000000..be41d0e8df --- /dev/null +++ b/assets/js/f05eaad1.c1263122.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1308],{50419:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>k,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),p=r(63366),o=(r(67294),r(3905)),a=["components"],l={id_old:"version-1.3-puppeteer-pool",title:"PuppeteerPool",id:"puppeteer-pool"},i=void 0,s={unversionedId:"api/puppeteer-pool",id:"version-1.3/api/puppeteer-pool",title:"PuppeteerPool",description:"Manages a pool of Chrome browser instances controlled using Puppeteer.",source:"@site/versioned_docs/version-1.3/api/PuppeteerPool.md",sourceDirName:"api",slug:"/api/puppeteer-pool",permalink:"/sdk/js/docs/1.3/api/puppeteer-pool",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerPool.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-pool",title:"PuppeteerPool",id:"puppeteer-pool"}},u={},c=[{value:"<code>new PuppeteerPool([options])</code>",id:"new-puppeteerpooloptions",level:2},{value:"<code>puppeteerPool.newPage()</code>",id:"puppeteerpoolnewpage",level:2},{value:"<code>puppeteerPool.destroy()</code>",id:"puppeteerpooldestroy",level:2},{value:"<code>puppeteerPool.retire(browser)</code>",id:"puppeteerpoolretirebrowser",level:2},{value:"<code>puppeteerPool.recyclePage(page)</code>",id:"puppeteerpoolrecyclepagepage",level:2},{value:"<code>puppeteerPool.serveLiveViewSnapshot(page)</code>",id:"puppeteerpoolserveliveviewsnapshotpage",level:2}],d={toc:c},m="wrapper";function k(e){var t=e.components,r=(0,p.Z)(e,a);return(0,o.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"puppeteerpool"}),(0,o.kt)("p",null,"Manages a pool of Chrome browser instances controlled using ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),"."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," reuses Chrome instances and tabs using specific browser rotation and retirement policies. This is useful in order to facilitate\nrotation of proxies, cookies or other settings in order to prevent detection of your web scraping bot, access web pages from various countries etc."),(0,o.kt)("p",null,"Additionally, the reuse of browser instances instances speeds up crawling, and the retirement of instances helps mitigate effects of memory leaks in\nChrome."),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," is internally used by the ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler"))," class."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example usage:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const puppeteerPool = new PuppeteerPool({\n launchPuppeteerOptions: {\n // Use Chrome instead of Chromium\n useChrome: true,\n // Hide from bot detection\n stealth: true,\n },\n});\n\nconst page1 = await puppeteerPool.newPage();\nconst page2 = await puppeteerPool.newPage();\n\n// ... do something with the pages ...\n\n// Close all browsers.\nawait puppeteerPool.destroy();\n")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"puppeteerpool"}),(0,o.kt)("h2",{id:"new-puppeteerpooloptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"new PuppeteerPool([options])")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-pool-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerPoolOptions"))," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"PuppeteerPool")," parameters are passed via an options object.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"newpage"}),(0,o.kt)("h2",{id:"puppeteerpoolnewpage"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.newPage()")),(0,o.kt)("p",null,"Produces a new page instance either by reusing an idle page that currently isn't processing any request or by spawning a new page (new browser tab) in\none of the available browsers when no idle pages are available."),(0,o.kt)("p",null,"To spawn a new browser tab for each page, set the ",(0,o.kt)("inlineCode",{parentName:"p"},"reusePages")," constructor option to false."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<Page>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"destroy"}),(0,o.kt)("h2",{id:"puppeteerpooldestroy"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.destroy()")),(0,o.kt)("p",null,"Closes all open browsers."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"retire"}),(0,o.kt)("h2",{id:"puppeteerpoolretirebrowser"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.retire(browser)")),(0,o.kt)("p",null,"Manually retires a Puppeteer ",(0,o.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-class-browser",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Browser"))," instance from the pool. The browser will\ncontinue to process open pages so that they may gracefully finish. This is unlike ",(0,o.kt)("inlineCode",{parentName:"p"},"browser.close()")," which will forcibly terminate the browser and all\nopen pages will be closed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"browser")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Browser"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"recyclepage"}),(0,o.kt)("h2",{id:"puppeteerpoolrecyclepagepage"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.recyclePage(page)")),(0,o.kt)("p",null,"Closes the page, unless the ",(0,o.kt)("inlineCode",{parentName:"p"},"reuseTabs")," option is set to true. Then it would only flag the page for a future reuse, without actually closing it."),(0,o.kt)("p",null,"NOTE: LiveView snapshotting is tied to this function. When ",(0,o.kt)("inlineCode",{parentName:"p"},"useLiveView")," option is set to true, a snapshot of the page will be taken just before\nclosing the page or flagging it for reuse."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Page"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"serveliveviewsnapshot"}),(0,o.kt)("h2",{id:"puppeteerpoolserveliveviewsnapshotpage"},(0,o.kt)("inlineCode",{parentName:"h2"},"puppeteerPool.serveLiveViewSnapshot(page)")),(0,o.kt)("p",null,"Tells the connected LiveViewServer to serve a snapshot when available."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Page"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>k});var n=r(67294);function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,p=function(e,t){if(null==e)return{};var r,n,p={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(p[r]=e[r]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(p[r]=e[r])}return p}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,p=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=s(r),m=p,k=c["".concat(i,".").concat(m)]||c[m]||d[m]||o;return r?n.createElement(k,a(a({ref:t},u),{},{components:r})):n.createElement(k,a({ref:t},u))}));function k(e,t){var r=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var o=r.length,a=new Array(o);a[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l[c]="string"==typeof e?e:p,a[1]=l;for(var s=2;s<o;s++)a[s]=r[s];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f151444f.49be28ab.js b/assets/js/f151444f.49be28ab.js new file mode 100644 index 0000000000..8557ca22fa --- /dev/null +++ b/assets/js/f151444f.49be28ab.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9471],{57760:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),i=["components"],s={id:"session-state",title:"SessionState"},l=void 0,p={unversionedId:"typedefs/session-state",id:"version-2.3/typedefs/session-state",title:"SessionState",description:"Persistable Session state.",source:"@site/versioned_docs/version-2.3/typedefs/SessionState.md",sourceDirName:"typedefs",slug:"/typedefs/session-state",permalink:"/sdk/js/docs/2.3/typedefs/session-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionState.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"session-state",title:"SessionState"},sidebar:"version-2.3/docs",previous:{title:"RequestListState",permalink:"/sdk/js/docs/2.3/typedefs/request-list-state"},next:{title:"SocialHandles",permalink:"/sdk/js/docs/2.3/typedefs/social-handles"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>id</code>",id:"id",level:3},{value:"<code>cookieJar</code>",id:"cookiejar",level:3},{value:"<code>userData</code>",id:"userdata",level:3},{value:"<code>errorScore</code>",id:"errorscore",level:3},{value:"<code>maxErrorScore</code>",id:"maxerrorscore",level:3},{value:"<code>errorScoreDecrement</code>",id:"errorscoredecrement",level:3},{value:"<code>usageCount</code>",id:"usagecount",level:3},{value:"<code>expiresAt</code>",id:"expiresat",level:3},{value:"<code>createdAt</code>",id:"createdat",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,r=(0,o.Z)(e,i);return(0,a.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"sessionstate"}),(0,a.kt)("p",null,"Persistable ",(0,a.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Session"))," state."),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"id"},(0,a.kt)("inlineCode",{parentName:"h3"},"id")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"cookiejar"},(0,a.kt)("inlineCode",{parentName:"h3"},"cookieJar")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"CookieJar")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"userdata"},(0,a.kt)("inlineCode",{parentName:"h3"},"userData")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"object")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"errorscore"},(0,a.kt)("inlineCode",{parentName:"h3"},"errorScore")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxerrorscore"},(0,a.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"errorscoredecrement"},(0,a.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usagecount"},(0,a.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"expiresat"},(0,a.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"createdat"},(0,a.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=o,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||a;return r?n.createElement(k,i(i({ref:t},d),{},{components:r})):n.createElement(k,i({ref:t},d))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:o,i[1]=s;for(var p=2;p<a;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f151444f.be3b7bd2.js b/assets/js/f151444f.be3b7bd2.js deleted file mode 100644 index 77d1839f88..0000000000 --- a/assets/js/f151444f.be3b7bd2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9471],{57760:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>k,frontMatter:()=>s,metadata:()=>p,toc:()=>c});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],s={id:"session-state",title:"SessionState"},l=void 0,p={unversionedId:"typedefs/session-state",id:"version-2.3/typedefs/session-state",title:"SessionState",description:"Persistable Session state.",source:"@site/versioned_docs/version-2.3/typedefs/SessionState.md",sourceDirName:"typedefs",slug:"/typedefs/session-state",permalink:"/sdk/js/docs/2.3/typedefs/session-state",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionState.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"session-state",title:"SessionState"},sidebar:"version-2.3/docs",previous:{title:"RequestListState",permalink:"/sdk/js/docs/2.3/typedefs/request-list-state"},next:{title:"SocialHandles",permalink:"/sdk/js/docs/2.3/typedefs/social-handles"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>id</code>",id:"id",level:3},{value:"<code>cookieJar</code>",id:"cookiejar",level:3},{value:"<code>userData</code>",id:"userdata",level:3},{value:"<code>errorScore</code>",id:"errorscore",level:3},{value:"<code>maxErrorScore</code>",id:"maxerrorscore",level:3},{value:"<code>errorScoreDecrement</code>",id:"errorscoredecrement",level:3},{value:"<code>usageCount</code>",id:"usagecount",level:3},{value:"<code>expiresAt</code>",id:"expiresat",level:3},{value:"<code>createdAt</code>",id:"createdat",level:3}],u={toc:c},m="wrapper";function k(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"sessionstate"}),(0,o.kt)("p",null,"Persistable ",(0,o.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Session"))," state."),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"id"},(0,o.kt)("inlineCode",{parentName:"h3"},"id")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"cookiejar"},(0,o.kt)("inlineCode",{parentName:"h3"},"cookieJar")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"CookieJar")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"userdata"},(0,o.kt)("inlineCode",{parentName:"h3"},"userData")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"object")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"errorscore"},(0,o.kt)("inlineCode",{parentName:"h3"},"errorScore")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxerrorscore"},(0,o.kt)("inlineCode",{parentName:"h3"},"maxErrorScore")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"errorscoredecrement"},(0,o.kt)("inlineCode",{parentName:"h3"},"errorScoreDecrement")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"usagecount"},(0,o.kt)("inlineCode",{parentName:"h3"},"usageCount")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"expiresat"},(0,o.kt)("inlineCode",{parentName:"h3"},"expiresAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"createdat"},(0,o.kt)("inlineCode",{parentName:"h3"},"createdAt")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Type"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>k});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,k=c["".concat(l,".").concat(m)]||c[m]||u[m]||o;return r?n.createElement(k,i(i({ref:t},d),{},{components:r})):n.createElement(k,i({ref:t},d))}));function k(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[c]="string"==typeof e?e:a,i[1]=s;for(var p=2;p<o;p++)i[p]=r[p];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f192608e.772248b3.js b/assets/js/f192608e.772248b3.js deleted file mode 100644 index 8e2c3bec0f..0000000000 --- a/assets/js/f192608e.772248b3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3049],{9713:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id:"cheerio-handle-page",title:"CheerioHandlePage"},s=void 0,l={unversionedId:"typedefs/cheerio-handle-page",id:"version-2.3/typedefs/cheerio-handle-page",title:"CheerioHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/CheerioHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePage.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"cheerio-handle-page",title:"CheerioHandlePage"},sidebar:"version-2.3/docs",previous:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/2.3/typedefs/system-status-options"},next:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepage"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/cheerio-handle-page-inputs",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioHandlePageInputs"))," - Arguments passed to this callback.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var l=2;l<o;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f192608e.ac0ebb34.js b/assets/js/f192608e.ac0ebb34.js new file mode 100644 index 0000000000..105bf06fa3 --- /dev/null +++ b/assets/js/f192608e.ac0ebb34.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3049],{9713:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>p,metadata:()=>l,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={id:"cheerio-handle-page",title:"CheerioHandlePage"},s=void 0,l={unversionedId:"typedefs/cheerio-handle-page",id:"version-2.3/typedefs/cheerio-handle-page",title:"CheerioHandlePage",description:"Parameters:",source:"@site/versioned_docs/version-2.3/typedefs/CheerioHandlePage.md",sourceDirName:"typedefs",slug:"/typedefs/cheerio-handle-page",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePage.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"cheerio-handle-page",title:"CheerioHandlePage"},sidebar:"version-2.3/docs",previous:{title:"SystemStatusOptions",permalink:"/sdk/js/docs/2.3/typedefs/system-status-options"},next:{title:"CheerioHandlePageInputs",permalink:"/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"}},c={},d=[],u={toc:d},f="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(f,(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"cheeriohandlepage"}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"inputs")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/cheerio-handle-page-inputs",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioHandlePageInputs"))," - Arguments passed to this callback.")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(r),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||o;return r?n.createElement(m,i(i({ref:t},c),{},{components:r})):n.createElement(m,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=f;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var l=2;l<o;l++)i[l]=r[l];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f246170c.155543d4.js b/assets/js/f246170c.155543d4.js new file mode 100644 index 0000000000..bd616d07be --- /dev/null +++ b/assets/js/f246170c.155543d4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9921],{68889:(e,r,t)=>{t.d(r,{Z:()=>p});var n=t(67294),a=t(88746),c=t(6141),o=t(6832);const p=function(e){var r=e.to,t=e.children,p=(0,c.E)(),l=p.version,i=p.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+r},t);var u=l+"/";return"current"===l?u="next/":i&&(u=""),n.createElement(a.default,{to:"/api/"+u+r},t)}},26569:(e,r,t)=>{t.d(r,{B:()=>p,T:()=>o});var n=t(67294),a=t(88746),c="https://crawlee.dev",o=function(e){var r=e.to,t=e.children,o=e.version;return n.createElement(a.default,{href:c+"/api"+(o?"/"+o:"")+"/"+r},t)},p=function(e){var r=e.to,t=e.children;return n.createElement(a.default,{href:c+"/"+r},t)}},19161:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>m,contentTitle:()=>s,default:()=>g,frontMatter:()=>u,metadata:()=>d,toc:()=>f});var n=t(87462),a=t(63366),c=(t(67294),t(3905)),o=(t(14563),t(68889),t(26569));const p={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page, enqueueLinks }) {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n await enqueueLinks({\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n});\n\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE"};var l,i=["components"],u={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},s=void 0,d={unversionedId:"examples/puppeteer-recursive-crawl",id:"examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/../docs/examples/puppeteer_recursive_crawl.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/next/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_recursive_crawl.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/next/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/next/examples/puppeteer-with-proxy"}},m={},f=[],y=(l="RunnableCodeBlock",function(e){return console.warn("Component "+l+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:f},w="wrapper";function g(e){var r=e.components,t=(0,a.Z)(e,i);return(0,c.kt)(w,(0,n.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,c.kt)(o.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(y,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},p))}g.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>f});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function p(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),i=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},u=function(e){var r=i(e.components);return n.createElement(l.Provider,{value:r},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,c=e.originalType,l=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=i(t),m=a,f=s["".concat(l,".").concat(m)]||s[m]||d[m]||c;return t?n.createElement(f,o(o({ref:r},u),{},{components:t})):n.createElement(f,o({ref:r},u))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var c=t.length,o=new Array(c);o[0]=m;var p={};for(var l in r)hasOwnProperty.call(r,l)&&(p[l]=r[l]);p.originalType=e,p[s]="string"==typeof e?e:a,o[1]=p;for(var i=2;i<c;i++)o[i]=t[i];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f246170c.d8e2283a.js b/assets/js/f246170c.d8e2283a.js deleted file mode 100644 index 8ac1a66759..0000000000 --- a/assets/js/f246170c.d8e2283a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9921],{68889:(e,r,t)=>{t.d(r,{Z:()=>o});var n=t(67294),a=t(88746),c=t(6141),p=t(6832);const o=function(e){var r=e.to,t=e.children,o=(0,c.E)(),l=o.version,i=o.isLast;if((0,p.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+r},t);var u=l+"/";return"current"===l?u="next/":i&&(u=""),n.createElement(a.default,{to:"/api/"+u+r},t)}},26569:(e,r,t)=>{t.d(r,{B:()=>o,T:()=>p});var n=t(67294),a=t(88746),c="https://crawlee.dev",p=function(e){var r=e.to,t=e.children,p=e.version;return n.createElement(a.default,{href:c+"/api"+(p?"/"+p:"")+"/"+r},t)},o=function(e){var r=e.to,t=e.children;return n.createElement(a.default,{href:c+"/"+r},t)}},19161:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>m,contentTitle:()=>s,default:()=>g,frontMatter:()=>u,metadata:()=>d,toc:()=>f});var n=t(87462),a=t(63366),c=(t(67294),t(3905)),p=(t(14563),t(68889),t(26569));const o={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page, enqueueLinks }) {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n await enqueueLinks({\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n});\n\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE"};var l,i=["components"],u={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},s=void 0,d={unversionedId:"examples/puppeteer-recursive-crawl",id:"examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/../docs/examples/puppeteer_recursive_crawl.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/next/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_recursive_crawl.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/next/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/next/examples/puppeteer-with-proxy"}},m={},f=[],y=(l="RunnableCodeBlock",function(e){return console.warn("Component "+l+" was not imported, exported, or provided by MDXProvider as global scope"),(0,c.kt)("div",e)}),b={toc:f},w="wrapper";function g(e){var r=e.components,t=(0,a.Z)(e,i);return(0,c.kt)(w,(0,n.Z)({},b,t,{components:r,mdxType:"MDXLayout"}),(0,c.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,c.kt)(p.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,c.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,c.kt)("admonition",{type:"tip"},(0,c.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,c.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,c.kt)(y,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},o))}g.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>f});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?c(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):c(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function o(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},c=Object.keys(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n<c.length;n++)t=c[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),i=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):p(p({},r),e)),t},u=function(e){var r=i(e.components);return n.createElement(l.Provider,{value:r},e.children)},s="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},m=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,c=e.originalType,l=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),s=i(t),m=a,f=s["".concat(l,".").concat(m)]||s[m]||d[m]||c;return t?n.createElement(f,p(p({ref:r},u),{},{components:t})):n.createElement(f,p({ref:r},u))}));function f(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var c=t.length,p=new Array(c);p[0]=m;var o={};for(var l in r)hasOwnProperty.call(r,l)&&(o[l]=r[l]);o.originalType=e,o[s]="string"==typeof e?e:a,p[1]=o;for(var i=2;i<c;i++)p[i]=t[i];return n.createElement.apply(null,p)}return n.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f26df47d.3f423388.js b/assets/js/f26df47d.3f423388.js deleted file mode 100644 index a692df2ab6..0000000000 --- a/assets/js/f26df47d.3f423388.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9128],{29730:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id_old:"version-1.3-migration-to-v1",title:"Migration to version 1",id:"migration-to-v1"},p=void 0,s={unversionedId:"guides/migration-to-v1",id:"version-1.3/guides/migration-to-v1",title:"Migration to version 1",description:"- Summary",source:"@site/versioned_docs/version-1.3/guides/migration_to_v1.md",sourceDirName:"guides",slug:"/guides/migration-to-v1",permalink:"/sdk/js/docs/1.3/guides/migration-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/migration_to_v1.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-migration-to-v1",title:"Migration to version 1",id:"migration-to-v1"},sidebar:"version-1.3/docs",previous:{title:"Running in Docker",permalink:"/sdk/js/docs/1.3/guides/docker-images"},next:{title:"Examples",permalink:"/sdk/js/docs/1.3/examples"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"<code>Map</code> of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"<code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code>",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code>",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running <code>BrowserPool</code>",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of <code>BrowserController</code>",id:"introduction-of-browsercontroller",level:3},{value:"<code>BrowserPool</code> methods vs <code>PuppeteerPool</code>",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated <code>PuppeteerCrawlerOptions</code>",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of <code>gotoFunction</code>",id:"removal-of-gotofunction",level:3},{value:"<code>launchPuppeteerOptions</code> => <code>launchContext</code>",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of <code>launchPuppeteerFunction</code>",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},m="wrapper";function h(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(m,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#summary",target:null,rel:null},"Summary")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#migration-guide",target:null,rel:null},"Migration Guide")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#installation",target:null,rel:null},"Installation")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#running-on-apify-platform",target:null,rel:null},"Running on Apify Platform")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},"Handler arguments are now Crawling Context"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#map-of-crawling-contexts-and-their-ids",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Map")," of crawling contexts and their IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#autoscaledpool-was-moved-under-crawlingcontextcrawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"a"},"crawlingContext.crawler"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#replacement-of-puppeteerpool-with-browserpool",target:null,rel:null},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#access-to-running-browserpool",target:null,rel:null},"Access to running ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#pages-now-have-ids",target:null,rel:null},"Pages now have IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Configuration and lifecycle hooks")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#introduction-of-browsercontroller",target:null,rel:null},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#browserpool-methods-vs-puppeteerpool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-puppeteercrawleroptions",target:null,rel:null},"Updated ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-gotofunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"gotoFunction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"a"},"launchContext"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-launchpuppeteerfunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerFunction"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launch-functions",target:null,rel:null},"Launch functions"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-arguments",target:null,rel:null},"Updated arguments")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#custom-modules",target:null,rel:null},"Custom modules"))))),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}h.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>h});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,h=c["".concat(p,".").concat(m)]||c[m]||d[m]||r;return t?a.createElement(h,l(l({ref:n},u),{},{components:t})):a.createElement(h,l({ref:n},u))}));function h(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=m;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s<r;s++)l[s]=t[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f26df47d.ab1dbdde.js b/assets/js/f26df47d.ab1dbdde.js new file mode 100644 index 0000000000..29657e0d50 --- /dev/null +++ b/assets/js/f26df47d.ab1dbdde.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9128],{29730:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=t(87462),o=t(63366),r=(t(67294),t(3905)),l=["components"],i={id_old:"version-1.3-migration-to-v1",title:"Migration to version 1",id:"migration-to-v1"},p=void 0,s={unversionedId:"guides/migration-to-v1",id:"version-1.3/guides/migration-to-v1",title:"Migration to version 1",description:"- Summary",source:"@site/versioned_docs/version-1.3/guides/migration_to_v1.md",sourceDirName:"guides",slug:"/guides/migration-to-v1",permalink:"/sdk/js/docs/1.3/guides/migration-to-v1",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/migration_to_v1.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-migration-to-v1",title:"Migration to version 1",id:"migration-to-v1"},sidebar:"version-1.3/docs",previous:{title:"Running in Docker",permalink:"/sdk/js/docs/1.3/guides/docker-images"},next:{title:"Examples",permalink:"/sdk/js/docs/1.3/examples"}},u={},c=[{value:"Summary",id:"summary",level:2},{value:"Migration Guide",id:"migration-guide",level:2},{value:"Installation",id:"installation",level:2},{value:"Running on Apify Platform",id:"running-on-apify-platform",level:2},{value:"Handler arguments are now Crawling Context",id:"handler-arguments-are-now-crawling-context",level:2},{value:"<code>Map</code> of crawling contexts and their IDs",id:"map-of-crawling-contexts-and-their-ids",level:3},{value:"<code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code>",id:"autoscaledpool-was-moved-under-crawlingcontextcrawler",level:3},{value:"Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code>",id:"replacement-of-puppeteerpool-with-browserpool",level:2},{value:"Access to running <code>BrowserPool</code>",id:"access-to-running-browserpool",level:3},{value:"Pages now have IDs",id:"pages-now-have-ids",level:3},{value:"Configuration and lifecycle hooks",id:"configuration-and-lifecycle-hooks",level:3},{value:"Introduction of <code>BrowserController</code>",id:"introduction-of-browsercontroller",level:3},{value:"<code>BrowserPool</code> methods vs <code>PuppeteerPool</code>",id:"browserpool-methods-vs-puppeteerpool",level:3},{value:"Updated <code>PuppeteerCrawlerOptions</code>",id:"updated-puppeteercrawleroptions",level:2},{value:"Removal of <code>gotoFunction</code>",id:"removal-of-gotofunction",level:3},{value:"<code>launchPuppeteerOptions</code> => <code>launchContext</code>",id:"launchpuppeteeroptions--launchcontext",level:3},{value:"Removal of <code>launchPuppeteerFunction</code>",id:"removal-of-launchpuppeteerfunction",level:3},{value:"Launch functions",id:"launch-functions",level:2},{value:"Updated arguments",id:"updated-arguments",level:3},{value:"Custom modules",id:"custom-modules",level:3}],d={toc:c},m="wrapper";function h(e){var n=e.components,t=(0,o.Z)(e,l);return(0,r.kt)(m,(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#summary",target:null,rel:null},"Summary")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#migration-guide",target:null,rel:null},"Migration Guide")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#installation",target:null,rel:null},"Installation")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#running-on-apify-platform",target:null,rel:null},"Running on Apify Platform")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},"Handler arguments are now Crawling Context"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#map-of-crawling-contexts-and-their-ids",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Map")," of crawling contexts and their IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#autoscaledpool-was-moved-under-crawlingcontextcrawler",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"a"},"crawlingContext.crawler"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#replacement-of-puppeteerpool-with-browserpool",target:null,rel:null},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#access-to-running-browserpool",target:null,rel:null},"Access to running ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#pages-now-have-ids",target:null,rel:null},"Pages now have IDs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Configuration and lifecycle hooks")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#introduction-of-browsercontroller",target:null,rel:null},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#browserpool-methods-vs-puppeteerpool",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerPool"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-puppeteercrawleroptions",target:null,rel:null},"Updated ",(0,r.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions")),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-gotofunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"gotoFunction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"a"},"launchContext"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#removal-of-launchpuppeteerfunction",target:null,rel:null},"Removal of ",(0,r.kt)("inlineCode",{parentName:"a"},"launchPuppeteerFunction"))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#launch-functions",target:null,rel:null},"Launch functions"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#updated-arguments",target:null,rel:null},"Updated arguments")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#custom-modules",target:null,rel:null},"Custom modules"))))),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"After 3.5 years of rapid development and a lot of breaking changes and deprecations,\nhere comes the result - ",(0,r.kt)("strong",{parentName:"p"},"Apify SDK v1"),". There were two goals for this release. ",(0,r.kt)("strong",{parentName:"p"},"Stability"),"\nand ",(0,r.kt)("strong",{parentName:"p"},"adding support for more browsers")," - Firefox and Webkit (Safari)."),(0,r.kt)("p",null,"The SDK has grown quite popular over the years, powering thousands of web scraping\nand automation projects. We think our developers deserve a stable environment to work\nin and by releasing SDK v1, ",(0,r.kt)("strong",{parentName:"p"},"we commit to only make breaking changes once a year,\nwith a new major release"),"."),(0,r.kt)("p",null,"We added support for more browsers by replacing ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")),". A new library that we created\nspecifically for this purpose. It builds on the ideas from ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," and extends\nthem to support ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright"),". Playwright is\na browser automation library similar to Puppeteer. It works with all well known browsers\nand uses almost the same interface as Puppeteer, while adding useful features and simplifying\ncommon tasks. Don't worry, you can still use Puppeteer with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),"."),(0,r.kt)("p",null,"A large breaking change is that neither ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," nor ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," are bundled with\nthe SDK v1. To make the choice of a library easier and installs faster, users will\nhave to install the selected modules and versions themselves. This allows us to add\nsupport for even more libraries in the future."),(0,r.kt)("p",null,"Thanks to the addition of Playwright we now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),". It is very similar\nto ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and you can pick the one you prefer. It also means we needed to make\nsome interface changes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerFunction")," option of ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," is gone\nand ",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were replaced by ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext"),". We also moved things around\nin the ",(0,r.kt)("inlineCode",{parentName:"p"},"handlePageFunction")," arguments. See the\n",(0,r.kt)("a",{parentName:"p",href:"#migration-guide",target:null,rel:null},"migration guide"),"\nfor more detailed explanation and migration examples."),(0,r.kt)("p",null,"What's in store for SDK v2? We want to split the SDK into smaller libraries,\nso that everyone can install only the things they need. We plan a TypeScript migration\nto make crawler development faster and safer. Finally, we will take a good look\nat the interface of the whole SDK and update it to improve the developer experience.\nBug fixes and scraping features will of course keep landing in versions 1.X as well."),(0,r.kt)("h2",{id:"migration-guide"},"Migration Guide"),(0,r.kt)("p",null,"There are a lot of breaking changes in the v1.0.0 release, but we're confident that\nupdating your code will be a matter of minutes. Below, you'll find examples how to do it\nand also short tutorials how to use many of the new features."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Many of the new features are made with power users in mind,\nso don't worry if something looks complicated. You don't need to use it.")),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Previous versions of the SDK bundled the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," package, so you did not have to install\nit. SDK v1 supports also ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," and we don't want to force users to install both.\nTo install SDK v1 with Puppeteer (same as previous versions), run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify puppeteer\n")),(0,r.kt)("p",null,"To install SDK v1 with Playwright run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install apify playwright\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"While we tried to add the most important functionality in the initial release,\nyou may find that there are still some utilities or options that are only\nsupported by Puppeteer and not Playwright.")),(0,r.kt)("h2",{id:"running-on-apify-platform"},"Running on Apify Platform"),(0,r.kt)("p",null,"If you want to make use of Playwright on the Apify Platform, you need to use a Docker image\nthat supports Playwright. We've created them for you, so head over to the new\n",(0,r.kt)("a",{parentName:"p",href:"https://sdk.apify.com/docs/guides/docker-images",target:null,rel:null},"Docker image guide")," and pick the one\nthat best suits your needs."),(0,r.kt)("p",null,"Note that your ",(0,r.kt)("inlineCode",{parentName:"p"},"package.json")," ",(0,r.kt)("strong",{parentName:"p"},"MUST")," include ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer")," and/or ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," as dependencies.\nIf you don't list them, the libraries will be uninstalled from your ",(0,r.kt)("inlineCode",{parentName:"p"},"node_modules")," folder\nwhen you build your actors."),(0,r.kt)("h2",{id:"handler-arguments-are-now-crawling-context"},"Handler arguments are now Crawling Context"),(0,r.kt)("p",null,"Previously, arguments of user provided handler functions were provided in separate\nobjects. This made it difficult to track values across function invocations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (args1) => {\n args1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (args2) => {\n args2.hasOwnProperty('proxyInfo') // false\n}\n\nargs1 === args2 // false\n")),(0,r.kt)("p",null,"This happened because a new arguments object was created for each function.\nWith SDK v1 we now have a single object called Crawling Context."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async (crawlingContext1) => {\n crawlingContext1.hasOwnProperty('proxyInfo') // true\n}\n\nconst handleFailedRequestFunction = async (crawlingContext2) => {\n crawlingContext2.hasOwnProperty('proxyInfo') // true\n}\n\n// All contexts are the same object.\ncrawlingContext1 === crawlingContext2 // true\n")),(0,r.kt)("h3",{id:"map-of-crawling-contexts-and-their-ids"},(0,r.kt)("inlineCode",{parentName:"h3"},"Map")," of crawling contexts and their IDs"),(0,r.kt)("p",null,"Now that all the objects are the same, we can keep track of all running crawling contexts.\nWe can do that by working with the new ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," property of ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nThis is useful when you need cross-context access."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"let masterContextId;\nconst handlePageFunction = async ({ id, page, request, crawler }) => {\n if (request.userData.masterPage) {\n masterContextId = id;\n // Prepare the master page.\n } else {\n const masterContext = crawler.crawlingContexts.get(masterContextId);\n const masterPage = masterContext.page;\n const masterRequest = masterContext.request;\n // Now we can manipulate the master data from another handlePageFunction.\n }\n}\n")),(0,r.kt)("h3",{id:"autoscaledpool-was-moved-under-crawlingcontextcrawler"},(0,r.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")," was moved under ",(0,r.kt)("inlineCode",{parentName:"h3"},"crawlingContext.crawler")),(0,r.kt)("p",null,"To prevent bloat and to make access to certain key objects easier, we exposed a ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler"),"\nproperty on the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async ({ request, page, crawler }) => {\n await crawler.requestQueue.addRequest({ url: 'https://example.com' });\n await crawler.autoscaledPool.pause();\n}\n")),(0,r.kt)("p",null,"This also means that some shorthands like ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerPool")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"autoscaledPool")," were\nno longer necessary."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handePageFunction = async (crawlingContext) => {\n crawlingContext.autoscaledPool // does NOT exist anymore\n crawlingContext.crawler.autoscaledPool // <= this is correct usage\n}\n")),(0,r.kt)("h2",{id:"replacement-of-puppeteerpool-with-browserpool"},"Replacement of ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerPool")," with ",(0,r.kt)("inlineCode",{parentName:"h2"},"BrowserPool")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," was created to extend ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerPool")," with the ability to manage other\nbrowser automation libraries. The API is similar, but not the same."),(0,r.kt)("h3",{id:"access-to-running-browserpool"},"Access to running ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")),(0,r.kt)("p",null,"Only ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," use ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool"),". You can access it\non the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler")," object."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PlaywrightCrawler({\n handlePageFunction: async ({ page, crawler }) => {\n crawler.browserPool // <-----\n }\n});\n\ncrawler.browserPool // <-----\n")),(0,r.kt)("h3",{id:"pages-now-have-ids"},"Pages now have IDs"),(0,r.kt)("p",null,"And they're equal to ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext.id")," which gives you access to full ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"\nin hooks. See ",(0,r.kt)("a",{parentName:"p",href:"#configuration-and-lifecycle-hooks",target:null,rel:null},"Lifecycle hooks")," below."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const pageId = browserPool.getPageId\n")),(0,r.kt)("h3",{id:"configuration-and-lifecycle-hooks"},"Configuration and lifecycle hooks"),(0,r.kt)("p",null,"The most important addition with ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserPool")," are the\n",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),".\nYou can access them via ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions")," in both crawlers. A full list of ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),"\ncan be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#new-browserpooloptions",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool")," readme"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n retireBrowserAfterPageCount: 10,\n preLaunchHooks: [\n async (pageId, launchContext) => {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n ]\n }\n})\n")),(0,r.kt)("h3",{id:"introduction-of-browsercontroller"},"Introduction of ",(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserController")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browsercontroller",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"BrowserController")),"\nis a class of ",(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," that's responsible for browser management.\nIts purpose is to provide a single API for working with both Puppeteer and Playwright browsers.\nIt works automatically in the background, but if you ever wanted to close a browser properly,\nyou should use a ",(0,r.kt)("inlineCode",{parentName:"p"},"browserController")," to do it. You can find it in the handle page arguments."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ page, browserController }) => {\n // Wrong usage. Could backfire because it bypasses BrowserPool.\n await page.browser().close();\n\n // Correct usage. Allows graceful shutdown.\n await browserController.close();\n\n const cookies = [/* some cookie objects */];\n // Wrong usage. Will only work in Puppeteer and not Playwright.\n await page.setCookies(...cookies);\n\n // Correct usage. Will work in both.\n await browserController.setCookies(page, cookies);\n}\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"BrowserController")," also includes important information about the browser, such as\nthe context it was launched with. This was difficult to do before SDK v1."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const handlePageFunction = async ({ browserController }) => {\n // Information about the proxy used by the browser\n browserController.launchContext.proxyInfo\n\n // Session used by the browser\n browserController.launchContext.session\n}\n")),(0,r.kt)("h3",{id:"browserpool-methods-vs-puppeteerpool"},(0,r.kt)("inlineCode",{parentName:"h3"},"BrowserPool")," methods vs ",(0,r.kt)("inlineCode",{parentName:"h3"},"PuppeteerPool")),(0,r.kt)("p",null,"Some functions were removed (in line with earlier deprecations), and some were changed a bit:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.recyclePage(page);\n\n// NEW\nawait page.close();\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.retire(page.browser());\n\n// NEW\nbrowserPool.retireBrowserByPage(page);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait puppeteerPool.serveLiveViewSnapshot();\n\n// NEW\n// There's no LiveView in BrowserPool\n")),(0,r.kt)("h2",{id:"updated-puppeteercrawleroptions"},"Updated ",(0,r.kt)("inlineCode",{parentName:"h2"},"PuppeteerCrawlerOptions")),(0,r.kt)("p",null,"To keep ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")," consistent, we updated the options."),(0,r.kt)("h3",{id:"removal-of-gotofunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"gotoFunction")),(0,r.kt)("p",null,"The concept of a configurable ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," is not ideal. Especially since we use a modified\n",(0,r.kt)("inlineCode",{parentName:"p"},"gotoExtended"),". Users have to know this when they override ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," if they want to\nextend default behavior. We decided to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"."),(0,r.kt)("p",null,"The following example illustrates how ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoFunction")," makes things complicated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const gotoFunction = async ({ request, page }) => {\n // pre-processing\n await makePageStealthy(page);\n\n // Have to remember how to do this:\n const response = await gotoExtended(page, request, {/* have to remember the defaults */});\n\n // post-processing\n await page.evaluate(() => {\n window.foo = 'bar';\n });\n\n // Must not forget!\n return response;\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n gotoFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"With ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks")," it's much easier. ",(0,r.kt)("inlineCode",{parentName:"p"},"preNavigationHooks"),"\nare called with two arguments: ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"gotoOptions"),". ",(0,r.kt)("inlineCode",{parentName:"p"},"postNavigationHooks"),"\nare called only with ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preNavigationHooks = [\n async ({ page }) => makePageStealthy(page)\n];\n\nconst postNavigationHooks = [\n async ({ page }) => page.evaluate(() => {\n window.foo = 'bar'\n })\n]\n\nconst crawler = new Apify.PuppeteerCrawler({\n preNavigationHooks,\n postNavigationHooks,\n // ...\n})\n")),(0,r.kt)("h3",{id:"launchpuppeteeroptions--launchcontext"},(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerOptions")," => ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchContext")),(0,r.kt)("p",null,"Those were always a point of confusion because they merged custom Apify options with\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions")," of Puppeteer."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerOptions = {\n useChrome: true, // Apify option\n headless: false, // Puppeteer option\n}\n")),(0,r.kt)("p",null,"Use the new ",(0,r.kt)("inlineCode",{parentName:"p"},"launchContext")," object, which explicitly defines ",(0,r.kt)("inlineCode",{parentName:"p"},"launchOptions"),".\n",(0,r.kt)("inlineCode",{parentName:"p"},"launchPuppeteerOptions")," were removed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const crawler = new Apify.PuppeteerCrawler({\n launchContext: {\n useChrome: true, // Apify option\n launchOptions: {\n headless: false // Puppeteer option\n }\n }\n})\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"LaunchContext is also a type of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"browser-pool"))," and\nthe structure is exactly the same there. SDK only adds extra options.")),(0,r.kt)("h3",{id:"removal-of-launchpuppeteerfunction"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h3"},"launchPuppeteerFunction")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"browser-pool")," introduces the idea of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool#browserpool",target:"_blank",rel:"noopener"},"lifecycle hooks"),",\nwhich are functions that are executed when a certain event in the browser lifecycle happens."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const launchPuppeteerFunction = async (launchPuppeteerOptions) => {\n if (someVariable === 'chrome') {\n launchPuppeteerOptions.useChrome = true;\n }\n return Apify.launchPuppeteer(launchPuppeteerOptions);\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n launchPuppeteerFunction,\n // ...\n})\n")),(0,r.kt)("p",null,"Now you can recreate the same functionality with a ",(0,r.kt)("inlineCode",{parentName:"p"},"preLaunchHook"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const maybeLaunchChrome = (pageId, launchContext) => {\n if (someVariable === 'chrome') {\n launchContext.useChrome = true;\n }\n}\n\nconst crawler = new Apify.PuppeteerCrawler({\n browserPoolOptions: {\n preLaunchHooks: [maybeLaunchChrome]\n },\n // ...\n})\n")),(0,r.kt)("p",null,"This is better in multiple ways. It is consistent across both Puppeteer and Playwright.\nIt allows you to easily construct your browsers with pre-defined behavior:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n maybeLaunchChrome,\n useHeadfulIfNeeded,\n injectNewFingerprint,\n]\n")),(0,r.kt)("p",null,"And thanks to the addition of ",(0,r.kt)("a",{parentName:"p",href:"#handler-arguments-are-now-crawling-context",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"crawler.crawlingContexts")),"\nthe functions also have access to the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlingContext")," of the ",(0,r.kt)("inlineCode",{parentName:"p"},"request")," that triggered the launch."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const preLaunchHooks = [\n async function maybeLaunchChrome(pageId, launchContext) {\n const { request } = crawler.crawlingContexts.get(pageId);\n if (request.userData.useHeadful === true) {\n launchContext.launchOptions.headless = false;\n }\n }\n]\n")),(0,r.kt)("h2",{id:"launch-functions"},"Launch functions"),(0,r.kt)("p",null,"In addition to ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer()")," we now also have ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPlaywright()"),"."),(0,r.kt)("h3",{id:"updated-arguments"},"Updated arguments"),(0,r.kt)("p",null,"We ",(0,r.kt)("a",{parentName:"p",href:"#launchpuppeteeroptions--launchcontext",target:null,rel:null},"updated the launch options object")," because\nit was a frequent source of confusion."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"// OLD\nawait Apify.launchPuppeteer({\n useChrome: true,\n headless: true,\n})\n\n// NEW\nawait Apify.launchPuppeteer({\n useChrome: true,\n launchOptions: {\n headless: true,\n }\n})\n")),(0,r.kt)("h3",{id:"custom-modules"},"Custom modules"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Apify.launchPuppeteer")," already supported the ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteerModule")," option. With Playwright,\nwe normalized the name to ",(0,r.kt)("inlineCode",{parentName:"p"},"launcher")," because the ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," module itself does not\nlaunch browsers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const puppeteer = require('puppeteer');\nconst playwright = require('playwright');\n\nawait Apify.launchPuppeteer();\n// Is the same as:\nawait Apify.launchPuppeteer({\n launcher: puppeteer\n})\n\nawait Apify.launchPlaywright();\n// Is the same as:\nawait Apify.launchPlaywright({\n launcher: playwright.chromium\n})\n")))}h.isMDXComponent=!0},3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>h});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function i(e,n){if(null==e)return{};var t,a,o=function(e,n){if(null==e)return{};var t,a,o={},r=Object.keys(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)t=r[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},u=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},m=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=s(t),m=o,h=c["".concat(p,".").concat(m)]||c[m]||d[m]||r;return t?a.createElement(h,l(l({ref:n},u),{},{components:t})):a.createElement(h,l({ref:n},u))}));function h(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,l=new Array(r);l[0]=m;var i={};for(var p in n)hasOwnProperty.call(n,p)&&(i[p]=n[p]);i.originalType=e,i[c]="string"==typeof e?e:o,l[1]=i;for(var s=2;s<r;s++)l[s]=t[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,t)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f313d5f9.2f133cb7.js b/assets/js/f313d5f9.2f133cb7.js deleted file mode 100644 index 316f8ae281..0000000000 --- a/assets/js/f313d5f9.2f133cb7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2998],{31714:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),i=["components"],o={id_old:"version-1.3-crawl-multiple-urls",title:"Crawl multiple URLs",id:"crawl-multiple-urls"},p=void 0,s={unversionedId:"examples/crawl-multiple-urls",id:"version-1.3/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-1.3/examples/crawl_multiple_urls.md",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/1.3/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_multiple_urls.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-crawl-multiple-urls",title:"Crawl multiple URLs",id:"crawl-multiple-urls"},sidebar:"version-1.3/docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/1.3/examples/crawl-relative-links"}},c={},u=[],m={toc:u},w="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,i);return(0,l.kt)(w,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},w=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(n),w=a,f=u["".concat(p,".").concat(w)]||u[w]||m[w]||l;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=w;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var s=2;s<l;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}w.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f313d5f9.fdef06cc.js b/assets/js/f313d5f9.fdef06cc.js new file mode 100644 index 0000000000..bd2f5b4bf9 --- /dev/null +++ b/assets/js/f313d5f9.fdef06cc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2998],{31714:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>f,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),i=["components"],o={id_old:"version-1.3-crawl-multiple-urls",title:"Crawl multiple URLs",id:"crawl-multiple-urls"},p=void 0,s={unversionedId:"examples/crawl-multiple-urls",id:"version-1.3/examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/versioned_docs/version-1.3/examples/crawl_multiple_urls.md",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/1.3/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_multiple_urls.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-crawl-multiple-urls",title:"Crawl multiple URLs",id:"crawl-multiple-urls"},sidebar:"version-1.3/docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/1.3/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/1.3/examples/crawl-relative-links"}},c={},u=[],m={toc:u},w="wrapper";function f(e){var t=e.components,n=(0,a.Z)(e,i);return(0,l.kt)(w,(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, $ }) => {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a CheerioCrawler\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("p",null,"\\\nUsing ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Create a RequestList\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n // Function called for each URL\n const handlePageFunction = async ({ request, page }) => {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n };\n // Create a PuppeteerCrawler\n const crawler = new Apify.PlaywrightCrawler({\n requestList,\n handlePageFunction,\n });\n // Run the crawler\n await crawler.run();\n});\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},w=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(n),w=a,f=u["".concat(p,".").concat(w)]||u[w]||m[w]||l;return n?r.createElement(f,i(i({ref:t},c),{},{components:n})):r.createElement(f,i({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=w;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:a,i[1]=o;for(var s=2;s<l;s++)i[s]=n[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}w.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f4575319.c7a59359.js b/assets/js/f4575319.c73a552b.js similarity index 63% rename from assets/js/f4575319.c7a59359.js rename to assets/js/f4575319.c73a552b.js index fe4a6a8b04..346e9b3b46 100644 --- a/assets/js/f4575319.c7a59359.js +++ b/assets/js/f4575319.c73a552b.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[284],{30433:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function c(e){var t=e.children,n=e.hidden,c=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,c),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),c=n(63735),i=n(38224),o=n(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,i=e.selectedValue,o=e.selectValue,s=e.tabValues,d=[],p=(0,c.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==i&&(p(t),o(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,c=d.indexOf(e.currentTarget)-1;n=null!=(l=d[c])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,c=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},c,{className:(0,l.Z)("tabs__item",u.tabItem,null==c?void 0:c.className,{"tabs__item--active":i===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var c=l.find((function(e){return e.props.value===r}));return c?(0,a.cloneElement)(c,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,i.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,o.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),c=n(20636),i=n(99200);function o(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:o(n);return function(e){var t=(0,c.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,c=e.groupId,i=(0,a.k6)(),o=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:c});return[(0,l._X)(o),(0,r.useCallback)((function(e){if(o){var t=new URLSearchParams(i.location.search);t.set(o,e),i.replace(Object.assign({},i.location,{search:t.toString()}))}}),[o,i])]}function p(e){var t,n,a,l,c=e.defaultValue,o=e.queryString,p=void 0!==o&&o,m=e.groupId,b=u(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:c,tabValues:b})})),f=g[0],y=g[1],w=d({queryString:p,groupId:m}),I=w[0],h=w[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,i.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=v[0],C=v[1],X=function(){var e=null!=I?I:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){X&&y(X)}),[X]),{selectedValue:f,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),h(e),C(e)}),[h,C,b]),tabValues:b}}},16288:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>f,contentTitle:()=>b,default:()=>v,frontMatter:()=>m,metadata:()=>g,toc:()=>y});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),c=n(65559),i=n(30433);n(14563);const o={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, $ }) {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0"};var d,p=["components"],m={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},b=void 0,g={unversionedId:"examples/crawl-multiple-urls",id:"examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/../docs/examples/crawl_multiple_urls.mdx",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/next/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_multiple_urls.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/next/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/next/examples/crawl-relative-links"}},f={},y=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),I={toc:y},h="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(h,(0,r.Z)({},I,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)(c.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(i.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(w,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},o)),(0,l.kt)(i.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(i.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var o=r.createContext({}),u=function(e){var t=r.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(o.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,o=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),d=u(n),m=a,b=d["".concat(o,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,c(c({ref:t},s),{},{components:n})):r.createElement(b,c({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,c=new Array(l);c[0]=m;var i={};for(var o in t)hasOwnProperty.call(t,o)&&(i[o]=t[o]);i.originalType=e,i[d]="string"==typeof e?e:a,c[1]=i;for(var u=2;u<l;u++)c[u]=n[u];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[284],{30433:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(67294),a=n(34334);const l={tabItem:"tabItem_Ymn6"};function c(e){var t=e.children,n=e.hidden,c=e.className;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l.tabItem,c),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(87462),a=n(67294),l=n(34334),c=n(63735),o=n(38224),i=n(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,i=e.selectValue,s=e.tabValues,d=[],p=(0,c.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,n=d.indexOf(t),r=s[n].value;r!==o&&(p(t),i(r))},b=function(e){var t,n=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var r,a=d.indexOf(e.currentTarget)+1;n=null!=(r=d[a])?r:d[0];break;case"ArrowLeft":var l,c=d.indexOf(e.currentTarget)-1;n=null!=(l=d[c])?l:d[d.length-1]}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,c=e.attributes;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:m},c,{className:(0,l.Z)("tabs__item",u.tabItem,null==c?void 0:c.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,r=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var c=l.find((function(e){return e.props.value===r}));return c?(0,a.cloneElement)(c,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r})})))}function p(e){var t=(0,o.Y)(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",u.tabList)},a.createElement(s,(0,r.Z)({},e,t)),a.createElement(d,(0,r.Z)({},e,t)))}function m(e){var t=(0,i.Z)();return a.createElement(p,(0,r.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>p});var r=n(67294),a=n(16550),l=n(34423),c=n(20636),o=n(99200);function i(e){return function(e){var t,n;return null!=(t=null==(n=r.Children.map(e,(function(e){if(!e||(0,r.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,n=e.children;return(0,r.useMemo)((function(){var e=null!=t?t:i(n);return function(e){var t=(0,c.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,c=e.groupId,o=(0,a.k6)(),i=function(e){var t=e.queryString,n=void 0!==t&&t,r=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!r)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=r?r:null}({queryString:n,groupId:c});return[(0,l._X)(i),(0,r.useCallback)((function(e){if(i){var t=new URLSearchParams(o.location.search);t.set(i,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[i,o])]}function p(e){var t,n,a,l,c=e.defaultValue,i=e.queryString,p=void 0!==i&&i,m=e.groupId,b=u(e),g=(0,r.useState)((function(){return function(e){var t,n=e.defaultValue,r=e.tabValues;if(0===r.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!s({value:n,tabValues:r}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+r.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var a=null!=(t=r.find((function(e){return e.default})))?t:r[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:c,tabValues:b})})),f=g[0],y=g[1],w=d({queryString:p,groupId:m}),I=w[0],h=w[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),n=(0,o.Nk)(t),a=n[0],l=n[1],[a,(0,r.useCallback)((function(e){t&&l.set(e)}),[t,l])]),x=v[0],C=v[1],X=function(){var e=null!=I?I:x;return s({value:e,tabValues:b})?e:null}();return(0,r.useLayoutEffect)((function(){X&&y(X)}),[X]),{selectedValue:f,selectValue:(0,r.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),h(e),C(e)}),[h,C,b]),tabValues:b}}},16288:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>f,contentTitle:()=>b,default:()=>v,frontMatter:()=>m,metadata:()=>g,toc:()=>y});var r=n(87462),a=n(63366),l=(n(67294),n(3905)),c=n(65559),o=n(30433);n(14563);const i={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n // Function called for each URL\n async requestHandler({ request, $ }) {\n const title = $('title').text();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8"},u={code:"import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8"},s={code:"import { Actor } from 'apify';\nimport { PlaywrightCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PlaywrightCrawler({\n // Function called for each URL\n async requestHandler({ request, page }) {\n const title = await page.title();\n console.log(`URL: ${request.url}\\nTITLE: ${title}`);\n },\n});\n\n// Run the crawler\nawait crawler.run([\n 'http://www.example.com/page-1',\n 'http://www.example.com/page-2',\n 'http://www.example.com/page-3',\n]);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0"};var d,p=["components"],m={id:"crawl-multiple-urls",title:"Crawl multiple URLs"},b=void 0,g={unversionedId:"examples/crawl-multiple-urls",id:"examples/crawl-multiple-urls",title:"Crawl multiple URLs",description:"This example crawls the specified list of URLs.",source:"@site/../docs/examples/crawl_multiple_urls.mdx",sourceDirName:"examples",slug:"/examples/crawl-multiple-urls",permalink:"/sdk/js/docs/next/examples/crawl-multiple-urls",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_multiple_urls.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-multiple-urls",title:"Crawl multiple URLs"},sidebar:"docs",previous:{title:"Crawl all links on a website",permalink:"/sdk/js/docs/next/examples/crawl-all-links"},next:{title:"Crawl a website with relative links",permalink:"/sdk/js/docs/next/examples/crawl-relative-links"}},f={},y=[],w=(d="RunnableCodeBlock",function(e){return console.warn("Component "+d+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),I={toc:y},h="wrapper";function v(e){var t=e.components,n=(0,a.Z)(e,p);return(0,l.kt)(h,(0,r.Z)({},I,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"This example crawls the specified list of URLs."),(0,l.kt)(c.Z,{groupId:"crawler-type",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"cheerio_crawler",label:"Cheerio Crawler",default:!0,mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"),":"),(0,l.kt)(w,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},i)),(0,l.kt)(o.Z,{value:"puppeteer_crawler",label:"Puppeteer Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"puppeteer",mdxType:"RunnableCodeBlock"},u)),(0,l.kt)(o.Z,{value:"playwright_crawler",label:"Playwright Crawler",mdxType:"TabItem"},(0,l.kt)("p",null,"Using ",(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"),":"),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,l.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-chrome")," image for your Dockerfile.")),(0,l.kt)(w,{className:"language-js",type:"playwright",mdxType:"RunnableCodeBlock"},s))))}v.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),u=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},s=function(e){var t=u(e.components);return r.createElement(i.Provider,{value:t},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=u(n),m=a,b=d["".concat(i,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(b,c(c({ref:t},s),{},{components:n})):r.createElement(b,c({ref:t},s))}));function b(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,c=new Array(l);c[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[d]="string"==typeof e?e:a,c[1]=o;for(var u=2;u<l;u++)c[u]=n[u];return r.createElement.apply(null,c)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f465590d.0d618cfa.js b/assets/js/f465590d.0d618cfa.js new file mode 100644 index 0000000000..8972bcc9ec --- /dev/null +++ b/assets/js/f465590d.0d618cfa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6809],{68889:(e,r,t)=>{t.d(r,{Z:()=>i});var n=t(67294),a=t(88746),o=t(6141),p=t(6832);const i=function(e){var r=e.to,t=e.children,i=(0,o.E)(),l=i.version,c=i.isLast;if((0,p.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+r},t);var s=l+"/";return"current"===l?s="next/":c&&(s=""),n.createElement(a.default,{to:"/api/"+s+r},t)}},26569:(e,r,t)=>{t.d(r,{B:()=>i,T:()=>p});var n=t(67294),a=t(88746),o="https://crawlee.dev",p=function(e){var r=e.to,t=e.children,p=e.version;return n.createElement(a.default,{href:o+"/api"+(p?"/"+p:"")+"/"+r},t)},i=function(e){var r=e.to,t=e.children;return n.createElement(a.default,{href:o+"/"+r},t)}},45949:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>d,contentTitle:()=>u,default:()=>y,frontMatter:()=>s,metadata:()=>f,toc:()=>m});var n=t(87462),a=t(63366),o=(t(67294),t(3905)),p=t(14563),i=(t(68889),t(26569));const l="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page, enqueueLinks }) {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n await enqueueLinks({\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n});\n\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n";var c=["components"],s={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},u=void 0,f={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-3.0/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/versioned_docs/version-3.0/examples/puppeteer_recursive_crawl.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_recursive_crawl.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/3.0/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/3.0/examples/puppeteer-with-proxy"}},d={},m=[],w={toc:m},v="wrapper";function y(e){var r=e.components,t=(0,a.Z)(e,c);return(0,o.kt)(v,(0,n.Z)({},w,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(p.Z,{className:"language-js",mdxType:"CodeBlock"},l))}y.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>m});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),c=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):p(p({},r),e)),t},s=function(e){var r=c(e.components);return n.createElement(l.Provider,{value:r},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=c(t),d=a,m=u["".concat(l,".").concat(d)]||u[d]||f[d]||o;return t?n.createElement(m,p(p({ref:r},s),{},{components:t})):n.createElement(m,p({ref:r},s))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,p=new Array(o);p[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[u]="string"==typeof e?e:a,p[1]=i;for(var c=2;c<o;c++)p[c]=t[c];return n.createElement.apply(null,p)}return n.createElement.apply(null,t)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f465590d.1ea096ec.js b/assets/js/f465590d.1ea096ec.js deleted file mode 100644 index 29215c9ed2..0000000000 --- a/assets/js/f465590d.1ea096ec.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[6809],{68889:(e,r,t)=>{t.d(r,{Z:()=>i});var n=t(67294),a=t(88746),p=t(6141),o=t(6832);const i=function(e){var r=e.to,t=e.children,i=(0,p.E)(),l=i.version,c=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+r},t);var s=l+"/";return"current"===l?s="next/":c&&(s=""),n.createElement(a.default,{to:"/api/"+s+r},t)}},26569:(e,r,t)=>{t.d(r,{B:()=>i,T:()=>o});var n=t(67294),a=t(88746),p="https://crawlee.dev",o=function(e){var r=e.to,t=e.children,o=e.version;return n.createElement(a.default,{href:p+"/api"+(o?"/"+o:"")+"/"+r},t)},i=function(e){var r=e.to,t=e.children;return n.createElement(a.default,{href:p+"/"+r},t)}},45949:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>f,contentTitle:()=>u,default:()=>y,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var n=t(87462),a=t(63366),p=(t(67294),t(3905)),o=t(14563),i=(t(68889),t(26569));const l="import { Actor } from 'apify';\nimport { PuppeteerCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new PuppeteerCrawler({\n async requestHandler({ request, page, enqueueLinks }) {\n const title = await page.title();\n console.log(`Title of ${request.url}: ${title}`);\n\n await enqueueLinks({\n pseudoUrls: ['https://www.iana.org/[.*]'],\n });\n },\n maxRequestsPerCrawl: 10,\n});\n\nawait crawler.run(['https://www.iana.org/']);\n\nawait Actor.exit();\n";var c=["components"],s={id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},u=void 0,d={unversionedId:"examples/puppeteer-recursive-crawl",id:"version-3.0/examples/puppeteer-recursive-crawl",title:"Puppeteer recursive crawl",description:"Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.",source:"@site/versioned_docs/version-3.0/examples/puppeteer_recursive_crawl.mdx",sourceDirName:"examples",slug:"/examples/puppeteer-recursive-crawl",permalink:"/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_recursive_crawl.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-recursive-crawl",title:"Puppeteer recursive crawl"},sidebar:"docs",previous:{title:"Puppeteer crawler",permalink:"/sdk/js/docs/3.0/examples/puppeteer-crawler"},next:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/3.0/examples/puppeteer-with-proxy"}},f={},m=[],w={toc:m},v="wrapper";function y(e){var r=e.components,t=(0,a.Z)(e,c);return(0,p.kt)(v,(0,n.Z)({},w,t,{components:r,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"Run the following example to perform a recursive crawl of a website using ",(0,p.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,p.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,p.kt)("admonition",{type:"tip"},(0,p.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)(o.Z,{className:"language-js",mdxType:"CodeBlock"},l))}y.isMDXComponent=!0},3905:(e,r,t)=>{t.d(r,{Zo:()=>s,kt:()=>m});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function o(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},p=Object.keys(e);for(n=0;n<p.length;n++)t=p[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)t=p[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=n.createContext({}),c=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):o(o({},r),e)),t},s=function(e){var r=c(e.components);return n.createElement(l.Provider,{value:r},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},f=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,p=e.originalType,l=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=c(t),f=a,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||p;return t?n.createElement(m,o(o({ref:r},s),{},{components:t})):n.createElement(m,o({ref:r},s))}));function m(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var p=t.length,o=new Array(p);o[0]=f;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[u]="string"==typeof e?e:a,o[1]=i;for(var c=2;c<p;c++)o[c]=t[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,t)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f5149e68.528d087a.js b/assets/js/f5149e68.528d087a.js new file mode 100644 index 0000000000..68a8128e6e --- /dev/null +++ b/assets/js/f5149e68.528d087a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4076],{53576:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>m,frontMatter:()=>p,metadata:()=>s,toc:()=>d});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],p={},c="Apify SDK: The scalable web crawling and scraping library for JavaScript",s={unversionedId:"readme/introduction",id:"version-3.0/readme/introduction",title:"Apify SDK: The scalable web crawling and scraping library for JavaScript",description:"npm version",source:"@site/versioned_docs/version-3.0/readme/introduction.md",sourceDirName:"readme",slug:"/readme/introduction",permalink:"/sdk/js/docs/3.0/readme/introduction",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/introduction.md",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{}},l={},d=[],f={toc:d},u="wrapper";function m(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(u,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"apify-sdk-the-scalable-web-crawling-and-scraping-library-for-javascript"},"Apify SDK: The scalable web crawling and scraping library for JavaScript"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("img",{parentName:"a",src:"https://badge.fury.io/js/apify.svg",alt:"npm version"}))),(0,o.kt)("p",null,"Apify SDK simplifies the development of web crawlers, scrapers, data extractors and web automation jobs.\nIt provides tools to manage and automatically scale a pool of headless browsers,\nto maintain queues of URLs to crawl, store crawling results to a local filesystem or into the cloud,\nrotate proxies and much more.\nThe SDK is available as the ",(0,o.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify"))," NPM package.\nIt can be used either stand-alone in your own applications\nor in ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"actors"),"\nrunning on the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/",target:"_blank",rel:"noopener"},"Apify Cloud"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"View full documentation, guides and examples on the ",(0,o.kt)("a",{parentName:"strong",href:"https://sdk.apify.com",target:null,rel:null},"Apify SDK project website"))))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},d="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=s(r),u=a,m=d["".concat(c,".").concat(u)]||d[u]||f[u]||o;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p[d]="string"==typeof e?e:a,i[1]=p;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f524c03d.9f44d3df.js b/assets/js/f524c03d.9f44d3df.js deleted file mode 100644 index c8c73996be..0000000000 --- a/assets/js/f524c03d.9f44d3df.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2893],{81811:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),i=["components"],l={id_old:"version-2.3.0-docker-images",title:"Running in Docker",id:"docker-images"},p=void 0,s={unversionedId:"guides/docker-images",id:"version-2.3/guides/docker-images",title:"Running in Docker",description:"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the Apify Platform.",source:"@site/versioned_docs/version-2.3/guides/docker_images.md",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/2.3/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/docker_images.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-docker-images",title:"Running in Docker",id:"docker-images"},sidebar:"version-2.3/docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/2.3/guides/type-script-actor"},next:{title:"Migration to version 1",permalink:"/sdk/js/docs/2.3/guides/migration-to-v1"}},d={},u=[{value:"Overview",id:"overview",level:2},{value:"Example Dockerfile",id:"example-dockerfile",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"actor-node",id:"actor-node",level:2},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:2},{value:"actor-node-playwright",id:"actor-node-playwright",level:2},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:2},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:2},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:2}],c={toc:u},m="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(m,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/2.3/guides/apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit your needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use our images, you need a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/2.3/guides/getting-started#creating-a-new-project",target:null,rel:null},"Apify CLI")," which automatically copies the correct Dockerfile into your project folder."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},'# First, specify the base Docker image. You can read more about\n# the available images at https://sdk.apify.com/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\n# The 16 represents the version of Node.js you want to use.\nFROM apify/actor-node:16\n\n# Second, copy just package.json and package-lock.json since it should be\n# the only file that affects "npm install" in the next step, to speed up the build\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n# Optionally, specify how to launch the source code of your actor.\n# By default, Apify\'s base Docker images define the CMD instruction\n# that runs the Node.js source code using the command specified\n# in the "scripts.start" section of the package.json file.\n# In short, the instruction looks something like this:\n#\n# CMD npm start\n')),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in your production Dockerfiles. It will ensure that a future update of Node.js will not break your automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js versions 14, 15 and 16 are supported. To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 14\nFROM apify/actor-node:14\n# Use Node.js 16\nFROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-8.0.0")," comes with Node.js 16 and Puppeteer v8.0.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chrome we pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.10.0")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.10.0."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Always")," use Node.js version tag."),(0,o.kt)("li",{parentName:"ul"},"For ",(0,o.kt)("strong",{parentName:"li"},"added security"),", use the automation library version tag."),(0,o.kt)("li",{parentName:"ul"},"Use asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," as the automation library version in your ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not reinstalled on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "apify": "^1.2.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"Be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"Use only what you need, and you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore\nbest used with ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"\nand other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h2",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with\n",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox,\nWebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose,\nbut in most cases, we suggest using the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),",\nbut ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")),"\nenvironment variable to block installation of more browsers into your images (to keep them small).\nIf you want more browsers, either choose the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image\nor override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=r.createContext({}),s=function(e){var t=r.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(a),m=n,h=u["".concat(p,".").concat(m)]||u[m]||c[m]||o;return a?r.createElement(h,i(i({ref:t},d),{},{components:a})):r.createElement(h,i({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var s=2;s<o;s++)i[s]=a[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f524c03d.a129fd13.js b/assets/js/f524c03d.a129fd13.js new file mode 100644 index 0000000000..089506d0f0 --- /dev/null +++ b/assets/js/f524c03d.a129fd13.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2893],{81811:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var r=a(87462),n=a(63366),o=(a(67294),a(3905)),i=["components"],l={id_old:"version-2.3.0-docker-images",title:"Running in Docker",id:"docker-images"},p=void 0,s={unversionedId:"guides/docker-images",id:"version-2.3/guides/docker-images",title:"Running in Docker",description:"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the Apify Platform.",source:"@site/versioned_docs/version-2.3/guides/docker_images.md",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/2.3/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/docker_images.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-docker-images",title:"Running in Docker",id:"docker-images"},sidebar:"version-2.3/docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/2.3/guides/type-script-actor"},next:{title:"Migration to version 1",permalink:"/sdk/js/docs/2.3/guides/migration-to-v1"}},d={},u=[{value:"Overview",id:"overview",level:2},{value:"Example Dockerfile",id:"example-dockerfile",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"actor-node",id:"actor-node",level:2},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:2},{value:"actor-node-playwright",id:"actor-node-playwright",level:2},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:2},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:2},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:2}],c={toc:u},m="wrapper";function h(e){var t=e.components,a=(0,n.Z)(e,i);return(0,o.kt)(m,(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But you don't need to worry about that, because we already did it for you and created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/2.3/guides/apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit your needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use our images, you need a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)("a",{parentName:"p",href:"/sdk/js/docs/2.3/guides/getting-started#creating-a-new-project",target:null,rel:null},"Apify CLI")," which automatically copies the correct Dockerfile into your project folder."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},'# First, specify the base Docker image. You can read more about\n# the available images at https://sdk.apify.com/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\n# The 16 represents the version of Node.js you want to use.\nFROM apify/actor-node:16\n\n# Second, copy just package.json and package-lock.json since it should be\n# the only file that affects "npm install" in the next step, to speed up the build\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n# Optionally, specify how to launch the source code of your actor.\n# By default, Apify\'s base Docker images define the CMD instruction\n# that runs the Node.js source code using the command specified\n# in the "scripts.start" section of the package.json file.\n# In short, the instruction looks something like this:\n#\n# CMD npm start\n')),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in your production Dockerfiles. It will ensure that a future update of Node.js will not break your automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js versions 14, 15 and 16 are supported. To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 14\nFROM apify/actor-node:14\n# Use Node.js 16\nFROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-8.0.0")," comes with Node.js 16 and Puppeteer v8.0.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chrome we pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.10.0")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.10.0."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Always")," use Node.js version tag."),(0,o.kt)("li",{parentName:"ul"},"For ",(0,o.kt)("strong",{parentName:"li"},"added security"),", use the automation library version tag."),(0,o.kt)("li",{parentName:"ul"},"Use asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," as the automation library version in your ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not reinstalled on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "apify": "^1.2.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"Be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"Use only what you need, and you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore\nbest used with ",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"\nand other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h2",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with\n",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox,\nWebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose,\nbut in most cases, we suggest using the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run\n",(0,o.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"CheerioCrawler"))," and ",(0,o.kt)("a",{parentName:"p",href:"../api/playwright-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PlaywrightCrawler")),",\nbut ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)("a",{parentName:"p",href:"../api/puppeteer-crawler",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD")),"\nenvironment variable to block installation of more browsers into your images (to keep them small).\nIf you want more browsers, either choose the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image\nor override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h2",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")))}h.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>h});var r=a(67294);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){n(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,r,n=function(e,t){if(null==e)return{};var a,r,n={},o=Object.keys(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)a=o[r],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=r.createContext({}),s=function(e){var t=r.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(a),m=n,h=u["".concat(p,".").concat(m)]||u[m]||c[m]||o;return a?r.createElement(h,i(i({ref:t},d),{},{components:a})):r.createElement(h,i({ref:t},d))}));function h(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:n,i[1]=l;for(var s=2;s<o;s++)i[s]=a[s];return r.createElement.apply(null,i)}return r.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6458d78.626d9c07.js b/assets/js/f6458d78.cf4dfecd.js similarity index 64% rename from assets/js/f6458d78.626d9c07.js rename to assets/js/f6458d78.cf4dfecd.js index f70a1462cf..c6910f428b 100644 --- a/assets/js/f6458d78.626d9c07.js +++ b/assets/js/f6458d78.cf4dfecd.js @@ -1 +1 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3871],{30433:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(67294),r=n(34334);const l={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(87462),r=n(67294),l=n(34334),i=n(63735),o=n(38224),u=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,d=[],m=(0,i.o5)().blockElementScrollPositionUntilNextRender,p=function(e){var t=e.currentTarget,n=d.indexOf(t),a=s[n].value;a!==o&&(m(t),u(a))},b=function(e){var t,n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":var a,r=d.indexOf(e.currentTarget)+1;n=null!=(a=d[r])?a:d[0];break;case"ArrowLeft":var l,i=d.indexOf(e.currentTarget)-1;n=null!=(l=d[i])?l:d[d.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,i=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:p},i,{className:(0,l.Z)("tabs__item",c.tabItem,null==i?void 0:i.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,a=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var i=l.find((function(e){return e.props.value===a}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function m(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},r.createElement(s,(0,a.Z)({},e,t)),r.createElement(d,(0,a.Z)({},e,t)))}function p(e){var t=(0,u.Z)();return r.createElement(m,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>m});var a=n(67294),r=n(16550),l=n(34423),i=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,i=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:i});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function m(e){var t,n,r,l,i=e.defaultValue,u=e.queryString,m=void 0!==u&&u,p=e.groupId,b=c(e),g=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!s({value:n,tabValues:a}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:b})})),h=g[0],y=g[1],I=d({queryString:m,groupId:p}),C=I[0],f=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:p}.groupId),n=(0,o.Nk)(t),r=n[0],l=n[1],[r,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),w=v[0],k=v[1],x=function(){var e=null!=C?C:w;return s({value:e,tabValues:b})?e:null}();return(0,a.useLayoutEffect)((function(){x&&y(x)}),[x]),{selectedValue:h,selectValue:(0,a.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),f(e),k(e)}),[f,k,b]),tabValues:b}}},68889:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(67294),r=n(88746),l=n(6141),i=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),u=o.version,c=o.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var s=u+"/";return"current"===u?s="next/":c&&(s=""),a.createElement(r.default,{to:"/api/"+s+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>i});var a=n(67294),r=n(88746),l="https://crawlee.dev",i=function(e){var t=e.to,n=e.children,i=e.version;return a.createElement(r.default,{href:l+"/api"+(i?"/"+i:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},84974:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>h,default:()=>k,frontMatter:()=>g,metadata:()=>y,toc:()=>C});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=n(65559),o=n(30433),u=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'all' will enqueue all links found\n // highlight-next-line\n strategy: 'all',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgZW5xdWV1ZUxpbmtzIH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcyh7XFxuICAgICAgICAgICAgLy8gU2V0dGluZyB0aGUgc3RyYXRlZ3kgdG8gJ2FsbCcgd2lsbCBlbnF1ZXVlIGFsbCBsaW5rcyBmb3VuZFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogJ2FsbCcsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbJ2h0dHBzOi8vYXBpZnkuY29tLyddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.a1IFpzCtFyz6kXkEkdwjYb-WWnJaRH4hJxbbzFMcYfg"},d={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-hostname'\n // strategy: 'same-hostname',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgaG9zdG5hbWVcXG4gICAgICAgICAgICAvLyBhcyByZXF1ZXN0LmxvYWRlZFVybCBvciByZXF1ZXN0LnVybFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogRW5xdWV1ZVN0cmF0ZWd5LlNhbWVIb3N0bmFtZSxcXG4gICAgICAgICAgICAvLyBBbHRlcm5hdGl2ZWx5LCB5b3UgY2FuIHBhc3MgaW4gdGhlIHN0cmluZyAnc2FtZS1ob3N0bmFtZSdcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtaG9zdG5hbWUnLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.yF2AJFRXorzWRuCXhRGjM8nWXBFT585D7nwOkBPAPf0"},m={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-subdomain'\n // strategy: 'same-subdomain',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw"};var p,b=["components"],g={id:"crawl-relative-links",title:"Crawl a website with relative links"},h=void 0,y={unversionedId:"examples/crawl-relative-links",id:"examples/crawl-relative-links",title:"Crawl a website with relative links",description:"When crawling a website, you may encounter different types of links present that you may want to crawl.",source:"@site/../docs/examples/crawl_relative_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/next/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_relative_links.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/next/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/next/examples/crawl-single-url"}},I={},C=[],f=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),v={toc:C},w="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,b);return(0,l.kt)(w,(0,a.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"When crawling a website, you may encounter different types of links present that you may want to crawl.\nTo facilitate the easy crawling of such links, we provide the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method on the crawler context, which will\nautomatically find links and add them to the crawler's ",(0,l.kt)(u.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"."),(0,l.kt)("p",null,"We provide 3 different strategies for crawling relative links:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#All",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"All"))," which will enqueue all links found, regardless of the domain they point to."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameHostname",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameHostname"))," which will enqueue all links found for the same hostname (regardless of any subdomains present)."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameSubdomain",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameSubdomain"))," which will enqueue all links found that have the same subdomain and hostname. This is the default strategy.")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For these examples, we are using the ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),", however\nthe same method is available for both the ",(0,l.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"\nand ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", and you use it\nthe exact same way.")),(0,l.kt)(i.Z,{groupId:"enqueue_strategy",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"all",label:"All Links",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"Any urls found will be matched by this strategy, even if they go off of the site you are currently crawling.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s)),(0,l.kt)(o.Z,{value:"same_hostname",label:"Same Hostname",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will match relative urls, urls that point to the same\nfull domain or urls that point to any subdomain of the provided domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example"),"\nor ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example")," will all be matched by this strategy.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d)),(0,l.kt)(o.Z,{value:"same-subdomain",label:"Same Subdomain",default:!0,mdxType:"TabItem"},(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This is the default strategy when calling ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", so you don't have to specify it.")),(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will only match relative urls or urls that point to the same\nfull domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example"),"\nwill all be matched by this strategy, while ",(0,l.kt)("inlineCode",{parentName:"p"},"https://other-subdomain.example.com")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"https://otherexample.com")," will not.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},m))))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),c=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=c(n),p=r,b=d["".concat(u,".").concat(p)]||d[p]||m[p]||l;return n?a.createElement(b,i(i({ref:t},s),{},{components:n})):a.createElement(b,i({ref:t},s))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=p;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[d]="string"==typeof e?e:r,i[1]=o;for(var c=2;c<l;c++)i[c]=n[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"}}]); \ No newline at end of file +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3871],{30433:(e,t,n)=>{n.d(t,{Z:()=>i});var a=n(67294),r=n(34334);const l={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(l.tabItem,i),hidden:n},t)}},65559:(e,t,n)=>{n.d(t,{Z:()=>p});var a=n(87462),r=n(67294),l=n(34334),i=n(63735),o=n(38224),u=n(5730);const c={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function s(e){var t=e.className,n=e.block,o=e.selectedValue,u=e.selectValue,s=e.tabValues,d=[],m=(0,i.o5)().blockElementScrollPositionUntilNextRender,p=function(e){var t=e.currentTarget,n=d.indexOf(t),a=s[n].value;a!==o&&(m(t),u(a))},b=function(e){var t,n=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":var a,r=d.indexOf(e.currentTarget)+1;n=null!=(a=d[r])?a:d[0];break;case"ArrowLeft":var l,i=d.indexOf(e.currentTarget)-1;n=null!=(l=d[i])?l:d[d.length-1]}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},s.map((function(e){var t=e.value,n=e.label,i=e.attributes;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:o===t?0:-1,"aria-selected":o===t,key:t,ref:function(e){return d.push(e)},onKeyDown:b,onClick:p},i,{className:(0,l.Z)("tabs__item",c.tabItem,null==i?void 0:i.className,{"tabs__item--active":o===t})}),null!=n?n:t)})))}function d(e){var t=e.lazy,n=e.children,a=e.selectedValue,l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){var i=l.find((function(e){return e.props.value===a}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},l.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a})})))}function m(e){var t=(0,o.Y)(e);return r.createElement("div",{className:(0,l.Z)("tabs-container",c.tabList)},r.createElement(s,(0,a.Z)({},e,t)),r.createElement(d,(0,a.Z)({},e,t)))}function p(e){var t=(0,u.Z)();return r.createElement(m,(0,a.Z)({key:String(t)},e))}},38224:(e,t,n)=>{n.d(t,{Y:()=>m});var a=n(67294),r=n(16550),l=n(34423),i=n(20636),o=n(99200);function u(e){return function(e){var t,n;return null!=(t=null==(n=a.Children.map(e,(function(e){if(!e||(0,a.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:n.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function c(e){var t=e.values,n=e.children;return(0,a.useMemo)((function(){var e=null!=t?t:u(n);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,n])}function s(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function d(e){var t=e.queryString,n=void 0!==t&&t,i=e.groupId,o=(0,r.k6)(),u=function(e){var t=e.queryString,n=void 0!==t&&t,a=e.groupId;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!a)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=a?a:null}({queryString:n,groupId:i});return[(0,l._X)(u),(0,a.useCallback)((function(e){if(u){var t=new URLSearchParams(o.location.search);t.set(u,e),o.replace(Object.assign({},o.location,{search:t.toString()}))}}),[u,o])]}function m(e){var t,n,r,l,i=e.defaultValue,u=e.queryString,m=void 0!==u&&u,p=e.groupId,b=c(e),g=(0,a.useState)((function(){return function(e){var t,n=e.defaultValue,a=e.tabValues;if(0===a.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!s({value:n,tabValues:a}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+n+'" but none of its children has the corresponding value. Available values are: '+a.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return n}var r=null!=(t=a.find((function(e){return e.default})))?t:a[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:b})})),h=g[0],y=g[1],I=d({queryString:m,groupId:p}),C=I[0],f=I[1],v=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:p}.groupId),n=(0,o.Nk)(t),r=n[0],l=n[1],[r,(0,a.useCallback)((function(e){t&&l.set(e)}),[t,l])]),w=v[0],k=v[1],x=function(){var e=null!=C?C:w;return s({value:e,tabValues:b})?e:null}();return(0,a.useLayoutEffect)((function(){x&&y(x)}),[x]),{selectedValue:h,selectValue:(0,a.useCallback)((function(e){if(!s({value:e,tabValues:b}))throw new Error("Can't select invalid tab value="+e);y(e),f(e),k(e)}),[f,k,b]),tabValues:b}}},68889:(e,t,n)=>{n.d(t,{Z:()=>o});var a=n(67294),r=n(88746),l=n(6141),i=n(6832);const o=function(e){var t=e.to,n=e.children,o=(0,l.E)(),u=o.version,c=o.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(r.default,{to:"/api/"+t},n);var s=u+"/";return"current"===u?s="next/":c&&(s=""),a.createElement(r.default,{to:"/api/"+s+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>o,T:()=>i});var a=n(67294),r=n(88746),l="https://crawlee.dev",i=function(e){var t=e.to,n=e.children,i=e.version;return a.createElement(r.default,{href:l+"/api"+(i?"/"+i:"")+"/"+t},n)},o=function(e){var t=e.to,n=e.children;return a.createElement(r.default,{href:l+"/"+t},n)}},84974:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>I,contentTitle:()=>h,default:()=>k,frontMatter:()=>g,metadata:()=>y,toc:()=>C});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),i=n(65559),o=n(30433),u=(n(14563),n(68889)),c=n(26569);const s={code:"import { Actor } from 'apify';\nimport { CheerioCrawler } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'all' will enqueue all links found\n // highlight-next-line\n strategy: 'all',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgZW5xdWV1ZUxpbmtzIH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcyh7XFxuICAgICAgICAgICAgLy8gU2V0dGluZyB0aGUgc3RyYXRlZ3kgdG8gJ2FsbCcgd2lsbCBlbnF1ZXVlIGFsbCBsaW5rcyBmb3VuZFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogJ2FsbCcsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbJ2h0dHBzOi8vYXBpZnkuY29tLyddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.a1IFpzCtFyz6kXkEkdwjYb-WWnJaRH4hJxbbzFMcYfg"},d={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-hostname'\n // strategy: 'same-hostname',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgaG9zdG5hbWVcXG4gICAgICAgICAgICAvLyBhcyByZXF1ZXN0LmxvYWRlZFVybCBvciByZXF1ZXN0LnVybFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogRW5xdWV1ZVN0cmF0ZWd5LlNhbWVIb3N0bmFtZSxcXG4gICAgICAgICAgICAvLyBBbHRlcm5hdGl2ZWx5LCB5b3UgY2FuIHBhc3MgaW4gdGhlIHN0cmluZyAnc2FtZS1ob3N0bmFtZSdcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtaG9zdG5hbWUnLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.yF2AJFRXorzWRuCXhRGjM8nWXBFT585D7nwOkBPAPf0"},m={code:"import { Actor } from 'apify';\nimport { CheerioCrawler, EnqueueStrategy } from 'crawlee';\n\nawait Actor.init();\n\nconst crawler = new CheerioCrawler({\n maxRequestsPerCrawl: 10, // Limitation for only 10 requests (do not use if you want to crawl all links)\n async requestHandler({ request, enqueueLinks }) {\n console.log(request.url);\n await enqueueLinks({\n // Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname\n // as request.loadedUrl or request.url\n // highlight-next-line\n strategy: EnqueueStrategy.SameHostname,\n // Alternatively, you can pass in the string 'same-subdomain'\n // strategy: 'same-subdomain',\n });\n },\n});\n\n// Run the crawler\nawait crawler.run(['https://apify.com/']);\n\nawait Actor.exit();\n",hash:"eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw"};var p,b=["components"],g={id:"crawl-relative-links",title:"Crawl a website with relative links"},h=void 0,y={unversionedId:"examples/crawl-relative-links",id:"examples/crawl-relative-links",title:"Crawl a website with relative links",description:"When crawling a website, you may encounter different types of links present that you may want to crawl.",source:"@site/../docs/examples/crawl_relative_links.mdx",sourceDirName:"examples",slug:"/examples/crawl-relative-links",permalink:"/sdk/js/docs/next/examples/crawl-relative-links",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_relative_links.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"crawl-relative-links",title:"Crawl a website with relative links"},sidebar:"docs",previous:{title:"Crawl multiple URLs",permalink:"/sdk/js/docs/next/examples/crawl-multiple-urls"},next:{title:"Crawl a single URL",permalink:"/sdk/js/docs/next/examples/crawl-single-url"}},I={},C=[],f=(p="RunnableCodeBlock",function(e){return console.warn("Component "+p+" was not imported, exported, or provided by MDXProvider as global scope"),(0,l.kt)("div",e)}),v={toc:C},w="wrapper";function k(e){var t=e.components,n=(0,r.Z)(e,b);return(0,l.kt)(w,(0,a.Z)({},v,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("p",null,"When crawling a website, you may encounter different types of links present that you may want to crawl.\nTo facilitate the easy crawling of such links, we provide the ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," method on the crawler context, which will\nautomatically find links and add them to the crawler's ",(0,l.kt)(u.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"RequestQueue")),"."),(0,l.kt)("p",null,"We provide 3 different strategies for crawling relative links:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#All",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"All"))," which will enqueue all links found, regardless of the domain they point to."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameHostname",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameHostname"))," which will enqueue all links found for the same hostname (regardless of any subdomains present)."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)(c.T,{to:"core/enum/EnqueueStrategy#SameSubdomain",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",null,"SameSubdomain"))," which will enqueue all links found that have the same subdomain and hostname. This is the default strategy.")),(0,l.kt)("admonition",{type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For these examples, we are using the ",(0,l.kt)(c.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),", however\nthe same method is available for both the ",(0,l.kt)(c.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"\nand ",(0,l.kt)(c.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,l.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", and you use it\nthe exact same way.")),(0,l.kt)(i.Z,{groupId:"enqueue_strategy",mdxType:"Tabs"},(0,l.kt)(o.Z,{value:"all",label:"All Links",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"Any urls found will be matched by this strategy, even if they go off of the site you are currently crawling.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},s)),(0,l.kt)(o.Z,{value:"same_hostname",label:"Same Hostname",mdxType:"TabItem"},(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will match relative urls, urls that point to the same\nfull domain or urls that point to any subdomain of the provided domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"https://example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example"),"\nor ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example")," will all be matched by this strategy.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},d)),(0,l.kt)(o.Z,{value:"same-subdomain",label:"Same Subdomain",default:!0,mdxType:"TabItem"},(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This is the default strategy when calling ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()"),", so you don't have to specify it.")),(0,l.kt)("admonition",{title:"Example domains",type:"note"},(0,l.kt)("p",{parentName:"admonition"},"For a url of ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," will only match relative urls or urls that point to the same\nfull domain."),(0,l.kt)("p",{parentName:"admonition"},"For instance, hyperlinks like ",(0,l.kt)("inlineCode",{parentName:"p"},"https://subdomain.example.com/some/path"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"/absolute/example")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"./relative/example"),"\nwill all be matched by this strategy, while ",(0,l.kt)("inlineCode",{parentName:"p"},"https://other-subdomain.example.com")," or ",(0,l.kt)("inlineCode",{parentName:"p"},"https://otherexample.com")," will not.")),(0,l.kt)(f,{className:"language-js",type:"cheerio",mdxType:"RunnableCodeBlock"},m))))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>b});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),c=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return a.createElement(u.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,u=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=c(n),p=r,b=d["".concat(u,".").concat(p)]||d[p]||m[p]||l;return n?a.createElement(b,i(i({ref:t},s),{},{components:n})):a.createElement(b,i({ref:t},s))}));function b(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=p;var o={};for(var u in t)hasOwnProperty.call(t,u)&&(o[u]=t[u]);o.originalType=e,o[d]="string"==typeof e?e:r,i[1]=o;for(var c=2;c<l;c++)i[c]=n[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}p.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f68ae16a.5b6b5371.js b/assets/js/f68ae16a.5b6b5371.js deleted file mode 100644 index 9f20bfc067..0000000000 --- a/assets/js/f68ae16a.5b6b5371.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3507],{68889:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),s=r(6141),o=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,s.E)(),u=i.version,l=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=u+"/";return"current"===u?p="next/":l&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},88569:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>g,frontMatter:()=>l,metadata:()=>c,toc:()=>h});var n,a=r(87462),s=r(63366),o=(r(67294),r(3905)),i=r(68889),u=["components"],l={id:"request-storage",title:"Request Storage"},p=void 0,c={unversionedId:"guides/request-storage",id:"guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/../docs/guides/request_storage.mdx",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/next/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/request_storage.mdx",tags:[],version:"current",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/next/guides/apify-platform"},next:{title:"Result Storage",permalink:"/sdk/js/docs/next/guides/result-storage"}},d={},h=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],m=(n="CrawleeApiLink",function(e){return console.warn("Component "+n+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:h},q="wrapper";function g(e){var t=e.components,r=(0,s.Z)(e,u);return(0,o.kt)(q,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await RequestQueue.open();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,o.kt)("h2",{id:"request-list"},"Request list"),(0,o.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,o.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,o.kt)(m,{to:"core/class/RequestList",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestList"))," class."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await RequestList.open('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,o.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,o.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,o.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,o.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,o.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await RequestList.open('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await RequestQueue.open();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}g.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=l(r),h=a,m=c["".concat(u,".").concat(h)]||c[h]||d[h]||s;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f68ae16a.602ace02.js b/assets/js/f68ae16a.602ace02.js new file mode 100644 index 0000000000..11cdd12e22 --- /dev/null +++ b/assets/js/f68ae16a.602ace02.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3507],{68889:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),s=r(6141),o=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,s.E)(),u=i.version,l=i.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var p=u+"/";return"current"===u?p="next/":l&&(p=""),n.createElement(a.default,{to:"/api/"+p+t},r)}},88569:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>c,toc:()=>h});var n,a=r(87462),s=r(63366),o=(r(67294),r(3905)),i=r(68889),u=["components"],l={id:"request-storage",title:"Request Storage"},p=void 0,c={unversionedId:"guides/request-storage",id:"guides/request-storage",title:"Request Storage",description:"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the",source:"@site/../docs/guides/request_storage.mdx",sourceDirName:"guides",slug:"/guides/request-storage",permalink:"/sdk/js/docs/next/guides/request-storage",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/request_storage.mdx",tags:[],version:"current",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"request-storage",title:"Request Storage"},sidebar:"docs",previous:{title:"Apify Platform",permalink:"/sdk/js/docs/next/guides/apify-platform"},next:{title:"Result Storage",permalink:"/sdk/js/docs/next/guides/result-storage"}},d={},h=[{value:"Request queue",id:"request-queue",level:2},{value:"Request list",id:"request-list",level:2},{value:"Which one to choose?",id:"which-one-to-choose",level:2}],m=(n="CrawleeApiLink",function(e){return console.warn("Component "+n+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",e)}),f={toc:h},q="wrapper";function y(e){var t=e.components,r=(0,s.Z)(e,u);return(0,o.kt)(q,(0,a.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the\n",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable, or on the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform")," under the user account identified by the API token defined by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable. If neither of these variables is defined, by default Apify SDK sets ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage")," in the current working directory and prints a warning."),(0,o.kt)("p",null,"Typically, you will be developing the code on your local computer and thus set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_TOKEN")," environment variable and thus use cloud storage. No code changes are needed."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/storage",target:"_blank",rel:"noopener"},"Apify platform storage documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/storage",target:"_blank",rel:"noopener"},"View storage in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/api/v2#/reference/request-queues",target:"_blank",rel:"noopener"},"Request queues API reference"))),(0,o.kt)("h2",{id:"request-queue"},"Request queue"),(0,o.kt)("p",null,"The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders."),(0,o.kt)("p",null,"Each actor run is associated with a ",(0,o.kt)("strong",{parentName:"p"},"default request queue"),", which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request queue is represented by the ",(0,o.kt)(i.Z,{to:"apify/class/RequestQueue",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestQueue"))," class."),(0,o.kt)("p",null,"In local configuration, the request queue is emulated by ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-storage-local-js",target:"_blank",rel:"noopener"},"@apify/storage-local")," NPM package and its data is stored in SQLite database in the directory specified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOCAL_STORAGE_DIR")," environment variable as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"{APIFY_LOCAL_STORAGE_DIR}/request_queues/{QUEUE_ID}/db.sqlite\n")),(0,o.kt)("p",null,"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"{QUEUE_ID}")," is the name or ID of the request queue. The default queue has ID ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", unless you override it by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_DEFAULT_REQUEST_QUEUE_ID")," environment variable."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request queue:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Open the default request queue associated with the actor run\nconst requestQueue = await RequestQueue.open();\n// Enqueue the initial request\nawait requestQueue.addRequest({ url: 'https://example.com' });\n\n// The crawler will automatically process requests from the queue\nconst crawler = new CheerioCrawler({\n requestQueue,\n handlePageFunction: async ({ $, request }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'https://example.com/new-page' });\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ $, requestQueue });\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request queue with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-crawler",target:null,rel:null},"Puppeteer Crawler")," example."),(0,o.kt)("h2",{id:"request-list"},"Request list"),(0,o.kt)("p",null,"The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage#key-value-store",target:null,rel:null},"Key-Value Store")," associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web."),(0,o.kt)("p",null,"Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional."),(0,o.kt)("p",null,"In Apify SDK, the request list is represented by the ",(0,o.kt)(m,{to:"core/class/RequestList",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"RequestList"))," class."),(0,o.kt)("p",null,"The following code demonstrates basic operations of the request list:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list.\n// List name is used to persist the sources and the list state in the key-value store\nconst requestList = await RequestList.open('my-list', sources);\n\n// The crawler will automatically process requests from the list\nconst crawler = new PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // Process the page (extract data, take page screenshot, etc).\n // No more requests could be added to the request list here\n },\n});\n")),(0,o.kt)("p",null,"To see more detailed example of how to use the request list with a crawler, see the ",(0,o.kt)("a",{parentName:"p",href:"/docs/examples/puppeteer-with-proxy",target:null,rel:null},"Puppeteer with proxy")," example."),(0,o.kt)("h2",{id:"which-one-to-choose"},"Which one to choose?"),(0,o.kt)("p",null,"When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either."),(0,o.kt)("p",null,"On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue."),(0,o.kt)("p",null,"Note that Request queue and Request list can be used together by the same crawler.\nIn such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter.\nThis is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue).\nIn practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler."),(0,o.kt)("p",null,"The following code demonstrates how to use Request queue and Request list in the same crawler:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Prepare the sources array with URLs to visit (it can contain millions of URLs)\nconst sources = [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n];\n// Open the request list\nconst requestList = await RequestList.open('my-list', sources);\n\n// Open the default request queue. It's not necessary to add any requests to the queue\nconst requestQueue = await RequestQueue.open();\n\n// The crawler will automatically process requests from the list and the queue\nconst crawler = new PuppeteerCrawler({\n requestList,\n requestQueue,\n // Each request from the request list is enqueued to the request queue one by one.\n // At this point request with the same URL would exist in the list and the queue\n handlePageFunction: async ({ request, page }) => {\n // Add new request to the queue\n await requestQueue.addRequest({ url: 'http://www.example.com/new-page' });\n\n // Add links found on page to the queue\n await Actor.utils.enqueueLinks({ page, requestQueue });\n\n // The requests above would be added to the queue (but not to the list)\n // and would be processed after the request list is empty.\n // No more requests could be added to the list here\n },\n});\n")))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=n.createContext({}),l=function(e){var t=n.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(u.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,s=e.originalType,u=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=l(r),h=a,m=c["".concat(u,".").concat(h)]||c[h]||d[h]||s;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=r.length,o=new Array(s);o[0]=h;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i[c]="string"==typeof e?e:a,o[1]=i;for(var l=2;l<s;l++)o[l]=r[l];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6c1d5d4.1d3784d1.js b/assets/js/f6c1d5d4.1d3784d1.js deleted file mode 100644 index 524603f088..0000000000 --- a/assets/js/f6c1d5d4.1d3784d1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3502],{47477:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),p=["components"],o={id_old:"version-1.3-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},i=void 0,s={unversionedId:"api/puppeteer-crawler",id:"version-1.3/api/puppeteer-crawler",title:"PuppeteerCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chrome with Puppeteer. The",source:"@site/versioned_docs/version-1.3/api/PuppeteerCrawler.md",sourceDirName:"api",slug:"/api/puppeteer-crawler",permalink:"/sdk/js/docs/1.3/api/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/1.3/api/playwright-crawler"},next:{title:"Statistics",permalink:"/sdk/js/docs/1.3/api/statistics"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>stats</code>",id:"stats",level:3},{value:"<code>requestList</code>",id:"requestlist",level:3},{value:"<code>requestQueue</code>",id:"requestqueue",level:3},{value:"<code>sessionPool</code>",id:"sessionpool",level:3},{value:"<code>proxyConfiguration</code>",id:"proxyconfiguration",level:3},{value:"<code>browserPool</code>",id:"browserpool",level:3},{value:"<code>autoscaledPool</code>",id:"autoscaledpool",level:3},{value:"<code>new PuppeteerCrawler(options)</code>",id:"new-puppeteercrawleroptions",level:2}],d={toc:c},m="wrapper";function h(e){var t=e.components,r=(0,n.Z)(e,p);return(0,l.kt)(m,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chrome with ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),". The\nURLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," uses headless Chrome to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Puppeteer instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Puppeteer.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("h2",{id:"new-puppeteercrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PuppeteerCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),c=s(r),m=n,h=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return r?a.createElement(h,p(p({ref:t},u),{},{components:r})):a.createElement(h,p({ref:t},u))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,p=new Array(l);p[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[c]="string"==typeof e?e:n,p[1]=o;for(var s=2;s<l;s++)p[s]=r[s];return a.createElement.apply(null,p)}return a.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6c1d5d4.cf783532.js b/assets/js/f6c1d5d4.cf783532.js new file mode 100644 index 0000000000..3b147a55f0 --- /dev/null +++ b/assets/js/f6c1d5d4.cf783532.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3502],{47477:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>h,frontMatter:()=>p,metadata:()=>s,toc:()=>c});var a=r(87462),n=r(63366),l=(r(67294),r(3905)),o=["components"],p={id_old:"version-1.3-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},i=void 0,s={unversionedId:"api/puppeteer-crawler",id:"version-1.3/api/puppeteer-crawler",title:"PuppeteerCrawler",description:"Provides a simple framework for parallel crawling of web pages using headless Chrome with Puppeteer. The",source:"@site/versioned_docs/version-1.3/api/PuppeteerCrawler.md",sourceDirName:"api",slug:"/api/puppeteer-crawler",permalink:"/sdk/js/docs/1.3/api/puppeteer-crawler",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerCrawler.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-crawler",title:"PuppeteerCrawler",id:"puppeteer-crawler"},sidebar:"version-1.3/docs",previous:{title:"PlaywrightCrawler",permalink:"/sdk/js/docs/1.3/api/playwright-crawler"},next:{title:"Statistics",permalink:"/sdk/js/docs/1.3/api/statistics"}},u={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>stats</code>",id:"stats",level:3},{value:"<code>requestList</code>",id:"requestlist",level:3},{value:"<code>requestQueue</code>",id:"requestqueue",level:3},{value:"<code>sessionPool</code>",id:"sessionpool",level:3},{value:"<code>proxyConfiguration</code>",id:"proxyconfiguration",level:3},{value:"<code>browserPool</code>",id:"browserpool",level:3},{value:"<code>autoscaledPool</code>",id:"autoscaledpool",level:3},{value:"<code>new PuppeteerCrawler(options)</code>",id:"new-puppeteercrawleroptions",level:2}],d={toc:c},m="wrapper";function h(e){var t=e.components,r=(0,n.Z)(e,o);return(0,l.kt)(m,(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("p",null,"Provides a simple framework for parallel crawling of web pages using headless Chrome with ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/puppeteer/puppeteer",target:"_blank",rel:"noopener"},"Puppeteer"),". The\nURLs to crawl are fed either from a static list of URLs or from a dynamic queue of URLs enabling recursive crawling of websites."),(0,l.kt)("p",null,"Since ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," uses headless Chrome to download web pages and extract data, it is useful for crawling of websites that require to execute\nJavaScript. If the target website doesn't need JavaScript, consider using ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler")),", which downloads the pages using\nraw HTTP requests and is about 10x faster."),(0,l.kt)("p",null,"The source URLs are represented using ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects that are fed from ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," instances provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," or\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," constructor options, respectively."),(0,l.kt)("p",null,"If both ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestlist",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestList"))," and\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#requestqueue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.requestQueue"))," are used, the instance first processes URLs from the\n",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," and automatically enqueues all of them to ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," before it starts their\nprocessing. This ensures that a single URL is not crawled multiple times."),(0,l.kt)("p",null,"The crawler finishes when there are no more ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," objects to crawl."),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," opens a new Chrome page (i.e. tab) for each ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request"))," object to crawl and then calls the function provided by\nuser as the ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#handlepagefunction",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.handlePageFunction"))," option."),(0,l.kt)("p",null,"New pages are only opened when there is enough free CPU and memory available, using the functionality provided by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class. All ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," configuration options can be passed to the\n",(0,l.kt)("a",{parentName:"p",href:"../typedefs/puppeteer-crawler-options#autoscaledpooloptions",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions.autoscaledPoolOptions"))," parameter of the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),"\nconstructor. For user convenience, the ",(0,l.kt)("inlineCode",{parentName:"p"},"minConcurrency")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxConcurrency")," ",(0,l.kt)("a",{parentName:"p",href:"../typedefs/autoscaled-pool-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPoolOptions"))," are\navailable directly in the ",(0,l.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")," constructor."),(0,l.kt)("p",null,"Note that the pool of Puppeteer instances is internally managed by the ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Example usage:")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-javascript"},"const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n // This function is called to extract data from a single web page\n // 'page' is an instance of Puppeteer.Page with page.goto(request.url) already called\n // 'request' is an instance of Request class with information about the page to load\n await Apify.pushData({\n title: await page.title(),\n url: request.url,\n succeeded: true,\n });\n },\n handleFailedRequestFunction: async ({ request }) => {\n // This function is called when the crawling of a request failed too many times\n await Apify.pushData({\n url: request.url,\n succeeded: false,\n errors: request.errorMessages,\n });\n },\n});\n\nawait crawler.run();\n")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"stats"},(0,l.kt)("inlineCode",{parentName:"h3"},"stats")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/statistics",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Statistics"))),(0,l.kt)("p",null,"Contains statistics about the current run."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestlist"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestList")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-list",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestList"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"requestqueue"},(0,l.kt)("inlineCode",{parentName:"h3"},"requestQueue")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/request-queue",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"RequestQueue"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/request",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Request")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"sessionpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"sessionPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/session-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SessionPool"))," class that manages the crawler's ",(0,l.kt)("a",{parentName:"p",href:"../api/session",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"Session")),"s. Only available if\nused by the crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"proxyconfiguration"},(0,l.kt)("inlineCode",{parentName:"h3"},"proxyConfiguration")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/proxy-configuration",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"ProxyConfiguration"))," class that manages the crawler's proxies. Only available if used by\nthe crawler."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"browserpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"browserPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("inlineCode",{parentName:"p"},"BrowserPool")," class that manages the crawler's browsers. For more information about it, see the\n",(0,l.kt)("a",{parentName:"p",href:"https://github.com/apify/browser-pool",target:"_blank",rel:"noopener"},(0,l.kt)("inlineCode",{parentName:"a"},"browser-pool")," module"),"."),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"autoscaledpool"},(0,l.kt)("inlineCode",{parentName:"h3"},"autoscaledPool")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Type"),": ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))),(0,l.kt)("p",null,"A reference to the underlying ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class that manages the concurrency of the crawler. Note that this property is\nonly initialized after calling the ",(0,l.kt)("a",{parentName:"p",href:"../api/cheerio-crawler#run",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"CheerioCrawler.run()"))," function. You can use it to change the concurrency settings on\nthe fly, to pause the crawler by calling ",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#pause",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.pause()"))," or to abort it by calling\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool#abort",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool.abort()")),"."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"puppeteercrawler"}),(0,l.kt)("h2",{id:"new-puppeteercrawleroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new PuppeteerCrawler(options)")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/puppeteer-crawler-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"PuppeteerCrawlerOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")," parameters are passed via an options\nobject.")),(0,l.kt)("hr",null))}h.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var a=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var i=a.createContext({}),s=function(e){var t=a.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),c=s(r),m=n,h=c["".concat(i,".").concat(m)]||c[m]||d[m]||l;return r?a.createElement(h,o(o({ref:t},u),{},{components:r})):a.createElement(h,o({ref:t},u))}));function h(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=r.length,o=new Array(l);o[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p[c]="string"==typeof e?e:n,o[1]=p;for(var s=2;s<l;s++)o[s]=r[s];return a.createElement.apply(null,o)}return a.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6c4c87b.2cc4f622.js b/assets/js/f6c4c87b.2cc4f622.js deleted file mode 100644 index 13dd0d1be2..0000000000 --- a/assets/js/f6c4c87b.2cc4f622.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4304],{68889:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(67294),i=n(88746),r=n(6141),o=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(i.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(i.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>l,T:()=>o});var a=n(67294),i=n(88746),r="https://crawlee.dev",o=function(e){var t=e.to,n=e.children,o=e.version;return a.createElement(i.default,{href:r+"/api"+(o?"/"+o:"")+"/"+t},n)},l=function(e){var t=e.to,n=e.children;return a.createElement(i.default,{href:r+"/"+t},n)}},54606:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=(n(68889),n(26569)),l=["components"],s={id:"upgrading-to-v3",title:"Upgrading to v3"},p=void 0,d={unversionedId:"upgrading/upgrading-to-v3",id:"version-3.1/upgrading/upgrading-to-v3",title:"Upgrading to v3",description:"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.",source:"@site/versioned_docs/version-3.1/upgrading/upgrading_v3.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v3",permalink:"/sdk/js/docs/upgrading/upgrading-to-v3",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v3.md",tags:[],version:"3.1",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"upgrading-to-v3",title:"Upgrading to v3"},sidebar:"docs",previous:{title:"Upgrading to v2",permalink:"/sdk/js/docs/upgrading/upgrading-to-v2"},next:{title:"Changelog",permalink:"/sdk/js/docs/changelog"}},u={},m=[{value:"Crawlee monorepo",id:"crawlee-monorepo",level:2},{value:"Installing Crawlee",id:"installing-crawlee",level:3},{value:"Full TypeScript support",id:"full-typescript-support",level:2},{value:"Docker build",id:"docker-build",level:3},{value:"Browser fingerprints",id:"browser-fingerprints",level:2},{value:"Session cookie method renames",id:"session-cookie-method-renames",level:2},{value:"Memory storage",id:"memory-storage",level:2},{value:"Purging of the default storage",id:"purging-of-the-default-storage",level:2},{value:"Renamed crawler options and interfaces",id:"renamed-crawler-options-and-interfaces",level:2},{value:"Context aware helpers",id:"context-aware-helpers",level:2},{value:"Enqueuing links",id:"enqueuing-links",level:3},{value:"Implicit <code>RequestQueue</code> instance",id:"implicit-requestqueue-instance",level:2},{value:"<code>crawler.addRequests()</code>",id:"crawleraddrequests",level:2},{value:"Less verbose error logging",id:"less-verbose-error-logging",level:2},{value:"<code>Request.label</code> shortcut",id:"requestlabel-shortcut",level:2},{value:"Removal of <code>requestAsBrowser</code>",id:"removal-of-requestasbrowser",level:2},{value:"How to use <code>sendRequest()</code>?",id:"how-to-use-sendrequest",level:3},{value:"Removed options",id:"removed-options",level:3},{value:"Renamed options",id:"renamed-options",level:3},{value:"<code>payload</code>",id:"payload",level:4},{value:"<code>ignoreSslErrors</code>",id:"ignoresslerrors",level:4},{value:"<code>header-generator</code> options",id:"header-generator-options",level:4},{value:"<code>timeoutSecs</code>",id:"timeoutsecs",level:4},{value:"<code>throwOnHttpErrors</code>",id:"throwonhttperrors",level:4},{value:"<code>decodeBody</code>",id:"decodebody",level:4},{value:"<code>abortFunction</code>",id:"abortfunction",level:4},{value:"Removal of browser pool plugin mixing",id:"removal-of-browser-pool-plugin-mixing",level:2},{value:"Handling requests outside of browser",id:"handling-requests-outside-of-browser",level:2},{value:"Logging",id:"logging",level:2},{value:"Auto-saved crawler state",id:"auto-saved-crawler-state",level:2},{value:"Apify SDK",id:"apify-sdk",level:2},{value:"Events",id:"events",level:3},{value:"Smaller/internal breaking changes",id:"smallerinternal-breaking-changes",level:2}],c={toc:m},k="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(k,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3."),(0,r.kt)("admonition",{title:"Crawlee vs Apify SDK v2",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Up until version 3 of ",(0,r.kt)("inlineCode",{parentName:"p"},"apify"),", the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/crawlee",target:"_blank",rel:"noopener"},"Crawlee"),", the new web-scraping library, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package on NPM"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/apify-sdk-js",target:"_blank",rel:"noopener"},"Apify SDK"),", helpers for the Apify platform, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"apify"))," package on NPM"))),(0,r.kt)("h2",{id:"crawlee-monorepo"},"Crawlee monorepo"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package consists of several smaller packages, released separately under ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee")," namespace:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/core"),": the base for all the crawler implementations, also contains things like ",(0,r.kt)("inlineCode",{parentName:"li"},"Request"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestQueue"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestList")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Dataset")," classes"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/basic"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BasicCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/http"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"HttpCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"DOMCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BrowserCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/memory-storage"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"@apify/storage-local")," alternative"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser-pool"),": previously ",(0,r.kt)("inlineCode",{parentName:"li"},"browser-pool")," package"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/utils"),": utility methods"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/types"),": holds TS interfaces mainly about the ",(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient"))),(0,r.kt)("h3",{id:"installing-crawlee"},"Installing Crawlee"),(0,r.kt)("p",null,"Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright")," if you plan on using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," - it already contains everything from the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/browser")," package, which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/basic"),", which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/core"),"."),(0,r.kt)("p",null,"If we don't care much about additional code being pulled in, we can just use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package, which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee\n")),(0,r.kt)("p",null,"Or if all we need is cheerio support, we can install only ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/cheerio"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @crawlee/cheerio\n")),(0,r.kt)("p",null,"When using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer"),", we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee playwright\n# or npm install @crawlee/playwright playwright\n")),(0,r.kt)("p",null,"Alternatively we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sometimes you might want to use some utility methods from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/utils"),", so you might want to install that as well. This package contains some utilities that were previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils"),". Browser related utilities can be also found in the crawler packages (e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright"),").")),(0,r.kt)("h2",{id:"full-typescript-support"},"Full TypeScript support"),(0,r.kt)("p",null,"Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," package. Don't forget to set the ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"target")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"ES2022")," or above to be able to use top level await."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," config has ",(0,r.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#noImplicitAny",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"noImplicitAny"))," enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="tsconfig.json"',title:'"tsconfig.json"'},'{\n "extends": "@apify/tsconfig",\n "compilerOptions": {\n "module": "ES2022",\n "target": "ES2022",\n "outDir": "dist",\n "lib": ["DOM"]\n },\n "include": [\n "./src/**/*"\n ]\n}\n')),(0,r.kt)("h3",{id:"docker-build"},"Docker build"),(0,r.kt)("p",null,"For ",(0,r.kt)("inlineCode",{parentName:"p"},"Dockerfile")," we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-dockerfile",metastring:'title="Dockerfile"',title:'"Dockerfile"'},'# using multistage build, as we need dev deps to build the TS source code\nFROM apify/actor-node:16 AS builder\n\n# copy all files, install all dependencies (including dev deps) and build the project\nCOPY . ./\nRUN npm install --include=dev \\\n && npm run build\n\n# create final image\nFROM apify/actor-node:16\n# copy only necessary files\nCOPY --from=builder /usr/src/app/package*.json ./\nCOPY --from=builder /usr/src/app/README.md ./\nCOPY --from=builder /usr/src/app/dist ./dist\nCOPY --from=builder /usr/src/app/apify.json ./apify.json\nCOPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json\n\n# install only prod deps\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --only=prod --no-optional --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# run compiled code\nCMD npm run start:prod\n')),(0,r.kt)("h2",{id:"browser-fingerprints"},"Browser fingerprints"),(0,r.kt)("p",null,"Previously we had a magical ",(0,r.kt)("inlineCode",{parentName:"p"},"stealth")," option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints."),(0,r.kt)("p",null,"In case we don't want to have dynamic fingerprints, we can disable this behaviour via ",(0,r.kt)("inlineCode",{parentName:"p"},"useFingerprints")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: false,\n },\n});\n")),(0,r.kt)("h2",{id:"session-cookie-method-renames"},"Session cookie method renames"),(0,r.kt)("p",null,"Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getPuppeteerCookies()")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setPuppeteerCookies()"),". Since this method could be used for any of our crawlers, not just ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),", the methods have been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getCookies()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setCookies()")," respectively. Otherwise, their usage is exactly the same!"),(0,r.kt)("h2",{id:"memory-storage"},"Memory storage"),(0,r.kt)("p",null,"When we store some data or intermediate state (like the one ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," holds), we now use ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/memory-storage")," by default. It is an alternative to the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", that stores the state inside memory (as opposed to SQLite database used by ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),"). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the ",(0,r.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file)."),(0,r.kt)("p",null,"When we want to run the crawler on Apify platform, we need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main"),", which will automatically switch the storage client to ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when on the Apify platform."),(0,r.kt)("p",null,"We can still use the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", to do it, first install it pass it to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," options:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local")," v2.1.0+ is required for Crawlee")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\nimport { ApifyStorageLocal } from '@apify/storage-local';\n\nconst storage = new ApifyStorageLocal(/* options like `enableWalMode` belong here */);\nawait Actor.init({ storage });\n")),(0,r.kt)("h2",{id:"purging-of-the-default-storage"},"Purging of the default storage"),(0,r.kt)("p",null,"Previously the state was preserved between local runs, and we had to use ",(0,r.kt)("inlineCode",{parentName:"p"},"--purge")," argument of the ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-cli"),". With Crawlee, this is now the default behaviour, we purge the storage automatically on ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init/main")," call. We can opt out of it via ",(0,r.kt)("inlineCode",{parentName:"p"},"purge: false")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," options."),(0,r.kt)("h2",{id:"renamed-crawler-options-and-interfaces"},"Renamed crawler options and interfaces"),(0,r.kt)("p",null,"Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"requestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"navigationTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleFailedRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"failedRequestHandler"))),(0,r.kt)("p",null,"We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CheerioHandlePageInputs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawlingContext"))),(0,r.kt)("h2",{id:"context-aware-helpers"},"Context aware helpers"),(0,r.kt)("p",null,"Some utilities previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils")," namespace are now moved to the crawling context and are ",(0,r.kt)("em",{parentName:"p"},"context aware"),". This means they have some parameters automatically filled in from the context, like the current ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," instance or current ",(0,r.kt)("inlineCode",{parentName:"p"},"Page")," object, or the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," bound to the crawler."),(0,r.kt)("h3",{id:"enqueuing-links"},"Enqueuing links"),(0,r.kt)("p",null,"One common helper that received more attention is the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks"),". As mentioned above, it is context aware - we no longer need pass in the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," arguments (or the cheerio handle ",(0,r.kt)("inlineCode",{parentName:"p"},"$"),"). In addition to that, it now offers 3 enqueuing strategies:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.All")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'all'"),"): Matches any URLs found"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameHostname")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-hostname'"),") Matches any URLs that have the same subdomain as the base URL (default)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameDomain")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-domain'"),") Matches any URLs that have the same domain name. For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://wow.an.example.com")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com")," will both be matched for a base url of ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com"),".")),(0,r.kt)("p",null,"This means we can even call ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain."),(0,r.kt)("p",null,"Moreover, we can specify patterns the URL should match via globs:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n async requestHandler({ enqueueLinks }) {\n await enqueueLinks({\n globs: ['https://crawlee.dev/*/*'],\n // we can also use `regexps` and `pseudoUrls` keys here\n });\n },\n});\n")),(0,r.kt)("h2",{id:"implicit-requestqueue-instance"},"Implicit ",(0,r.kt)("inlineCode",{parentName:"h2"},"RequestQueue")," instance"),(0,r.kt)("p",null,"All crawlers now have the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance automatically available via ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance manually, and we can just use ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.addRequests()")," method described underneath."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can still create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," explicitly, the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method will respect that and return the instance provided via crawler options.")),(0,r.kt)("h2",{id:"crawleraddrequests"},(0,r.kt)("inlineCode",{parentName:"h2"},"crawler.addRequests()")),(0,r.kt)("p",null,"We can now add multiple requests in batches. The newly added ",(0,r.kt)("inlineCode",{parentName:"p"},"addRequests")," method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// will resolve right after the initial batch of 1000 requests is added\nconst result = await crawler.addRequests([/* many requests, can be even millions */]);\n\n// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise\nawait result.waitForAllRequestsToBeAdded;\n")),(0,r.kt)("h2",{id:"less-verbose-error-logging"},"Less verbose error logging"),(0,r.kt)("p",null,"Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"CRAWLEE_VERBOSE_LOG")," env var."),(0,r.kt)("h2",{id:"requestlabel-shortcut"},(0,r.kt)("inlineCode",{parentName:"h2"},"Request.label")," shortcut"),(0,r.kt)("p",null,"Labeling requests used to work via the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData")," object. With Crawlee, we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.label")," shortcut. It is implemented as a ",(0,r.kt)("inlineCode",{parentName:"p"},"get/set")," pair, using the value from ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData"),". The support for this shortcut is also added to the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," options interface."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"async requestHandler({ request, enqueueLinks }) {\n if (request.label !== 'DETAIL') {\n await enqueueLinks({\n globs: ['...'],\n label: 'DETAIL',\n });\n }\n}\n")),(0,r.kt)("h2",{id:"removal-of-requestasbrowser"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h2"},"requestAsBrowser")),(0,r.kt)("p",null,"In v1 we replaced the underlying implementation of ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," to be just a proxy over calling ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," - our custom extension to ",(0,r.kt)("inlineCode",{parentName:"p"},"got")," that tries to mimic the real browsers as much as possible. With v3, we are removing the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser"),", encouraging the use of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," directly."),(0,r.kt)("p",null,"For easier migration, we also added ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()")," helper that allows processing the context bound ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," object through ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping")),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new BasicCrawler({\n async requestHandler({ sendRequest, log }) {\n // we can use the options parameter to override gotScraping options\n const res = await sendRequest({ responseType: 'json' });\n log.info('received body', res.body);\n },\n});\n")),(0,r.kt)("h3",{id:"how-to-use-sendrequest"},"How to use ",(0,r.kt)("inlineCode",{parentName:"h3"},"sendRequest()"),"?"),(0,r.kt)("p",null,"See ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/guides/got-scraping",target:"_blank",rel:"noopener"},"the Got Scraping guide"),"."),(0,r.kt)("h3",{id:"removed-options"},"Removed options"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option has been removed. It's permanently set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," in order to better mimic browsers' behavior."),(0,r.kt)("p",null,"Got Scraping automatically performs protocol negotiation, hence we removed the ",(0,r.kt)("inlineCode",{parentName:"p"},"useHttp2")," option. It's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!"),(0,r.kt)("h3",{id:"renamed-options"},"Renamed options"),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," approach, some of the options were named differently. Here's a list of renamed options:"),(0,r.kt)("h4",{id:"payload"},(0,r.kt)("inlineCode",{parentName:"h4"},"payload")),(0,r.kt)("p",null,"This options represents the body to send. It could be a ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"Buffer"),". However, there is no ",(0,r.kt)("inlineCode",{parentName:"p"},"payload")," option anymore. You need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"body")," instead. Or, if you wish to send JSON, ",(0,r.kt)("inlineCode",{parentName:"p"},"json"),". Here's an example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, payload: 'Hello, world!' });\nawait Apify.utils.requestAsBrowser({ \u2026, payload: Buffer.from('c0ffe', 'hex') });\nawait Apify.utils.requestAsBrowser({ \u2026, json: { hello: 'world' } });\n\n// After:\nawait gotScraping({ \u2026, body: 'Hello, world!' });\nawait gotScraping({ \u2026, body: Buffer.from('c0ffe', 'hex') });\nawait gotScraping({ \u2026, json: { hello: 'world' } });\n")),(0,r.kt)("h4",{id:"ignoresslerrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"ignoreSslErrors")),(0,r.kt)("p",null,"It has been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"https.rejectUnauthorized"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," for convenience. However, if you want to make sure the connection is secure, you can do the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, ignoreSslErrors: false });\n\n// After:\nawait gotScraping({ \u2026, https: { rejectUnauthorized: true } });\n")),(0,r.kt)("p",null,"Please note: the meanings are opposite! So we needed to invert the values as well."),(0,r.kt)("h4",{id:"header-generator-options"},(0,r.kt)("inlineCode",{parentName:"h4"},"header-generator")," options"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"useMobileVersion"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"languageCode")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"countryCode")," no longer exist. Instead, you need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," directly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n useMobileVersion: true,\n languageCode: 'en',\n countryCode: 'US',\n});\n\n// After:\nawait gotScraping({\n \u2026,\n headerGeneratorOptions: {\n devices: ['mobile'], // or ['desktop']\n locales: ['en-US'],\n },\n});\n")),(0,r.kt)("h4",{id:"timeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h4"},"timeoutSecs")),(0,r.kt)("p",null,"In order to set a timeout, use ",(0,r.kt)("inlineCode",{parentName:"p"},"timeout.request")," (which is ",(0,r.kt)("strong",{parentName:"p"},"milliseconds")," now)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n timeoutSecs: 30,\n});\n\n// After:\nawait gotScraping({\n \u2026,\n timeout: {\n request: 30 * 1000,\n },\n});\n")),(0,r.kt)("h4",{id:"throwonhttperrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"throwOnHttpErrors")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"throwOnHttpErrors")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"throwHttpErrors"),". This options throws on unsuccessful HTTP status codes, for example ",(0,r.kt)("inlineCode",{parentName:"p"},"404"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h4",{id:"decodebody"},(0,r.kt)("inlineCode",{parentName:"h4"},"decodeBody")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"decodeBody")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"decompress"),". This options decompresses the body. Defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - please do not change this or websites will break (unless you know what you're doing!)."),(0,r.kt)("h4",{id:"abortfunction"},(0,r.kt)("inlineCode",{parentName:"h4"},"abortFunction")),(0,r.kt)("p",null,"This function used to make the promise throw on specific responses, if it returned ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". However, it wasn't that useful."),(0,r.kt)("p",null,"You probably want to cancel the request instead, which you can do in the following way:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const promise = gotScraping(\u2026);\n\npromise.on('request', request => {\n // Please note this is not a Got Request instance, but a ClientRequest one.\n // https://nodejs.org/api/http.html#class-httpclientrequest\n\n if (request.protocol !== 'https:') {\n // Unsecure request, abort.\n promise.cancel();\n\n // If you set `isStream` to `true`, please use `stream.destroy()` instead.\n }\n});\n\nconst response = await promise;\n")),(0,r.kt)("h2",{id:"removal-of-browser-pool-plugin-mixing"},"Removal of browser pool plugin mixing"),(0,r.kt)("p",null,"Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type)."),(0,r.kt)("admonition",{title:"Confused?",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!")),(0,r.kt)("h2",{id:"handling-requests-outside-of-browser"},"Handling requests outside of browser"),(0,r.kt)("p",null,"One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.skipNavigation")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()"),"."),(0,r.kt)("p",null,"Take a look at how to achieve this by checking out the ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/examples/skip-navigation",target:"_blank",rel:"noopener"},"Skipping navigation for certain requests")," example!"),(0,r.kt)("h2",{id:"logging"},"Logging"),(0,r.kt)("p",null,"Crawlee exports the default ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance directly as a named export. We also have a scoped ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ log, request }) {\n log.info(`Opened ${request.loadedUrl}`);\n },\n});\n")),(0,r.kt)("h2",{id:"auto-saved-crawler-state"},"Auto-saved crawler state"),(0,r.kt)("p",null,"Every crawler instance now has ",(0,r.kt)("inlineCode",{parentName:"p"},"useState()")," method that will return a state object we can use. It will be automatically saved when ",(0,r.kt)("inlineCode",{parentName:"p"},"persistState")," event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ crawler }) {\n const state = await crawler.useState({ foo: [] as number[] });\n // just change the value, no need to care about saving it\n state.foo.push(123);\n },\n});\n")),(0,r.kt)("h2",{id:"apify-sdk"},"Apify SDK"),(0,r.kt)("p",null,"The Apify platform helpers can be now found in the Apify SDK (",(0,r.kt)("inlineCode",{parentName:"p"},"apify")," NPM package). It exports the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor")," class that offers following static helpers:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient")," shortcuts: ",(0,r.kt)("inlineCode",{parentName:"li"},"addWebhook()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"call()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"callTask()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"metamorph()")),(0,r.kt)("li",{parentName:"ul"},"helpers for running on Apify platform: ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"exit()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"fail()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"main()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"isAtHome()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"createProxyConfiguration()")),(0,r.kt)("li",{parentName:"ul"},"storage support: ",(0,r.kt)("inlineCode",{parentName:"li"},"getInput()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"getValue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openDataset()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openKeyValueStore()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openRequestQueue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"pushData()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"setValue()")),(0,r.kt)("li",{parentName:"ul"},"events support: ",(0,r.kt)("inlineCode",{parentName:"li"},"on()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"off()")),(0,r.kt)("li",{parentName:"ul"},"other utilities: ",(0,r.kt)("inlineCode",{parentName:"li"},"getEnv()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"newClient()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"reboot()"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," is now just a syntax sugar around calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," at the beginning and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.init();\n// your code\nawait Actor.exit('Crawling finished!');\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.main(async () => {\n // your code\n}, { statusMessage: 'Crawling finished!' });\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," will conditionally set the storage implementation of Crawlee to the ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," will handle the tear down and calls ",(0,r.kt)("inlineCode",{parentName:"p"},"process.exit()")," to ensure our process won't hang indefinitely for some reason."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"Apify SDK (v2) exports ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.events"),", which is an ",(0,r.kt)("inlineCode",{parentName:"p"},"EventEmitter")," instance. With Crawlee, the events are managed by ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," class instead. We can either access it via ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.eventManager")," getter, or use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.on")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.off")," shortcuts instead."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-diff"},"-Apify.events.on(...);\n+Actor.on(...);\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can also get the ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," instance via ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration.getEventManager()"),".")),(0,r.kt)("p",null,"In addition to the existing events, we now have an ",(0,r.kt)("inlineCode",{parentName:"p"},"exit")," event fired when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," (which is called at the end of ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main()"),"). This event allows you to gracefully shut down any resources when ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit")," is called."),(0,r.kt)("h2",{id:"smallerinternal-breaking-changes"},"Smaller/internal breaking changes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.call()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.actor(actorId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.callTask()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.metamorph()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).metamorph(input, options)"),", while also taking the ACTOR_RUN_ID inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.waitForRunToFinish()")," has been removed, use ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.waitForFinish()")," instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Actor.main/init")," purges the storage by default"),(0,r.kt)("li",{parentName:"ul"},"remove ",(0,r.kt)("inlineCode",{parentName:"li"},"purgeLocalStorage")," helper, move purging to the storage class directly",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient")," interface now has optional ",(0,r.kt)("inlineCode",{parentName:"li"},"purge")," method"),(0,r.kt)("li",{parentName:"ul"},"purging happens automatically via ",(0,r.kt)("inlineCode",{parentName:"li"},"Actor.init()")," (you can opt out via ",(0,r.kt)("inlineCode",{parentName:"li"},"purge: false")," in the options of ",(0,r.kt)("inlineCode",{parentName:"li"},"init/main")," methods)"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"QueueOperationInfo.request")," is no longer available"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.handledAt")," is now string date in ISO format"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.inProgress")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Request.reclaimed")," are now ",(0,r.kt)("inlineCode",{parentName:"li"},"Set"),"s instead of POJOs"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"injectUnderscore")," from puppeteer utils has been removed"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"APIFY_MEMORY_MBYTES")," is no longer taken into account, use ",(0,r.kt)("inlineCode",{parentName:"li"},"CRAWLEE_AVAILABLE_MEMORY_RATIO")," instead"),(0,r.kt)("li",{parentName:"ul"},"some ",(0,r.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," options are no longer available:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"cpuSnapshotIntervalSecs")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"memorySnapshotIntervalSecs")," has been replaced with top level ",(0,r.kt)("inlineCode",{parentName:"li"},"systemInfoIntervalMillis")," configuration"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"maxUsedCpuRatio")," has been moved to the top level configuration"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ProxyConfiguration.newUrlFunction")," can be async. ",(0,r.kt)("inlineCode",{parentName:"li"},".newUrl()")," and ",(0,r.kt)("inlineCode",{parentName:"li"},".newProxyInfo()")," now return promises."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"prepareRequestFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"postResponseFunction")," options are removed, use navigation hooks instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"gotoFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"gotoTimeoutSecs")," are removed"),(0,r.kt)("li",{parentName:"ul"},"removed compatibility fix for old/broken request queues with null ",(0,r.kt)("inlineCode",{parentName:"li"},"Request")," props"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintsOptions")," renamed to ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," (",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprints")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprint"),")."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," now accept ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintCacheSize")," (instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintPerProxyCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintPerProxyCacheSize"),", which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=i,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<r;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6c4c87b.336b52f0.js b/assets/js/f6c4c87b.336b52f0.js new file mode 100644 index 0000000000..74df0a3eed --- /dev/null +++ b/assets/js/f6c4c87b.336b52f0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4304],{68889:(e,t,n)=>{n.d(t,{Z:()=>l});var a=n(67294),i=n(88746),r=n(6141),o=n(6832);const l=function(e){var t=e.to,n=e.children,l=(0,r.E)(),s=l.version,p=l.isLast;if((0,o.default)().siteConfig.presets[0][1].docs.disableVersioning)return a.createElement(i.default,{to:"/api/"+t},n);var d=s+"/";return"current"===s?d="next/":p&&(d=""),a.createElement(i.default,{to:"/api/"+d+t},n)}},26569:(e,t,n)=>{n.d(t,{B:()=>l,T:()=>o});var a=n(67294),i=n(88746),r="https://crawlee.dev",o=function(e){var t=e.to,n=e.children,o=e.version;return a.createElement(i.default,{href:r+"/api"+(o?"/"+o:"")+"/"+t},n)},l=function(e){var t=e.to,n=e.children;return a.createElement(i.default,{href:r+"/"+t},n)}},54606:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>p,default:()=>h,frontMatter:()=>s,metadata:()=>d,toc:()=>m});var a=n(87462),i=n(63366),r=(n(67294),n(3905)),o=(n(68889),n(26569)),l=["components"],s={id:"upgrading-to-v3",title:"Upgrading to v3"},p=void 0,d={unversionedId:"upgrading/upgrading-to-v3",id:"version-3.1/upgrading/upgrading-to-v3",title:"Upgrading to v3",description:"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.",source:"@site/versioned_docs/version-3.1/upgrading/upgrading_v3.md",sourceDirName:"upgrading",slug:"/upgrading/upgrading-to-v3",permalink:"/sdk/js/docs/upgrading/upgrading-to-v3",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v3.md",tags:[],version:"3.1",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"upgrading-to-v3",title:"Upgrading to v3"},sidebar:"docs",previous:{title:"Upgrading to v2",permalink:"/sdk/js/docs/upgrading/upgrading-to-v2"},next:{title:"Changelog",permalink:"/sdk/js/docs/changelog"}},u={},m=[{value:"Crawlee monorepo",id:"crawlee-monorepo",level:2},{value:"Installing Crawlee",id:"installing-crawlee",level:3},{value:"Full TypeScript support",id:"full-typescript-support",level:2},{value:"Docker build",id:"docker-build",level:3},{value:"Browser fingerprints",id:"browser-fingerprints",level:2},{value:"Session cookie method renames",id:"session-cookie-method-renames",level:2},{value:"Memory storage",id:"memory-storage",level:2},{value:"Purging of the default storage",id:"purging-of-the-default-storage",level:2},{value:"Renamed crawler options and interfaces",id:"renamed-crawler-options-and-interfaces",level:2},{value:"Context aware helpers",id:"context-aware-helpers",level:2},{value:"Enqueuing links",id:"enqueuing-links",level:3},{value:"Implicit <code>RequestQueue</code> instance",id:"implicit-requestqueue-instance",level:2},{value:"<code>crawler.addRequests()</code>",id:"crawleraddrequests",level:2},{value:"Less verbose error logging",id:"less-verbose-error-logging",level:2},{value:"<code>Request.label</code> shortcut",id:"requestlabel-shortcut",level:2},{value:"Removal of <code>requestAsBrowser</code>",id:"removal-of-requestasbrowser",level:2},{value:"How to use <code>sendRequest()</code>?",id:"how-to-use-sendrequest",level:3},{value:"Removed options",id:"removed-options",level:3},{value:"Renamed options",id:"renamed-options",level:3},{value:"<code>payload</code>",id:"payload",level:4},{value:"<code>ignoreSslErrors</code>",id:"ignoresslerrors",level:4},{value:"<code>header-generator</code> options",id:"header-generator-options",level:4},{value:"<code>timeoutSecs</code>",id:"timeoutsecs",level:4},{value:"<code>throwOnHttpErrors</code>",id:"throwonhttperrors",level:4},{value:"<code>decodeBody</code>",id:"decodebody",level:4},{value:"<code>abortFunction</code>",id:"abortfunction",level:4},{value:"Removal of browser pool plugin mixing",id:"removal-of-browser-pool-plugin-mixing",level:2},{value:"Handling requests outside of browser",id:"handling-requests-outside-of-browser",level:2},{value:"Logging",id:"logging",level:2},{value:"Auto-saved crawler state",id:"auto-saved-crawler-state",level:2},{value:"Apify SDK",id:"apify-sdk",level:2},{value:"Events",id:"events",level:3},{value:"Smaller/internal breaking changes",id:"smallerinternal-breaking-changes",level:2}],c={toc:m},k="wrapper";function h(e){var t=e.components,n=(0,i.Z)(e,l);return(0,r.kt)(k,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3."),(0,r.kt)("admonition",{title:"Crawlee vs Apify SDK v2",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Up until version 3 of ",(0,r.kt)("inlineCode",{parentName:"p"},"apify"),", the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/crawlee",target:"_blank",rel:"noopener"},"Crawlee"),", the new web-scraping library, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package on NPM"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/apify/apify-sdk-js",target:"_blank",rel:"noopener"},"Apify SDK"),", helpers for the Apify platform, available as ",(0,r.kt)("a",{parentName:"li",href:"https://www.npmjs.com/package/apify",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"apify"))," package on NPM"))),(0,r.kt)("h2",{id:"crawlee-monorepo"},"Crawlee monorepo"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"https://www.npmjs.com/package/crawlee",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"crawlee"))," package consists of several smaller packages, released separately under ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee")," namespace:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/core"),": the base for all the crawler implementations, also contains things like ",(0,r.kt)("inlineCode",{parentName:"li"},"Request"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestQueue"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"RequestList")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"Dataset")," classes"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/basic"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BasicCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/http"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"HttpCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/dom"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"DOMCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/cheerio"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"BrowserCrawler")," (which is used for creating ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),")"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/playwright"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/puppeteer"),": exports ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/memory-storage"),": ",(0,r.kt)("inlineCode",{parentName:"li"},"@apify/storage-local")," alternative"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/browser-pool"),": previously ",(0,r.kt)("inlineCode",{parentName:"li"},"browser-pool")," package"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/utils"),": utility methods"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"@crawlee/types"),": holds TS interfaces mainly about the ",(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient"))),(0,r.kt)("h3",{id:"installing-crawlee"},"Installing Crawlee"),(0,r.kt)("p",null,"Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright")," if you plan on using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," - it already contains everything from the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/browser")," package, which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/basic"),", which includes everything from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/core"),"."),(0,r.kt)("p",null,"If we don't care much about additional code being pulled in, we can just use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package, which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee\n")),(0,r.kt)("p",null,"Or if all we need is cheerio support, we can install only ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/cheerio"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install @crawlee/cheerio\n")),(0,r.kt)("p",null,"When using ",(0,r.kt)("inlineCode",{parentName:"p"},"playwright")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"puppeteer"),", we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"npm install crawlee playwright\n# or npm install @crawlee/playwright playwright\n")),(0,r.kt)("p",null,"Alternatively we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawlee")," meta-package which contains (re-exports) most of the ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/*")," packages, and therefore contains all the crawler classes."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Sometimes you might want to use some utility methods from ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/utils"),", so you might want to install that as well. This package contains some utilities that were previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils"),". Browser related utilities can be also found in the crawler packages (e.g. ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/playwright"),").")),(0,r.kt)("h2",{id:"full-typescript-support"},"Full TypeScript support"),(0,r.kt)("p",null,"Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," package. Don't forget to set the ",(0,r.kt)("inlineCode",{parentName:"p"},"module")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"target")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"ES2022")," or above to be able to use top level await."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/tsconfig")," config has ",(0,r.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#noImplicitAny",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"noImplicitAny"))," enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json",metastring:'title="tsconfig.json"',title:'"tsconfig.json"'},'{\n "extends": "@apify/tsconfig",\n "compilerOptions": {\n "module": "ES2022",\n "target": "ES2022",\n "outDir": "dist",\n "lib": ["DOM"]\n },\n "include": [\n "./src/**/*"\n ]\n}\n')),(0,r.kt)("h3",{id:"docker-build"},"Docker build"),(0,r.kt)("p",null,"For ",(0,r.kt)("inlineCode",{parentName:"p"},"Dockerfile")," we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-dockerfile",metastring:'title="Dockerfile"',title:'"Dockerfile"'},'# using multistage build, as we need dev deps to build the TS source code\nFROM apify/actor-node:16 AS builder\n\n# copy all files, install all dependencies (including dev deps) and build the project\nCOPY . ./\nRUN npm install --include=dev \\\n && npm run build\n\n# create final image\nFROM apify/actor-node:16\n# copy only necessary files\nCOPY --from=builder /usr/src/app/package*.json ./\nCOPY --from=builder /usr/src/app/README.md ./\nCOPY --from=builder /usr/src/app/dist ./dist\nCOPY --from=builder /usr/src/app/apify.json ./apify.json\nCOPY --from=builder /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json\n\n# install only prod deps\nRUN npm --quiet set progress=false \\\n && npm install --only=prod --no-optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --only=prod --no-optional --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# run compiled code\nCMD npm run start:prod\n')),(0,r.kt)("h2",{id:"browser-fingerprints"},"Browser fingerprints"),(0,r.kt)("p",null,"Previously we had a magical ",(0,r.kt)("inlineCode",{parentName:"p"},"stealth")," option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints."),(0,r.kt)("p",null,"In case we don't want to have dynamic fingerprints, we can disable this behaviour via ",(0,r.kt)("inlineCode",{parentName:"p"},"useFingerprints")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"browserPoolOptions"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n browserPoolOptions: {\n useFingerprints: false,\n },\n});\n")),(0,r.kt)("h2",{id:"session-cookie-method-renames"},"Session cookie method renames"),(0,r.kt)("p",null,"Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getPuppeteerCookies()")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setPuppeteerCookies()"),". Since this method could be used for any of our crawlers, not just ",(0,r.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"),", the methods have been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"session.getCookies()")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"session.setCookies()")," respectively. Otherwise, their usage is exactly the same!"),(0,r.kt)("h2",{id:"memory-storage"},"Memory storage"),(0,r.kt)("p",null,"When we store some data or intermediate state (like the one ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," holds), we now use ",(0,r.kt)("inlineCode",{parentName:"p"},"@crawlee/memory-storage")," by default. It is an alternative to the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", that stores the state inside memory (as opposed to SQLite database used by ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),"). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the ",(0,r.kt)("inlineCode",{parentName:"p"},"INPUT.json")," file)."),(0,r.kt)("p",null,"When we want to run the crawler on Apify platform, we need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main"),", which will automatically switch the storage client to ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when on the Apify platform."),(0,r.kt)("p",null,"We can still use the ",(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local"),", to do it, first install it pass it to the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," options:"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("inlineCode",{parentName:"p"},"@apify/storage-local")," v2.1.0+ is required for Crawlee")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\nimport { ApifyStorageLocal } from '@apify/storage-local';\n\nconst storage = new ApifyStorageLocal(/* options like `enableWalMode` belong here */);\nawait Actor.init({ storage });\n")),(0,r.kt)("h2",{id:"purging-of-the-default-storage"},"Purging of the default storage"),(0,r.kt)("p",null,"Previously the state was preserved between local runs, and we had to use ",(0,r.kt)("inlineCode",{parentName:"p"},"--purge")," argument of the ",(0,r.kt)("inlineCode",{parentName:"p"},"apify-cli"),". With Crawlee, this is now the default behaviour, we purge the storage automatically on ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init/main")," call. We can opt out of it via ",(0,r.kt)("inlineCode",{parentName:"p"},"purge: false")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init")," options."),(0,r.kt)("h2",{id:"renamed-crawler-options-and-interfaces"},"Renamed crawler options and interfaces"),(0,r.kt)("p",null,"Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandler")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleRequestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handlePageTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"requestHandlerTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"requestTimeoutSecs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"navigationTimeoutSecs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"handleFailedRequestFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"failedRequestHandler"))),(0,r.kt)("p",null,"We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"CheerioHandlePageInputs")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"CheerioCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PlaywrightCrawlingContext")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerHandlePageFunction")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"PuppeteerCrawlingContext"))),(0,r.kt)("h2",{id:"context-aware-helpers"},"Context aware helpers"),(0,r.kt)("p",null,"Some utilities previously available under ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.utils")," namespace are now moved to the crawling context and are ",(0,r.kt)("em",{parentName:"p"},"context aware"),". This means they have some parameters automatically filled in from the context, like the current ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," instance or current ",(0,r.kt)("inlineCode",{parentName:"p"},"Page")," object, or the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," bound to the crawler."),(0,r.kt)("h3",{id:"enqueuing-links"},"Enqueuing links"),(0,r.kt)("p",null,"One common helper that received more attention is the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks"),". As mentioned above, it is context aware - we no longer need pass in the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestQueue")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"page")," arguments (or the cheerio handle ",(0,r.kt)("inlineCode",{parentName:"p"},"$"),"). In addition to that, it now offers 3 enqueuing strategies:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.All")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'all'"),"): Matches any URLs found"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameHostname")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-hostname'"),") Matches any URLs that have the same subdomain as the base URL (default)"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"EnqueueStrategy.SameDomain")," (",(0,r.kt)("inlineCode",{parentName:"li"},"'same-domain'"),") Matches any URLs that have the same domain name. For example, ",(0,r.kt)("inlineCode",{parentName:"li"},"https://wow.an.example.com")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com")," will both be matched for a base url of ",(0,r.kt)("inlineCode",{parentName:"li"},"https://example.com"),".")),(0,r.kt)("p",null,"This means we can even call ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks()")," without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain."),(0,r.kt)("p",null,"Moreover, we can specify patterns the URL should match via globs:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new PlaywrightCrawler({\n async requestHandler({ enqueueLinks }) {\n await enqueueLinks({\n globs: ['https://crawlee.dev/*/*'],\n // we can also use `regexps` and `pseudoUrls` keys here\n });\n },\n});\n")),(0,r.kt)("h2",{id:"implicit-requestqueue-instance"},"Implicit ",(0,r.kt)("inlineCode",{parentName:"h2"},"RequestQueue")," instance"),(0,r.kt)("p",null,"All crawlers now have the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance automatically available via ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," instance manually, and we can just use ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.addRequests()")," method described underneath."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can still create the ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," explicitly, the ",(0,r.kt)("inlineCode",{parentName:"p"},"crawler.getRequestQueue()")," method will respect that and return the instance provided via crawler options.")),(0,r.kt)("h2",{id:"crawleraddrequests"},(0,r.kt)("inlineCode",{parentName:"h2"},"crawler.addRequests()")),(0,r.kt)("p",null,"We can now add multiple requests in batches. The newly added ",(0,r.kt)("inlineCode",{parentName:"p"},"addRequests")," method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestQueue")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"RequestList"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// will resolve right after the initial batch of 1000 requests is added\nconst result = await crawler.addRequests([/* many requests, can be even millions */]);\n\n// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise\nawait result.waitForAllRequestsToBeAdded;\n")),(0,r.kt)("h2",{id:"less-verbose-error-logging"},"Less verbose error logging"),(0,r.kt)("p",null,"Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the ",(0,r.kt)("inlineCode",{parentName:"p"},"CRAWLEE_VERBOSE_LOG")," env var."),(0,r.kt)("h2",{id:"requestlabel-shortcut"},(0,r.kt)("inlineCode",{parentName:"h2"},"Request.label")," shortcut"),(0,r.kt)("p",null,"Labeling requests used to work via the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData")," object. With Crawlee, we can also use the ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.label")," shortcut. It is implemented as a ",(0,r.kt)("inlineCode",{parentName:"p"},"get/set")," pair, using the value from ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.userData"),". The support for this shortcut is also added to the ",(0,r.kt)("inlineCode",{parentName:"p"},"enqueueLinks")," options interface."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"async requestHandler({ request, enqueueLinks }) {\n if (request.label !== 'DETAIL') {\n await enqueueLinks({\n globs: ['...'],\n label: 'DETAIL',\n });\n }\n}\n")),(0,r.kt)("h2",{id:"removal-of-requestasbrowser"},"Removal of ",(0,r.kt)("inlineCode",{parentName:"h2"},"requestAsBrowser")),(0,r.kt)("p",null,"In v1 we replaced the underlying implementation of ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," to be just a proxy over calling ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," - our custom extension to ",(0,r.kt)("inlineCode",{parentName:"p"},"got")," that tries to mimic the real browsers as much as possible. With v3, we are removing the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser"),", encouraging the use of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping"))," directly."),(0,r.kt)("p",null,"For easier migration, we also added ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()")," helper that allows processing the context bound ",(0,r.kt)("inlineCode",{parentName:"p"},"Request")," object through ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/apify/got-scraping",target:"_blank",rel:"noopener"},(0,r.kt)("inlineCode",{parentName:"a"},"got-scraping")),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new BasicCrawler({\n async requestHandler({ sendRequest, log }) {\n // we can use the options parameter to override gotScraping options\n const res = await sendRequest({ responseType: 'json' });\n log.info('received body', res.body);\n },\n});\n")),(0,r.kt)("h3",{id:"how-to-use-sendrequest"},"How to use ",(0,r.kt)("inlineCode",{parentName:"h3"},"sendRequest()"),"?"),(0,r.kt)("p",null,"See ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/guides/got-scraping",target:"_blank",rel:"noopener"},"the Got Scraping guide"),"."),(0,r.kt)("h3",{id:"removed-options"},"Removed options"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"useInsecureHttpParser")," option has been removed. It's permanently set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," in order to better mimic browsers' behavior."),(0,r.kt)("p",null,"Got Scraping automatically performs protocol negotiation, hence we removed the ",(0,r.kt)("inlineCode",{parentName:"p"},"useHttp2")," option. It's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!"),(0,r.kt)("h3",{id:"renamed-options"},"Renamed options"),(0,r.kt)("p",null,"In the ",(0,r.kt)("inlineCode",{parentName:"p"},"requestAsBrowser")," approach, some of the options were named differently. Here's a list of renamed options:"),(0,r.kt)("h4",{id:"payload"},(0,r.kt)("inlineCode",{parentName:"h4"},"payload")),(0,r.kt)("p",null,"This options represents the body to send. It could be a ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"Buffer"),". However, there is no ",(0,r.kt)("inlineCode",{parentName:"p"},"payload")," option anymore. You need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"body")," instead. Or, if you wish to send JSON, ",(0,r.kt)("inlineCode",{parentName:"p"},"json"),". Here's an example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, payload: 'Hello, world!' });\nawait Apify.utils.requestAsBrowser({ \u2026, payload: Buffer.from('c0ffe', 'hex') });\nawait Apify.utils.requestAsBrowser({ \u2026, json: { hello: 'world' } });\n\n// After:\nawait gotScraping({ \u2026, body: 'Hello, world!' });\nawait gotScraping({ \u2026, body: Buffer.from('c0ffe', 'hex') });\nawait gotScraping({ \u2026, json: { hello: 'world' } });\n")),(0,r.kt)("h4",{id:"ignoresslerrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"ignoreSslErrors")),(0,r.kt)("p",null,"It has been renamed to ",(0,r.kt)("inlineCode",{parentName:"p"},"https.rejectUnauthorized"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false")," for convenience. However, if you want to make sure the connection is secure, you can do the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({ \u2026, ignoreSslErrors: false });\n\n// After:\nawait gotScraping({ \u2026, https: { rejectUnauthorized: true } });\n")),(0,r.kt)("p",null,"Please note: the meanings are opposite! So we needed to invert the values as well."),(0,r.kt)("h4",{id:"header-generator-options"},(0,r.kt)("inlineCode",{parentName:"h4"},"header-generator")," options"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"useMobileVersion"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"languageCode")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"countryCode")," no longer exist. Instead, you need to use ",(0,r.kt)("inlineCode",{parentName:"p"},"headerGeneratorOptions")," directly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n useMobileVersion: true,\n languageCode: 'en',\n countryCode: 'US',\n});\n\n// After:\nawait gotScraping({\n \u2026,\n headerGeneratorOptions: {\n devices: ['mobile'], // or ['desktop']\n locales: ['en-US'],\n },\n});\n")),(0,r.kt)("h4",{id:"timeoutsecs"},(0,r.kt)("inlineCode",{parentName:"h4"},"timeoutSecs")),(0,r.kt)("p",null,"In order to set a timeout, use ",(0,r.kt)("inlineCode",{parentName:"p"},"timeout.request")," (which is ",(0,r.kt)("strong",{parentName:"p"},"milliseconds")," now)."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Before:\nawait Apify.utils.requestAsBrowser({\n \u2026,\n timeoutSecs: 30,\n});\n\n// After:\nawait gotScraping({\n \u2026,\n timeout: {\n request: 30 * 1000,\n },\n});\n")),(0,r.kt)("h4",{id:"throwonhttperrors"},(0,r.kt)("inlineCode",{parentName:"h4"},"throwOnHttpErrors")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"throwOnHttpErrors")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"throwHttpErrors"),". This options throws on unsuccessful HTTP status codes, for example ",(0,r.kt)("inlineCode",{parentName:"p"},"404"),". By default, it's set to ",(0,r.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,r.kt)("h4",{id:"decodebody"},(0,r.kt)("inlineCode",{parentName:"h4"},"decodeBody")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"decodeBody")," \u2192 ",(0,r.kt)("inlineCode",{parentName:"p"},"decompress"),". This options decompresses the body. Defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"true")," - please do not change this or websites will break (unless you know what you're doing!)."),(0,r.kt)("h4",{id:"abortfunction"},(0,r.kt)("inlineCode",{parentName:"h4"},"abortFunction")),(0,r.kt)("p",null,"This function used to make the promise throw on specific responses, if it returned ",(0,r.kt)("inlineCode",{parentName:"p"},"true"),". However, it wasn't that useful."),(0,r.kt)("p",null,"You probably want to cancel the request instead, which you can do in the following way:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const promise = gotScraping(\u2026);\n\npromise.on('request', request => {\n // Please note this is not a Got Request instance, but a ClientRequest one.\n // https://nodejs.org/api/http.html#class-httpclientrequest\n\n if (request.protocol !== 'https:') {\n // Unsecure request, abort.\n promise.cancel();\n\n // If you set `isStream` to `true`, please use `stream.destroy()` instead.\n }\n});\n\nconst response = await promise;\n")),(0,r.kt)("h2",{id:"removal-of-browser-pool-plugin-mixing"},"Removal of browser pool plugin mixing"),(0,r.kt)("p",null,"Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type)."),(0,r.kt)("admonition",{title:"Confused?",type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!")),(0,r.kt)("h2",{id:"handling-requests-outside-of-browser"},"Handling requests outside of browser"),(0,r.kt)("p",null,"One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of ",(0,r.kt)("inlineCode",{parentName:"p"},"Request.skipNavigation")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"context.sendRequest()"),"."),(0,r.kt)("p",null,"Take a look at how to achieve this by checking out the ",(0,r.kt)("a",{parentName:"p",href:"https://crawlee.dev/docs/examples/skip-navigation",target:"_blank",rel:"noopener"},"Skipping navigation for certain requests")," example!"),(0,r.kt)("h2",{id:"logging"},"Logging"),(0,r.kt)("p",null,"Crawlee exports the default ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance directly as a named export. We also have a scoped ",(0,r.kt)("inlineCode",{parentName:"p"},"log")," instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ log, request }) {\n log.info(`Opened ${request.loadedUrl}`);\n },\n});\n")),(0,r.kt)("h2",{id:"auto-saved-crawler-state"},"Auto-saved crawler state"),(0,r.kt)("p",null,"Every crawler instance now has ",(0,r.kt)("inlineCode",{parentName:"p"},"useState()")," method that will return a state object we can use. It will be automatically saved when ",(0,r.kt)("inlineCode",{parentName:"p"},"persistState")," event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const crawler = new CheerioCrawler({\n async requestHandler({ crawler }) {\n const state = await crawler.useState({ foo: [] as number[] });\n // just change the value, no need to care about saving it\n state.foo.push(123);\n },\n});\n")),(0,r.kt)("h2",{id:"apify-sdk"},"Apify SDK"),(0,r.kt)("p",null,"The Apify platform helpers can be now found in the Apify SDK (",(0,r.kt)("inlineCode",{parentName:"p"},"apify")," NPM package). It exports the ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor")," class that offers following static helpers:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient")," shortcuts: ",(0,r.kt)("inlineCode",{parentName:"li"},"addWebhook()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"call()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"callTask()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"metamorph()")),(0,r.kt)("li",{parentName:"ul"},"helpers for running on Apify platform: ",(0,r.kt)("inlineCode",{parentName:"li"},"init()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"exit()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"fail()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"main()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"isAtHome()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"createProxyConfiguration()")),(0,r.kt)("li",{parentName:"ul"},"storage support: ",(0,r.kt)("inlineCode",{parentName:"li"},"getInput()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"getValue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openDataset()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openKeyValueStore()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"openRequestQueue()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"pushData()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"setValue()")),(0,r.kt)("li",{parentName:"ul"},"events support: ",(0,r.kt)("inlineCode",{parentName:"li"},"on()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"off()")),(0,r.kt)("li",{parentName:"ul"},"other utilities: ",(0,r.kt)("inlineCode",{parentName:"li"},"getEnv()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"newClient()"),", ",(0,r.kt)("inlineCode",{parentName:"li"},"reboot()"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main")," is now just a syntax sugar around calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," at the beginning and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.init();\n// your code\nawait Actor.exit('Crawling finished!');\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"import { Actor } from 'apify';\n\nawait Actor.main(async () => {\n // your code\n}, { statusMessage: 'Crawling finished!' });\n")),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Actor.init()")," will conditionally set the storage implementation of Crawlee to the ",(0,r.kt)("inlineCode",{parentName:"p"},"ApifyClient")," when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," will handle the tear down and calls ",(0,r.kt)("inlineCode",{parentName:"p"},"process.exit()")," to ensure our process won't hang indefinitely for some reason."),(0,r.kt)("h3",{id:"events"},"Events"),(0,r.kt)("p",null,"Apify SDK (v2) exports ",(0,r.kt)("inlineCode",{parentName:"p"},"Apify.events"),", which is an ",(0,r.kt)("inlineCode",{parentName:"p"},"EventEmitter")," instance. With Crawlee, the events are managed by ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," class instead. We can either access it via ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.eventManager")," getter, or use ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.on")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.off")," shortcuts instead."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-diff"},"-Apify.events.on(...);\n+Actor.on(...);\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"We can also get the ",(0,r.kt)(o.T,{to:"core/class/EventManager",mdxType:"CrawleeApiLink"},(0,r.kt)("inlineCode",{parentName:"p"},"EventManager"))," instance via ",(0,r.kt)("inlineCode",{parentName:"p"},"Configuration.getEventManager()"),".")),(0,r.kt)("p",null,"In addition to the existing events, we now have an ",(0,r.kt)("inlineCode",{parentName:"p"},"exit")," event fired when calling ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit()")," (which is called at the end of ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.main()"),"). This event allows you to gracefully shut down any resources when ",(0,r.kt)("inlineCode",{parentName:"p"},"Actor.exit")," is called."),(0,r.kt)("h2",{id:"smallerinternal-breaking-changes"},"Smaller/internal breaking changes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.call()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.actor(actorId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.callTask()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).call(input, options)"),", while also taking the token inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.metamorph()")," is now just a shortcut for running ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.task(taskId).metamorph(input, options)"),", while also taking the ACTOR_RUN_ID inside env vars into account"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Apify.waitForRunToFinish()")," has been removed, use ",(0,r.kt)("inlineCode",{parentName:"li"},"ApifyClient.waitForFinish()")," instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Actor.main/init")," purges the storage by default"),(0,r.kt)("li",{parentName:"ul"},"remove ",(0,r.kt)("inlineCode",{parentName:"li"},"purgeLocalStorage")," helper, move purging to the storage class directly",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"StorageClient")," interface now has optional ",(0,r.kt)("inlineCode",{parentName:"li"},"purge")," method"),(0,r.kt)("li",{parentName:"ul"},"purging happens automatically via ",(0,r.kt)("inlineCode",{parentName:"li"},"Actor.init()")," (you can opt out via ",(0,r.kt)("inlineCode",{parentName:"li"},"purge: false")," in the options of ",(0,r.kt)("inlineCode",{parentName:"li"},"init/main")," methods)"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"QueueOperationInfo.request")," is no longer available"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.handledAt")," is now string date in ISO format"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"Request.inProgress")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"Request.reclaimed")," are now ",(0,r.kt)("inlineCode",{parentName:"li"},"Set"),"s instead of POJOs"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"injectUnderscore")," from puppeteer utils has been removed"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"APIFY_MEMORY_MBYTES")," is no longer taken into account, use ",(0,r.kt)("inlineCode",{parentName:"li"},"CRAWLEE_AVAILABLE_MEMORY_RATIO")," instead"),(0,r.kt)("li",{parentName:"ul"},"some ",(0,r.kt)("inlineCode",{parentName:"li"},"AutoscaledPool")," options are no longer available:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"cpuSnapshotIntervalSecs")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"memorySnapshotIntervalSecs")," has been replaced with top level ",(0,r.kt)("inlineCode",{parentName:"li"},"systemInfoIntervalMillis")," configuration"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"maxUsedCpuRatio")," has been moved to the top level configuration"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"ProxyConfiguration.newUrlFunction")," can be async. ",(0,r.kt)("inlineCode",{parentName:"li"},".newUrl()")," and ",(0,r.kt)("inlineCode",{parentName:"li"},".newProxyInfo()")," now return promises."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"prepareRequestFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"postResponseFunction")," options are removed, use navigation hooks instead"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"gotoFunction")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"gotoTimeoutSecs")," are removed"),(0,r.kt)("li",{parentName:"ul"},"removed compatibility fix for old/broken request queues with null ",(0,r.kt)("inlineCode",{parentName:"li"},"Request")," props"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintsOptions")," renamed to ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," (",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprints")," -> ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprint"),")."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintOptions")," now accept ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintCacheSize")," (instead of ",(0,r.kt)("inlineCode",{parentName:"li"},"useFingerprintPerProxyCache")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"fingerprintPerProxyCacheSize"),", which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),c=i,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<r;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}c.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6dc22f7.1cba3953.js b/assets/js/f6dc22f7.1cba3953.js deleted file mode 100644 index 37284d248b..0000000000 --- a/assets/js/f6dc22f7.1cba3953.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5643],{64544:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=["components"],i={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},s=void 0,l={unversionedId:"examples/puppeteer-with-proxy",id:"version-2.3/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer",source:"@site/versioned_docs/version-2.3/examples/puppeteer_with_proxy.md",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/2.3/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_with_proxy.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"version-2.3/docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"},next:{title:"Synchronous run",permalink:"/sdk/js/docs/2.3/examples/synchronous-run"}},c={},u=[],y={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,p.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer\nover ",(0,p.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),".\nTo make it work, you'll need an Apify account with access to the proxy.\nVisit the ",(0,p.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find\nhow to log into your account from the SDK."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', [\n 'http://proxy.apify.com',\n ]);\n\n // Proxy connection is automatically established in the Crawler\n const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n proxyConfiguration,\n handlePageFunction: async ({ page }) => {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n });\n\n console.log('Running Puppeteer script...');\n await crawler.run();\n console.log('Puppeteer closed.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(s,".").concat(f)]||u[f]||y[f]||p;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var l=2;l<p;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f6dc22f7.bec086fb.js b/assets/js/f6dc22f7.bec086fb.js new file mode 100644 index 0000000000..0411b544cb --- /dev/null +++ b/assets/js/f6dc22f7.bec086fb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[5643],{64544:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=["components"],i={id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},s=void 0,l={unversionedId:"examples/puppeteer-with-proxy",id:"version-2.3/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer",source:"@site/versioned_docs/version-2.3/examples/puppeteer_with_proxy.md",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/2.3/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_with_proxy.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"puppeteer-with-proxy",title:"Puppeteer with proxy"},sidebar:"version-2.3/docs",previous:{title:"Puppeteer recursive crawl",permalink:"/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"},next:{title:"Synchronous run",permalink:"/sdk/js/docs/2.3/examples/synchronous-run"}},c={},u=[],y={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,p.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer\nover ",(0,p.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),".\nTo make it work, you'll need an Apify account with access to the proxy.\nVisit the ",(0,p.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find\nhow to log into your account from the SDK."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', [\n 'http://proxy.apify.com',\n ]);\n\n // Proxy connection is automatically established in the Crawler\n const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n proxyConfiguration,\n handlePageFunction: async ({ page }) => {\n const status = await page.$eval('td.status', (el) => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n });\n\n console.log('Running Puppeteer script...');\n await crawler.run();\n console.log('Puppeteer closed.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(s,".").concat(f)]||u[f]||y[f]||p;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var l=2;l<p;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f7684d20.7bd574bd.js b/assets/js/f7684d20.7bd574bd.js new file mode 100644 index 0000000000..1e2b97c4a7 --- /dev/null +++ b/assets/js/f7684d20.7bd574bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4720],{55977:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>m});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,s={unversionedId:"examples/call-actor",id:"version-2.3/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/versioned_docs/version-2.3/examples/call_actor.md",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/2.3/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/call_actor.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"version-2.3/docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/2.3/examples/basic-crawler"},next:{title:"Capture a screenshot",permalink:"/sdk/js/docs/2.3/examples/capture-screenshot"}},p={},m=[],d={toc:m},u="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,l);return(0,o.kt)(u,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#client",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.client")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)"),"\nbase image on the ",(0,o.kt)("strong",{parentName:"p"},"Source")," tab when configuring the actor.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { Actor } = require('apify');\nconst { launchPuppeteer } = require('crawlee');\n\nActor.main(async () => {\n // Launch the web browser.\n const browser = await launchPuppeteer();\n\n console.log('Obtaining own email address...');\n const apifyClient = Actor.newClient();\n const user = await apifyClient.user().get();\n\n // Load randomword.com and get a random word\n console.log('Fetching a random word.');\n const page = await browser.newPage();\n await page.goto('https://randomword.com/');\n const randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n // Send random word to your email. For that, you can use an actor we already\n // have available on the platform under the name: apify/send-mail.\n // The second parameter to the Apify.call() invocation is the actor's\n // desired input. You can find the required input parameters by checking\n // the actor's documentation page: https://apify.com/apify/send-mail\n console.log(`Sending email to ${user.email}...`);\n await Actor.call('apify/send-mail', {\n to: user.email,\n subject: 'Random Word',\n html: `<h1>Random Word</h1>${randomWord}`,\n });\n console.log('Email sent. Good luck!');\n\n // Close Browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=r,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?a.createElement(f,l(l({ref:t},p),{},{components:n})):a.createElement(f,l({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[m]="string"==typeof e?e:r,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f7684d20.d352b73c.js b/assets/js/f7684d20.d352b73c.js deleted file mode 100644 index 1923599c1e..0000000000 --- a/assets/js/f7684d20.d352b73c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4720],{55977:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),l=["components"],i={id:"call-actor",title:"Call actor"},c=void 0,s={unversionedId:"examples/call-actor",id:"version-2.3/examples/call-actor",title:"Call actor",description:"This example demonstrates how to start an Apify actor using",source:"@site/versioned_docs/version-2.3/examples/call_actor.md",sourceDirName:"examples",slug:"/examples/call-actor",permalink:"/sdk/js/docs/2.3/examples/call-actor",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/call_actor.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"call-actor",title:"Call actor"},sidebar:"version-2.3/docs",previous:{title:"Basic crawler",permalink:"/sdk/js/docs/2.3/examples/basic-crawler"},next:{title:"Capture a screenshot",permalink:"/sdk/js/docs/2.3/examples/capture-screenshot"}},p={},d=[],m={toc:d},u="wrapper";function f(e){var t=e.components,n=(0,r.Z)(e,l);return(0,o.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to start an Apify actor using\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#call",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.call()"))," and how to call the Apify API using\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#client",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.client")),".\nThe script gets a random weird word and its explanation from ",(0,o.kt)("a",{parentName:"p",href:"https://randomword.com/",target:"_blank",rel:"noopener"},"randomword.com"),"\nand sends it to your email using the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/apify/send-mail",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"apify/send-mail"))," actor."),(0,o.kt)("p",null,"To make the example work, you'll need an ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/",target:"_blank",rel:"noopener"},"Apify account"),".\nGo to the ",(0,o.kt)("a",{parentName:"p",href:"https://my.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"Account - Integrations")," page to obtain your API token\nand set it to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/guides/environment-variables#APIFY_TOKEN",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment variable,\nor run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set\nup a scheduler to run your actor early in the morning."),(0,o.kt)("p",null,"To see what other actors are available, visit the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store"),"."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)"),"\nbase image on the ",(0,o.kt)("strong",{parentName:"p"},"Source")," tab when configuring the actor.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { Actor } = require('apify');\nconst { launchPuppeteer } = require('crawlee');\n\nActor.main(async () => {\n // Launch the web browser.\n const browser = await launchPuppeteer();\n\n console.log('Obtaining own email address...');\n const apifyClient = Actor.newClient();\n const user = await apifyClient.user().get();\n\n // Load randomword.com and get a random word\n console.log('Fetching a random word.');\n const page = await browser.newPage();\n await page.goto('https://randomword.com/');\n const randomWord = await page.$eval('#shared_section', (el) => el.outerHTML);\n\n // Send random word to your email. For that, you can use an actor we already\n // have available on the platform under the name: apify/send-mail.\n // The second parameter to the Apify.call() invocation is the actor's\n // desired input. You can find the required input parameters by checking\n // the actor's documentation page: https://apify.com/apify/send-mail\n console.log(`Sending email to ${user.email}...`);\n await Actor.call('apify/send-mail', {\n to: user.email,\n subject: 'Random Word',\n html: `<h1>Random Word</h1>${randomWord}`,\n });\n console.log('Email sent. Good luck!');\n\n // Close Browser\n await browser.close();\n});\n")))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=s(n),u=r,f=d["".concat(c,".").concat(u)]||d[u]||m[u]||o;return n?a.createElement(f,l(l({ref:t},p),{},{components:n})):a.createElement(f,l({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i[d]="string"==typeof e?e:r,l[1]=i;for(var s=2;s<o;s++)l[s]=n[s];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f7aa35a1.69b6e2ee.js b/assets/js/f7aa35a1.69b6e2ee.js new file mode 100644 index 0000000000..fb0528e37b --- /dev/null +++ b/assets/js/f7aa35a1.69b6e2ee.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2976],{68889:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),s=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var c=l+"/";return"current"===l?c="next/":p&&(c=""),n.createElement(a.default,{to:"/api/"+c+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>s});var n=r(67294),a=r(88746),o="https://crawlee.dev",s=function(e){var t=e.to,r=e.children,s=e.version;return n.createElement(a.default,{href:o+"/api"+(s?"/"+s:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},76897:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>f,contentTitle:()=>u,default:()=>v,frontMatter:()=>d,metadata:()=>m,toc:()=>h});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=r(14563),i=r(68889),l=r(26569);const p="import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\n// Create and navigate new page\nconsole.log('Open target page');\nconst page = await browser.newPage();\nawait page.goto('https://github.com/search/advanced');\n\n// Fill form fields and select desired search options\nconsole.log('Fill in search form');\nawait page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\nawait page.type('#search_from', 'apify');\nawait page.type('#search_date', '>2015');\nawait page.select('select#search_language', 'JavaScript');\n\n// Submit the form and wait for full load of next page\nconsole.log('Submit search form');\nawait Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n]);\n\n// Obtain and print list of search results\nconst results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n})));\n\nconsole.log('Results:', results);\n\n// Store data in default dataset\nawait Actor.pushData(results);\n\n// Close browser\nawait browser.close();\n\nawait Actor.exit();\n";var c=["components"],d={id:"forms",title:"Forms"},u=void 0,m={unversionedId:"examples/forms",id:"version-3.0/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to",source:"@site/versioned_docs/version-3.0/examples/forms.mdx",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/3.0/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/forms.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/3.0/examples/map-and-reduce"}},f={},h=[],y={toc:h},g="wrapper";function v(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(g,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(l.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," to\nautomatically fill and submit a search form to look up repositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and language of the repository, then submits the form\nand prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},p))}v.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,s[1]=i;for(var p=2;p<o;p++)s[p]=r[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f7aa35a1.854b5c2c.js b/assets/js/f7aa35a1.854b5c2c.js deleted file mode 100644 index b4a45016a2..0000000000 --- a/assets/js/f7aa35a1.854b5c2c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2976],{68889:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),a=r(88746),o=r(6141),s=r(6832);const i=function(e){var t=e.to,r=e.children,i=(0,o.E)(),l=i.version,p=i.isLast;if((0,s.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(a.default,{to:"/api/"+t},r);var c=l+"/";return"current"===l?c="next/":p&&(c=""),n.createElement(a.default,{to:"/api/"+c+t},r)}},26569:(e,t,r)=>{r.d(t,{B:()=>i,T:()=>s});var n=r(67294),a=r(88746),o="https://crawlee.dev",s=function(e){var t=e.to,r=e.children,s=e.version;return n.createElement(a.default,{href:o+"/api"+(s?"/"+s:"")+"/"+t},r)},i=function(e){var t=e.to,r=e.children;return n.createElement(a.default,{href:o+"/"+t},r)}},76897:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>f,contentTitle:()=>u,default:()=>w,frontMatter:()=>d,metadata:()=>m,toc:()=>h});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),s=r(14563),i=r(68889),l=r(26569);const p="import { Actor } from 'apify';\nimport { launchPuppeteer } from 'crawlee';\n\nawait Actor.init();\n\n// Launch the web browser.\nconst browser = await launchPuppeteer();\n\n// Create and navigate new page\nconsole.log('Open target page');\nconst page = await browser.newPage();\nawait page.goto('https://github.com/search/advanced');\n\n// Fill form fields and select desired search options\nconsole.log('Fill in search form');\nawait page.type('#adv_code_search input.js-advanced-search-input', 'apify-js');\nawait page.type('#search_from', 'apify');\nawait page.type('#search_date', '>2015');\nawait page.select('select#search_language', 'JavaScript');\n\n// Submit the form and wait for full load of next page\nconsole.log('Submit search form');\nawait Promise.all([\n page.waitForNavigation(),\n page.click('#adv_code_search button[type=\"submit\"]'),\n]);\n\n// Obtain and print list of search results\nconst results = await page.$$eval('div.f4.text-normal a', (nodes) => nodes.map((node) => ({\n url: node.href,\n name: node.innerText,\n})));\n\nconsole.log('Results:', results);\n\n// Store data in default dataset\nawait Actor.pushData(results);\n\n// Close browser\nawait browser.close();\n\nawait Actor.exit();\n";var c=["components"],d={id:"forms",title:"Forms"},u=void 0,m={unversionedId:"examples/forms",id:"version-3.0/examples/forms",title:"Forms",description:"This example demonstrates how to use PuppeteerCrawler to",source:"@site/versioned_docs/version-3.0/examples/forms.mdx",sourceDirName:"examples",slug:"/examples/forms",permalink:"/sdk/js/docs/3.0/examples/forms",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/forms.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"forms",title:"Forms"},sidebar:"docs",previous:{title:"Crawl some links on a website",permalink:"/sdk/js/docs/3.0/examples/crawl-some-links"},next:{title:"Dataset Map and Reduce methods",permalink:"/sdk/js/docs/3.0/examples/map-and-reduce"}},f={},h=[],y={toc:h},g="wrapper";function w(e){var t=e.components,r=(0,a.Z)(e,c);return(0,o.kt)(g,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to use ",(0,o.kt)(l.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler"))," to\nautomatically fill and submit a search form to look up repositories on ",(0,o.kt)("a",{parentName:"p",href:"https://github.com",target:"_blank",rel:"noopener"},"GitHub")," using headless Chrome / Puppeteer.\nThe actor first fills in the search term, repository owner, start date and language of the repository, then submits the form\nand prints out the results. Finally, the results are saved either on the Apify platform to the\ndefault ",(0,o.kt)(i.Z,{to:"apify/class/Dataset",mdxType:"ApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"dataset"))," or on the local machine as JSON files in ",(0,o.kt)("inlineCode",{parentName:"p"},"./storage/datasets/default"),"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,o.kt)(s.Z,{className:"language-js",mdxType:"CodeBlock"},p))}w.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,s(s({ref:t},c),{},{components:r})):n.createElement(f,s({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,s=new Array(o);s[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:a,s[1]=i;for(var p=2;p<o;p++)s[p]=r[p];return n.createElement.apply(null,s)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f8d59dec.55b6f0fd.js b/assets/js/f8d59dec.55b6f0fd.js new file mode 100644 index 0000000000..170adeebcb --- /dev/null +++ b/assets/js/f8d59dec.55b6f0fd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8405],{41428:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>y,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),i=["components"],a={id_old:"version-2.3.0-puppeteer-cookie",title:"PuppeteerCookie",id:"puppeteer-cookie"},c=void 0,s={unversionedId:"typedefs/puppeteer-cookie",id:"version-2.3/typedefs/puppeteer-cookie",title:"PuppeteerCookie",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerCookie.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-cookie",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-cookie",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCookie.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-cookie",title:"PuppeteerCookie",id:"puppeteer-cookie"}},u={},l=[],d={toc:l},f="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteercookie"}),(0,p.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},l="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),l=s(r),f=o,y=l["".concat(c,".").concat(f)]||l[f]||d[f]||p;return r?n.createElement(y,i(i({ref:t},u),{},{components:r})):n.createElement(y,i({ref:t},u))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,i=new Array(p);i[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[l]="string"==typeof e?e:o,i[1]=a;for(var s=2;s<p;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f8d59dec.d8cd8cdb.js b/assets/js/f8d59dec.d8cd8cdb.js deleted file mode 100644 index b4b139c5c3..0000000000 --- a/assets/js/f8d59dec.d8cd8cdb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[8405],{41428:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>c,default:()=>y,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),i=["components"],a={id_old:"version-2.3.0-puppeteer-cookie",title:"PuppeteerCookie",id:"puppeteer-cookie"},c=void 0,s={unversionedId:"typedefs/puppeteer-cookie",id:"version-2.3/typedefs/puppeteer-cookie",title:"PuppeteerCookie",description:"---",source:"@site/versioned_docs/version-2.3/typedefs/PuppeteerCookie.md",sourceDirName:"typedefs",slug:"/typedefs/puppeteer-cookie",permalink:"/sdk/js/docs/2.3/typedefs/puppeteer-cookie",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCookie.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-2.3.0-puppeteer-cookie",title:"PuppeteerCookie",id:"puppeteer-cookie"}},u={},l=[],d={toc:l},f="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,i);return(0,p.kt)(f,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("a",{name:"puppeteercookie"}),(0,p.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},u=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},l="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),l=s(r),f=o,y=l["".concat(c,".").concat(f)]||l[f]||d[f]||p;return r?n.createElement(y,i(i({ref:t},u),{},{components:r})):n.createElement(y,i({ref:t},u))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,i=new Array(p);i[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a[l]="string"==typeof e?e:o,i[1]=a;for(var s=2;s<p;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f90a522b.f37d9a85.js b/assets/js/f90a522b.f37d9a85.js new file mode 100644 index 0000000000..cc98f5ba3d --- /dev/null +++ b/assets/js/f90a522b.f37d9a85.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1324],{3509:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>y,frontMatter:()=>s,metadata:()=>u,toc:()=>l});var n=r(87462),o=r(63366),a=(r(67294),r(3905)),c=["components"],s={id:"user-func",title:"UserFunc"},i=void 0,u={unversionedId:"typedefs/user-func",id:"version-2.3/typedefs/user-func",title:"UserFunc",description:"Returns:",source:"@site/versioned_docs/version-2.3/typedefs/UserFunc.md",sourceDirName:"typedefs",slug:"/typedefs/user-func",permalink:"/sdk/js/docs/2.3/typedefs/user-func",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/UserFunc.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"user-func",title:"UserFunc"}},p={},l=[],f={toc:l},d="wrapper";function y(e){var t=e.components,r=(0,o.Z)(e,c);return(0,a.kt)(d,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"userfunc"}),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Returns"),":"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,a.kt)("hr",null))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>y});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},l="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),l=u(r),d=o,y=l["".concat(i,".").concat(d)]||l[d]||f[d]||a;return r?n.createElement(y,c(c({ref:t},p),{},{components:r})):n.createElement(y,c({ref:t},p))}));function y(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[l]="string"==typeof e?e:o,c[1]=s;for(var u=2;u<a;u++)c[u]=r[u];return n.createElement.apply(null,c)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f9db2d7d.12391645.js b/assets/js/f9db2d7d.12391645.js deleted file mode 100644 index fb39ea4e5c..0000000000 --- a/assets/js/f9db2d7d.12391645.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4364],{13485:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>d,metadata:()=>l,toc:()=>c});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],d={id_old:"version-1.3-add-data-to-dataset",title:"Add data to dataset",id:"add-data-to-dataset"},i=void 0,l={unversionedId:"examples/add-data-to-dataset",id:"version-1.3/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using",source:"@site/versioned_docs/version-1.3/examples/add_data_to_dataset.md",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/1.3/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/add_data_to_dataset.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-add-data-to-dataset",title:"Add data to dataset",id:"add-data-to-dataset"},sidebar:"version-1.3/docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/1.3/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/1.3/examples/basic-crawler"}},p={},c=[],u={toc:c},f="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n\n // Function called for each URL\n const handlePageFunction = async ({ request, body }) => {\n // Save data to default dataset\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n };\n\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function d(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),l=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},p=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),c=l(a),f=r,m=c["".concat(i,".").concat(f)]||c[f]||u[f]||o;return a?n.createElement(m,s(s({ref:t},p),{},{components:a})):n.createElement(m,s({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=f;var d={};for(var i in t)hasOwnProperty.call(t,i)&&(d[i]=t[i]);d.originalType=e,d[c]="string"==typeof e?e:r,s[1]=d;for(var l=2;l<o;l++)s[l]=a[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,a)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/f9db2d7d.3951810b.js b/assets/js/f9db2d7d.3951810b.js new file mode 100644 index 0000000000..fa9a639aac --- /dev/null +++ b/assets/js/f9db2d7d.3951810b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4364],{13485:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>d,metadata:()=>l,toc:()=>c});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),s=["components"],d={id_old:"version-1.3-add-data-to-dataset",title:"Add data to dataset",id:"add-data-to-dataset"},i=void 0,l={unversionedId:"examples/add-data-to-dataset",id:"version-1.3/examples/add-data-to-dataset",title:"Add data to dataset",description:"This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using",source:"@site/versioned_docs/version-1.3/examples/add_data_to_dataset.md",sourceDirName:"examples",slug:"/examples/add-data-to-dataset",permalink:"/sdk/js/docs/1.3/examples/add-data-to-dataset",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/add_data_to_dataset.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-add-data-to-dataset",title:"Add data to dataset",id:"add-data-to-dataset"},sidebar:"version-1.3/docs",previous:{title:"Accept user input",permalink:"/sdk/js/docs/1.3/examples/accept-user-input"},next:{title:"Basic crawler",permalink:"/sdk/js/docs/1.3/examples/basic-crawler"}},p={},c=[],u={toc:c},f="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,s);return(0,o.kt)(f,(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using\n",(0,o.kt)("a",{parentName:"p",href:"../api/apify#opendataset",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.openDataset()"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', [\n { url: 'http://www.example.com/page-1' },\n { url: 'http://www.example.com/page-2' },\n { url: 'http://www.example.com/page-3' },\n ]);\n\n // Function called for each URL\n const handlePageFunction = async ({ request, body }) => {\n // Save data to default dataset\n await Apify.pushData({\n url: request.url,\n html: body,\n });\n };\n\n const crawler = new Apify.CheerioCrawler({\n requestList,\n handlePageFunction,\n });\n\n // Run the crawler\n await crawler.run();\n});\n")),(0,o.kt)("p",null,"Each item in this dataset will be saved to its own file in the following directory:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"{PROJECT_FOLDER}/apify_storage/datasets/default/\n")))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function d(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),l=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},p=function(e){var t=l(e.components);return n.createElement(i.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),c=l(a),f=r,m=c["".concat(i,".").concat(f)]||c[f]||u[f]||o;return a?n.createElement(m,s(s({ref:t},p),{},{components:a})):n.createElement(m,s({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=f;var d={};for(var i in t)hasOwnProperty.call(t,i)&&(d[i]=t[i]);d.originalType=e,d[c]="string"==typeof e?e:r,s[1]=d;for(var l=2;l<o;l++)s[l]=a[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,a)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fa524c57.ba092093.js b/assets/js/fa524c57.ba092093.js new file mode 100644 index 0000000000..eea0b16834 --- /dev/null +++ b/assets/js/fa524c57.ba092093.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3993],{91277:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=["components"],i={id_old:"version-1.3-puppeteer-with-proxy",title:"Puppeteer with proxy",id:"puppeteer-with-proxy"},s=void 0,l={unversionedId:"examples/puppeteer-with-proxy",id:"version-1.3/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy. To make it work, you'll",source:"@site/versioned_docs/version-1.3/examples/puppeteer_with_proxy.md",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/1.3/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_with_proxy.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-puppeteer-with-proxy",title:"Puppeteer with proxy",id:"puppeteer-with-proxy"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer sitemap",permalink:"/sdk/js/docs/1.3/examples/puppeteer-sitemap"},next:{title:"Screenshots",permalink:"/sdk/js/docs/1.3/examples/screenshots"}},c={},u=[],y={toc:u},f="wrapper";function m(e){var t=e.components,r=(0,o.Z)(e,a);return(0,p.kt)(f,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,p.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". To make it work, you'll\nneed an Apify account with access to the proxy. Visit the ",(0,p.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your\naccount from the SDK."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', ['http://proxy.apify.com']);\n\n // Proxy connection is automatically established in the Crawler\n const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n proxyConfiguration,\n handlePageFunction: async ({ page }) => {\n const status = await page.$eval('td.status', el => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n });\n\n console.log('Running Puppeteer script...');\n await crawler.run();\n console.log('Puppeteer closed.');\n});\n")))}m.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(s,".").concat(f)]||u[f]||y[f]||p;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var l=2;l<p;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fa524c57.d58cd05f.js b/assets/js/fa524c57.d58cd05f.js deleted file mode 100644 index 05029c748b..0000000000 --- a/assets/js/fa524c57.d58cd05f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[3993],{91277:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>f,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var n=r(87462),o=r(63366),p=(r(67294),r(3905)),a=["components"],i={id_old:"version-1.3-puppeteer-with-proxy",title:"Puppeteer with proxy",id:"puppeteer-with-proxy"},s=void 0,l={unversionedId:"examples/puppeteer-with-proxy",id:"version-1.3/examples/puppeteer-with-proxy",title:"Puppeteer with proxy",description:"This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy. To make it work, you'll",source:"@site/versioned_docs/version-1.3/examples/puppeteer_with_proxy.md",sourceDirName:"examples",slug:"/examples/puppeteer-with-proxy",permalink:"/sdk/js/docs/1.3/examples/puppeteer-with-proxy",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_with_proxy.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-puppeteer-with-proxy",title:"Puppeteer with proxy",id:"puppeteer-with-proxy"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer sitemap",permalink:"/sdk/js/docs/1.3/examples/puppeteer-sitemap"},next:{title:"Screenshots",permalink:"/sdk/js/docs/1.3/examples/screenshots"}},c={},u=[],y={toc:u},d="wrapper";function f(e){var t=e.components,r=(0,o.Z)(e,a);return(0,p.kt)(d,(0,n.Z)({},y,r,{components:t,mdxType:"MDXLayout"}),(0,p.kt)("p",null,"This example demonstrates how to load pages in headless Chrome / Puppeteer over ",(0,p.kt)("a",{parentName:"p",href:"https://docs.apify.com/proxy",target:"_blank",rel:"noopener"},"Apify Proxy"),". To make it work, you'll\nneed an Apify account with access to the proxy. Visit the ",(0,p.kt)("a",{parentName:"p",href:"/docs/guides/apify-platform",target:null,rel:null},"Apify platform introduction")," to find how to log into your\naccount from the SDK."),(0,p.kt)("blockquote",null,(0,p.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,p.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," image for your Dockerfile.")),(0,p.kt)("pre",null,(0,p.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n const requestList = await Apify.openRequestList('start-urls', ['http://proxy.apify.com']);\n\n // Proxy connection is automatically established in the Crawler\n const proxyConfiguration = await Apify.createProxyConfiguration();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n proxyConfiguration,\n handlePageFunction: async ({ page }) => {\n const status = await page.$eval('td.status', el => el.textContent);\n console.log(`Proxy Status: ${status}`);\n },\n });\n\n console.log('Running Puppeteer script...');\n await crawler.run();\n console.log('Puppeteer closed.');\n});\n")))}f.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},p=Object.keys(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(e);for(n=0;n<p.length;n++)r=p[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",y={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,p=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),u=l(r),d=o,f=u["".concat(s,".").concat(d)]||u[d]||y[d]||p;return r?n.createElement(f,a(a({ref:t},c),{},{components:r})):n.createElement(f,a({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var p=r.length,a=new Array(p);a[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:o,a[1]=i;for(var l=2;l<p;l++)a[l]=r[l];return n.createElement.apply(null,a)}return n.createElement.apply(null,r)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fbdbd19e.5d147712.js b/assets/js/fbdbd19e.5d147712.js new file mode 100644 index 0000000000..36b1675897 --- /dev/null +++ b/assets/js/fbdbd19e.5d147712.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1658],{43937:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>m,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),o=(n(67294),n(3905)),l=["components"],s={id_old:"version-1.3-snapshotter",title:"Snapshotter",id:"snapshotter"},i=void 0,p={unversionedId:"api/snapshotter",id:"version-1.3/api/snapshotter",title:"Snapshotter",description:"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history",source:"@site/versioned_docs/version-1.3/api/Snapshotter.md",sourceDirName:"api",slug:"/api/snapshotter",permalink:"/sdk/js/docs/1.3/api/snapshotter",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Snapshotter.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-snapshotter",title:"Snapshotter",id:"snapshotter"},sidebar:"version-1.3/docs",previous:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/1.3/api/proxy-configuration"},next:{title:"SystemStatus",permalink:"/sdk/js/docs/1.3/api/system-status"}},m={},u=[{value:"<code>new Snapshotter([options])</code>",id:"new-snapshotteroptions",level:2},{value:"<code>snapshotter.log</code>",id:"snapshotterlog",level:2},{value:"<code>snapshotter.start()</code>",id:"snapshotterstart",level:2},{value:"<code>snapshotter.stop()</code>",id:"snapshotterstop",level:2},{value:"<code>snapshotter.getMemorySample([sampleDurationMillis])</code>",id:"snapshottergetmemorysamplesampledurationmillis",level:2},{value:"<code>snapshotter.getEventLoopSample([sampleDurationMillis])</code>",id:"snapshottergeteventloopsamplesampledurationmillis",level:2},{value:"<code>snapshotter.getCpuSample([sampleDurationMillis])</code>",id:"snapshottergetcpusamplesampledurationmillis",level:2},{value:"<code>snapshotter.getClientSample(sampleDurationMillis)</code>",id:"snapshottergetclientsamplesampledurationmillis",level:2}],d={toc:u},h="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,l);return(0,o.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"snapshotter"}),(0,o.kt)("p",null,"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history\nof the snapshots. It tracks the following resources: Memory, EventLoop, API and CPU. The class is used by the\n",(0,o.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,o.kt)("p",null,"When running on the Apify platform, the CPU and memory statistics are provided by the platform, as collected from the running Docker container. When\nrunning locally, ",(0,o.kt)("inlineCode",{parentName:"p"},"Snapshotter")," makes its own statistics by querying the OS."),(0,o.kt)("p",null,"CPU becomes overloaded locally when its current use exceeds the ",(0,o.kt)("inlineCode",{parentName:"p"},"maxUsedCpuRatio")," option or when Apify platform marks it as overloaded."),(0,o.kt)("p",null,"Memory becomes overloaded if its current use exceeds the ",(0,o.kt)("inlineCode",{parentName:"p"},"maxUsedMemoryRatio")," option. It's computed using the total memory available to the container\nwhen running on the Apify platform and a quarter of total system memory when running locally. Max total memory when running locally may be overridden\nby using the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_MEMORY_MBYTES")," environment variable."),(0,o.kt)("p",null,"Event loop becomes overloaded if it slows down by more than the ",(0,o.kt)("inlineCode",{parentName:"p"},"maxBlockedMillis")," option."),(0,o.kt)("p",null,"Client becomes overloaded when rate limit errors (429 - Too Many Requests), typically received from the request queue, exceed the set limit within the\nset interval."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"snapshotter"}),(0,o.kt)("h2",{id:"new-snapshotteroptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"new Snapshotter([options])")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))," - All ",(0,o.kt)("inlineCode",{parentName:"li"},"Snapshotter")," configuration options.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"log"}),(0,o.kt)("h2",{id:"snapshotterlog"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.log")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"start"}),(0,o.kt)("h2",{id:"snapshotterstart"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.start()")),(0,o.kt)("p",null,"Starts capturing snapshots at configured intervals."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"stop"}),(0,o.kt)("h2",{id:"snapshotterstop"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.stop()")),(0,o.kt)("p",null,"Stops all resource capturing."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getmemorysample"}),(0,o.kt)("h2",{id:"snapshottergetmemorysamplesampledurationmillis"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.getMemorySample([sampleDurationMillis])")),(0,o.kt)("p",null,"Returns a sample of latest memory snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"geteventloopsample"}),(0,o.kt)("h2",{id:"snapshottergeteventloopsamplesampledurationmillis"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.getEventLoopSample([sampleDurationMillis])")),(0,o.kt)("p",null,"Returns a sample of latest event loop snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a\nfull snapshot history."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getcpusample"}),(0,o.kt)("h2",{id:"snapshottergetcpusamplesampledurationmillis"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.getCpuSample([sampleDurationMillis])")),(0,o.kt)("p",null,"Returns a sample of latest CPU snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getclientsample"}),(0,o.kt)("h2",{id:"snapshottergetclientsamplesampledurationmillis"},(0,o.kt)("inlineCode",{parentName:"h2"},"snapshotter.getClientSample(sampleDurationMillis)")),(0,o.kt)("p",null,"Returns a sample of latest Client snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"sampleDurationMillis")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,o.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,c=u["".concat(i,".").concat(h)]||u[h]||d[h]||o;return n?a.createElement(c,l(l({ref:t},m),{},{components:n})):a.createElement(c,l({ref:t},m))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=h;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:r,l[1]=s;for(var p=2;p<o;p++)l[p]=n[p];return a.createElement.apply(null,l)}return a.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fbdbd19e.fb51e63f.js b/assets/js/fbdbd19e.fb51e63f.js deleted file mode 100644 index d3689911bd..0000000000 --- a/assets/js/fbdbd19e.fb51e63f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1658],{43937:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>m,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>p,toc:()=>u});var a=n(87462),r=n(63366),l=(n(67294),n(3905)),o=["components"],s={id_old:"version-1.3-snapshotter",title:"Snapshotter",id:"snapshotter"},i=void 0,p={unversionedId:"api/snapshotter",id:"version-1.3/api/snapshotter",title:"Snapshotter",description:"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history",source:"@site/versioned_docs/version-1.3/api/Snapshotter.md",sourceDirName:"api",slug:"/api/snapshotter",permalink:"/sdk/js/docs/1.3/api/snapshotter",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Snapshotter.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-snapshotter",title:"Snapshotter",id:"snapshotter"},sidebar:"version-1.3/docs",previous:{title:"ProxyConfiguration",permalink:"/sdk/js/docs/1.3/api/proxy-configuration"},next:{title:"SystemStatus",permalink:"/sdk/js/docs/1.3/api/system-status"}},m={},u=[{value:"<code>new Snapshotter([options])</code>",id:"new-snapshotteroptions",level:2},{value:"<code>snapshotter.log</code>",id:"snapshotterlog",level:2},{value:"<code>snapshotter.start()</code>",id:"snapshotterstart",level:2},{value:"<code>snapshotter.stop()</code>",id:"snapshotterstop",level:2},{value:"<code>snapshotter.getMemorySample([sampleDurationMillis])</code>",id:"snapshottergetmemorysamplesampledurationmillis",level:2},{value:"<code>snapshotter.getEventLoopSample([sampleDurationMillis])</code>",id:"snapshottergeteventloopsamplesampledurationmillis",level:2},{value:"<code>snapshotter.getCpuSample([sampleDurationMillis])</code>",id:"snapshottergetcpusamplesampledurationmillis",level:2},{value:"<code>snapshotter.getClientSample(sampleDurationMillis)</code>",id:"snapshottergetclientsamplesampledurationmillis",level:2}],d={toc:u},h="wrapper";function c(e){var t=e.components,n=(0,r.Z)(e,o);return(0,l.kt)(h,(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("a",{name:"snapshotter"}),(0,l.kt)("p",null,"Creates snapshots of system resources at given intervals and marks the resource as either overloaded or not during the last interval. Keeps a history\nof the snapshots. It tracks the following resources: Memory, EventLoop, API and CPU. The class is used by the\n",(0,l.kt)("a",{parentName:"p",href:"../api/autoscaled-pool",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"AutoscaledPool"))," class."),(0,l.kt)("p",null,"When running on the Apify platform, the CPU and memory statistics are provided by the platform, as collected from the running Docker container. When\nrunning locally, ",(0,l.kt)("inlineCode",{parentName:"p"},"Snapshotter")," makes its own statistics by querying the OS."),(0,l.kt)("p",null,"CPU becomes overloaded locally when its current use exceeds the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxUsedCpuRatio")," option or when Apify platform marks it as overloaded."),(0,l.kt)("p",null,"Memory becomes overloaded if its current use exceeds the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxUsedMemoryRatio")," option. It's computed using the total memory available to the container\nwhen running on the Apify platform and a quarter of total system memory when running locally. Max total memory when running locally may be overridden\nby using the ",(0,l.kt)("inlineCode",{parentName:"p"},"APIFY_MEMORY_MBYTES")," environment variable."),(0,l.kt)("p",null,"Event loop becomes overloaded if it slows down by more than the ",(0,l.kt)("inlineCode",{parentName:"p"},"maxBlockedMillis")," option."),(0,l.kt)("p",null,"Client becomes overloaded when rate limit errors (429 - Too Many Requests), typically received from the request queue, exceed the set limit within the\nset interval."),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"snapshotter"}),(0,l.kt)("h2",{id:"new-snapshotteroptions"},(0,l.kt)("inlineCode",{parentName:"h2"},"new Snapshotter([options])")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,l.kt)("a",{parentName:"li",href:"../typedefs/snapshotter-options",target:null,rel:null},(0,l.kt)("inlineCode",{parentName:"a"},"SnapshotterOptions"))," - All ",(0,l.kt)("inlineCode",{parentName:"li"},"Snapshotter")," configuration options.")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"log"}),(0,l.kt)("h2",{id:"snapshotterlog"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.log")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"start"}),(0,l.kt)("h2",{id:"snapshotterstart"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.start()")),(0,l.kt)("p",null,"Starts capturing snapshots at configured intervals."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"stop"}),(0,l.kt)("h2",{id:"snapshotterstop"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.stop()")),(0,l.kt)("p",null,"Stops all resource capturing."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Promise<void>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getmemorysample"}),(0,l.kt)("h2",{id:"snapshottergetmemorysamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getMemorySample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest memory snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"geteventloopsample"}),(0,l.kt)("h2",{id:"snapshottergeteventloopsamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getEventLoopSample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest event loop snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a\nfull snapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getcpusample"}),(0,l.kt)("h2",{id:"snapshottergetcpusamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getCpuSample([sampleDurationMillis])")),(0,l.kt)("p",null,"Returns a sample of latest CPU snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"[sampleDurationMillis]")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null),(0,l.kt)("a",{name:"getclientsample"}),(0,l.kt)("h2",{id:"snapshottergetclientsamplesampledurationmillis"},(0,l.kt)("inlineCode",{parentName:"h2"},"snapshotter.getClientSample(sampleDurationMillis)")),(0,l.kt)("p",null,"Returns a sample of latest Client snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full\nsnapshot history."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("strong",{parentName:"li"},(0,l.kt)("inlineCode",{parentName:"strong"},"sampleDurationMillis")),": ",(0,l.kt)("inlineCode",{parentName:"li"},"number"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Returns"),":"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"Array<*>")),(0,l.kt)("hr",null))}c.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>c});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},l=Object.keys(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)n=l[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},m=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,c=u["".concat(i,".").concat(h)]||u[h]||d[h]||l;return n?a.createElement(c,o(o({ref:t},m),{},{components:n})):a.createElement(c,o({ref:t},m))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=h;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s[u]="string"==typeof e?e:r,o[1]=s;for(var p=2;p<l;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fc7ff2a2.2d9810fe.js b/assets/js/fc7ff2a2.2d9810fe.js deleted file mode 100644 index 8535cb8524..0000000000 --- a/assets/js/fc7ff2a2.2d9810fe.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4481],{9680:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var n=a(87462),r=a(63366),i=(a(67294),a(3905)),l=["components"],o={id:"playwright",title:"utils.playwright"},p=void 0,s={unversionedId:"api/playwright",id:"version-2.3/api/playwright",title:"utils.playwright",description:"A namespace that contains various utilities for Playwright - the headless Chrome Node API.",source:"@site/versioned_docs/version-2.3/api/playwright.md",sourceDirName:"api",slug:"/api/playwright",permalink:"/sdk/js/docs/2.3/api/playwright",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/playwright.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"playwright",title:"utils.playwright"},sidebar:"version-2.3/docs",previous:{title:"utils.log",permalink:"/sdk/js/docs/2.3/api/log"},next:{title:"utils.puppeteer",permalink:"/sdk/js/docs/2.3/api/puppeteer"}},c={},u=[{value:"<code>playwright.gotoExtended</code>",id:"playwrightgotoextended",level:2},{value:"<code>playwright.injectFile(page, filePath, [options])</code>",id:"playwrightinjectfilepage-filepath-options",level:2},{value:"<code>playwright.injectJQuery(page)</code>",id:"playwrightinjectjquerypage",level:2}],g={toc:u},d="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,l);return(0,i.kt)(d,(0,n.Z)({},g,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwright"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { playwright } = Apify.utils;\n\n// Navigate to https://www.example.com in Playwright with a POST request\nconst browser = await Apify.launchPlaywright();\nconst page = await browser.newPage();\nawait playwright.gotoExtended(page, {\n url: 'https://example.com,\n method: 'POST',\n});\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"playwrightgotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.gotoExtended")),(0,i.kt)("p",null,"Extended version of Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload.\nURL, method, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Playwright using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Playwright ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectfile"}),(0,i.kt)("h2",{id:"playwrightinjectfilepage-filepath-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.injectFile(page, filePath, [options])")),(0,i.kt)("p",null,"Injects a JavaScript file into a Playright page. Unlike Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"addScriptTag")," function, this function works on pages with arbitrary Cross-Origin\nResource Sharing (CORS) policies."),(0,i.kt)("p",null,"File contents are cached for up to 10 files to limit file system access."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Playwright ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"filePath")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - File path"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[surviveNavigations]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," - Enables the injected script to survive page navigations and reloads without need to be re-injected\nmanually. This does not mean, however, that internal state will be preserved. Just that it will be automatically re-injected on each\nnavigation before any other scripts get the chance to execute.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectjquery"}),(0,i.kt)("h2",{id:"playwrightinjectjquerypage"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.injectJQuery(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery")," library into a Playwright page. jQuery is often useful for various web scraping and crawling tasks. For\nexample, it can help extract text from HTML elements using CSS selectors."),(0,i.kt)("p",null,"Beware that the injected jQuery object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window.$")," variable and thus it might cause conflicts with other libraries included by the\npage that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected jQuery will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.playwright.injectJQuery(page);\nconst title = await page.evaluate(() => {\n return $('head title').text();\n});\n")),(0,i.kt)("p",null,"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"injectJQuery()")," does not affect the Playwright ",(0,i.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-page#page-query-selector",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"page.$()"))," function in any\nway."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Playwright ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(a),d=r,m=u["".concat(p,".").concat(d)]||u[d]||g[d]||i;return a?n.createElement(m,l(l({ref:t},c),{},{components:a})):n.createElement(m,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:r,l[1]=o;for(var s=2;s<i;s++)l[s]=a[s];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fc7ff2a2.70bc0ef9.js b/assets/js/fc7ff2a2.70bc0ef9.js new file mode 100644 index 0000000000..3204ec358d --- /dev/null +++ b/assets/js/fc7ff2a2.70bc0ef9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4481],{9680:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>m,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var n=a(87462),r=a(63366),i=(a(67294),a(3905)),l=["components"],o={id:"playwright",title:"utils.playwright"},p=void 0,s={unversionedId:"api/playwright",id:"version-2.3/api/playwright",title:"utils.playwright",description:"A namespace that contains various utilities for Playwright - the headless Chrome Node API.",source:"@site/versioned_docs/version-2.3/api/playwright.md",sourceDirName:"api",slug:"/api/playwright",permalink:"/sdk/js/docs/2.3/api/playwright",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/playwright.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"playwright",title:"utils.playwright"},sidebar:"version-2.3/docs",previous:{title:"utils.log",permalink:"/sdk/js/docs/2.3/api/log"},next:{title:"utils.puppeteer",permalink:"/sdk/js/docs/2.3/api/puppeteer"}},c={},u=[{value:"<code>playwright.gotoExtended</code>",id:"playwrightgotoextended",level:2},{value:"<code>playwright.injectFile(page, filePath, [options])</code>",id:"playwrightinjectfilepage-filepath-options",level:2},{value:"<code>playwright.injectJQuery(page)</code>",id:"playwrightinjectjquerypage",level:2}],g={toc:u},d="wrapper";function m(e){var t=e.components,a=(0,r.Z)(e,l);return(0,i.kt)(d,(0,n.Z)({},g,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("a",{name:"playwright"}),(0,i.kt)("p",null,"A namespace that contains various utilities for ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/microsoft/playwright",target:"_blank",rel:"noopener"},"Playwright")," - the headless Chrome Node API."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\nconst { playwright } = Apify.utils;\n\n// Navigate to https://www.example.com in Playwright with a POST request\nconst browser = await Apify.launchPlaywright();\nconst page = await browser.newPage();\nawait playwright.gotoExtended(page, {\n url: 'https://example.com,\n method: 'POST',\n});\n")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"gotoextended"}),(0,i.kt)("h2",{id:"playwrightgotoextended"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.gotoExtended")),(0,i.kt)("p",null,"Extended version of Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"page.goto()")," allowing to perform requests with HTTP method other than GET, with custom headers and POST payload.\nURL, method, headers and payload are taken from request parameter that must be an instance of Apify.Request class."),(0,i.kt)("p",null,(0,i.kt)("em",{parentName:"p"},"NOTE:")," In recent versions of Playwright using requests other than GET, overriding headers and adding payloads disables browser cache which degrades\nperformance."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Playwright ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"request")),": ",(0,i.kt)("a",{parentName:"li",href:"../api/request",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"Request"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[gotoOptions]")),": ",(0,i.kt)("a",{parentName:"li",href:"../typedefs/direct-navigation-options",target:null,rel:null},(0,i.kt)("inlineCode",{parentName:"a"},"DirectNavigationOptions"))," - Custom options for ",(0,i.kt)("inlineCode",{parentName:"li"},"page.goto()"),".")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<(Response|null)>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectfile"}),(0,i.kt)("h2",{id:"playwrightinjectfilepage-filepath-options"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.injectFile(page, filePath, [options])")),(0,i.kt)("p",null,"Injects a JavaScript file into a Playright page. Unlike Playwright's ",(0,i.kt)("inlineCode",{parentName:"p"},"addScriptTag")," function, this function works on pages with arbitrary Cross-Origin\nResource Sharing (CORS) policies."),(0,i.kt)("p",null,"File contents are cached for up to 10 files to limit file system access."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Playwright ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"filePath")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"string")," - File path"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"object"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"[surviveNavigations]")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"boolean")," - Enables the injected script to survive page navigations and reloads without need to be re-injected\nmanually. This does not mean, however, that internal state will be preserved. Just that it will be automatically re-injected on each\nnavigation before any other scripts get the chance to execute.")))),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null),(0,i.kt)("a",{name:"injectjquery"}),(0,i.kt)("h2",{id:"playwrightinjectjquerypage"},(0,i.kt)("inlineCode",{parentName:"h2"},"playwright.injectJQuery(page)")),(0,i.kt)("p",null,"Injects the ",(0,i.kt)("a",{parentName:"p",href:"https://jquery.com/",target:"_blank",rel:"noopener"},"jQuery")," library into a Playwright page. jQuery is often useful for various web scraping and crawling tasks. For\nexample, it can help extract text from HTML elements using CSS selectors."),(0,i.kt)("p",null,"Beware that the injected jQuery object will be set to the ",(0,i.kt)("inlineCode",{parentName:"p"},"window.$")," variable and thus it might cause conflicts with other libraries included by the\npage that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts."),(0,i.kt)("p",null,"The injected jQuery will survive page navigations and reloads."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Example usage:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-javascript"},"await Apify.utils.playwright.injectJQuery(page);\nconst title = await page.evaluate(() => {\n return $('head title').text();\n});\n")),(0,i.kt)("p",null,"Note that ",(0,i.kt)("inlineCode",{parentName:"p"},"injectJQuery()")," does not affect the Playwright ",(0,i.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/class-page#page-query-selector",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"page.$()"))," function in any\nway."),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},(0,i.kt)("inlineCode",{parentName:"strong"},"page")),": ",(0,i.kt)("inlineCode",{parentName:"li"},"Page")," - Playwright ",(0,i.kt)("a",{parentName:"li",href:"https://playwright.dev/docs/api/class-page",target:"_blank",rel:"noopener"},(0,i.kt)("inlineCode",{parentName:"a"},"Page"))," object.")),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},"Returns"),":"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Promise<*>")),(0,i.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),u=s(a),d=r,m=u["".concat(p,".").concat(d)]||u[d]||g[d]||i;return a?n.createElement(m,l(l({ref:t},c),{},{components:a})):n.createElement(m,l({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o[u]="string"==typeof e?e:r,l[1]=o;for(var s=2;s<i;s++)l[s]=a[s];return n.createElement.apply(null,l)}return n.createElement.apply(null,a)}d.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fd1097f5.50decb2e.js b/assets/js/fd1097f5.50decb2e.js new file mode 100644 index 0000000000..54b9e59b3a --- /dev/null +++ b/assets/js/fd1097f5.50decb2e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[361],{30433:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>m});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),s=a(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,a=e.block,l=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],d=(0,i.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,a=c.indexOf(t),n=p[a].value;n!==l&&(d(t),s(n))},h=function(e){var t,a=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},p.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:h,onClick:m},i,{className:(0,o.Z)("tabs__item",u.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function d(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",u.tabList)},r.createElement(p,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function m(e){var t=(0,s.Z)();return r.createElement(d,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function s(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,a])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),s=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(l.location.search);t.set(s,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[s,l])]}function d(e){var t,a,r,o,i=e.defaultValue,s=e.queryString,d=void 0!==s&&s,m=e.groupId,h=u(e),g=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(a){if(!p({value:a,tabValues:n}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:h})})),f=g[0],k=g[1],y=c({queryString:d,groupId:m}),b=y[0],v=y[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],C=w[1],P=function(){var e=null!=b?b:N;return p({value:e,tabValues:h})?e:null}();return(0,n.useLayoutEffect)((function(){P&&k(P)}),[P]),{selectedValue:f,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:h}))throw new Error("Can't select invalid tab value="+e);k(e),v(e),C(e)}),[v,C,h]),tabValues:h}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),s=l.version,u=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var p=s+"/";return"current"===s?p="next/":u&&(p=""),n.createElement(r.default,{to:"/api/"+p+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},17360:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>y,contentTitle:()=>f,default:()=>N,frontMatter:()=>g,metadata:()=>k,toc:()=>b});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(68889),a(26569)),l=a(65559),s=a(30433),u=a(14563);const p='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm start --silent\n',c='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder /usr/src/app/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm run start:prod --silent\n',d='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image.\nCMD npm start --silent\n',m='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY --chown=myuser . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder --chown=myuser /home/myuser/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image. If you know you won\'t need headful browsers,\n# you can remove the XVFB start script for a micro perf gain.\nCMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent\n';var h=["components"],g={id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},f=void 0,k={unversionedId:"guides/docker-images",id:"version-3.0/guides/docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers",source:"@site/versioned_docs/version-3.0/guides/docker_images.mdx",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/3.0/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/docker_images.mdx",tags:[],version:"3.0",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},sidebar:"docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/3.0/guides/type-script-actor"},next:{title:"Examples",permalink:"/sdk/js/docs/3.0/examples"}},y={},b=[{value:"Overview",id:"overview",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"Apify Docker Images",id:"apify-docker-images",level:2},{value:"actor-node",id:"actor-node",level:3},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:3},{value:"actor-node-playwright",id:"actor-node-playwright",level:3},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:3},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:3},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:3},{value:"Example Dockerfile",id:"example-dockerfile",level:2}],v={toc:b},w="wrapper";function N(e){var t=e.components,a=(0,r.Z)(e,h);return(0,o.kt)(w,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"./apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js ",(0,o.kt)("strong",{parentName:"p"},"versions 16 and 18 are supported")," (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 16\nFROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-13.7.0")," comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chromium that's pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.21.1")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Node.js version tag should ",(0,o.kt)("strong",{parentName:"li"},"always")," be used."),(0,o.kt)("li",{parentName:"ul"},"The automation library version tag should be used for ",(0,o.kt)("strong",{parentName:"li"},"added security"),"."),(0,o.kt)("li",{parentName:"ul"},"Asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," should be used as the automation library version in our ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "crawlee": "^3.0.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"When you use only what you need, you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"apify-docker-images"},"Apify Docker Images"),(0,o.kt)("h3",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,"\u200b",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"))," and other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"))," environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so we can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use the above images, it's necessary to have a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)(i.B,{to:"docs/introduction/setting-up",mdxType:"CrawleeLink"},"Crawlee CLI")," which automatically adds the correct Dockerfile into our project folder."),(0,o.kt)(l.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"node+js",label:"Node+JavaScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},p)),(0,o.kt)(s.Z,{value:"node+ts",label:"Node+TypeScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"browser+js",label:"Browser+JavaScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in the ",(0,o.kt)("code",null,"FROM")," declaration.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},d)),(0,o.kt)(s.Z,{value:"browser+ts",label:"Browser+TypeScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in both ",(0,o.kt)("code",null,"FROM")," declarations.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},m))))}N.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=u(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return a?n.createElement(h,i(i({ref:t},p),{},{components:a})):n.createElement(h,i({ref:t},p))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var u=2;u<o;u++)i[u]=a[u];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fd1097f5.7a45088c.js b/assets/js/fd1097f5.7a45088c.js deleted file mode 100644 index 7d7ed0099a..0000000000 --- a/assets/js/fd1097f5.7a45088c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[361],{30433:(e,t,a)=>{a.d(t,{Z:()=>i});var n=a(67294),r=a(34334);const o={tabItem:"tabItem_Ymn6"};function i(e){var t=e.children,a=e.hidden,i=e.className;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o.tabItem,i),hidden:a},t)}},65559:(e,t,a)=>{a.d(t,{Z:()=>m});var n=a(87462),r=a(67294),o=a(34334),i=a(63735),l=a(38224),s=a(5730);const u={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};function p(e){var t=e.className,a=e.block,l=e.selectedValue,s=e.selectValue,p=e.tabValues,c=[],d=(0,i.o5)().blockElementScrollPositionUntilNextRender,m=function(e){var t=e.currentTarget,a=c.indexOf(t),n=p[a].value;n!==l&&(d(t),s(n))},h=function(e){var t,a=null;switch(e.key){case"Enter":m(e);break;case"ArrowRight":var n,r=c.indexOf(e.currentTarget)+1;a=null!=(n=c[r])?n:c[0];break;case"ArrowLeft":var o,i=c.indexOf(e.currentTarget)-1;a=null!=(o=c[i])?o:c[c.length-1]}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},p.map((function(e){var t=e.value,a=e.label,i=e.attributes;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:function(e){return c.push(e)},onKeyDown:h,onClick:m},i,{className:(0,o.Z)("tabs__item",u.tabItem,null==i?void 0:i.className,{"tabs__item--active":l===t})}),null!=a?a:t)})))}function c(e){var t=e.lazy,a=e.children,n=e.selectedValue,o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){var i=o.find((function(e){return e.props.value===n}));return i?(0,r.cloneElement)(i,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map((function(e,t){return(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n})})))}function d(e){var t=(0,l.Y)(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",u.tabList)},r.createElement(p,(0,n.Z)({},e,t)),r.createElement(c,(0,n.Z)({},e,t)))}function m(e){var t=(0,s.Z)();return r.createElement(d,(0,n.Z)({key:String(t)},e))}},38224:(e,t,a)=>{a.d(t,{Y:()=>d});var n=a(67294),r=a(16550),o=a(34423),i=a(20636),l=a(99200);function s(e){return function(e){var t,a;return null!=(t=null==(a=n.Children.map(e,(function(e){if(!e||(0,n.isValidElement)(e)&&(t=e.props)&&"object"==typeof t&&"value"in t)return e;var t;throw new Error("Docusaurus error: Bad <Tabs> child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.')})))?void 0:a.filter(Boolean))?t:[]}(e).map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes,default:t.default}}))}function u(e){var t=e.values,a=e.children;return(0,n.useMemo)((function(){var e=null!=t?t:s(a);return function(e){var t=(0,i.l)(e,(function(e,t){return e.value===t.value}));if(t.length>0)throw new Error('Docusaurus error: Duplicate values "'+t.map((function(e){return e.value})).join(", ")+'" found in <Tabs>. Every value needs to be unique.')}(e),e}),[t,a])}function p(e){var t=e.value;return e.tabValues.some((function(e){return e.value===t}))}function c(e){var t=e.queryString,a=void 0!==t&&t,i=e.groupId,l=(0,r.k6)(),s=function(e){var t=e.queryString,a=void 0!==t&&t,n=e.groupId;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return null!=n?n:null}({queryString:a,groupId:i});return[(0,o._X)(s),(0,n.useCallback)((function(e){if(s){var t=new URLSearchParams(l.location.search);t.set(s,e),l.replace(Object.assign({},l.location,{search:t.toString()}))}}),[s,l])]}function d(e){var t,a,r,o,i=e.defaultValue,s=e.queryString,d=void 0!==s&&s,m=e.groupId,h=u(e),g=(0,n.useState)((function(){return function(e){var t,a=e.defaultValue,n=e.tabValues;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(a){if(!p({value:a,tabValues:n}))throw new Error('Docusaurus error: The <Tabs> has a defaultValue "'+a+'" but none of its children has the corresponding value. Available values are: '+n.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");return a}var r=null!=(t=n.find((function(e){return e.default})))?t:n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:i,tabValues:h})})),f=g[0],k=g[1],y=c({queryString:d,groupId:m}),b=y[0],v=y[1],w=(t=function(e){return e?"docusaurus.tab."+e:null}({groupId:m}.groupId),a=(0,l.Nk)(t),r=a[0],o=a[1],[r,(0,n.useCallback)((function(e){t&&o.set(e)}),[t,o])]),N=w[0],C=w[1],P=function(){var e=null!=b?b:N;return p({value:e,tabValues:h})?e:null}();return(0,n.useLayoutEffect)((function(){P&&k(P)}),[P]),{selectedValue:f,selectValue:(0,n.useCallback)((function(e){if(!p({value:e,tabValues:h}))throw new Error("Can't select invalid tab value="+e);k(e),v(e),C(e)}),[v,C,h]),tabValues:h}}},68889:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(67294),r=a(88746),o=a(6141),i=a(6832);const l=function(e){var t=e.to,a=e.children,l=(0,o.E)(),s=l.version,u=l.isLast;if((0,i.default)().siteConfig.presets[0][1].docs.disableVersioning)return n.createElement(r.default,{to:"/api/"+t},a);var p=s+"/";return"current"===s?p="next/":u&&(p=""),n.createElement(r.default,{to:"/api/"+p+t},a)}},26569:(e,t,a)=>{a.d(t,{B:()=>l,T:()=>i});var n=a(67294),r=a(88746),o="https://crawlee.dev",i=function(e){var t=e.to,a=e.children,i=e.version;return n.createElement(r.default,{href:o+"/api"+(i?"/"+i:"")+"/"+t},a)},l=function(e){var t=e.to,a=e.children;return n.createElement(r.default,{href:o+"/"+t},a)}},17360:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>y,contentTitle:()=>f,default:()=>N,frontMatter:()=>g,metadata:()=>k,toc:()=>b});var n=a(87462),r=a(63366),o=(a(67294),a(3905)),i=(a(68889),a(26569)),l=a(65559),s=a(30433),u=a(14563);const p='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm start --silent\n',c='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder /usr/src/app/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY . ./\n\n\n# Run the image.\nCMD npm run start:prod --silent\n',d='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image.\nCMD npm start --silent\n',m='# Specify the base Docker image. You can read more about\n# the available images at https://crawlee.dev/docs/guides/docker-images\n# You can also use any other image from Docker Hub.\nFROM apify/actor-node-playwright-chrome:16 AS builder\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install all dependencies. Don\'t audit to speed up the installation.\nRUN npm install --include=dev --audit=false\n\n# Next, copy the source files using the user set\n# in the base image.\nCOPY --chown=myuser . ./\n\n# Install all dependencies and build the project.\n# Don\'t audit to speed up the installation.\nRUN npm run build\n\n# Create final image\nFROM apify/actor-node-playwright-chrome:16\n\n# Copy only built JS files from builder image\nCOPY --from=builder --chown=myuser /home/myuser/dist ./dist\n\n# Copy just package.json and package-lock.json\n# to speed up the build using Docker layer cache.\nCOPY --chown=myuser package*.json ./\n\n# Install NPM packages, skip optional and development dependencies to\n# keep the image small. Avoid logging too much and print the dependency\n# tree for debugging\nRUN npm --quiet set progress=false \\\n && npm install --omit=dev --omit=optional \\\n && echo "Installed NPM packages:" \\\n && (npm list --omit=dev --all || true) \\\n && echo "Node.js version:" \\\n && node --version \\\n && echo "NPM version:" \\\n && npm --version\n\n# Next, copy the remaining files and directories with the source code.\n# Since we do this after NPM install, quick build will be really fast\n# for most source file changes.\nCOPY --chown=myuser . ./\n\n\n# Run the image. If you know you won\'t need headful browsers,\n# you can remove the XVFB start script for a micro perf gain.\nCMD ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent\n';var h=["components"],g={id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},f=void 0,k={unversionedId:"guides/docker-images",id:"version-3.0/guides/docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers",source:"@site/versioned_docs/version-3.0/guides/docker_images.mdx",sourceDirName:"guides",slug:"/guides/docker-images",permalink:"/sdk/js/docs/3.0/guides/docker-images",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/docker_images.mdx",tags:[],version:"3.0",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"docker-images",title:"Running in Docker",description:"Example Docker images to run your crawlers"},sidebar:"docs",previous:{title:"TypeScript Actors",permalink:"/sdk/js/docs/3.0/guides/type-script-actor"},next:{title:"Examples",permalink:"/sdk/js/docs/3.0/examples"}},y={},b=[{value:"Overview",id:"overview",level:2},{value:"Versioning",id:"versioning",level:2},{value:"Node.js versioning",id:"nodejs-versioning",level:3},{value:"Automation library versioning",id:"automation-library-versioning",level:3},{value:"Pre-release tags",id:"pre-release-tags",level:3},{value:"Best practices",id:"best-practices",level:2},{value:"Warning about image size",id:"warning-about-image-size",level:3},{value:"Apify Docker Images",id:"apify-docker-images",level:2},{value:"actor-node",id:"actor-node",level:3},{value:"actor-node-puppeteer-chrome",id:"actor-node-puppeteer-chrome",level:3},{value:"actor-node-playwright",id:"actor-node-playwright",level:3},{value:"actor-node-playwright-chrome",id:"actor-node-playwright-chrome",level:3},{value:"actor-node-playwright-firefox",id:"actor-node-playwright-firefox",level:3},{value:"actor-node-playwright-webkit",id:"actor-node-playwright-webkit",level:3},{value:"Example Dockerfile",id:"example-dockerfile",level:2}],v={toc:b},w="wrapper";function N(e){var t=e.components,a=(0,r.Z)(e,h);return(0,o.kt)(w,(0,n.Z)({},v,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the ",(0,o.kt)("a",{parentName:"p",href:"./apify-platform",target:null,rel:null},"Apify Platform"),"."),(0,o.kt)("p",null,"All images can be found in their ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-actor-docker",target:"_blank",rel:"noopener"},"GitHub repo")," and in our ",(0,o.kt)("a",{parentName:"p",href:"https://hub.docker.com/orgs/apify",target:"_blank",rel:"noopener"},"DockerHub"),"."),(0,o.kt)("h2",{id:"overview"},"Overview"),(0,o.kt)("p",null,"Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-puppeteer-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-chrome"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-firefox",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-firefox"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#actor-node-playwright-webkit",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"apify/actor-node-playwright-webkit")))),(0,o.kt)("h2",{id:"versioning"},"Versioning"),(0,o.kt)("p",null,"Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.")),(0,o.kt)("h3",{id:"nodejs-versioning"},"Node.js versioning"),(0,o.kt)("p",null,"Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js ",(0,o.kt)("strong",{parentName:"p"},"versions 16 and 18 are supported")," (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Use Node.js 16\nFROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"automation-library-versioning"},"Automation library versioning"),(0,o.kt)("p",null,"Images that include a pre-installed automation library, which means all images that include ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"playwright")," in their name, are also tagged with the pre-installed version of the library. For example, ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome:16-13.7.0")," comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer")," will not match the version of Chromium that's pre-installed."),(0,o.kt)("p",null,"Similarly ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-playwright-firefox:14-1.21.1")," runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1."),(0,o.kt)("p",null,"Installing ",(0,o.kt)("inlineCode",{parentName:"p"},"apify/actor-node-puppeteer-chrome")," (without a tag) will install the latest available version of Node.js and ",(0,o.kt)("inlineCode",{parentName:"p"},"puppeteer"),"."),(0,o.kt)("h3",{id:"pre-release-tags"},"Pre-release tags"),(0,o.kt)("p",null,"We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a ",(0,o.kt)("inlineCode",{parentName:"p"},"beta")," suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# Without library version.\nFROM apify/actor-node:16-beta\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"# With library version.\nFROM apify/actor-node-playwright-chrome:16-1.10.0-beta\n")),(0,o.kt)("h2",{id:"best-practices"},"Best practices"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Node.js version tag should ",(0,o.kt)("strong",{parentName:"li"},"always")," be used."),(0,o.kt)("li",{parentName:"ul"},"The automation library version tag should be used for ",(0,o.kt)("strong",{parentName:"li"},"added security"),"."),(0,o.kt)("li",{parentName:"ul"},"Asterisk ",(0,o.kt)("inlineCode",{parentName:"li"},"*")," should be used as the automation library version in our ",(0,o.kt)("inlineCode",{parentName:"li"},"package.json")," files.")),(0,o.kt)("p",null,"It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "dependencies": {\n "crawlee": "^3.0.0",\n "playwright": "*"\n }\n}\n')),(0,o.kt)("h3",{id:"warning-about-image-size"},"Warning about image size"),(0,o.kt)("p",null,"Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need."),(0,o.kt)("p",null,"You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the",(0,o.kt)("inlineCode",{parentName:"p"},"actor-node-puppeteer-chrome")," image, but the resulting image will be about 3 times larger and extremely slow to download and build."),(0,o.kt)("p",null,"When you use only what you need, you'll be rewarded with reasonable build and start times."),(0,o.kt)("h2",{id:"apify-docker-images"},"Apify Docker Images"),(0,o.kt)("h3",{id:"actor-node"},"actor-node"),(0,o.kt)("p",null,"This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler")),". It benefits from lightning fast builds and container startups."),(0,o.kt)("p",null,"\u200b",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler"))," and other browser based features will ",(0,o.kt)("strong",{parentName:"p"},"NOT")," work with this image."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node:16\n")),(0,o.kt)("h3",{id:"actor-node-puppeteer-chrome"},"actor-node-puppeteer-chrome"),(0,o.kt)("p",null,"This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," with ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),"."),(0,o.kt)("p",null,"The image supports XVFB by default, so you can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-puppeteer-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright"},"actor-node-playwright"),(0,o.kt)("p",null,"A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-chrome"},"actor-node-playwright-chrome"),(0,o.kt)("p",null,"Similar to ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-puppeteer-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-puppeteer-chrome")),", but for Playwright. You can run ",(0,o.kt)(i.T,{to:"cheerio-crawler/class/CheerioCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"CheerioCrawler"))," and ",(0,o.kt)(i.T,{to:"playwright-crawler/class/PlaywrightCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PlaywrightCrawler")),", but ",(0,o.kt)("strong",{parentName:"p"},"NOT")," ",(0,o.kt)(i.T,{to:"puppeteer-crawler/class/PuppeteerCrawler",mdxType:"CrawleeApiLink"},(0,o.kt)("inlineCode",{parentName:"p"},"PuppeteerCrawler")),"."),(0,o.kt)("p",null,"It uses the ",(0,o.kt)("a",{parentName:"p",href:"https://playwright.dev/docs/api/environment-variables/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD"))," environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright"))," image override this env var."),(0,o.kt)("p",null,"The image supports XVFB by default, so we can run both ",(0,o.kt)("inlineCode",{parentName:"p"},"headless")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"headful")," browsers with it."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-chrome:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-firefox"},"actor-node-playwright-firefox"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with Firefox\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-firefox:16\n")),(0,o.kt)("h3",{id:"actor-node-playwright-webkit"},"actor-node-playwright-webkit"),(0,o.kt)("p",null,"Same idea as ",(0,o.kt)("a",{parentName:"p",href:"#actor-node-playwright-chrome",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"actor-node-playwright-chrome")),", but with WebKit\npre-installed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-dockerfile"},"FROM apify/actor-node-playwright-webkit:16\n")),(0,o.kt)("h2",{id:"example-dockerfile"},"Example Dockerfile"),(0,o.kt)("p",null,"To use the above images, it's necessary to have a ",(0,o.kt)("a",{parentName:"p",href:"https://docs.docker.com/engine/reference/builder/",target:"_blank",rel:"noopener"},(0,o.kt)("inlineCode",{parentName:"a"},"Dockerfile")),". You can either use this example, or bootstrap your projects with the ",(0,o.kt)(i.B,{to:"docs/introduction/setting-up",mdxType:"CrawleeLink"},"Crawlee CLI")," which automatically adds the correct Dockerfile into our project folder."),(0,o.kt)(l.Z,{mdxType:"Tabs"},(0,o.kt)(s.Z,{value:"node+js",label:"Node+JavaScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},p)),(0,o.kt)(s.Z,{value:"node+ts",label:"Node+TypeScript",mdxType:"TabItem"},(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},c)),(0,o.kt)(s.Z,{value:"browser+js",label:"Browser+JavaScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in the ",(0,o.kt)("code",null,"FROM")," declaration.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},d)),(0,o.kt)(s.Z,{value:"browser+ts",label:"Browser+TypeScript",mdxType:"TabItem"},"This example is for Playwright. If you want to use Puppeteer, simply replace ",(0,o.kt)("b",null,"playwright"),"with ",(0,o.kt)("b",null,"puppeteer")," in both ",(0,o.kt)("code",null,"FROM")," declarations.",(0,o.kt)(u.Z,{language:"dockerfile",mdxType:"CodeBlock"},m))))}N.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?o(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},o=Object.keys(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),u=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=u(e.components);return n.createElement(s.Provider,{value:t},e.children)},c="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),c=u(a),m=r,h=c["".concat(s,".").concat(m)]||c[m]||d[m]||o;return a?n.createElement(h,i(i({ref:t},p),{},{components:a})):n.createElement(h,i({ref:t},p))}));function h(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[c]="string"==typeof e?e:r,i[1]=l;for(var u=2;u<o;u++)i[u]=a[u];return n.createElement.apply(null,i)}return n.createElement.apply(null,a)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fd951894.107654b4.js b/assets/js/fd951894.107654b4.js deleted file mode 100644 index a07710ddd1..0000000000 --- a/assets/js/fd951894.107654b4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2615],{90798:(t,e,s)=>{s.r(e),s.d(e,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=s(87462),i=s(63366),r=(s(67294),s(3905)),n=["components"],l={id_old:"version-1.3-statistics",title:"Statistics",id:"statistics"},o=void 0,c={unversionedId:"api/statistics",id:"version-1.3/api/statistics",title:"Statistics",description:"The statistics class provides an interface to collecting and logging run statistics for requests.",source:"@site/versioned_docs/version-1.3/api/Statistics.md",sourceDirName:"api",slug:"/api/statistics",permalink:"/sdk/js/docs/1.3/api/statistics",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Statistics.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-statistics",title:"Statistics",id:"statistics"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/1.3/api/puppeteer-crawler"},next:{title:"Dataset",permalink:"/sdk/js/docs/1.3/api/dataset"}},p={},u=[{value:"Properties",id:"properties",level:2},{value:"<code>state</code>",id:"state",level:3},{value:"<code>id</code>",id:"id",level:3},{value:"<code>requestRetryHistogram</code>",id:"requestretryhistogram",level:3},{value:"<code>statistics.reset()</code>",id:"statisticsreset",level:2},{value:"<code>statistics.calculate()</code>",id:"statisticscalculate",level:2},{value:"<code>statistics.startCapturing()</code>",id:"statisticsstartcapturing",level:2},{value:"<code>statistics.stopCapturing()</code>",id:"statisticsstopcapturing",level:2},{value:"<code>statistics.persistState()</code>",id:"statisticspersiststate",level:2},{value:"<code>statistics.toJSON()</code>",id:"statisticstojson",level:2}],d={toc:u},k="wrapper";function m(t){var e=t.components,s=(0,i.Z)(t,n);return(0,r.kt)(k,(0,a.Z)({},d,s,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"statistics"}),(0,r.kt)("p",null,"The statistics class provides an interface to collecting and logging run statistics for requests."),(0,r.kt)("p",null,"All statistic information is saved on key value store under the key SDK",(0,r.kt)("em",{parentName:"p"},"CRAWLER_STATISTICS"),"*",", persists between migrations and abort/resurrect"),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"state"},(0,r.kt)("inlineCode",{parentName:"h3"},"state")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("p",null,"Current statistic state used for doing calculations on ",(0,r.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/statistics#calculate",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Statistics.calculate()"))," calls"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"id"},(0,r.kt)("inlineCode",{parentName:"h3"},"id")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Statistic instance id"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestretryhistogram"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Array<number>")),(0,r.kt)("p",null,"Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reset"}),(0,r.kt)("h2",{id:"statisticsreset"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.reset()")),(0,r.kt)("p",null,"Set the current statistic instance to pristine values"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"calculate"}),(0,r.kt)("h2",{id:"statisticscalculate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.calculate()")),(0,r.kt)("p",null,"Calculate the current statistics"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"startcapturing"}),(0,r.kt)("h2",{id:"statisticsstartcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.startCapturing()")),(0,r.kt)("p",null,"Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"stopcapturing"}),(0,r.kt)("h2",{id:"statisticsstopcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.stopCapturing()")),(0,r.kt)("p",null,"Stops logging and remove event listeners, then persist"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"persiststate"}),(0,r.kt)("h2",{id:"statisticspersiststate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.persistState()")),(0,r.kt)("p",null,"Persist internal state to the key value store"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"tojson"}),(0,r.kt)("h2",{id:"statisticstojson"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.toJSON()")),(0,r.kt)("p",null,"Make this class serializable when called with ",(0,r.kt)("inlineCode",{parentName:"p"},"JSON.stringify(statsInstance)")," directly or through ",(0,r.kt)("inlineCode",{parentName:"p"},"keyValueStore.setValue('KEY', statsInstance)")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-persisted-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticPersistedState"))," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("hr",null))}m.isMDXComponent=!0},3905:(t,e,s)=>{s.d(e,{Zo:()=>p,kt:()=>m});var a=s(67294);function i(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function r(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,a)}return s}function n(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?r(Object(s),!0).forEach((function(e){i(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function l(t,e){if(null==t)return{};var s,a,i=function(t,e){if(null==t)return{};var s,a,i={},r=Object.keys(t);for(a=0;a<r.length;a++)s=r[a],e.indexOf(s)>=0||(i[s]=t[s]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(a=0;a<r.length;a++)s=r[a],e.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(t,s)&&(i[s]=t[s])}return i}var o=a.createContext({}),c=function(t){var e=a.useContext(o),s=e;return t&&(s="function"==typeof t?t(e):n(n({},e),t)),s},p=function(t){var e=c(t.components);return a.createElement(o.Provider,{value:e},t.children)},u="mdxType",d={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var s=t.components,i=t.mdxType,r=t.originalType,o=t.parentName,p=l(t,["components","mdxType","originalType","parentName"]),u=c(s),k=i,m=u["".concat(o,".").concat(k)]||u[k]||d[k]||r;return s?a.createElement(m,n(n({ref:e},p),{},{components:s})):a.createElement(m,n({ref:e},p))}));function m(t,e){var s=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=s.length,n=new Array(r);n[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[u]="string"==typeof t?t:i,n[1]=l;for(var c=2;c<r;c++)n[c]=s[c];return a.createElement.apply(null,n)}return a.createElement.apply(null,s)}k.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fd951894.38b069cc.js b/assets/js/fd951894.38b069cc.js new file mode 100644 index 0000000000..be9a615b22 --- /dev/null +++ b/assets/js/fd951894.38b069cc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2615],{90798:(t,e,s)=>{s.r(e),s.d(e,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=s(87462),i=s(63366),r=(s(67294),s(3905)),n=["components"],l={id_old:"version-1.3-statistics",title:"Statistics",id:"statistics"},o=void 0,c={unversionedId:"api/statistics",id:"version-1.3/api/statistics",title:"Statistics",description:"The statistics class provides an interface to collecting and logging run statistics for requests.",source:"@site/versioned_docs/version-1.3/api/Statistics.md",sourceDirName:"api",slug:"/api/statistics",permalink:"/sdk/js/docs/1.3/api/statistics",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Statistics.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-statistics",title:"Statistics",id:"statistics"},sidebar:"version-1.3/docs",previous:{title:"PuppeteerCrawler",permalink:"/sdk/js/docs/1.3/api/puppeteer-crawler"},next:{title:"Dataset",permalink:"/sdk/js/docs/1.3/api/dataset"}},p={},u=[{value:"Properties",id:"properties",level:2},{value:"<code>state</code>",id:"state",level:3},{value:"<code>id</code>",id:"id",level:3},{value:"<code>requestRetryHistogram</code>",id:"requestretryhistogram",level:3},{value:"<code>statistics.reset()</code>",id:"statisticsreset",level:2},{value:"<code>statistics.calculate()</code>",id:"statisticscalculate",level:2},{value:"<code>statistics.startCapturing()</code>",id:"statisticsstartcapturing",level:2},{value:"<code>statistics.stopCapturing()</code>",id:"statisticsstopcapturing",level:2},{value:"<code>statistics.persistState()</code>",id:"statisticspersiststate",level:2},{value:"<code>statistics.toJSON()</code>",id:"statisticstojson",level:2}],d={toc:u},k="wrapper";function m(t){var e=t.components,s=(0,i.Z)(t,n);return(0,r.kt)(k,(0,a.Z)({},d,s,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"statistics"}),(0,r.kt)("p",null,"The statistics class provides an interface to collecting and logging run statistics for requests."),(0,r.kt)("p",null,"All statistic information is saved on key value store under the key SDK",(0,r.kt)("em",{parentName:"p"},"CRAWLER_STATISTICS"),"*",", persists between migrations and abort/resurrect"),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"state"},(0,r.kt)("inlineCode",{parentName:"h3"},"state")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("p",null,"Current statistic state used for doing calculations on ",(0,r.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/statistics#calculate",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Statistics.calculate()"))," calls"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"id"},(0,r.kt)("inlineCode",{parentName:"h3"},"id")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"Statistic instance id"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"requestretryhistogram"},(0,r.kt)("inlineCode",{parentName:"h3"},"requestRetryHistogram")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Array<number>")),(0,r.kt)("p",null,"Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"reset"}),(0,r.kt)("h2",{id:"statisticsreset"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.reset()")),(0,r.kt)("p",null,"Set the current statistic instance to pristine values"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"calculate"}),(0,r.kt)("h2",{id:"statisticscalculate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.calculate()")),(0,r.kt)("p",null,"Calculate the current statistics"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"startcapturing"}),(0,r.kt)("h2",{id:"statisticsstartcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.startCapturing()")),(0,r.kt)("p",null,"Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"stopcapturing"}),(0,r.kt)("h2",{id:"statisticsstopcapturing"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.stopCapturing()")),(0,r.kt)("p",null,"Stops logging and remove event listeners, then persist"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"persiststate"}),(0,r.kt)("h2",{id:"statisticspersiststate"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.persistState()")),(0,r.kt)("p",null,"Persist internal state to the key value store"),(0,r.kt)("hr",null),(0,r.kt)("a",{name:"tojson"}),(0,r.kt)("h2",{id:"statisticstojson"},(0,r.kt)("inlineCode",{parentName:"h2"},"statistics.toJSON()")),(0,r.kt)("p",null,"Make this class serializable when called with ",(0,r.kt)("inlineCode",{parentName:"p"},"JSON.stringify(statsInstance)")," directly or through ",(0,r.kt)("inlineCode",{parentName:"p"},"keyValueStore.setValue('KEY', statsInstance)")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Returns"),":"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-persisted-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticPersistedState"))," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/statistic-state",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"StatisticState"))),(0,r.kt)("hr",null))}m.isMDXComponent=!0},3905:(t,e,s)=>{s.d(e,{Zo:()=>p,kt:()=>m});var a=s(67294);function i(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function r(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),s.push.apply(s,a)}return s}function n(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?r(Object(s),!0).forEach((function(e){i(t,e,s[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}function l(t,e){if(null==t)return{};var s,a,i=function(t,e){if(null==t)return{};var s,a,i={},r=Object.keys(t);for(a=0;a<r.length;a++)s=r[a],e.indexOf(s)>=0||(i[s]=t[s]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(a=0;a<r.length;a++)s=r[a],e.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(t,s)&&(i[s]=t[s])}return i}var o=a.createContext({}),c=function(t){var e=a.useContext(o),s=e;return t&&(s="function"==typeof t?t(e):n(n({},e),t)),s},p=function(t){var e=c(t.components);return a.createElement(o.Provider,{value:e},t.children)},u="mdxType",d={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},k=a.forwardRef((function(t,e){var s=t.components,i=t.mdxType,r=t.originalType,o=t.parentName,p=l(t,["components","mdxType","originalType","parentName"]),u=c(s),k=i,m=u["".concat(o,".").concat(k)]||u[k]||d[k]||r;return s?a.createElement(m,n(n({ref:e},p),{},{components:s})):a.createElement(m,n({ref:e},p))}));function m(t,e){var s=arguments,i=e&&e.mdxType;if("string"==typeof t||i){var r=s.length,n=new Array(r);n[0]=k;var l={};for(var o in e)hasOwnProperty.call(e,o)&&(l[o]=e[o]);l.originalType=t,l[u]="string"==typeof t?t:i,n[1]=l;for(var c=2;c<r;c++)n[c]=s[c];return a.createElement.apply(null,n)}return a.createElement.apply(null,s)}k.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fdb21dcb.22b7fa15.js b/assets/js/fdb21dcb.22b7fa15.js deleted file mode 100644 index 0d8793eb21..0000000000 --- a/assets/js/fdb21dcb.22b7fa15.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[323],{42208:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>f,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var o=n(87462),s=n(63366),r=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},p=void 0,l={unversionedId:"typedefs/session-pool-options",id:"version-1.3/typedefs/session-pool-options",title:"SessionPoolOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SessionPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-pool-options",permalink:"/sdk/js/docs/1.3/typedefs/session-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionPoolOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},sidebar:"version-1.3/docs",previous:{title:"SessionOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-options"},next:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/1.3/typedefs/snapshotter-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>maxPoolSize</code>",id:"maxpoolsize",level:3},{value:"<code>sessionOptions</code>",id:"sessionoptions",level:3},{value:"<code>persistStateKeyValueStoreId</code>",id:"persiststatekeyvaluestoreid",level:3},{value:"<code>persistStateKey</code>",id:"persiststatekey",level:3},{value:"<code>createSessionFunction</code>",id:"createsessionfunction",level:3}],u={toc:c},m="wrapper";function f(e){var t=e.components,n=(0,s.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"sessionpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"maxpoolsize"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxPoolSize")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Maximum size of the pool. Indicates how many sessions are rotated."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekeyvaluestoreid"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKeyValueStoreId")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Name or Id of ",(0,r.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," where is the ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool")," state stored."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekey"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ",(0,r.kt)("code",null," = ",'"',"\\",'"',"SESSION_POOL_STATE\\",'"','"')),(0,r.kt)("p",null,"Session pool persists it's state under this key in Key value store."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"createsessionfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"createSessionFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/create-session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CreateSession"))),(0,r.kt)("p",null,"Custom function that should return ",(0,r.kt)("inlineCode",{parentName:"p"},"Session")," instance. Any error thrown from this function will terminate the process. Function receives ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool"),"\ninstance as a parameter"),(0,r.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var o=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,o,s=function(e,t){if(null==e)return{};var n,o,s={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var p=o.createContext({}),l=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return o.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,p=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=l(n),m=s,f=c["".concat(p,".").concat(m)]||c[m]||u[m]||r;return n?o.createElement(f,i(i({ref:t},d),{},{components:n})):o.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,i=new Array(r);i[0]=m;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[c]="string"==typeof e?e:s,i[1]=a;for(var l=2;l<r;l++)i[l]=n[l];return o.createElement.apply(null,i)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fdb21dcb.5342a0ae.js b/assets/js/fdb21dcb.5342a0ae.js new file mode 100644 index 0000000000..d20f562a68 --- /dev/null +++ b/assets/js/fdb21dcb.5342a0ae.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[323],{42208:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>p,default:()=>f,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var o=n(87462),s=n(63366),r=(n(67294),n(3905)),i=["components"],a={id_old:"version-1.3-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},p=void 0,l={unversionedId:"typedefs/session-pool-options",id:"version-1.3/typedefs/session-pool-options",title:"SessionPoolOptions",description:"Properties",source:"@site/versioned_docs/version-1.3/typedefs/SessionPoolOptions.md",sourceDirName:"typedefs",slug:"/typedefs/session-pool-options",permalink:"/sdk/js/docs/1.3/typedefs/session-pool-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionPoolOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-session-pool-options",title:"SessionPoolOptions",id:"session-pool-options"},sidebar:"version-1.3/docs",previous:{title:"SessionOptions",permalink:"/sdk/js/docs/1.3/typedefs/session-options"},next:{title:"SnapshotterOptions",permalink:"/sdk/js/docs/1.3/typedefs/snapshotter-options"}},d={},c=[{value:"Properties",id:"properties",level:2},{value:"<code>maxPoolSize</code>",id:"maxpoolsize",level:3},{value:"<code>sessionOptions</code>",id:"sessionoptions",level:3},{value:"<code>persistStateKeyValueStoreId</code>",id:"persiststatekeyvaluestoreid",level:3},{value:"<code>persistStateKey</code>",id:"persiststatekey",level:3},{value:"<code>createSessionFunction</code>",id:"createsessionfunction",level:3}],u={toc:c},m="wrapper";function f(e){var t=e.components,n=(0,s.Z)(e,i);return(0,r.kt)(m,(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("a",{name:"sessionpooloptions"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"maxpoolsize"},(0,r.kt)("inlineCode",{parentName:"h3"},"maxPoolSize")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ",(0,r.kt)("code",null," = 1000")),(0,r.kt)("p",null,"Maximum size of the pool. Indicates how many sessions are rotated."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sessionoptions"},(0,r.kt)("inlineCode",{parentName:"h3"},"sessionOptions")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/session-options",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"SessionOptions"))),(0,r.kt)("p",null,"The configuration options for ",(0,r.kt)("a",{parentName:"p",href:"/sdk/js/docs/1.3/api/session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"Session"))," instances."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekeyvaluestoreid"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKeyValueStoreId")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Name or Id of ",(0,r.kt)("inlineCode",{parentName:"p"},"KeyValueStore")," where is the ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool")," state stored."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"persiststatekey"},(0,r.kt)("inlineCode",{parentName:"h3"},"persistStateKey")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ",(0,r.kt)("code",null," = ",'"',"\\",'"',"SESSION_POOL_STATE\\",'"','"')),(0,r.kt)("p",null,"Session pool persists it's state under this key in Key value store."),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"createsessionfunction"},(0,r.kt)("inlineCode",{parentName:"h3"},"createSessionFunction")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Type"),": ",(0,r.kt)("a",{parentName:"p",href:"../typedefs/create-session",target:null,rel:null},(0,r.kt)("inlineCode",{parentName:"a"},"CreateSession"))),(0,r.kt)("p",null,"Custom function that should return ",(0,r.kt)("inlineCode",{parentName:"p"},"Session")," instance. Any error thrown from this function will terminate the process. Function receives ",(0,r.kt)("inlineCode",{parentName:"p"},"SessionPool"),"\ninstance as a parameter"),(0,r.kt)("hr",null))}f.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var o=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){if(null==e)return{};var n,o,s=function(e,t){if(null==e)return{};var n,o,s={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var p=o.createContext({}),l=function(e){var t=o.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=l(e.components);return o.createElement(p.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,p=e.parentName,d=a(e,["components","mdxType","originalType","parentName"]),c=l(n),m=s,f=c["".concat(p,".").concat(m)]||c[m]||u[m]||r;return n?o.createElement(f,i(i({ref:t},d),{},{components:n})):o.createElement(f,i({ref:t},d))}));function f(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,i=new Array(r);i[0]=m;var a={};for(var p in t)hasOwnProperty.call(t,p)&&(a[p]=t[p]);a.originalType=e,a[c]="string"==typeof e?e:s,i[1]=a;for(var l=2;l<r;l++)i[l]=n[l];return o.createElement.apply(null,i)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fed1d36d.66d449e5.js b/assets/js/fed1d36d.66d449e5.js new file mode 100644 index 0000000000..d9941613af --- /dev/null +++ b/assets/js/fed1d36d.66d449e5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2164],{25480:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>y,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"apify-platform",title:"Apify Platform"},p=void 0,s={unversionedId:"guides/apify-platform",id:"version-2.3/guides/apify-platform",title:"Apify Platform",description:"Apify is a platform built to serve large-scale and high-performance web scraping",source:"@site/versioned_docs/version-2.3/guides/apify_platform.md",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/2.3/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/apify_platform.md",tags:[],version:"2.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform"},sidebar:"version-2.3/docs",previous:{title:"Quick Start",permalink:"/sdk/js/docs/2.3/guides/quick-start"},next:{title:"Getting Started",permalink:"/sdk/js/docs/2.3/guides/getting-started"}},c={},u=[{value:"Logging into Apify platform from Apify SDK",id:"logging-into-apify-platform-from-apify-sdk",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2}],f={toc:u},m="wrapper";function y(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"../guides/proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and you should definitely sign up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Apify SDK is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Note that we do not test Apify SDK in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-apify-sdk"},"Logging into Apify platform from Apify SDK"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from the SDK, you must provide\ncredentials - ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"your API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures of the SDK, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"npm install -g apify-cli\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify login -t YOUR_API_TOKEN\n")),(0,o.kt)("p",null,"In your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify run -p\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"If you prefer not to use Apify CLI, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. It is automatically inferred from your token by the SDK, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))))}y.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,y=u["".concat(p,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(y,i(i({ref:t},c),{},{components:r})):n.createElement(y,i({ref:t},c))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/fed1d36d.6c5c420e.js b/assets/js/fed1d36d.6c5c420e.js deleted file mode 100644 index 0b5b07f8f1..0000000000 --- a/assets/js/fed1d36d.6c5c420e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2164],{25480:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>p,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=r(63366),o=(r(67294),r(3905)),i=["components"],l={id:"apify-platform",title:"Apify Platform"},p=void 0,s={unversionedId:"guides/apify-platform",id:"version-2.3/guides/apify-platform",title:"Apify Platform",description:"Apify is a platform built to serve large-scale and high-performance web scraping",source:"@site/versioned_docs/version-2.3/guides/apify_platform.md",sourceDirName:"guides",slug:"/guides/apify-platform",permalink:"/sdk/js/docs/2.3/guides/apify-platform",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/apify_platform.md",tags:[],version:"2.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id:"apify-platform",title:"Apify Platform"},sidebar:"version-2.3/docs",previous:{title:"Quick Start",permalink:"/sdk/js/docs/2.3/guides/quick-start"},next:{title:"Getting Started",permalink:"/sdk/js/docs/2.3/guides/getting-started"}},c={},u=[{value:"Logging into Apify platform from Apify SDK",id:"logging-into-apify-platform-from-apify-sdk",level:2},{value:"Log in with CLI",id:"log-in-with-cli",level:3},{value:"Log in with environment variables",id:"log-in-with-environment-variables",level:3},{value:"What is an actor",id:"what-is-an-actor",level:2}],f={toc:u},m="wrapper";function d(e){var t=e.components,r=(0,a.Z)(e,i);return(0,o.kt)(m,(0,n.Z)({},f,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Apify is a ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com",target:"_blank",rel:"noopener"},"platform")," built to serve large-scale and high-performance web scraping\nand automation needs. It provides easy access to ",(0,o.kt)("a",{parentName:"p",href:"#what-is-an-actor",target:null,rel:null},"compute instances (Actors)"),",\nconvenient ",(0,o.kt)("a",{parentName:"p",href:"../guides/request-storage",target:null,rel:null},"request")," and ",(0,o.kt)("a",{parentName:"p",href:"../guides/result-storage",target:null,rel:null},"result")," storages, ",(0,o.kt)("a",{parentName:"p",href:"../guides/proxy-management",target:null,rel:null},"proxies"),",\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/scheduler",target:"_blank",rel:"noopener"},"scheduling"),", ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/webhooks",target:"_blank",rel:"noopener"},"webhooks"),"\nand ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/",target:"_blank",rel:"noopener"},"more"),", accessible through a ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com",target:"_blank",rel:"noopener"},"web interface"),"\nor an ",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/api",target:"_blank",rel:"noopener"},"API"),"."),(0,o.kt)("p",null,"While we think that the Apify platform is super cool, and you should definitely sign up for a\n",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"free account"),", ",(0,o.kt)("strong",{parentName:"p"},"Apify SDK is and will always be open source"),",\nrunnable locally or on any cloud infrastructure."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"Note that we do not test Apify SDK in other cloud environments such as Lambda or on specific\narchitectures such as Raspberry PI. We strive to make it work, but there are no guarantees.")),(0,o.kt)("h2",{id:"logging-into-apify-platform-from-apify-sdk"},"Logging into Apify platform from Apify SDK"),(0,o.kt)("p",null,"To access your ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/sign-up",target:"_blank",rel:"noopener"},"Apify account")," from the SDK, you must provide\ncredentials - ",(0,o.kt)("a",{parentName:"p",href:"https://console.apify.com/account#/integrations",target:"_blank",rel:"noopener"},"your API token"),". You can do that\neither by utilizing ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/apify/apify-cli",target:"_blank",rel:"noopener"},"Apify CLI")," or with environment\nvariables."),(0,o.kt)("p",null,"Once you provide credentials to your scraper, you will be able to use all the Apify platform\nfeatures of the SDK, such as calling actors, saving to cloud storages, using Apify proxies,\nsetting up webhooks and so on."),(0,o.kt)("h3",{id:"log-in-with-cli"},"Log in with CLI"),(0,o.kt)("p",null,"Apify CLI allows you to log in to your Apify account on your computer. If you then run your\nscraper using the CLI, your credentials will automatically be added."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"npm install -g apify-cli\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify login -t YOUR_API_TOKEN\n")),(0,o.kt)("p",null,"In your project folder:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"apify run -p\n")),(0,o.kt)("h3",{id:"log-in-with-environment-variables"},"Log in with environment variables"),(0,o.kt)("p",null,"If you prefer not to use Apify CLI, you can always provide credentials to your scraper\nby setting the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_token",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_TOKEN"))," environment\nvariable to your API token."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"There's also the ",(0,o.kt)("a",{parentName:"p",href:"../guides/environment-variables#apify_proxy_password",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"APIFY_PROXY_PASSWORD")),"\nenvironment variable. It is automatically inferred from your token by the SDK, but it can be useful\nwhen you need to access proxies from a different account than your token represents.")),(0,o.kt)("h2",{id:"what-is-an-actor"},"What is an actor"),(0,o.kt)("p",null,"When you deploy your script to the Apify platform, it becomes an ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/actors",target:"_blank",rel:"noopener"},"actor"),".\nAn actor is a serverless microservice that accepts an input and produces an output. It can run for\na few seconds, hours or even infinitely. An actor can perform anything from a simple action such\nas filling out a web form or sending an email, to complex operations such as crawling an entire website\nand removing duplicates from a large dataset."),(0,o.kt)("p",null,"Actors can be shared in the ",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Apify Store")," so that other people can use them.\nBut don't worry, if you share your actor in the store and somebody uses it, it runs under their account,\nnot yours."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Related links")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/store",target:"_blank",rel:"noopener"},"Store of existing actors")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://docs.apify.com/actor",target:"_blank",rel:"noopener"},"Documentation")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://console.apify.com/actors",target:"_blank",rel:"noopener"},"View actors in Apify Console")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://apify.com/docs/api/v2#/reference/actors",target:"_blank",rel:"noopener"},"API reference"))))}d.isMDXComponent=!0},3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,d=u["".concat(p,".").concat(m)]||u[m]||f[m]||o;return r?n.createElement(d,i(i({ref:t},c),{},{components:r})):n.createElement(d,i({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l[u]="string"==typeof e?e:a,i[1]=l;for(var s=2;s<o;s++)i[s]=r[s];return n.createElement.apply(null,i)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ff13d56b.d73b9afb.js b/assets/js/ff13d56b.d73b9afb.js new file mode 100644 index 0000000000..cba5cc44ef --- /dev/null +++ b/assets/js/ff13d56b.d73b9afb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7366],{4916:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var r=n(87462),p=n(63366),a=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-launch-puppeteer-options",title:"LaunchPuppeteerOptions",id:"launch-puppeteer-options"},l=void 0,s={unversionedId:"typedefs/launch-puppeteer-options",id:"version-1.3/typedefs/launch-puppeteer-options",title:"LaunchPuppeteerOptions",description:"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible",source:"@site/versioned_docs/version-1.3/typedefs/LaunchPuppeteerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/launch-puppeteer-options",permalink:"/sdk/js/docs/1.3/typedefs/launch-puppeteer-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-launch-puppeteer-options",title:"LaunchPuppeteerOptions",id:"launch-puppeteer-options"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"<code>proxyUrl</code>",id:"proxyurl",level:3},{value:"<code>userAgent</code>",id:"useragent",level:3},{value:"<code>useChrome</code>",id:"usechrome",level:3},{value:"<code>puppeteerModule</code>",id:"puppeteermodule",level:3},{value:"<code>stealth</code>",id:"stealth",level:3},{value:"<code>stealthOptions</code>",id:"stealthoptions",level:3}],c={toc:d},h="wrapper";function m(e){var t=e.components,n=(0,p.Z)(e,o);return(0,a.kt)(h,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"launchpuppeteeroptions"}),(0,a.kt)("p",null,"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options in the\n",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," function and in addition, all the options available below."),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useragent"},(0,a.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,a.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Puppeteer will launch full Google Chrome browser available on the machine rather than the bundled Chromium.\nThe path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical Google\nChrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"puppeteermodule"},(0,a.kt)("inlineCode",{parentName:"h3"},"puppeteerModule")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"Either a require path (",(0,a.kt)("inlineCode",{parentName:"p"},"string"),") to a package to be used instead of default ",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer"),", or an already required module (",(0,a.kt)("inlineCode",{parentName:"p"},"Object"),"). This enables usage\nof various Puppeteer wrappers such as ",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer-extra"),"."),(0,a.kt)("p",null,"Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides\n",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer")," itself."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stealth"},(0,a.kt)("inlineCode",{parentName:"h3"},"stealth")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"This setting hides most of the known properties that identify headless Chrome and makes it nearly undetectable. It is recommended to use it together\nwith the ",(0,a.kt)("inlineCode",{parentName:"p"},"useChrome")," set to ",(0,a.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stealthoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"stealthOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/stealth-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"StealthOptions"))),(0,a.kt)("p",null,"Using this configuration, you can disable some of the hiding tricks. For these settings to take effect ",(0,a.kt)("inlineCode",{parentName:"p"},"stealth")," must be set to true"),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,p=function(e,t){if(null==e)return{};var n,r,p={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(p[n]=e[n]);return p}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(p[n]=e[n])}return p}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,p=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(n),h=p,m=d["".concat(l,".").concat(h)]||d[h]||c[h]||a;return n?r.createElement(m,o(o({ref:t},u),{},{components:n})):r.createElement(m,o({ref:t},u))}));function m(e,t){var n=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var a=n.length,o=new Array(a);o[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:p,o[1]=i;for(var s=2;s<a;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ff13d56b.e8e8e4bf.js b/assets/js/ff13d56b.e8e8e4bf.js deleted file mode 100644 index 0394140f6f..0000000000 --- a/assets/js/ff13d56b.e8e8e4bf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7366],{4916:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>d});var r=n(87462),p=n(63366),a=(n(67294),n(3905)),o=["components"],i={id_old:"version-1.3-launch-puppeteer-options",title:"LaunchPuppeteerOptions",id:"launch-puppeteer-options"},l=void 0,s={unversionedId:"typedefs/launch-puppeteer-options",id:"version-1.3/typedefs/launch-puppeteer-options",title:"LaunchPuppeteerOptions",description:"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible",source:"@site/versioned_docs/version-1.3/typedefs/LaunchPuppeteerOptions.md",sourceDirName:"typedefs",slug:"/typedefs/launch-puppeteer-options",permalink:"/sdk/js/docs/1.3/typedefs/launch-puppeteer-options",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerOptions.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-launch-puppeteer-options",title:"LaunchPuppeteerOptions",id:"launch-puppeteer-options"}},u={},d=[{value:"Properties",id:"properties",level:2},{value:"<code>proxyUrl</code>",id:"proxyurl",level:3},{value:"<code>userAgent</code>",id:"useragent",level:3},{value:"<code>useChrome</code>",id:"usechrome",level:3},{value:"<code>puppeteerModule</code>",id:"puppeteermodule",level:3},{value:"<code>stealth</code>",id:"stealth",level:3},{value:"<code>stealthOptions</code>",id:"stealthoptions",level:3}],c={toc:d},h="wrapper";function m(e){var t=e.components,n=(0,p.Z)(e,o);return(0,a.kt)(h,(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("a",{name:"launchpuppeteeroptions"}),(0,a.kt)("p",null,"Apify extends the launch options of Puppeteer. You can use any of the Puppeteer compatible\n",(0,a.kt)("a",{parentName:"p",href:"https://pptr.dev/#?product=Puppeteer&show=api-puppeteerlaunchoptions",target:"_blank",rel:"noopener"},(0,a.kt)("inlineCode",{parentName:"a"},"LaunchOptions"))," options in the\n",(0,a.kt)("a",{parentName:"p",href:"../api/apify#launchpuppeteer",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.launchPuppeteer()"))," function and in addition, all the options available below."),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"proxyurl"},(0,a.kt)("inlineCode",{parentName:"h3"},"proxyUrl")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password."),(0,a.kt)("p",null,"Example: ",(0,a.kt)("inlineCode",{parentName:"p"},"http://bob:pass123@proxy.example.com:1234"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"useragent"},(0,a.kt)("inlineCode",{parentName:"h3"},"userAgent")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"User-Agent")," HTTP header used by the browser. If not provided, the function sets ",(0,a.kt)("inlineCode",{parentName:"p"},"User-Agent")," to a reasonable default to reduce the chance of\ndetection of the crawler."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"usechrome"},(0,a.kt)("inlineCode",{parentName:"h3"},"useChrome")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ",(0,a.kt)("code",null," = false")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"executablePath")," is not set, Puppeteer will launch full Google Chrome browser available on the machine rather than the bundled Chromium.\nThe path to Chrome executable is taken from the ",(0,a.kt)("inlineCode",{parentName:"p"},"APIFY_CHROME_EXECUTABLE_PATH")," environment variable if provided, or defaults to the typical Google\nChrome executable location specific for the operating system. By default, this option is ",(0,a.kt)("inlineCode",{parentName:"p"},"false"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"puppeteermodule"},(0,a.kt)("inlineCode",{parentName:"h3"},"puppeteerModule")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," | ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("p",null,"Either a require path (",(0,a.kt)("inlineCode",{parentName:"p"},"string"),") to a package to be used instead of default ",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer"),", or an already required module (",(0,a.kt)("inlineCode",{parentName:"p"},"Object"),"). This enables usage\nof various Puppeteer wrappers such as ",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer-extra"),"."),(0,a.kt)("p",null,"Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides\n",(0,a.kt)("inlineCode",{parentName:"p"},"puppeteer")," itself."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stealth"},(0,a.kt)("inlineCode",{parentName:"h3"},"stealth")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"This setting hides most of the known properties that identify headless Chrome and makes it nearly undetectable. It is recommended to use it together\nwith the ",(0,a.kt)("inlineCode",{parentName:"p"},"useChrome")," set to ",(0,a.kt)("inlineCode",{parentName:"p"},"true"),"."),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stealthoptions"},(0,a.kt)("inlineCode",{parentName:"h3"},"stealthOptions")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Type"),": ",(0,a.kt)("a",{parentName:"p",href:"../typedefs/stealth-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"StealthOptions"))),(0,a.kt)("p",null,"Using this configuration, you can disable some of the hiding tricks. For these settings to take effect ",(0,a.kt)("inlineCode",{parentName:"p"},"stealth")," must be set to true"),(0,a.kt)("hr",null))}m.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,p=function(e,t){if(null==e)return{};var n,r,p={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(p[n]=e[n]);return p}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(p[n]=e[n])}return p}var l=r.createContext({}),s=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(l.Provider,{value:t},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},h=r.forwardRef((function(e,t){var n=e.components,p=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=s(n),h=p,m=d["".concat(l,".").concat(h)]||d[h]||c[h]||a;return n?r.createElement(m,o(o({ref:t},u),{},{components:n})):r.createElement(m,o({ref:t},u))}));function m(e,t){var n=arguments,p=t&&t.mdxType;if("string"==typeof e||p){var a=n.length,o=new Array(a);o[0]=h;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[d]="string"==typeof e?e:p,o[1]=i;for(var s=2;s<a;s++)o[s]=n[s];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}h.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ff2dc39f.16cfcab9.js b/assets/js/ff2dc39f.16cfcab9.js deleted file mode 100644 index 30aa769fe5..0000000000 --- a/assets/js/ff2dc39f.16cfcab9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[553],{1483:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),a=n(63366),o=(n(67294),n(3905)),s=["components"],i={id_old:"version-1.3-screenshots",title:"Screenshots",id:"screenshots"},l=void 0,c={unversionedId:"examples/screenshots",id:"version-1.3/examples/screenshots",title:"Screenshots",description:"This example demonstrates how to read and write data to the default key-value store using Apify.getValue() and",source:"@site/versioned_docs/version-1.3/examples/screenshots.md",sourceDirName:"examples",slug:"/examples/screenshots",permalink:"/sdk/js/docs/1.3/examples/screenshots",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/screenshots.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-screenshots",title:"Screenshots",id:"screenshots"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/1.3/examples/puppeteer-with-proxy"},next:{title:"Synchronous run",permalink:"/sdk/js/docs/1.3/examples/synchronous-run"}},p={},u=[],d={toc:u},f="wrapper";function h(e){var t=e.components,n=(0,a.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"This example demonstrates how to read and write data to the default key-value store using ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#apifygetvaluekey",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,o.kt)("a",{parentName:"p",href:"/docs/api/apify#apifysetvaluekey-value-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"Apify.setValue()")),"."),(0,o.kt)("p",null,"The script crawls a list of URLs using Puppeteer, captures a screenshot of each page, and saves it to the store. The list of URLs is provided as actor\ninput that is also read from the store."),(0,o.kt)("p",null,"In local configuration, the input is stored in the default key-value store's directory as a JSON file at\n",(0,o.kt)("inlineCode",{parentName:"p"},"./apify_storage/key_value_stores/default/INPUT.json"),". You need to create the file and set it with the following content:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{ "sources": [{ "url": "https://www.google.com" }, { "url": "https://www.duckduckgo.com" }] }\n')),(0,o.kt)("p",null,"On the Apify cloud, the input can be either set manually in the UI app or passed as the POST payload to the\n",(0,o.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Run actor API call"),". For more details, see\n",(0,o.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#input-and-output",target:"_blank",rel:"noopener"},"Input and output")," in the Apify Actor documentation."),(0,o.kt)("blockquote",null,(0,o.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,o.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)")," base image on the source tab of your\nactor configuration.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Read the actor input configuration containing the URLs for the screenshot.\n // By convention, the input is present in the actor's default key-value store under the \"INPUT\" key.\n const input = await Apify.getInput();\n if (!input) throw new Error('Have you passed the correct INPUT ?');\n\n const { sources } = input;\n\n const requestList = new Apify.RequestList({ sources });\n await requestList.initialize();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n console.log(`Processing ${request.url}...`);\n\n // This is a Puppeteer function that takes a screenshot of the page and returns its buffer.\n const screenshotBuffer = await page.screenshot();\n\n // The record key may only include the following characters: a-zA-Z0-9!-_.'()\n const key = request.url.replace(/[:/]/g, '_');\n\n // Save the screenshot. Choosing the right content type will automatically\n // assign the local file the right extension, in this case .png.\n // The screenshots will be stored in ./apify_storage/key_value_stores/default/\n await Apify.setValue(key, screenshotBuffer, { contentType: 'image/png' });\n console.log(`Screenshot of ${request.url} saved.`);\n },\n });\n\n // Run crawler.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=a,h=u["".concat(l,".").concat(f)]||u[f]||d[f]||o;return n?r.createElement(h,s(s({ref:t},p),{},{components:n})):r.createElement(h,s({ref:t},p))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:a,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ff2dc39f.9b2e5660.js b/assets/js/ff2dc39f.9b2e5660.js new file mode 100644 index 0000000000..3e6541b0bd --- /dev/null +++ b/assets/js/ff2dc39f.9b2e5660.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[553],{1483:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>h,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var r=n(87462),o=n(63366),a=(n(67294),n(3905)),s=["components"],i={id_old:"version-1.3-screenshots",title:"Screenshots",id:"screenshots"},l=void 0,c={unversionedId:"examples/screenshots",id:"version-1.3/examples/screenshots",title:"Screenshots",description:"This example demonstrates how to read and write data to the default key-value store using Apify.getValue() and",source:"@site/versioned_docs/version-1.3/examples/screenshots.md",sourceDirName:"examples",slug:"/examples/screenshots",permalink:"/sdk/js/docs/1.3/examples/screenshots",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/screenshots.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-screenshots",title:"Screenshots",id:"screenshots"},sidebar:"version-1.3/docs",previous:{title:"Puppeteer with proxy",permalink:"/sdk/js/docs/1.3/examples/puppeteer-with-proxy"},next:{title:"Synchronous run",permalink:"/sdk/js/docs/1.3/examples/synchronous-run"}},p={},u=[],d={toc:u},f="wrapper";function h(e){var t=e.components,n=(0,o.Z)(e,s);return(0,a.kt)(f,(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This example demonstrates how to read and write data to the default key-value store using ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/apify#apifygetvaluekey",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.getValue()"))," and\n",(0,a.kt)("a",{parentName:"p",href:"/docs/api/apify#apifysetvaluekey-value-options",target:null,rel:null},(0,a.kt)("inlineCode",{parentName:"a"},"Apify.setValue()")),"."),(0,a.kt)("p",null,"The script crawls a list of URLs using Puppeteer, captures a screenshot of each page, and saves it to the store. The list of URLs is provided as actor\ninput that is also read from the store."),(0,a.kt)("p",null,"In local configuration, the input is stored in the default key-value store's directory as a JSON file at\n",(0,a.kt)("inlineCode",{parentName:"p"},"./apify_storage/key_value_stores/default/INPUT.json"),". You need to create the file and set it with the following content:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-json"},'{ "sources": [{ "url": "https://www.google.com" }, { "url": "https://www.duckduckgo.com" }] }\n')),(0,a.kt)("p",null,"On the Apify cloud, the input can be either set manually in the UI app or passed as the POST payload to the\n",(0,a.kt)("a",{parentName:"p",href:"https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor",target:"_blank",rel:"noopener"},"Run actor API call"),". For more details, see\n",(0,a.kt)("a",{parentName:"p",href:"https://docs.apify.com/actor/run#input-and-output",target:"_blank",rel:"noopener"},"Input and output")," in the Apify Actor documentation."),(0,a.kt)("blockquote",null,(0,a.kt)("p",{parentName:"blockquote"},"To run this example on the Apify Platform, select the ",(0,a.kt)("inlineCode",{parentName:"p"},"Node.js 12 + Chrome on Debian (apify/actor-node-chrome)")," base image on the source tab of your\nactor configuration.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-javascript"},"const Apify = require('apify');\n\nApify.main(async () => {\n // Read the actor input configuration containing the URLs for the screenshot.\n // By convention, the input is present in the actor's default key-value store under the \"INPUT\" key.\n const input = await Apify.getInput();\n if (!input) throw new Error('Have you passed the correct INPUT ?');\n\n const { sources } = input;\n\n const requestList = new Apify.RequestList({ sources });\n await requestList.initialize();\n\n const crawler = new Apify.PuppeteerCrawler({\n requestList,\n handlePageFunction: async ({ page, request }) => {\n console.log(`Processing ${request.url}...`);\n\n // This is a Puppeteer function that takes a screenshot of the page and returns its buffer.\n const screenshotBuffer = await page.screenshot();\n\n // The record key may only include the following characters: a-zA-Z0-9!-_.'()\n const key = request.url.replace(/[:/]/g, '_');\n\n // Save the screenshot. Choosing the right content type will automatically\n // assign the local file the right extension, in this case .png.\n // The screenshots will be stored in ./apify_storage/key_value_stores/default/\n await Apify.setValue(key, screenshotBuffer, { contentType: 'image/png' });\n console.log(`Screenshot of ${request.url} saved.`);\n },\n });\n\n // Run crawler.\n await crawler.run();\n\n console.log('Crawler finished.');\n});\n")))}h.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=o,h=u["".concat(l,".").concat(f)]||u[f]||d[f]||a;return n?r.createElement(h,s(s({ref:t},p),{},{components:n})):r.createElement(h,s({ref:t},p))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=f;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c<a;c++)s[c]=n[c];return r.createElement.apply(null,s)}return r.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ff3c6a0b.015b5268.js b/assets/js/ff3c6a0b.015b5268.js new file mode 100644 index 0000000000..c3c5b0caa7 --- /dev/null +++ b/assets/js/ff3c6a0b.015b5268.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[49],{41324:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>g,contentTitle:()=>s,default:()=>k,frontMatter:()=>r,metadata:()=>p,toc:()=>d});var a=n(87462),l=n(63366),o=(n(67294),n(3905)),i=["components"],r={id_old:"version-1.3-log",title:"utils.log",id:"log"},s=void 0,p={unversionedId:"api/log",id:"version-1.3/api/log",title:"utils.log",description:"The log instance enables level aware logging of messages and we advise to use it instead of console.log() and its aliases in most development",source:"@site/versioned_docs/version-1.3/api/log.md",sourceDirName:"api",slug:"/api/log",permalink:"/sdk/js/docs/1.3/api/log",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/log.md",tags:[],version:"1.3",lastUpdatedBy:"renovate[bot]",lastUpdatedAt:1698817465,formattedLastUpdatedAt:"Nov 1, 2023",frontMatter:{id_old:"version-1.3-log",title:"utils.log",id:"log"},sidebar:"version-1.3/docs",previous:{title:"utils",permalink:"/sdk/js/docs/1.3/api/utils"},next:{title:"utils.playwright",permalink:"/sdk/js/docs/1.3/api/playwright"}},g={},d=[{value:"<code>log.LEVELS</code>",id:"loglevels",level:2},{value:"<code>log.setLevel(level)</code>",id:"logsetlevellevel",level:2},{value:"<code>log.getLevel()</code>",id:"loggetlevel",level:2},{value:"<code>log.setOptions(options)</code>",id:"logsetoptionsoptions",level:2},{value:"<code>log.child([options])</code>",id:"logchildoptions",level:2},{value:"<code>log.getOptions()</code>",id:"loggetoptions",level:2},{value:"<code>log.debug(message, [data])</code>",id:"logdebugmessage-data",level:2},{value:"<code>log.info(message, [data])</code>",id:"loginfomessage-data",level:2},{value:"<code>log.warning(message, [data])</code>",id:"logwarningmessage-data",level:2},{value:"<code>log.error(message, [data])</code>",id:"logerrormessage-data",level:2},{value:"<code>log.exception(exception, [message], [data])</code>",id:"logexceptionexception-message-data",level:2}],m={toc:d},u="wrapper";function k(e){var t=e.components,n=(0,l.Z)(e,i);return(0,o.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"log"}),(0,o.kt)("p",null,"The log instance enables level aware logging of messages and we advise to use it instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"console.log()")," and its aliases in most development\nscenarios."),(0,o.kt)("p",null,"A very useful use case for ",(0,o.kt)("inlineCode",{parentName:"p"},"log")," is using ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug")," liberally throughout the codebase to get useful logging messages only when appropriate log level\nis set and keeping the console tidy in production environments."),(0,o.kt)("p",null,"The available logging levels are, in this order: ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"OFF")," and can be referenced from the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constant, such\nas ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.ERROR"),"."),(0,o.kt)("p",null,"To log messages to the system console, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.level(message)")," invocation, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug('this is a debug message')"),"."),(0,o.kt)("p",null,"To prevent writing of messages above a certain log level to the console, simply set the appropriate level. The default log level is ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", which\nmeans that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages will not be printed, unless enabled."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst { log } = Apify.utils;\n\nlog.info('Information message', { someData: 123 }); // prints message\nlog.debug('Debug message', { debugData: 'hello' }); // doesn't print anything\n\nlog.setLevel(log.LEVELS.DEBUG);\nlog.debug('Debug message'); // prints message\n\nlog.setLevel(log.LEVELS.ERROR);\nlog.debug('Debug message'); // doesn't print anything\nlog.info('Info message'); // doesn't print anything\n\nlog.error('Error message', { errorDetails: 'This is bad!' }); // prints message\ntry {\n throw new Error('Not good!');\n} catch (e) {\n log.exception(e, 'Exception occurred', { errorDetails: 'This is really bad!' }); // prints message\n}\n\nlog.setOptions({ prefix: 'My actor' });\nlog.info('I am running!'); // prints \"My actor: I am running\"\n\nconst childLog = log.child({ prefix: 'Crawler' });\nlog.info('I am crawling!'); // prints \"My actor:Crawler: I am crawling\"\n")),(0,o.kt)("p",null,"Another very useful way of setting the log level is by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," environment variable, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". This way,\nno code changes are necessary to turn on your debug messages and start debugging right away."),(0,o.kt)("p",null,"To add timestamps to your logs, you can override the default logger settings:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"log.setOptions({\n logger: new log.LoggerText({ skipTime: false }),\n});\n")),(0,o.kt)("p",null,"You can customize your logging further by extending or replacing the default logger instances with your own implementations."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"levels"}),(0,o.kt)("h2",{id:"loglevels"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.LEVELS")),(0,o.kt)("p",null,"Map of available log levels that's useful for easy setting of appropriate log levels. Each log level is represented internally by a number. Eg.\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.DEBUG === 5"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setlevel"}),(0,o.kt)("h2",{id:"logsetlevellevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setLevel(level)")),(0,o.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants such as"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"log.setLevel(log.LEVELS.DEBUG);\n")),(0,o.kt)("p",null,"Default log level is INFO."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"level")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getlevel"}),(0,o.kt)("h2",{id:"loggetlevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getLevel()")),(0,o.kt)("p",null,"Returns the currently selected logging level. This is useful for checking whether a message will actually be printed to the console before one\nactually performs a resource intensive operation to construct the message, such as querying a DB for some metadata that need to be added. If the log\nlevel is not high enough at the moment, it doesn't make sense to execute the query."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setoptions"}),(0,o.kt)("h2",{id:"logsetoptionsoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setOptions(options)")),(0,o.kt)("p",null,"Configures logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions")))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"child"}),(0,o.kt)("h2",{id:"logchildoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.child([options])")),(0,o.kt)("p",null,"Creates a new instance of logger that inherits settings from a parent logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))," - Supports the same options as the ",(0,o.kt)("inlineCode",{parentName:"li"},"setOptions()")," method.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getoptions"}),(0,o.kt)("h2",{id:"loggetoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getOptions()")),(0,o.kt)("p",null,"Returns the logger configuration."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"debug"}),(0,o.kt)("h2",{id:"logdebugmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.debug(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," message. By default, it will not be written to the console. To see ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages in the console, set the log level to ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," either\nusing the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.setLevel(log.LEVELS.DEBUG)")," method or using the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". Data are stringified and appended to the\nmessage."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"info"}),(0,o.kt)("h2",{id:"loginfomessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.info(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," message. ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," is the default log level so info messages will be always logged, unless the log level is changed. Data are stringified\nand appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"warning"}),(0,o.kt)("h2",{id:"logwarningmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.warning(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," level message. Data are stringified and appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"error"}),(0,o.kt)("h2",{id:"logerrormessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.error(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," message. Use this method to log error messages that are not directly connected to an exception. For logging exceptions, use the\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.exception")," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"exception"}),(0,o.kt)("h2",{id:"logexceptionexception-message-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.exception(exception, [message], [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," level message with a nicely formatted exception. Note that the exception is the first parameter here and an additional message is only\noptional."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"exception")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Error")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>g,kt:()=>k});var a=n(67294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(e,t){if(null==e)return{};var n,a,l=function(e,t){if(null==e)return{};var n,a,l={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},g=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,g=r(e,["components","mdxType","originalType","parentName"]),d=p(n),u=l,k=d["".concat(s,".").concat(u)]||d[u]||m[u]||o;return n?a.createElement(k,i(i({ref:t},g),{},{components:n})):a.createElement(k,i({ref:t},g))}));function k(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=n.length,i=new Array(o);i[0]=u;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[d]="string"==typeof e?e:l,i[1]=r;for(var p=2;p<o;p++)i[p]=n[p];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/ff3c6a0b.8aa85a11.js b/assets/js/ff3c6a0b.8aa85a11.js deleted file mode 100644 index bb5edc1262..0000000000 --- a/assets/js/ff3c6a0b.8aa85a11.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[49],{41324:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>k,frontMatter:()=>r,metadata:()=>g,toc:()=>d});var a=n(87462),l=n(63366),o=(n(67294),n(3905)),i=["components"],r={id_old:"version-1.3-log",title:"utils.log",id:"log"},s=void 0,g={unversionedId:"api/log",id:"version-1.3/api/log",title:"utils.log",description:"The log instance enables level aware logging of messages and we advise to use it instead of console.log() and its aliases in most development",source:"@site/versioned_docs/version-1.3/api/log.md",sourceDirName:"api",slug:"/api/log",permalink:"/sdk/js/docs/1.3/api/log",draft:!1,editUrl:"https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/log.md",tags:[],version:"1.3",lastUpdatedBy:"Vlad Frangu",lastUpdatedAt:1698752548,formattedLastUpdatedAt:"Oct 31, 2023",frontMatter:{id_old:"version-1.3-log",title:"utils.log",id:"log"},sidebar:"version-1.3/docs",previous:{title:"utils",permalink:"/sdk/js/docs/1.3/api/utils"},next:{title:"utils.playwright",permalink:"/sdk/js/docs/1.3/api/playwright"}},p={},d=[{value:"<code>log.LEVELS</code>",id:"loglevels",level:2},{value:"<code>log.setLevel(level)</code>",id:"logsetlevellevel",level:2},{value:"<code>log.getLevel()</code>",id:"loggetlevel",level:2},{value:"<code>log.setOptions(options)</code>",id:"logsetoptionsoptions",level:2},{value:"<code>log.child([options])</code>",id:"logchildoptions",level:2},{value:"<code>log.getOptions()</code>",id:"loggetoptions",level:2},{value:"<code>log.debug(message, [data])</code>",id:"logdebugmessage-data",level:2},{value:"<code>log.info(message, [data])</code>",id:"loginfomessage-data",level:2},{value:"<code>log.warning(message, [data])</code>",id:"logwarningmessage-data",level:2},{value:"<code>log.error(message, [data])</code>",id:"logerrormessage-data",level:2},{value:"<code>log.exception(exception, [message], [data])</code>",id:"logexceptionexception-message-data",level:2}],m={toc:d},u="wrapper";function k(e){var t=e.components,n=(0,l.Z)(e,i);return(0,o.kt)(u,(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("a",{name:"log"}),(0,o.kt)("p",null,"The log instance enables level aware logging of messages and we advise to use it instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"console.log()")," and its aliases in most development\nscenarios."),(0,o.kt)("p",null,"A very useful use case for ",(0,o.kt)("inlineCode",{parentName:"p"},"log")," is using ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug")," liberally throughout the codebase to get useful logging messages only when appropriate log level\nis set and keeping the console tidy in production environments."),(0,o.kt)("p",null,"The available logging levels are, in this order: ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"OFF")," and can be referenced from the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constant, such\nas ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.ERROR"),"."),(0,o.kt)("p",null,"To log messages to the system console, use the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.level(message)")," invocation, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"log.debug('this is a debug message')"),"."),(0,o.kt)("p",null,"To prevent writing of messages above a certain log level to the console, simply set the appropriate level. The default log level is ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO"),", which\nmeans that ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages will not be printed, unless enabled."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"const Apify = require('apify');\nconst { log } = Apify.utils;\n\nlog.info('Information message', { someData: 123 }); // prints message\nlog.debug('Debug message', { debugData: 'hello' }); // doesn't print anything\n\nlog.setLevel(log.LEVELS.DEBUG);\nlog.debug('Debug message'); // prints message\n\nlog.setLevel(log.LEVELS.ERROR);\nlog.debug('Debug message'); // doesn't print anything\nlog.info('Info message'); // doesn't print anything\n\nlog.error('Error message', { errorDetails: 'This is bad!' }); // prints message\ntry {\n throw new Error('Not good!');\n} catch (e) {\n log.exception(e, 'Exception occurred', { errorDetails: 'This is really bad!' }); // prints message\n}\n\nlog.setOptions({ prefix: 'My actor' });\nlog.info('I am running!'); // prints \"My actor: I am running\"\n\nconst childLog = log.child({ prefix: 'Crawler' });\nlog.info('I am crawling!'); // prints \"My actor:Crawler: I am crawling\"\n")),(0,o.kt)("p",null,"Another very useful way of setting the log level is by setting the ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL")," environment variable, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". This way,\nno code changes are necessary to turn on your debug messages and start debugging right away."),(0,o.kt)("p",null,"To add timestamps to your logs, you can override the default logger settings:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"log.setOptions({\n logger: new log.LoggerText({ skipTime: false }),\n});\n")),(0,o.kt)("p",null,"You can customize your logging further by extending or replacing the default logger instances with your own implementations."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"levels"}),(0,o.kt)("h2",{id:"loglevels"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.LEVELS")),(0,o.kt)("p",null,"Map of available log levels that's useful for easy setting of appropriate log levels. Each log level is represented internally by a number. Eg.\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS.DEBUG === 5"),"."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setlevel"}),(0,o.kt)("h2",{id:"logsetlevellevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setLevel(level)")),(0,o.kt)("p",null,"Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with\nthe ",(0,o.kt)("inlineCode",{parentName:"p"},"log.LEVELS")," constants such as"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"log.setLevel(log.LEVELS.DEBUG);\n")),(0,o.kt)("p",null,"Default log level is INFO."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"level")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"number"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getlevel"}),(0,o.kt)("h2",{id:"loggetlevel"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getLevel()")),(0,o.kt)("p",null,"Returns the currently selected logging level. This is useful for checking whether a message will actually be printed to the console before one\nactually performs a resource intensive operation to construct the message, such as querying a DB for some metadata that need to be added. If the log\nlevel is not high enough at the moment, it doesn't make sense to execute the query."),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"setoptions"}),(0,o.kt)("h2",{id:"logsetoptionsoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.setOptions(options)")),(0,o.kt)("p",null,"Configures logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"options")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions")))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"child"}),(0,o.kt)("h2",{id:"logchildoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.child([options])")),(0,o.kt)("p",null,"Creates a new instance of logger that inherits settings from a parent logger."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[options]")),": ",(0,o.kt)("a",{parentName:"li",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))," - Supports the same options as the ",(0,o.kt)("inlineCode",{parentName:"li"},"setOptions()")," method.")),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"getoptions"}),(0,o.kt)("h2",{id:"loggetoptions"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.getOptions()")),(0,o.kt)("p",null,"Returns the logger configuration."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Returns"),":"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"../typedefs/logger-options",target:null,rel:null},(0,o.kt)("inlineCode",{parentName:"a"},"LoggerOptions"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"debug"}),(0,o.kt)("h2",{id:"logdebugmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.debug(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," message. By default, it will not be written to the console. To see ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," messages in the console, set the log level to ",(0,o.kt)("inlineCode",{parentName:"p"},"DEBUG")," either\nusing the ",(0,o.kt)("inlineCode",{parentName:"p"},"log.setLevel(log.LEVELS.DEBUG)")," method or using the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"APIFY_LOG_LEVEL=DEBUG"),". Data are stringified and appended to the\nmessage."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"info"}),(0,o.kt)("h2",{id:"loginfomessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.info(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," message. ",(0,o.kt)("inlineCode",{parentName:"p"},"INFO")," is the default log level so info messages will be always logged, unless the log level is changed. Data are stringified\nand appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"warning"}),(0,o.kt)("h2",{id:"logwarningmessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.warning(message, [data])")),(0,o.kt)("p",null,"Logs a ",(0,o.kt)("inlineCode",{parentName:"p"},"WARNING")," level message. Data are stringified and appended to the message."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"error"}),(0,o.kt)("h2",{id:"logerrormessage-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.error(message, [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," message. Use this method to log error messages that are not directly connected to an exception. For logging exceptions, use the\n",(0,o.kt)("inlineCode",{parentName:"p"},"log.exception")," method."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"message")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null),(0,o.kt)("a",{name:"exception"}),(0,o.kt)("h2",{id:"logexceptionexception-message-data"},(0,o.kt)("inlineCode",{parentName:"h2"},"log.exception(exception, [message], [data])")),(0,o.kt)("p",null,"Logs an ",(0,o.kt)("inlineCode",{parentName:"p"},"ERROR")," level message with a nicely formatted exception. Note that the exception is the first parameter here and an additional message is only\noptional."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Parameters"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"exception")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"Error")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[message]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"strong"},"[data]")),": ",(0,o.kt)("inlineCode",{parentName:"li"},"object"))),(0,o.kt)("hr",null))}k.isMDXComponent=!0},3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var a=n(67294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(e,t){if(null==e)return{};var n,a,l=function(e,t){if(null==e)return{};var n,a,l={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var s=a.createContext({}),g=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=g(e.components);return a.createElement(s.Provider,{value:t},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,l=e.mdxType,o=e.originalType,s=e.parentName,p=r(e,["components","mdxType","originalType","parentName"]),d=g(n),u=l,k=d["".concat(s,".").concat(u)]||d[u]||m[u]||o;return n?a.createElement(k,i(i({ref:t},p),{},{components:n})):a.createElement(k,i({ref:t},p))}));function k(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=n.length,i=new Array(o);i[0]=u;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[d]="string"==typeof e?e:l,i[1]=r;for(var g=2;g<o;g++)i[g]=n[g];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.f0c284b9.js b/assets/js/runtime~main.d3ee87be.js similarity index 63% rename from assets/js/runtime~main.f0c284b9.js rename to assets/js/runtime~main.d3ee87be.js index 9e706ccba9..c4085f3a3f 100644 --- a/assets/js/runtime~main.f0c284b9.js +++ b/assets/js/runtime~main.d3ee87be.js @@ -1 +1 @@ -(()=>{"use strict";var e,d,a,b,f={},c={};function r(e){var d=c[e];if(void 0!==d)return d.exports;var a=c[e]={exports:{}};return f[e].call(a.exports,a,a.exports,r),a.exports}r.m=f,e=[],r.O=(d,a,b,f)=>{if(!a){var c=1/0;for(i=0;i<e.length;i++){for(var[a,b,f]=e[i],t=!0,o=0;o<a.length;o++)(!1&f||c>=f)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,f<c&&(c=f));if(t){e.splice(i--,1);var n=b();void 0!==n&&(d=n)}}return d}f=f||0;for(var i=e.length;i>0&&e[i-1][2]>f;i--)e[i]=e[i-1];e[i]=[a,b,f]},r.n=e=>{var d=e&&e.__esModule?()=>e.default:()=>e;return r.d(d,{a:d}),d},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,b){if(1&b&&(e=this(e)),8&b)return e;if("object"==typeof e&&e){if(4&b&&e.__esModule)return e;if(16&b&&"function"==typeof e.then)return e}var f=Object.create(null);r.r(f);var c={};d=d||[null,a({}),a([]),a(a)];for(var t=2&b&&e;"object"==typeof t&&!~d.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((d=>c[d]=()=>e[d]));return c.default=()=>e,r.d(f,c),f},r.d=(e,d)=>{for(var a in d)r.o(d,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:d[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((d,a)=>(r.f[a](e,d),d)),[])),r.u=e=>"assets/js/"+({0:"51bc951c",49:"ff3c6a0b",53:"935f2afb",69:"83abd415",77:"c51695b1",99:"dba394d5",148:"68822c95",154:"a53ea2ce",178:"2c07a8b9",189:"b2aba146",192:"acd2b387",217:"62f22d87",218:"0ac89400",240:"7e30b660",245:"2ba66cb3",284:"f4575319",323:"fdb21dcb",328:"932291ce",332:"51ad3013",351:"5375cdb8",361:"fd1097f5",370:"331c3af7",387:"d1c4056c",398:"6e7fb50b",403:"1bed5c44",411:"6ef80218",419:"0e073905",428:"524cb2c7",501:"90b59a8e",516:"0d86db4e",553:"ff2dc39f",570:"872d056d",576:"401b5d44",637:"dda920fe",671:"78b3a14d",675:"84b325c6",707:"163894cc",794:"2bf182e2",846:"753e0990",856:"3f34f70a",882:"9d3805ff",895:"62a5678f",905:"605f4eaa",939:"860db0ad",942:"0e50c74a",990:"08eb3cc8",1e3:"7a7ff987",1003:"d1b5f25c",1027:"92689751",1032:"7b4bca30",1035:"4dfd2520",1085:"9083eab8",1093:"52729552",1099:"46f574b8",1106:"1b0e562b",1107:"befbd6a7",1120:"0a6a6221",1308:"f05eaad1",1320:"d6d3abb7",1324:"f90a522b",1369:"e15dee63",1370:"58fb69cb",1387:"6f0928dc",1437:"42282d60",1449:"4faa6d6b",1475:"86823464",1505:"d9fd8234",1516:"60f5fef7",1534:"159dcb57",1564:"44c9dba7",1588:"36f803ad",1616:"8f23db15",1634:"1c4b3c39",1642:"7f042c21",1657:"5dc8eb44",1658:"fbdbd19e",1690:"b991b973",1697:"b62055f3",1704:"115654df",1756:"dfff5bbd",1769:"6d4f442d",1777:"04f4467f",1902:"35804303",1903:"672b1f87",1905:"c29f440f",1925:"9dcee6ec",1928:"a5c97f70",1935:"5042abcc",1944:"267143e1",1951:"001c51b5",2002:"c551cafd",2006:"c7571bc1",2007:"a3368d96",2063:"a5bd23c9",2082:"872590c3",2099:"02c75427",2134:"77b6a063",2144:"ca24a393",2157:"e805786e",2164:"fed1d36d",2194:"72442644",2233:"570d2578",2258:"dfb1d591",2260:"4700376e",2276:"d5b0e882",2283:"638119b8",2299:"eab91185",2319:"45502991",2331:"a697b914",2373:"0b7eaab8",2378:"c0e54d24",2405:"3e9eea18",2409:"6d6065ba",2424:"55d5f305",2467:"4ddcce88",2503:"ed3555df",2535:"041abd93",2538:"56c5d261",2561:"82a8f848",2614:"162dcb22",2615:"fd951894",2631:"5374a44b",2711:"e23933fb",2736:"dbb49d41",2755:"3158e88a",2780:"1770ca36",2893:"f524c03d",2917:"7c3c1ac5",2929:"d54f8bf8",2965:"3c4479b4",2976:"f7aa35a1",2977:"8a738547",2978:"319b2b13",2982:"b766f0f5",2987:"cf720268",2995:"2a3ae0ae",2998:"f313d5f9",3042:"18b93cb3",3049:"f192608e",3090:"1df244d0",3146:"53bfe04a",3148:"99c970ed",3167:"2d046998",3211:"192384cd",3215:"63148a7b",3256:"100eb332",3280:"72801ac9",3297:"8aec8783",3310:"12e04edb",3320:"568b9dc5",3361:"41050165",3378:"75e2c646",3431:"3d936583",3461:"5b0acce6",3469:"b8352d9f",3491:"229ea6a0",3501:"2a6d2bba",3502:"f6c1d5d4",3503:"82fd6c76",3507:"f68ae16a",3532:"53d9c72e",3552:"886a51d0",3605:"216b8e3c",3608:"73da24cf",3628:"6de6630d",3639:"737fa906",3651:"a9ec048f",3707:"e332cb1d",3731:"68dd252e",3734:"aaacd0d9",3761:"92e6ea4e",3824:"9ad0147b",3855:"ad3736e4",3861:"377585f0",3871:"f6458d78",3891:"2f85d4d6",3906:"475b3bf7",3932:"2c20ba8f",3976:"c4cb772c",3977:"3812c5c3",3978:"b668c116",3993:"fa524c57",4030:"3806ade4",4059:"0cea9b55",4076:"f5149e68",4145:"483e0b51",4175:"7b4c0e17",4195:"c4f5d8e4",4218:"d01228a5",4238:"9af295d5",4252:"431cf2eb",4259:"e517eaf8",4286:"1c099a9f",4287:"4e09fe05",4304:"f6c4c87b",4320:"170d6be9",4331:"68eabfb5",4349:"67d28b6a",4359:"93110cb0",4360:"e64029a2",4364:"f9db2d7d",4370:"7313fd7a",4389:"bbc94b11",4410:"4ccbb70a",4432:"9fbcf557",4481:"fc7ff2a2",4510:"a7b04d77",4521:"61967a7e",4570:"971563fd",4720:"f7684d20",4725:"d886524c",4749:"78139242",4766:"dee3ecd2",4841:"68736142",4871:"82a9c3ef",4946:"18e611e2",4973:"0e9db64f",5002:"aab9af85",5023:"592484e5",5085:"397bd6ab",5097:"b008f099",5098:"7f5eb3e6",5121:"ae4e6f87",5123:"eeab08e0",5139:"e871a034",5191:"779f583b",5216:"485ca468",5240:"22fb9af5",5328:"9054cdab",5342:"382621e5",5361:"a206a9c1",5379:"78cb75ef",5380:"1ec0f80c",5385:"55586e1d",5401:"e0e5647f",5450:"a7c2807a",5465:"447118c0",5501:"7a2bfb8b",5503:"dab92480",5508:"96cef825",5518:"47829127",5571:"1d009603",5620:"5105d4d0",5639:"82f379c4",5640:"e90d91d8",5643:"f6dc22f7",5659:"b0caafe4",5681:"c6d0846e",5701:"b45e280b",5769:"9238297f",5805:"c682498f",5826:"ca3d71aa",5844:"810e374e",5850:"ded84e96",5852:"d9576928",5967:"53a76c7a",6013:"0c841c36",6014:"253ececf",6027:"84f46e05",6054:"6d6e515e",6070:"5f8084b8",6083:"7de43df3",6144:"2ce7f68b",6312:"1071fca8",6315:"355fc026",6326:"40a504e1",6329:"d6dcf287",6344:"76df9c8b",6438:"54a16d7d",6474:"37013f15",6533:"15a8891f",6552:"e382198a",6554:"e257b45f",6558:"c6778369",6607:"11505f77",6625:"a4d6bdde",6634:"5ba0794c",6659:"eb8556aa",6668:"3bf23c4e",6690:"54a01eb0",6749:"3be75469",6785:"70dae8dd",6790:"213c7fa6",6809:"f465590d",6813:"c2ed7101",6814:"9140c03f",6844:"a301c199",6862:"e69236dc",6906:"3a277c22",6944:"863f9875",6956:"6c67d5a8",6962:"3401f4b6",6963:"082a7789",6972:"b49027e7",7012:"47fd5279",7030:"d6b4fa26",7041:"acd2d654",7105:"54865067",7156:"3ac5d6b2",7214:"e44f362d",7234:"67500e9f",7352:"7a1175a9",7366:"ff13d56b",7368:"46ba6f65",7370:"8365d62c",7400:"0ca0c16a",7426:"591069a4",7463:"d7c3b9b6",7465:"d8156f77",7468:"037e4b31",7470:"61b39c60",7525:"c383d2f2",7559:"4ea8d4c2",7576:"b5e2e2d2",7619:"2c01aa76",7641:"97b157fa",7642:"7b2a378f",7671:"7c2701e5",7689:"8324e86a",7699:"682b0e8f",7739:"77707cf0",7747:"ad3bb904",7756:"88e7e176",7800:"c55a5241",7801:"4e26fbd3",7808:"5c9eac6d",7821:"b3a5b427",7827:"54dbbc63",7833:"eb6ab2a9",7918:"17896441",7920:"1a4e3797",7929:"c9c84060",7950:"663175c4",7964:"223687fe",8006:"4a4ee5ae",8036:"97dad17b",8082:"9459be10",8138:"96233099",8178:"9120eacc",8223:"1520c72c",8248:"0a516a98",8290:"0e5742b7",8303:"e1d7336f",8306:"e58ed2d9",8343:"4203f852",8345:"63293a61",8377:"b54a2cde",8386:"dc709263",8405:"f8d59dec",8418:"8045ebfb",8436:"b8464347",8441:"02e607f4",8464:"75abb2cc",8468:"5d720912",8530:"0446b87a",8536:"497c00e1",8578:"48a0db10",8594:"da95e9ed",8632:"8794441f",8655:"a1b898fb",8671:"8ad77fae",8695:"e49bebe0",8703:"15db26f2",8730:"4d2e949c",8734:"23397b1c",8760:"0168ca68",8781:"09c240ea",8815:"3c90cae9",8858:"1e80880e",8872:"5e3e81f0",8918:"fd8f0a97",8946:"dd418e11",8949:"2737d619",8957:"5a37cf0a",8967:"9d932f06",8991:"85ab98f3",8994:"562ce9c1",9128:"f26df47d",9189:"00ef3aea",9193:"025c1660",9245:"79645554",9262:"d0fee05b",9304:"eeaf0494",9307:"0610130c",9315:"4c614940",9329:"e57ce3fc",9357:"43be729b",9390:"315dbec1",9421:"5a7d5ec8",9432:"ca7fd0b3",9448:"420f0077",9471:"f151444f",9498:"b4775fe0",9514:"1be78505",9555:"b334a18e",9581:"57486b1e",9585:"80d5cd29",9610:"2f98fe09",9627:"759213d5",9641:"9786e703",9661:"cbd95619",9679:"d5a4b422",9737:"8577b3cc",9750:"d564bc96",9759:"074de6eb",9796:"0da3f339",9814:"6f38df76",9817:"14eb3368",9843:"1346a6c3",9875:"ef801d26",9918:"607d8226",9919:"6588942a",9921:"f246170c",9930:"52374bd6",9932:"e9e17c4b",9938:"0ea72b03",9943:"dbd783b0",9955:"3fd4c7ac",9964:"8a573c85",9972:"23faecc2"}[e]||e)+"."+{0:"c3766b21",49:"8aa85a11",53:"4d0df164",69:"b72fb7d9",77:"4b5510c2",99:"85bf3474",148:"cb171c2b",154:"6efcc9ac",178:"a99dfbd4",189:"6f8511df",192:"edd50b5f",217:"2acc1ce2",218:"0891fc7a",240:"db35dbd1",245:"f5b0f86b",284:"c7a59359",323:"22b7fa15",328:"f4a64eb5",332:"e1422550",351:"2603061d",361:"7a45088c",370:"16f43295",387:"33982c47",398:"2b7cecea",403:"74a4c91f",411:"8e0c5b17",419:"b7646716",428:"366fe48f",501:"ce0e6dbd",516:"6f52380c",553:"16cfcab9",570:"2d232fd5",576:"b9b85cb3",637:"221872b5",671:"bb54a383",675:"39093ca7",707:"98b9c76f",794:"2f41d207",846:"865c511d",856:"1227aeb5",882:"882f453b",895:"fa117daf",905:"69156375",939:"2b8f6848",942:"488b4aa7",990:"8598bca3",1e3:"1f17bea2",1003:"cb4621a2",1027:"cc6e5c6c",1032:"de3e0685",1035:"95a23ecb",1085:"0be20297",1093:"590be39f",1099:"195e8838",1106:"60e86f5f",1107:"e31dd686",1120:"b03a4264",1308:"37af536b",1320:"bcea5039",1324:"dcfc40ad",1369:"5c5af9cc",1370:"07911008",1387:"0c1b28d8",1437:"326ed2a2",1449:"5d6af93f",1475:"66d328e0",1505:"399d3fa2",1516:"c9e13dad",1534:"a08a30fd",1564:"e8720c95",1588:"7101263a",1616:"b737f864",1634:"482b350c",1642:"3af83ade",1657:"9f5f227e",1658:"fb51e63f",1690:"c9e2ea97",1697:"d49a801b",1704:"7b62f716",1756:"c78044fc",1769:"bd0307bc",1777:"fc5e73ce",1902:"b9653858",1903:"4592a432",1905:"7622a150",1925:"36c8baae",1928:"c46891eb",1935:"a5a03916",1944:"c62d198f",1951:"f7a3d44b",2002:"3d5d0743",2006:"174d1d5c",2007:"4f34bbed",2063:"0e095e1b",2082:"fc6613d3",2099:"6986c9f6",2134:"11b6b425",2144:"73567973",2157:"7cac59f4",2164:"6c5c420e",2194:"e18a7c37",2233:"bb7fa366",2258:"104e674c",2260:"0d118649",2276:"dc845cb6",2283:"9bcf9988",2299:"6675a3d7",2319:"58e30219",2331:"3a9ca929",2373:"824d43bd",2378:"2417d300",2405:"b447610b",2409:"81f0fb7d",2424:"2376d983",2467:"eb8ebf87",2503:"54743de7",2535:"3fbd61e1",2538:"c5908e7a",2561:"df4f76fa",2610:"06843304",2614:"7a92bb0f",2615:"107654b4",2631:"b6e5bbd0",2711:"81764f75",2736:"8a87b336",2755:"22afb14a",2780:"06f85534",2893:"9f44d3df",2917:"5b1c7f77",2929:"a27703a1",2965:"cfa590bd",2976:"854b5c2c",2977:"a0bcae4e",2978:"177ed5e2",2982:"0a147f1c",2987:"241da986",2995:"5a0be99a",2998:"2f133cb7",3042:"1f72d975",3049:"772248b3",3090:"139d6d5e",3146:"2799ca53",3148:"b8517cd8",3167:"53812d54",3211:"6b2a5fc3",3215:"1907497c",3256:"ad51362c",3280:"072cbc1f",3297:"5458628f",3310:"e4e70389",3320:"c7aad732",3361:"be37b9da",3378:"dd4af6ee",3431:"aac36051",3461:"d6d6c019",3469:"f23d73b8",3481:"c4db48a8",3491:"c814bb0b",3501:"ea3fb5e2",3502:"1d3784d1",3503:"cbbacbfb",3507:"5b6b5371",3532:"2cb578d3",3552:"1285747c",3605:"1db44127",3608:"024f8c8b",3628:"b63bf257",3639:"2aa964cb",3651:"3971e9b9",3707:"d171870f",3731:"9994d658",3734:"2096db22",3761:"82931fdb",3824:"952e885b",3855:"fd1df4c0",3861:"f436cfb9",3871:"626d9c07",3891:"0226aa09",3906:"2c6b7f93",3932:"0e17930f",3976:"ac4a7ad2",3977:"86dedb43",3978:"3f380914",3993:"d58cd05f",4030:"a49b2c5b",4059:"c5d10fec",4076:"67be3647",4145:"ab6d3d8e",4175:"91f8f547",4195:"54eac8cb",4218:"1d6e74ec",4238:"3832592d",4252:"b05a96be",4259:"cebfb001",4286:"104eec97",4287:"d30ab7f8",4304:"2cc4f622",4320:"e9709655",4331:"c0e881fe",4349:"ed75b9cb",4359:"4bdf94a3",4360:"de377845",4364:"12391645",4370:"81e845bd",4389:"d56f1781",4410:"002e2670",4432:"7ac7e9c6",4481:"2d9810fe",4510:"569cdbc9",4521:"4540344f",4563:"3ebd3df8",4570:"8b9c6d38",4720:"d352b73c",4725:"d3071687",4749:"67db880f",4766:"f0c70771",4841:"3e22aae5",4871:"e7f1d411",4946:"7c3f4fe4",4973:"31bb2e89",5002:"205c65b6",5023:"56348e93",5085:"c399b972",5097:"d786814e",5098:"05a6ff81",5121:"ffcfa435",5123:"841d2298",5139:"feea5877",5191:"f6106f3a",5216:"cbd5e126",5240:"40165bc4",5328:"f778ab52",5342:"50e64d8e",5361:"46ff1b6b",5379:"5aa34671",5380:"88b22974",5385:"bd8a1e9d",5401:"f2ca051f",5450:"13c6d24d",5465:"855b4927",5501:"a92132f4",5503:"f9a3a440",5508:"69dec1d8",5518:"a42d4698",5571:"547b4c20",5620:"dced3a1d",5639:"7dfad395",5640:"9f84abf2",5643:"1cba3953",5659:"5549df83",5681:"6452e62e",5701:"11af8de3",5769:"3a5cb03e",5805:"206f3e55",5826:"869d5e97",5844:"714a445d",5850:"ec9aa0b0",5852:"c323db4e",5967:"8fce27be",6013:"def1784a",6014:"26b4b316",6027:"a377d3a0",6054:"67b4e82e",6070:"4b92967e",6083:"a47eccb5",6144:"aaaccd21",6312:"a7f36335",6315:"20f8c38f",6326:"8dec1b13",6329:"e6d694c8",6344:"c894cf81",6438:"f207bf1a",6474:"0fb9ed80",6533:"3efeb53c",6552:"a54988d3",6554:"4bd7d5c2",6558:"bc5c6218",6607:"f76d4f2b",6625:"8ae30a13",6634:"1a926b07",6659:"f07ddac8",6668:"f03cf23e",6690:"13252b56",6749:"342d6e99",6785:"c3ac600a",6790:"6b60e7e5",6809:"1ea096ec",6813:"0a146af3",6814:"6301a92a",6844:"2d348245",6862:"1aa49dca",6906:"2420ba1e",6944:"1f215946",6956:"9e78704f",6962:"47c13536",6963:"c62bf467",6972:"b4cc1b77",7012:"6b112399",7030:"851290e4",7041:"2144479d",7105:"9ef5ddea",7156:"9c37b190",7214:"f334f9b1",7234:"ab88e857",7352:"c010d6f2",7366:"e8e8e4bf",7368:"9de63661",7370:"49b4cdb4",7400:"c779c36b",7426:"15bfcb23",7463:"0fe98483",7465:"bc0b692e",7468:"1c308860",7470:"069d03cb",7525:"2d18bddc",7559:"a632b6a1",7576:"f7804b6e",7619:"c4a0a002",7641:"fb0d3a40",7642:"dec3750a",7671:"748547cc",7689:"c9424f8e",7699:"f7797a77",7739:"bc557d1e",7747:"74d260ca",7756:"b11ffdf3",7800:"078f634a",7801:"f5365484",7808:"e3a5a4b7",7821:"6b19238d",7827:"7a96ed9a",7833:"e7827eba",7918:"3776a162",7920:"23d2d6d8",7929:"9acf1c7a",7950:"fd65b8cf",7964:"c8a07462",8006:"bf0d44d3",8036:"29cb08b2",8082:"737e1ff1",8138:"2071c474",8178:"24990869",8223:"cdce29be",8248:"1fedcf8d",8290:"0cbe050f",8303:"eda627d6",8306:"e4b26ce2",8343:"a2d347e2",8345:"5ffed3d9",8377:"047618ca",8386:"2617ede0",8405:"d8cd8cdb",8418:"2495cd04",8436:"35e7edcf",8441:"5accbcf5",8464:"148652fb",8468:"c408ecb4",8530:"b0fb3de4",8536:"4d882ab1",8578:"8bbd8ed0",8594:"176462b4",8632:"4fad2dbe",8655:"29825d05",8671:"4ceff92a",8695:"027c3b2b",8703:"11d0abf6",8730:"5f078ff4",8734:"066f9844",8760:"e3fc05f3",8781:"8c02534e",8815:"c98a857d",8858:"90ede643",8872:"011cc9f2",8918:"22d45daf",8946:"26ca8a0f",8949:"4e9eb63c",8957:"165aa921",8967:"7e98b52a",8977:"3688cfae",8991:"ef8b9b95",8994:"ad355a40",9128:"3f423388",9189:"9fb1d170",9193:"6293cdb4",9245:"033d9a55",9262:"f6c21f41",9304:"7a95bc48",9307:"2fb3e3e1",9315:"ecf6aaa0",9329:"c33dde04",9357:"e3c0d5db",9390:"030e6744",9421:"8f3092b5",9432:"482fc6f9",9448:"e2576319",9471:"be3b7bd2",9498:"cc251f8d",9514:"27d292ac",9555:"03a24678",9581:"d939e591",9585:"2d1cdd49",9610:"48a7c468",9627:"b50ac4f3",9641:"716b4c1f",9661:"9045340a",9679:"6332d0b4",9737:"64496401",9750:"28964036",9759:"f81f3c08",9796:"07f8d3e6",9814:"23fbcd31",9817:"b154fdbd",9843:"efcead84",9875:"aa3432fb",9918:"9d1e0b26",9919:"f9fa54e4",9921:"d8e2283a",9930:"d34bd389",9932:"e1e142f2",9938:"92ed1d19",9943:"8292bdcf",9955:"35aa464e",9964:"3c07da9c",9972:"791f0e4b"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,d)=>Object.prototype.hasOwnProperty.call(e,d),b={},r.l=(e,d,a,f)=>{if(b[e])b[e].push(d);else{var c,t;if(void 0!==a)for(var o=document.getElementsByTagName("script"),n=0;n<o.length;n++){var i=o[n];if(i.getAttribute("src")==e){c=i;break}}c||(t=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,r.nc&&c.setAttribute("nonce",r.nc),c.src=e),b[e]=[d];var u=(d,a)=>{c.onerror=c.onload=null,clearTimeout(l);var f=b[e];if(delete b[e],c.parentNode&&c.parentNode.removeChild(c),f&&f.forEach((e=>e(a))),d)return d(a)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=u.bind(null,c.onerror),c.onload=u.bind(null,c.onload),t&&document.head.appendChild(c)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/sdk/js/",r.gca=function(e){return e={17896441:"7918",35804303:"1902",41050165:"3361",45502991:"2319",47829127:"5518",52729552:"1093",54865067:"7105",68736142:"4841",72442644:"2194",78139242:"4749",79645554:"9245",86823464:"1475",92689751:"1027",96233099:"8138","51bc951c":"0",ff3c6a0b:"49","935f2afb":"53","83abd415":"69",c51695b1:"77",dba394d5:"99","68822c95":"148",a53ea2ce:"154","2c07a8b9":"178",b2aba146:"189",acd2b387:"192","62f22d87":"217","0ac89400":"218","7e30b660":"240","2ba66cb3":"245",f4575319:"284",fdb21dcb:"323","932291ce":"328","51ad3013":"332","5375cdb8":"351",fd1097f5:"361","331c3af7":"370",d1c4056c:"387","6e7fb50b":"398","1bed5c44":"403","6ef80218":"411","0e073905":"419","524cb2c7":"428","90b59a8e":"501","0d86db4e":"516",ff2dc39f:"553","872d056d":"570","401b5d44":"576",dda920fe:"637","78b3a14d":"671","84b325c6":"675","163894cc":"707","2bf182e2":"794","753e0990":"846","3f34f70a":"856","9d3805ff":"882","62a5678f":"895","605f4eaa":"905","860db0ad":"939","0e50c74a":"942","08eb3cc8":"990","7a7ff987":"1000",d1b5f25c:"1003","7b4bca30":"1032","4dfd2520":"1035","9083eab8":"1085","46f574b8":"1099","1b0e562b":"1106",befbd6a7:"1107","0a6a6221":"1120",f05eaad1:"1308",d6d3abb7:"1320",f90a522b:"1324",e15dee63:"1369","58fb69cb":"1370","6f0928dc":"1387","42282d60":"1437","4faa6d6b":"1449",d9fd8234:"1505","60f5fef7":"1516","159dcb57":"1534","44c9dba7":"1564","36f803ad":"1588","8f23db15":"1616","1c4b3c39":"1634","7f042c21":"1642","5dc8eb44":"1657",fbdbd19e:"1658",b991b973:"1690",b62055f3:"1697","115654df":"1704",dfff5bbd:"1756","6d4f442d":"1769","04f4467f":"1777","672b1f87":"1903",c29f440f:"1905","9dcee6ec":"1925",a5c97f70:"1928","5042abcc":"1935","267143e1":"1944","001c51b5":"1951",c551cafd:"2002",c7571bc1:"2006",a3368d96:"2007",a5bd23c9:"2063","872590c3":"2082","02c75427":"2099","77b6a063":"2134",ca24a393:"2144",e805786e:"2157",fed1d36d:"2164","570d2578":"2233",dfb1d591:"2258","4700376e":"2260",d5b0e882:"2276","638119b8":"2283",eab91185:"2299",a697b914:"2331","0b7eaab8":"2373",c0e54d24:"2378","3e9eea18":"2405","6d6065ba":"2409","55d5f305":"2424","4ddcce88":"2467",ed3555df:"2503","041abd93":"2535","56c5d261":"2538","82a8f848":"2561","162dcb22":"2614",fd951894:"2615","5374a44b":"2631",e23933fb:"2711",dbb49d41:"2736","3158e88a":"2755","1770ca36":"2780",f524c03d:"2893","7c3c1ac5":"2917",d54f8bf8:"2929","3c4479b4":"2965",f7aa35a1:"2976","8a738547":"2977","319b2b13":"2978",b766f0f5:"2982",cf720268:"2987","2a3ae0ae":"2995",f313d5f9:"2998","18b93cb3":"3042",f192608e:"3049","1df244d0":"3090","53bfe04a":"3146","99c970ed":"3148","2d046998":"3167","192384cd":"3211","63148a7b":"3215","100eb332":"3256","72801ac9":"3280","8aec8783":"3297","12e04edb":"3310","568b9dc5":"3320","75e2c646":"3378","3d936583":"3431","5b0acce6":"3461",b8352d9f:"3469","229ea6a0":"3491","2a6d2bba":"3501",f6c1d5d4:"3502","82fd6c76":"3503",f68ae16a:"3507","53d9c72e":"3532","886a51d0":"3552","216b8e3c":"3605","73da24cf":"3608","6de6630d":"3628","737fa906":"3639",a9ec048f:"3651",e332cb1d:"3707","68dd252e":"3731",aaacd0d9:"3734","92e6ea4e":"3761","9ad0147b":"3824",ad3736e4:"3855","377585f0":"3861",f6458d78:"3871","2f85d4d6":"3891","475b3bf7":"3906","2c20ba8f":"3932",c4cb772c:"3976","3812c5c3":"3977",b668c116:"3978",fa524c57:"3993","3806ade4":"4030","0cea9b55":"4059",f5149e68:"4076","483e0b51":"4145","7b4c0e17":"4175",c4f5d8e4:"4195",d01228a5:"4218","9af295d5":"4238","431cf2eb":"4252",e517eaf8:"4259","1c099a9f":"4286","4e09fe05":"4287",f6c4c87b:"4304","170d6be9":"4320","68eabfb5":"4331","67d28b6a":"4349","93110cb0":"4359",e64029a2:"4360",f9db2d7d:"4364","7313fd7a":"4370",bbc94b11:"4389","4ccbb70a":"4410","9fbcf557":"4432",fc7ff2a2:"4481",a7b04d77:"4510","61967a7e":"4521","971563fd":"4570",f7684d20:"4720",d886524c:"4725",dee3ecd2:"4766","82a9c3ef":"4871","18e611e2":"4946","0e9db64f":"4973",aab9af85:"5002","592484e5":"5023","397bd6ab":"5085",b008f099:"5097","7f5eb3e6":"5098",ae4e6f87:"5121",eeab08e0:"5123",e871a034:"5139","779f583b":"5191","485ca468":"5216","22fb9af5":"5240","9054cdab":"5328","382621e5":"5342",a206a9c1:"5361","78cb75ef":"5379","1ec0f80c":"5380","55586e1d":"5385",e0e5647f:"5401",a7c2807a:"5450","447118c0":"5465","7a2bfb8b":"5501",dab92480:"5503","96cef825":"5508","1d009603":"5571","5105d4d0":"5620","82f379c4":"5639",e90d91d8:"5640",f6dc22f7:"5643",b0caafe4:"5659",c6d0846e:"5681",b45e280b:"5701","9238297f":"5769",c682498f:"5805",ca3d71aa:"5826","810e374e":"5844",ded84e96:"5850",d9576928:"5852","53a76c7a":"5967","0c841c36":"6013","253ececf":"6014","84f46e05":"6027","6d6e515e":"6054","5f8084b8":"6070","7de43df3":"6083","2ce7f68b":"6144","1071fca8":"6312","355fc026":"6315","40a504e1":"6326",d6dcf287:"6329","76df9c8b":"6344","54a16d7d":"6438","37013f15":"6474","15a8891f":"6533",e382198a:"6552",e257b45f:"6554",c6778369:"6558","11505f77":"6607",a4d6bdde:"6625","5ba0794c":"6634",eb8556aa:"6659","3bf23c4e":"6668","54a01eb0":"6690","3be75469":"6749","70dae8dd":"6785","213c7fa6":"6790",f465590d:"6809",c2ed7101:"6813","9140c03f":"6814",a301c199:"6844",e69236dc:"6862","3a277c22":"6906","863f9875":"6944","6c67d5a8":"6956","3401f4b6":"6962","082a7789":"6963",b49027e7:"6972","47fd5279":"7012",d6b4fa26:"7030",acd2d654:"7041","3ac5d6b2":"7156",e44f362d:"7214","67500e9f":"7234","7a1175a9":"7352",ff13d56b:"7366","46ba6f65":"7368","8365d62c":"7370","0ca0c16a":"7400","591069a4":"7426",d7c3b9b6:"7463",d8156f77:"7465","037e4b31":"7468","61b39c60":"7470",c383d2f2:"7525","4ea8d4c2":"7559",b5e2e2d2:"7576","2c01aa76":"7619","97b157fa":"7641","7b2a378f":"7642","7c2701e5":"7671","8324e86a":"7689","682b0e8f":"7699","77707cf0":"7739",ad3bb904:"7747","88e7e176":"7756",c55a5241:"7800","4e26fbd3":"7801","5c9eac6d":"7808",b3a5b427:"7821","54dbbc63":"7827",eb6ab2a9:"7833","1a4e3797":"7920",c9c84060:"7929","663175c4":"7950","223687fe":"7964","4a4ee5ae":"8006","97dad17b":"8036","9459be10":"8082","9120eacc":"8178","1520c72c":"8223","0a516a98":"8248","0e5742b7":"8290",e1d7336f:"8303",e58ed2d9:"8306","4203f852":"8343","63293a61":"8345",b54a2cde:"8377",dc709263:"8386",f8d59dec:"8405","8045ebfb":"8418",b8464347:"8436","02e607f4":"8441","75abb2cc":"8464","5d720912":"8468","0446b87a":"8530","497c00e1":"8536","48a0db10":"8578",da95e9ed:"8594","8794441f":"8632",a1b898fb:"8655","8ad77fae":"8671",e49bebe0:"8695","15db26f2":"8703","4d2e949c":"8730","23397b1c":"8734","0168ca68":"8760","09c240ea":"8781","3c90cae9":"8815","1e80880e":"8858","5e3e81f0":"8872",fd8f0a97:"8918",dd418e11:"8946","2737d619":"8949","5a37cf0a":"8957","9d932f06":"8967","85ab98f3":"8991","562ce9c1":"8994",f26df47d:"9128","00ef3aea":"9189","025c1660":"9193",d0fee05b:"9262",eeaf0494:"9304","0610130c":"9307","4c614940":"9315",e57ce3fc:"9329","43be729b":"9357","315dbec1":"9390","5a7d5ec8":"9421",ca7fd0b3:"9432","420f0077":"9448",f151444f:"9471",b4775fe0:"9498","1be78505":"9514",b334a18e:"9555","57486b1e":"9581","80d5cd29":"9585","2f98fe09":"9610","759213d5":"9627","9786e703":"9641",cbd95619:"9661",d5a4b422:"9679","8577b3cc":"9737",d564bc96:"9750","074de6eb":"9759","0da3f339":"9796","6f38df76":"9814","14eb3368":"9817","1346a6c3":"9843",ef801d26:"9875","607d8226":"9918","6588942a":"9919",f246170c:"9921","52374bd6":"9930",e9e17c4b:"9932","0ea72b03":"9938",dbd783b0:"9943","3fd4c7ac":"9955","8a573c85":"9964","23faecc2":"9972"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(d,a)=>{var b=r.o(e,d)?e[d]:void 0;if(0!==b)if(b)a.push(b[2]);else if(/^(1303|532)$/.test(d))e[d]=0;else{var f=new Promise(((a,f)=>b=e[d]=[a,f]));a.push(b[2]=f);var c=r.p+r.u(d),t=new Error;r.l(c,(a=>{if(r.o(e,d)&&(0!==(b=e[d])&&(e[d]=void 0),b)){var f=a&&("load"===a.type?"missing":a.type),c=a&&a.target&&a.target.src;t.message="Loading chunk "+d+" failed.\n("+f+": "+c+")",t.name="ChunkLoadError",t.type=f,t.request=c,b[1](t)}}),"chunk-"+d,d)}},r.O.j=d=>0===e[d];var d=(d,a)=>{var b,f,[c,t,o]=a,n=0;if(c.some((d=>0!==e[d]))){for(b in t)r.o(t,b)&&(r.m[b]=t[b]);if(o)var i=o(r)}for(d&&d(a);n<c.length;n++)f=c[n],r.o(e,f)&&e[f]&&e[f][0](),e[f]=0;return r.O(i)},a=self.webpackChunk=self.webpackChunk||[];a.forEach(d.bind(null,0)),a.push=d.bind(null,a.push.bind(a))})()})(); \ No newline at end of file +(()=>{"use strict";var e,d,a,b,c={},f={};function r(e){var d=f[e];if(void 0!==d)return d.exports;var a=f[e]={exports:{}};return c[e].call(a.exports,a,a.exports,r),a.exports}r.m=c,e=[],r.O=(d,a,b,c)=>{if(!a){var f=1/0;for(i=0;i<e.length;i++){for(var[a,b,c]=e[i],t=!0,o=0;o<a.length;o++)(!1&c||f>=c)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,c<f&&(f=c));if(t){e.splice(i--,1);var n=b();void 0!==n&&(d=n)}}return d}c=c||0;for(var i=e.length;i>0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[a,b,c]},r.n=e=>{var d=e&&e.__esModule?()=>e.default:()=>e;return r.d(d,{a:d}),d},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,b){if(1&b&&(e=this(e)),8&b)return e;if("object"==typeof e&&e){if(4&b&&e.__esModule)return e;if(16&b&&"function"==typeof e.then)return e}var c=Object.create(null);r.r(c);var f={};d=d||[null,a({}),a([]),a(a)];for(var t=2&b&&e;"object"==typeof t&&!~d.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((d=>f[d]=()=>e[d]));return f.default=()=>e,r.d(c,f),c},r.d=(e,d)=>{for(var a in d)r.o(d,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:d[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((d,a)=>(r.f[a](e,d),d)),[])),r.u=e=>"assets/js/"+({0:"51bc951c",49:"ff3c6a0b",53:"935f2afb",69:"83abd415",77:"c51695b1",99:"dba394d5",148:"68822c95",154:"a53ea2ce",178:"2c07a8b9",189:"b2aba146",192:"acd2b387",217:"62f22d87",218:"0ac89400",240:"7e30b660",245:"2ba66cb3",284:"f4575319",323:"fdb21dcb",328:"932291ce",332:"51ad3013",351:"5375cdb8",361:"fd1097f5",370:"331c3af7",387:"d1c4056c",398:"6e7fb50b",403:"1bed5c44",411:"6ef80218",419:"0e073905",428:"524cb2c7",501:"90b59a8e",516:"0d86db4e",553:"ff2dc39f",570:"872d056d",576:"401b5d44",637:"dda920fe",671:"78b3a14d",675:"84b325c6",707:"163894cc",794:"2bf182e2",846:"753e0990",856:"3f34f70a",882:"9d3805ff",895:"62a5678f",905:"605f4eaa",939:"860db0ad",942:"0e50c74a",990:"08eb3cc8",1e3:"7a7ff987",1003:"d1b5f25c",1027:"92689751",1032:"7b4bca30",1035:"4dfd2520",1085:"9083eab8",1093:"52729552",1099:"46f574b8",1106:"1b0e562b",1107:"befbd6a7",1120:"0a6a6221",1308:"f05eaad1",1320:"d6d3abb7",1324:"f90a522b",1369:"e15dee63",1370:"58fb69cb",1387:"6f0928dc",1437:"42282d60",1449:"4faa6d6b",1475:"86823464",1505:"d9fd8234",1516:"60f5fef7",1534:"159dcb57",1564:"44c9dba7",1588:"36f803ad",1616:"8f23db15",1634:"1c4b3c39",1642:"7f042c21",1657:"5dc8eb44",1658:"fbdbd19e",1690:"b991b973",1697:"b62055f3",1704:"115654df",1756:"dfff5bbd",1769:"6d4f442d",1777:"04f4467f",1902:"35804303",1903:"672b1f87",1905:"c29f440f",1925:"9dcee6ec",1928:"a5c97f70",1935:"5042abcc",1944:"267143e1",1951:"001c51b5",2002:"c551cafd",2006:"c7571bc1",2007:"a3368d96",2063:"a5bd23c9",2082:"872590c3",2099:"02c75427",2134:"77b6a063",2144:"ca24a393",2157:"e805786e",2164:"fed1d36d",2194:"72442644",2233:"570d2578",2258:"dfb1d591",2260:"4700376e",2276:"d5b0e882",2283:"638119b8",2299:"eab91185",2319:"45502991",2331:"a697b914",2373:"0b7eaab8",2378:"c0e54d24",2405:"3e9eea18",2409:"6d6065ba",2424:"55d5f305",2467:"4ddcce88",2503:"ed3555df",2535:"041abd93",2538:"56c5d261",2561:"82a8f848",2614:"162dcb22",2615:"fd951894",2631:"5374a44b",2711:"e23933fb",2736:"dbb49d41",2755:"3158e88a",2780:"1770ca36",2893:"f524c03d",2917:"7c3c1ac5",2929:"d54f8bf8",2965:"3c4479b4",2976:"f7aa35a1",2977:"8a738547",2978:"319b2b13",2982:"b766f0f5",2987:"cf720268",2995:"2a3ae0ae",2998:"f313d5f9",3042:"18b93cb3",3049:"f192608e",3090:"1df244d0",3146:"53bfe04a",3148:"99c970ed",3167:"2d046998",3211:"192384cd",3215:"63148a7b",3256:"100eb332",3280:"72801ac9",3297:"8aec8783",3310:"12e04edb",3320:"568b9dc5",3361:"41050165",3378:"75e2c646",3431:"3d936583",3461:"5b0acce6",3469:"b8352d9f",3491:"229ea6a0",3501:"2a6d2bba",3502:"f6c1d5d4",3503:"82fd6c76",3507:"f68ae16a",3532:"53d9c72e",3552:"886a51d0",3605:"216b8e3c",3608:"73da24cf",3628:"6de6630d",3639:"737fa906",3651:"a9ec048f",3707:"e332cb1d",3731:"68dd252e",3734:"aaacd0d9",3761:"92e6ea4e",3824:"9ad0147b",3855:"ad3736e4",3861:"377585f0",3871:"f6458d78",3891:"2f85d4d6",3906:"475b3bf7",3932:"2c20ba8f",3976:"c4cb772c",3977:"3812c5c3",3978:"b668c116",3993:"fa524c57",4030:"3806ade4",4059:"0cea9b55",4076:"f5149e68",4145:"483e0b51",4175:"7b4c0e17",4195:"c4f5d8e4",4218:"d01228a5",4238:"9af295d5",4252:"431cf2eb",4259:"e517eaf8",4286:"1c099a9f",4287:"4e09fe05",4304:"f6c4c87b",4320:"170d6be9",4331:"68eabfb5",4349:"67d28b6a",4359:"93110cb0",4360:"e64029a2",4364:"f9db2d7d",4370:"7313fd7a",4389:"bbc94b11",4410:"4ccbb70a",4432:"9fbcf557",4481:"fc7ff2a2",4510:"a7b04d77",4521:"61967a7e",4570:"971563fd",4720:"f7684d20",4725:"d886524c",4749:"78139242",4766:"dee3ecd2",4841:"68736142",4871:"82a9c3ef",4946:"18e611e2",4973:"0e9db64f",5002:"aab9af85",5023:"592484e5",5085:"397bd6ab",5097:"b008f099",5098:"7f5eb3e6",5121:"ae4e6f87",5123:"eeab08e0",5139:"e871a034",5191:"779f583b",5216:"485ca468",5240:"22fb9af5",5328:"9054cdab",5342:"382621e5",5361:"a206a9c1",5379:"78cb75ef",5380:"1ec0f80c",5385:"55586e1d",5401:"e0e5647f",5450:"a7c2807a",5465:"447118c0",5501:"7a2bfb8b",5503:"dab92480",5508:"96cef825",5518:"47829127",5571:"1d009603",5620:"5105d4d0",5639:"82f379c4",5640:"e90d91d8",5643:"f6dc22f7",5659:"b0caafe4",5681:"c6d0846e",5701:"b45e280b",5769:"9238297f",5805:"c682498f",5826:"ca3d71aa",5844:"810e374e",5850:"ded84e96",5852:"d9576928",5967:"53a76c7a",6013:"0c841c36",6014:"253ececf",6027:"84f46e05",6054:"6d6e515e",6070:"5f8084b8",6083:"7de43df3",6144:"2ce7f68b",6312:"1071fca8",6315:"355fc026",6326:"40a504e1",6329:"d6dcf287",6344:"76df9c8b",6438:"54a16d7d",6474:"37013f15",6533:"15a8891f",6552:"e382198a",6554:"e257b45f",6558:"c6778369",6607:"11505f77",6625:"a4d6bdde",6634:"5ba0794c",6659:"eb8556aa",6668:"3bf23c4e",6690:"54a01eb0",6749:"3be75469",6785:"70dae8dd",6790:"213c7fa6",6809:"f465590d",6813:"c2ed7101",6814:"9140c03f",6844:"a301c199",6862:"e69236dc",6906:"3a277c22",6944:"863f9875",6956:"6c67d5a8",6962:"3401f4b6",6963:"082a7789",6972:"b49027e7",7012:"47fd5279",7030:"d6b4fa26",7041:"acd2d654",7105:"54865067",7156:"3ac5d6b2",7214:"e44f362d",7234:"67500e9f",7352:"7a1175a9",7366:"ff13d56b",7368:"46ba6f65",7370:"8365d62c",7400:"0ca0c16a",7426:"591069a4",7463:"d7c3b9b6",7465:"d8156f77",7468:"037e4b31",7470:"61b39c60",7525:"c383d2f2",7559:"4ea8d4c2",7576:"b5e2e2d2",7619:"2c01aa76",7641:"97b157fa",7642:"7b2a378f",7671:"7c2701e5",7689:"8324e86a",7699:"682b0e8f",7739:"77707cf0",7747:"ad3bb904",7756:"88e7e176",7800:"c55a5241",7801:"4e26fbd3",7808:"5c9eac6d",7821:"b3a5b427",7827:"54dbbc63",7833:"eb6ab2a9",7918:"17896441",7920:"1a4e3797",7929:"c9c84060",7950:"663175c4",7964:"223687fe",8006:"4a4ee5ae",8036:"97dad17b",8082:"9459be10",8138:"96233099",8178:"9120eacc",8223:"1520c72c",8248:"0a516a98",8290:"0e5742b7",8303:"e1d7336f",8306:"e58ed2d9",8343:"4203f852",8345:"63293a61",8377:"b54a2cde",8386:"dc709263",8405:"f8d59dec",8418:"8045ebfb",8436:"b8464347",8441:"02e607f4",8464:"75abb2cc",8468:"5d720912",8530:"0446b87a",8536:"497c00e1",8578:"48a0db10",8594:"da95e9ed",8632:"8794441f",8655:"a1b898fb",8671:"8ad77fae",8695:"e49bebe0",8703:"15db26f2",8730:"4d2e949c",8734:"23397b1c",8760:"0168ca68",8781:"09c240ea",8815:"3c90cae9",8858:"1e80880e",8872:"5e3e81f0",8918:"fd8f0a97",8946:"dd418e11",8949:"2737d619",8957:"5a37cf0a",8967:"9d932f06",8991:"85ab98f3",8994:"562ce9c1",9128:"f26df47d",9189:"00ef3aea",9193:"025c1660",9245:"79645554",9262:"d0fee05b",9304:"eeaf0494",9307:"0610130c",9315:"4c614940",9329:"e57ce3fc",9357:"43be729b",9390:"315dbec1",9421:"5a7d5ec8",9432:"ca7fd0b3",9448:"420f0077",9471:"f151444f",9498:"b4775fe0",9514:"1be78505",9555:"b334a18e",9581:"57486b1e",9585:"80d5cd29",9610:"2f98fe09",9627:"759213d5",9641:"9786e703",9661:"cbd95619",9679:"d5a4b422",9737:"8577b3cc",9750:"d564bc96",9759:"074de6eb",9796:"0da3f339",9814:"6f38df76",9817:"14eb3368",9843:"1346a6c3",9875:"ef801d26",9918:"607d8226",9919:"6588942a",9921:"f246170c",9930:"52374bd6",9932:"e9e17c4b",9938:"0ea72b03",9943:"dbd783b0",9955:"3fd4c7ac",9964:"8a573c85",9972:"23faecc2"}[e]||e)+"."+{0:"8369c2bc",49:"015b5268",53:"4d0df164",69:"14b9ef83",77:"55185067",99:"85bf3474",148:"a07560ef",154:"32fc2093",178:"5b9b3f75",189:"aa6475b7",192:"4db9445a",217:"5293eb9e",218:"19e2a4cc",240:"bf677cab",245:"bc75ee21",284:"c73a552b",323:"5342a0ae",328:"f4a64eb5",332:"bf89b64d",351:"cd3afcab",361:"50decb2e",370:"91ec1dd3",387:"0c61b767",398:"1177e07a",403:"72ace1be",411:"ea7feac7",419:"21ea2b7e",428:"a7df81b8",501:"ce0e6dbd",516:"6f52380c",553:"9b2e5660",570:"1dd27b89",576:"8fb1ad95",637:"afbfc990",671:"9dd00eaa",675:"e61ce959",707:"af655143",794:"e5ec246c",846:"9af6d485",856:"1e626eb5",882:"0f2983a3",895:"eb946204",905:"0728adfd",939:"7a2914e4",942:"fd6abe05",990:"c605c798",1e3:"3f53f05c",1003:"c28bde94",1027:"1795c909",1032:"36b4a6c9",1035:"49ad4551",1085:"4bd33fd0",1093:"91ba0cdc",1099:"f5487557",1106:"250db096",1107:"40135b90",1120:"de4ba70f",1308:"c1263122",1320:"942e4395",1324:"f37d9a85",1369:"aef24d7c",1370:"31e2ca8f",1387:"d5bb1c78",1437:"a4d385b2",1449:"5d6af93f",1475:"d31d32e5",1505:"3c54f763",1516:"80b23d64",1534:"12c5d28d",1564:"b8413b6a",1588:"1c97bb5a",1616:"b737f864",1634:"482b350c",1642:"68574b71",1657:"9f5f227e",1658:"5d147712",1690:"776352f7",1697:"761a5d79",1704:"4d40d2fb",1756:"6db4493e",1769:"50db73ca",1777:"958e6326",1902:"b9653858",1903:"29efc3e7",1905:"01576903",1925:"36c8baae",1928:"883edfd1",1935:"a5a03916",1944:"175f82e4",1951:"2a683f40",2002:"05398854",2006:"0f9821dc",2007:"5c003e57",2063:"d0d40afb",2082:"5c2a610a",2099:"df2afec7",2134:"b09379ff",2144:"a6c605bc",2157:"3bbb072c",2164:"66d449e5",2194:"1bcf0d76",2233:"4cb35a60",2258:"4c5640a6",2260:"661350e3",2276:"dc845cb6",2283:"a18f6537",2299:"d32f9132",2319:"73763e9b",2331:"2481f0bb",2373:"d35e61b1",2378:"3cb209a7",2405:"8ed3ccb7",2409:"67832fd4",2424:"b04b3ed0",2467:"1d891561",2503:"da43292b",2535:"3fbd61e1",2538:"c56c49ad",2561:"6c8cc247",2610:"06843304",2614:"812b5b69",2615:"38b069cc",2631:"2c9e6730",2711:"9ce80101",2736:"0bcc8d87",2755:"e9c24de1",2780:"1f3a1b3f",2893:"a129fd13",2917:"5b1c7f77",2929:"d2d8b680",2965:"840ed5d5",2976:"69b6e2ee",2977:"11c5a4ac",2978:"e93e3e4c",2982:"eb47026b",2987:"405d5679",2995:"79e2b522",2998:"fdef06cc",3042:"1f72d975",3049:"ac0ebb34",3090:"fabd5f5d",3146:"0c6fa852",3148:"74346992",3167:"6a3ce35e",3211:"692c5c16",3215:"c40b6ddf",3256:"0cc9f7bf",3280:"151d6321",3297:"70d04cde",3310:"abd4c8ee",3320:"86421178",3361:"24d7be56",3378:"574b62a5",3431:"332ccf87",3461:"5cc7fc67",3469:"a0566f3d",3481:"c4db48a8",3491:"e50cc477",3501:"fac57926",3502:"cf783532",3503:"c65c95c8",3507:"602ace02",3532:"5eb46d62",3552:"a7a5c45a",3605:"24b655bb",3608:"f4589a9c",3628:"4e031050",3639:"38e39cb1",3651:"1a3b2b0c",3707:"d2db8219",3731:"c839b0d5",3734:"026900d4",3761:"105b76ca",3824:"510d114e",3855:"ab374ff0",3861:"3db40871",3871:"cf4dfecd",3891:"a8527e68",3906:"6dce02f5",3932:"9a67ff8b",3976:"ac4a7ad2",3977:"bcc62645",3978:"b4631267",3993:"ba092093",4030:"a49b2c5b",4059:"c5d10fec",4076:"528d087a",4145:"a3fb8726",4175:"05b03c90",4195:"54eac8cb",4218:"42ef4e5f",4238:"50050570",4252:"5ef27ee0",4259:"7cfc5c9c",4286:"69c8be59",4287:"1f6ce2ee",4304:"336b52f0",4320:"77838031",4331:"df834f17",4349:"8a39ab33",4359:"3d20bc60",4360:"aa712dab",4364:"3951810b",4370:"15d003e5",4389:"5b5c26fd",4410:"4f92a39d",4432:"7e048d41",4481:"70bc0ef9",4510:"9382477f",4521:"5a097ddb",4563:"3ebd3df8",4570:"99c8355d",4720:"7bd574bd",4725:"978a56c7",4749:"50116f89",4766:"44158cf9",4841:"8c072827",4871:"a6d588a8",4946:"7c3f4fe4",4973:"4eec3bb9",5002:"36be9b24",5023:"c73e2a34",5085:"319a11ec",5097:"b82ef5dd",5098:"6a25bc03",5121:"ec9d7b86",5123:"0aa3f4dc",5139:"832ae7d6",5191:"0a896f23",5216:"f231a38d",5240:"0c33a61f",5328:"7cee6fa7",5342:"a272f822",5361:"212a4631",5379:"4402bf88",5380:"b839d4b2",5385:"76497088",5401:"a9351132",5450:"51fc6d5e",5465:"070444e1",5501:"a92132f4",5503:"d55ec404",5508:"21045606",5518:"ba3a1b5e",5571:"96273cfb",5620:"616b9d8d",5639:"fa39d891",5640:"d916c4e7",5643:"bec086fb",5659:"5549df83",5681:"5f522e0d",5701:"792451d3",5769:"4a82d363",5805:"d98e3f6e",5826:"0ce83e9e",5844:"1d6aba05",5850:"a966c3a4",5852:"8b9d2f26",5967:"480397b8",6013:"5d6d9b06",6014:"80b404b1",6027:"7fb1ba22",6054:"cfe576ac",6070:"4b92967e",6083:"d16ac86b",6144:"0cdc5a97",6312:"8a45aea1",6315:"4b8df742",6326:"e50f8c25",6329:"16d2c0d4",6344:"a62e1ba0",6438:"da421fa7",6474:"35e420d5",6533:"882e2695",6552:"cd2ab781",6554:"28f68b38",6558:"b51de9ff",6607:"f208496c",6625:"6f350723",6634:"d37eaeec",6659:"57b16900",6668:"8d1f2371",6690:"c11a3902",6749:"bb04708c",6785:"ce06688c",6790:"52db6242",6809:"0d618cfa",6813:"0a146af3",6814:"96e45e7b",6844:"d3322a51",6862:"b5391d29",6906:"06d5b434",6944:"a49678cb",6956:"b2ded963",6962:"1218662c",6963:"7c4aa51c",6972:"8cea151b",7012:"e113c450",7030:"da1ac863",7041:"bd2efba7",7105:"e5e0d3c4",7156:"a7896f4f",7214:"f334f9b1",7234:"ab88e857",7352:"8172be9b",7366:"d73b9afb",7368:"9de63661",7370:"6732e52b",7400:"b3ff18e8",7426:"7922d051",7463:"2ea4132c",7465:"46077ff3",7468:"25665134",7470:"069d03cb",7525:"0ee0ce58",7559:"54b677f5",7576:"e9cda411",7619:"7a021e10",7641:"bf24dbbd",7642:"66c3a71c",7671:"d5924701",7689:"ecad8ba1",7699:"c7dae11f",7739:"69329dc0",7747:"f9d20b99",7756:"be85dcf2",7800:"93a8b2a7",7801:"e1e5598f",7808:"e3a5a4b7",7821:"67669617",7827:"5825521f",7833:"65be5c96",7918:"3776a162",7920:"23d2d6d8",7929:"fe632eeb",7950:"f8cf46ab",7964:"189e9fd1",8006:"75553d9a",8036:"5ee8dec3",8082:"146f4bab",8138:"2071c474",8178:"31353dad",8223:"cdce29be",8248:"3153528a",8290:"116e2cd1",8303:"55d36668",8306:"b1824340",8343:"0223c6a0",8345:"be2f5e94",8377:"ab4d4aaa",8386:"77340951",8405:"55b6f0fd",8418:"b88fa486",8436:"0afe1041",8441:"5accbcf5",8464:"455351e5",8468:"49bbc874",8530:"400dff76",8536:"4fc752b0",8578:"b07c3b30",8594:"c521af15",8632:"65312c19",8655:"29825d05",8671:"76f49f45",8695:"7bcb9a76",8703:"93c6748e",8730:"5f078ff4",8734:"b8fb157a",8760:"01cc7100",8781:"8c02534e",8815:"543141b8",8858:"94d43e4f",8872:"23cdbb2b",8918:"22d45daf",8946:"0e780fac",8949:"f48a0451",8957:"76a7b174",8967:"bb28d707",8977:"3688cfae",8991:"936922c2",8994:"fc575427",9128:"ab1dbdde",9189:"a745c97a",9193:"411910e5",9245:"5a8766ab",9262:"8ca71fc1",9304:"661ebee1",9307:"2fb3e3e1",9315:"ecf6aaa0",9329:"0a786bd9",9357:"e30d6d79",9390:"12ed0c8e",9421:"b0c88290",9432:"295abad4",9448:"e2576319",9471:"49be28ab",9498:"700a8d3b",9514:"27d292ac",9555:"1a35c11b",9581:"61bc0182",9585:"c5cbd436",9610:"cff4169f",9627:"b50ac4f3",9641:"98fd4cdd",9661:"54d7cf58",9679:"cf91be28",9737:"fec3f2c8",9750:"ba613be6",9759:"ccfa4229",9796:"f3852ef3",9814:"fed1f342",9817:"b154fdbd",9843:"e03b46e5",9875:"aa3432fb",9918:"09504618",9919:"88cf18fd",9921:"155543d4",9930:"cbbf8367",9932:"f2b36d48",9938:"8932f0ee",9943:"7281029f",9955:"e249b656",9964:"0dc215e3",9972:"a2b066a1"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,d)=>Object.prototype.hasOwnProperty.call(e,d),b={},r.l=(e,d,a,c)=>{if(b[e])b[e].push(d);else{var f,t;if(void 0!==a)for(var o=document.getElementsByTagName("script"),n=0;n<o.length;n++){var i=o[n];if(i.getAttribute("src")==e){f=i;break}}f||(t=!0,(f=document.createElement("script")).charset="utf-8",f.timeout=120,r.nc&&f.setAttribute("nonce",r.nc),f.src=e),b[e]=[d];var u=(d,a)=>{f.onerror=f.onload=null,clearTimeout(l);var c=b[e];if(delete b[e],f.parentNode&&f.parentNode.removeChild(f),c&&c.forEach((e=>e(a))),d)return d(a)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:f}),12e4);f.onerror=u.bind(null,f.onerror),f.onload=u.bind(null,f.onload),t&&document.head.appendChild(f)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/sdk/js/",r.gca=function(e){return e={17896441:"7918",35804303:"1902",41050165:"3361",45502991:"2319",47829127:"5518",52729552:"1093",54865067:"7105",68736142:"4841",72442644:"2194",78139242:"4749",79645554:"9245",86823464:"1475",92689751:"1027",96233099:"8138","51bc951c":"0",ff3c6a0b:"49","935f2afb":"53","83abd415":"69",c51695b1:"77",dba394d5:"99","68822c95":"148",a53ea2ce:"154","2c07a8b9":"178",b2aba146:"189",acd2b387:"192","62f22d87":"217","0ac89400":"218","7e30b660":"240","2ba66cb3":"245",f4575319:"284",fdb21dcb:"323","932291ce":"328","51ad3013":"332","5375cdb8":"351",fd1097f5:"361","331c3af7":"370",d1c4056c:"387","6e7fb50b":"398","1bed5c44":"403","6ef80218":"411","0e073905":"419","524cb2c7":"428","90b59a8e":"501","0d86db4e":"516",ff2dc39f:"553","872d056d":"570","401b5d44":"576",dda920fe:"637","78b3a14d":"671","84b325c6":"675","163894cc":"707","2bf182e2":"794","753e0990":"846","3f34f70a":"856","9d3805ff":"882","62a5678f":"895","605f4eaa":"905","860db0ad":"939","0e50c74a":"942","08eb3cc8":"990","7a7ff987":"1000",d1b5f25c:"1003","7b4bca30":"1032","4dfd2520":"1035","9083eab8":"1085","46f574b8":"1099","1b0e562b":"1106",befbd6a7:"1107","0a6a6221":"1120",f05eaad1:"1308",d6d3abb7:"1320",f90a522b:"1324",e15dee63:"1369","58fb69cb":"1370","6f0928dc":"1387","42282d60":"1437","4faa6d6b":"1449",d9fd8234:"1505","60f5fef7":"1516","159dcb57":"1534","44c9dba7":"1564","36f803ad":"1588","8f23db15":"1616","1c4b3c39":"1634","7f042c21":"1642","5dc8eb44":"1657",fbdbd19e:"1658",b991b973:"1690",b62055f3:"1697","115654df":"1704",dfff5bbd:"1756","6d4f442d":"1769","04f4467f":"1777","672b1f87":"1903",c29f440f:"1905","9dcee6ec":"1925",a5c97f70:"1928","5042abcc":"1935","267143e1":"1944","001c51b5":"1951",c551cafd:"2002",c7571bc1:"2006",a3368d96:"2007",a5bd23c9:"2063","872590c3":"2082","02c75427":"2099","77b6a063":"2134",ca24a393:"2144",e805786e:"2157",fed1d36d:"2164","570d2578":"2233",dfb1d591:"2258","4700376e":"2260",d5b0e882:"2276","638119b8":"2283",eab91185:"2299",a697b914:"2331","0b7eaab8":"2373",c0e54d24:"2378","3e9eea18":"2405","6d6065ba":"2409","55d5f305":"2424","4ddcce88":"2467",ed3555df:"2503","041abd93":"2535","56c5d261":"2538","82a8f848":"2561","162dcb22":"2614",fd951894:"2615","5374a44b":"2631",e23933fb:"2711",dbb49d41:"2736","3158e88a":"2755","1770ca36":"2780",f524c03d:"2893","7c3c1ac5":"2917",d54f8bf8:"2929","3c4479b4":"2965",f7aa35a1:"2976","8a738547":"2977","319b2b13":"2978",b766f0f5:"2982",cf720268:"2987","2a3ae0ae":"2995",f313d5f9:"2998","18b93cb3":"3042",f192608e:"3049","1df244d0":"3090","53bfe04a":"3146","99c970ed":"3148","2d046998":"3167","192384cd":"3211","63148a7b":"3215","100eb332":"3256","72801ac9":"3280","8aec8783":"3297","12e04edb":"3310","568b9dc5":"3320","75e2c646":"3378","3d936583":"3431","5b0acce6":"3461",b8352d9f:"3469","229ea6a0":"3491","2a6d2bba":"3501",f6c1d5d4:"3502","82fd6c76":"3503",f68ae16a:"3507","53d9c72e":"3532","886a51d0":"3552","216b8e3c":"3605","73da24cf":"3608","6de6630d":"3628","737fa906":"3639",a9ec048f:"3651",e332cb1d:"3707","68dd252e":"3731",aaacd0d9:"3734","92e6ea4e":"3761","9ad0147b":"3824",ad3736e4:"3855","377585f0":"3861",f6458d78:"3871","2f85d4d6":"3891","475b3bf7":"3906","2c20ba8f":"3932",c4cb772c:"3976","3812c5c3":"3977",b668c116:"3978",fa524c57:"3993","3806ade4":"4030","0cea9b55":"4059",f5149e68:"4076","483e0b51":"4145","7b4c0e17":"4175",c4f5d8e4:"4195",d01228a5:"4218","9af295d5":"4238","431cf2eb":"4252",e517eaf8:"4259","1c099a9f":"4286","4e09fe05":"4287",f6c4c87b:"4304","170d6be9":"4320","68eabfb5":"4331","67d28b6a":"4349","93110cb0":"4359",e64029a2:"4360",f9db2d7d:"4364","7313fd7a":"4370",bbc94b11:"4389","4ccbb70a":"4410","9fbcf557":"4432",fc7ff2a2:"4481",a7b04d77:"4510","61967a7e":"4521","971563fd":"4570",f7684d20:"4720",d886524c:"4725",dee3ecd2:"4766","82a9c3ef":"4871","18e611e2":"4946","0e9db64f":"4973",aab9af85:"5002","592484e5":"5023","397bd6ab":"5085",b008f099:"5097","7f5eb3e6":"5098",ae4e6f87:"5121",eeab08e0:"5123",e871a034:"5139","779f583b":"5191","485ca468":"5216","22fb9af5":"5240","9054cdab":"5328","382621e5":"5342",a206a9c1:"5361","78cb75ef":"5379","1ec0f80c":"5380","55586e1d":"5385",e0e5647f:"5401",a7c2807a:"5450","447118c0":"5465","7a2bfb8b":"5501",dab92480:"5503","96cef825":"5508","1d009603":"5571","5105d4d0":"5620","82f379c4":"5639",e90d91d8:"5640",f6dc22f7:"5643",b0caafe4:"5659",c6d0846e:"5681",b45e280b:"5701","9238297f":"5769",c682498f:"5805",ca3d71aa:"5826","810e374e":"5844",ded84e96:"5850",d9576928:"5852","53a76c7a":"5967","0c841c36":"6013","253ececf":"6014","84f46e05":"6027","6d6e515e":"6054","5f8084b8":"6070","7de43df3":"6083","2ce7f68b":"6144","1071fca8":"6312","355fc026":"6315","40a504e1":"6326",d6dcf287:"6329","76df9c8b":"6344","54a16d7d":"6438","37013f15":"6474","15a8891f":"6533",e382198a:"6552",e257b45f:"6554",c6778369:"6558","11505f77":"6607",a4d6bdde:"6625","5ba0794c":"6634",eb8556aa:"6659","3bf23c4e":"6668","54a01eb0":"6690","3be75469":"6749","70dae8dd":"6785","213c7fa6":"6790",f465590d:"6809",c2ed7101:"6813","9140c03f":"6814",a301c199:"6844",e69236dc:"6862","3a277c22":"6906","863f9875":"6944","6c67d5a8":"6956","3401f4b6":"6962","082a7789":"6963",b49027e7:"6972","47fd5279":"7012",d6b4fa26:"7030",acd2d654:"7041","3ac5d6b2":"7156",e44f362d:"7214","67500e9f":"7234","7a1175a9":"7352",ff13d56b:"7366","46ba6f65":"7368","8365d62c":"7370","0ca0c16a":"7400","591069a4":"7426",d7c3b9b6:"7463",d8156f77:"7465","037e4b31":"7468","61b39c60":"7470",c383d2f2:"7525","4ea8d4c2":"7559",b5e2e2d2:"7576","2c01aa76":"7619","97b157fa":"7641","7b2a378f":"7642","7c2701e5":"7671","8324e86a":"7689","682b0e8f":"7699","77707cf0":"7739",ad3bb904:"7747","88e7e176":"7756",c55a5241:"7800","4e26fbd3":"7801","5c9eac6d":"7808",b3a5b427:"7821","54dbbc63":"7827",eb6ab2a9:"7833","1a4e3797":"7920",c9c84060:"7929","663175c4":"7950","223687fe":"7964","4a4ee5ae":"8006","97dad17b":"8036","9459be10":"8082","9120eacc":"8178","1520c72c":"8223","0a516a98":"8248","0e5742b7":"8290",e1d7336f:"8303",e58ed2d9:"8306","4203f852":"8343","63293a61":"8345",b54a2cde:"8377",dc709263:"8386",f8d59dec:"8405","8045ebfb":"8418",b8464347:"8436","02e607f4":"8441","75abb2cc":"8464","5d720912":"8468","0446b87a":"8530","497c00e1":"8536","48a0db10":"8578",da95e9ed:"8594","8794441f":"8632",a1b898fb:"8655","8ad77fae":"8671",e49bebe0:"8695","15db26f2":"8703","4d2e949c":"8730","23397b1c":"8734","0168ca68":"8760","09c240ea":"8781","3c90cae9":"8815","1e80880e":"8858","5e3e81f0":"8872",fd8f0a97:"8918",dd418e11:"8946","2737d619":"8949","5a37cf0a":"8957","9d932f06":"8967","85ab98f3":"8991","562ce9c1":"8994",f26df47d:"9128","00ef3aea":"9189","025c1660":"9193",d0fee05b:"9262",eeaf0494:"9304","0610130c":"9307","4c614940":"9315",e57ce3fc:"9329","43be729b":"9357","315dbec1":"9390","5a7d5ec8":"9421",ca7fd0b3:"9432","420f0077":"9448",f151444f:"9471",b4775fe0:"9498","1be78505":"9514",b334a18e:"9555","57486b1e":"9581","80d5cd29":"9585","2f98fe09":"9610","759213d5":"9627","9786e703":"9641",cbd95619:"9661",d5a4b422:"9679","8577b3cc":"9737",d564bc96:"9750","074de6eb":"9759","0da3f339":"9796","6f38df76":"9814","14eb3368":"9817","1346a6c3":"9843",ef801d26:"9875","607d8226":"9918","6588942a":"9919",f246170c:"9921","52374bd6":"9930",e9e17c4b:"9932","0ea72b03":"9938",dbd783b0:"9943","3fd4c7ac":"9955","8a573c85":"9964","23faecc2":"9972"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(d,a)=>{var b=r.o(e,d)?e[d]:void 0;if(0!==b)if(b)a.push(b[2]);else if(/^(1303|532)$/.test(d))e[d]=0;else{var c=new Promise(((a,c)=>b=e[d]=[a,c]));a.push(b[2]=c);var f=r.p+r.u(d),t=new Error;r.l(f,(a=>{if(r.o(e,d)&&(0!==(b=e[d])&&(e[d]=void 0),b)){var c=a&&("load"===a.type?"missing":a.type),f=a&&a.target&&a.target.src;t.message="Loading chunk "+d+" failed.\n("+c+": "+f+")",t.name="ChunkLoadError",t.type=c,t.request=f,b[1](t)}}),"chunk-"+d,d)}},r.O.j=d=>0===e[d];var d=(d,a)=>{var b,c,[f,t,o]=a,n=0;if(f.some((d=>0!==e[d]))){for(b in t)r.o(t,b)&&(r.m[b]=t[b]);if(o)var i=o(r)}for(d&&d(a);n<f.length;n++)c=f[n],r.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return r.O(i)},a=self.webpackChunk=self.webpackChunk||[];a.forEach(d.bind(null,0)),a.push=d.bind(null,a.push.bind(a))})()})(); \ No newline at end of file diff --git a/docs/1.3/api/apify-call-error.html b/docs/1.3/api/apify-call-error.html index b564b54c53..9c18bbea10 100644 --- a/docs/1.3/api/apify-call-error.html +++ b/docs/1.3/api/apify-call-error.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/apify-call-error">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/apify-call-error">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyCallError</h1></header><a name="apifycallerror"></a><p>The class represents exceptions thrown by the <a href="/sdk/js/docs/1.3/api/apify#call"><code>Apify.call()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="message"><code>message</code><a href="#message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Error message</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="run"><code>run</code><a href="#run" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/actor-run"><code>ActorRun</code></a></p><p>Object representing the failed actor run.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Contains <code>"ApifyCallError"</code></p><hr><a name="exports.apifycallerror"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-apifycallerrorrun-message"><code>new ApifyCallError(run, [message])</code><a href="#new-apifycallerrorrun-message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>run</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/actor-run"><code>ActorRun</code></a></li><li><strong><code>[message]</code></strong>: <code>string</code> <code> = <!-- -->"<!-- -->The actor invoked by Apify.call() did not succeed<!-- -->"</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ApifyCallError.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#message" class="table-of-contents__link toc-highlight"><code>message</code></a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><code>run</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li></ul></li><li><a href="#new-apifycallerrorrun-message" class="table-of-contents__link toc-highlight"><code>new ApifyCallError(run, [message])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/apify-call-error">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/apify-call-error">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyCallError</h1></header><a name="apifycallerror"></a><p>The class represents exceptions thrown by the <a href="/sdk/js/docs/1.3/api/apify#call"><code>Apify.call()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="message"><code>message</code><a href="#message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Error message</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="run"><code>run</code><a href="#run" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/actor-run"><code>ActorRun</code></a></p><p>Object representing the failed actor run.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Contains <code>"ApifyCallError"</code></p><hr><a name="exports.apifycallerror"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-apifycallerrorrun-message"><code>new ApifyCallError(run, [message])</code><a href="#new-apifycallerrorrun-message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>run</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/actor-run"><code>ActorRun</code></a></li><li><strong><code>[message]</code></strong>: <code>string</code> <code> = <!-- -->"<!-- -->The actor invoked by Apify.call() did not succeed<!-- -->"</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ApifyCallError.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#message" class="table-of-contents__link toc-highlight"><code>message</code></a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><code>run</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li></ul></li><li><a href="#new-apifycallerrorrun-message" class="table-of-contents__link toc-highlight"><code>new ApifyCallError(run, [message])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/apify.html b/docs/1.3/api/apify.html index f07eef054a..d289555c2d 100644 --- a/docs/1.3/api/apify.html +++ b/docs/1.3/api/apify.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -135,8 +135,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable is set. This way it is possible to combine local and cloud storage.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/request-queue"><code>Promise<RequestQueue></code></a></p><hr><a name="opensessionpool"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyopensessionpoolsessionpooloptions"><code>Apify.openSessionPool(sessionPoolOptions)</code><a href="#apifyopensessionpoolsessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Opens a SessionPool and returns a promise resolving to an instance of the <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> class that is already initialized.</p><p>For more details and code examples, see the <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> class.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionPoolOptions</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/session-pool"><code>Promise<SessionPool></code></a></p><hr><a name="pushdata"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifypushdataitem"><code>Apify.pushData(item)</code><a href="#apifypushdataitem" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stores an object or an array of objects to the default <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> of the current actor run.</p><p>This is just a convenient shortcut for <a href="/sdk/js/docs/1.3/api/dataset#pushdata"><code>Dataset.pushData()</code></a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myValue</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>is equivalent to:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myValue</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>For more information, see <a href="/sdk/js/docs/1.3/api/apify#opendataset"><code>Apify.openDataset()</code></a> and <a href="/sdk/js/docs/1.3/api/dataset#pushdata"><code>Dataset.pushData()</code></a></p><p><strong>IMPORTANT</strong>: Make sure to use the <code>await</code> keyword when calling <code>pushData()</code>, otherwise the actor process might finish before the data are stored!</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Object or array of objects containing data to be stored in the default dataset. The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="setvalue"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifysetvaluekey-value-options"><code>Apify.setValue(key, value, [options])</code><a href="#apifysetvaluekey-value-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stores or deletes a value in the default <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a> associated with the current actor run.</p><p>This is just a convenient shortcut for <a href="/sdk/js/docs/1.3/api/key-value-store#setvalue"><code>KeyValueStore.setValue()</code></a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'OUTPUT'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>is equivalent to:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> store </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openKeyValueStore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> store</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'OUTPUT'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To get a value from the default key-value store, you can use the <a href="/sdk/js/docs/1.3/api/apify#getvalue"><code>Apify.getValue()</code></a> function.</p><p>For more information, see <a href="/sdk/js/docs/1.3/api/apify#openkeyvaluestore"><code>Apify.openKeyValueStore()</code></a> and <a href="/sdk/js/docs/1.3/api/key-value-store#getvalue"><code>KeyValueStore.getValue()</code></a>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code> - Unique record key.</li><li><strong><code>value</code></strong>: <code>*</code> - Record data, which can be one of the following values:<ul><li>If <code>null</code>, the record in the key-value store is deleted.</li><li>If no <code>options.contentType</code> is specified, <code>value</code> can be any JavaScript object and it will be stringified to JSON.</li><li>If <code>options.contentType</code> is set, <code>value</code> is taken as is and it must be a <code>String</code> or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener"><code>Buffer</code></a>. For any -other value an error will be thrown.</li></ul></li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[contentType]</code></strong>: <code>string</code> - Specifies a custom MIME content type of the record.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Apify.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Use stealth mode</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify-class" class="table-of-contents__link toc-highlight"><code>Apify</code> Class</a></li><li><a href="#apifyaddwebhookoptions" class="table-of-contents__link toc-highlight"><code>Apify.addWebhook(options)</code></a></li><li><a href="#apifycallactid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.call(actId, [input], [options])</code></a></li><li><a href="#apifycalltasktaskid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.callTask(taskId, [input], [options])</code></a></li><li><a href="#apifycreateproxyconfigurationproxyconfigurationoptions" class="table-of-contents__link toc-highlight"><code>Apify.createProxyConfiguration([proxyConfigurationOptions])</code></a></li><li><a href="#apifyevents" class="table-of-contents__link toc-highlight"><code>Apify.events</code></a></li><li><a href="#apifygetenv" class="table-of-contents__link toc-highlight"><code>Apify.getEnv()</code></a></li><li><a href="#apifygetinput" class="table-of-contents__link toc-highlight"><code>Apify.getInput()</code></a></li><li><a href="#apifygetmemoryinfo" class="table-of-contents__link toc-highlight"><code>Apify.getMemoryInfo()</code></a></li><li><a href="#apifygetvaluekey" class="table-of-contents__link toc-highlight"><code>Apify.getValue(key)</code></a></li><li><a href="#apifyisathome" class="table-of-contents__link toc-highlight"><code>Apify.isAtHome()</code></a></li><li><a href="#apifylaunchplaywrightlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPlaywright([launchContext])</code></a></li><li><a href="#apifylaunchpuppeteerlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPuppeteer([launchContext])</code></a></li><li><a href="#apifymainuserfunc" class="table-of-contents__link toc-highlight"><code>Apify.main(userFunc)</code></a></li><li><a href="#apifymetamorphtargetactorid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.metamorph(targetActorId, [input], [options])</code></a></li><li><a href="#apifynewclientoptions" class="table-of-contents__link toc-highlight"><code>Apify.newClient([options])</code></a></li><li><a href="#apifyopendatasetdatasetidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openDataset([datasetIdOrName], [options])</code></a></li><li><a href="#apifyopenkeyvaluestorestoreidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openKeyValueStore([storeIdOrName], [options])</code></a></li><li><a href="#apifyopenrequestlistlistname-sources-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestList(listName, sources, [options])</code></a></li><li><a href="#apifyopenrequestqueuequeueidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestQueue([queueIdOrName], [options])</code></a></li><li><a href="#apifyopensessionpoolsessionpooloptions" class="table-of-contents__link toc-highlight"><code>Apify.openSessionPool(sessionPoolOptions)</code></a></li><li><a href="#apifypushdataitem" class="table-of-contents__link toc-highlight"><code>Apify.pushData(item)</code></a></li><li><a href="#apifysetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>Apify.setValue(key, value, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +other value an error will be thrown.</li></ul></li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[contentType]</code></strong>: <code>string</code> - Specifies a custom MIME content type of the record.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Apify.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Use stealth mode</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify-class" class="table-of-contents__link toc-highlight"><code>Apify</code> Class</a></li><li><a href="#apifyaddwebhookoptions" class="table-of-contents__link toc-highlight"><code>Apify.addWebhook(options)</code></a></li><li><a href="#apifycallactid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.call(actId, [input], [options])</code></a></li><li><a href="#apifycalltasktaskid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.callTask(taskId, [input], [options])</code></a></li><li><a href="#apifycreateproxyconfigurationproxyconfigurationoptions" class="table-of-contents__link toc-highlight"><code>Apify.createProxyConfiguration([proxyConfigurationOptions])</code></a></li><li><a href="#apifyevents" class="table-of-contents__link toc-highlight"><code>Apify.events</code></a></li><li><a href="#apifygetenv" class="table-of-contents__link toc-highlight"><code>Apify.getEnv()</code></a></li><li><a href="#apifygetinput" class="table-of-contents__link toc-highlight"><code>Apify.getInput()</code></a></li><li><a href="#apifygetmemoryinfo" class="table-of-contents__link toc-highlight"><code>Apify.getMemoryInfo()</code></a></li><li><a href="#apifygetvaluekey" class="table-of-contents__link toc-highlight"><code>Apify.getValue(key)</code></a></li><li><a href="#apifyisathome" class="table-of-contents__link toc-highlight"><code>Apify.isAtHome()</code></a></li><li><a href="#apifylaunchplaywrightlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPlaywright([launchContext])</code></a></li><li><a href="#apifylaunchpuppeteerlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPuppeteer([launchContext])</code></a></li><li><a href="#apifymainuserfunc" class="table-of-contents__link toc-highlight"><code>Apify.main(userFunc)</code></a></li><li><a href="#apifymetamorphtargetactorid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.metamorph(targetActorId, [input], [options])</code></a></li><li><a href="#apifynewclientoptions" class="table-of-contents__link toc-highlight"><code>Apify.newClient([options])</code></a></li><li><a href="#apifyopendatasetdatasetidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openDataset([datasetIdOrName], [options])</code></a></li><li><a href="#apifyopenkeyvaluestorestoreidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openKeyValueStore([storeIdOrName], [options])</code></a></li><li><a href="#apifyopenrequestlistlistname-sources-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestList(listName, sources, [options])</code></a></li><li><a href="#apifyopenrequestqueuequeueidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestQueue([queueIdOrName], [options])</code></a></li><li><a href="#apifyopensessionpoolsessionpooloptions" class="table-of-contents__link toc-highlight"><code>Apify.openSessionPool(sessionPoolOptions)</code></a></li><li><a href="#apifypushdataitem" class="table-of-contents__link toc-highlight"><code>Apify.pushData(item)</code></a></li><li><a href="#apifysetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>Apify.setValue(key, value, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/autoscaled-pool.html b/docs/1.3/api/autoscaled-pool.html index ed38c24a96..a644cf63d6 100644 --- a/docs/1.3/api/autoscaled-pool.html +++ b/docs/1.3/api/autoscaled-pool.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -34,8 +34,8 @@ <a href="/sdk/js/docs/1.3/api/autoscaled-pool#resume"><code>AutoscaledPool.resume()</code></a></p><p>The function's promise will resolve once all running tasks have completed and the pool is effectively idle. If the <code>timeoutSecs</code> argument is provided, the promise will reject with a timeout error after the <code>timeoutSecs</code> seconds.</p><p>The promise returned from the <a href="/sdk/js/docs/1.3/api/autoscaled-pool#run"><code>AutoscaledPool.run()</code></a> function will not resolve when <code>.pause()</code> is invoked (unlike abort, which resolves it).</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[timeoutSecs]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="resume"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpoolresume"><code>autoscaledPool.resume()</code><a href="#autoscaledpoolresume" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Resumes the operation of the autoscaled-pool by allowing more tasks to be run. Used together with -<a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a></p><p>Tasks will automatically start running again in <code>options.maybeRunIntervalSecs</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/AutoscaledPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/key-value-store"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>new AutoscaledPool(options)</code></a></li><li><a href="#autoscaledpoollog" class="table-of-contents__link toc-highlight"><code>autoscaledPool.log</code></a></li><li><a href="#autoscaledpoolminconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolminconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpoolcurrentconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.currentConcurrency</code></a></li><li><a href="#autoscaledpoolrun" class="table-of-contents__link toc-highlight"><code>autoscaledPool.run()</code></a></li><li><a href="#autoscaledpoolabort" class="table-of-contents__link toc-highlight"><code>autoscaledPool.abort()</code></a></li><li><a href="#autoscaledpoolpausetimeoutsecs" class="table-of-contents__link toc-highlight"><code>autoscaledPool.pause([timeoutSecs])</code></a></li><li><a href="#autoscaledpoolresume" class="table-of-contents__link toc-highlight"><code>autoscaledPool.resume()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a></p><p>Tasks will automatically start running again in <code>options.maybeRunIntervalSecs</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/AutoscaledPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/key-value-store"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>new AutoscaledPool(options)</code></a></li><li><a href="#autoscaledpoollog" class="table-of-contents__link toc-highlight"><code>autoscaledPool.log</code></a></li><li><a href="#autoscaledpoolminconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolminconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpoolcurrentconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.currentConcurrency</code></a></li><li><a href="#autoscaledpoolrun" class="table-of-contents__link toc-highlight"><code>autoscaledPool.run()</code></a></li><li><a href="#autoscaledpoolabort" class="table-of-contents__link toc-highlight"><code>autoscaledPool.abort()</code></a></li><li><a href="#autoscaledpoolpausetimeoutsecs" class="table-of-contents__link toc-highlight"><code>autoscaledPool.pause([timeoutSecs])</code></a></li><li><a href="#autoscaledpoolresume" class="table-of-contents__link toc-highlight"><code>autoscaledPool.resume()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/basic-crawler.html b/docs/1.3/api/basic-crawler.html index 64406801f9..f0fe5a510c 100644 --- a/docs/1.3/api/basic-crawler.html +++ b/docs/1.3/api/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -33,8 +33,8 @@ used by the crawler.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>A reference to the underlying <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/1.3/api/basic-crawler#run"><code>BasicCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling -<a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="exports.basiccrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-basiccrawleroptions"><code>new BasicCrawler(options)</code><a href="#new-basiccrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/basic-crawler-options"><code>BasicCrawlerOptions</code></a> - All <code>BasicCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="log"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerlog"><code>basicCrawler.log</code><a href="#basiccrawlerlog" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="sessionpooloptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlersessionpooloptions"><code>basicCrawler.sessionPoolOptions</code><a href="#basiccrawlersessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="run"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerrun"><code>basicCrawler.run()</code><a href="#basiccrawlerrun" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Runs the crawler. Returns a promise that gets resolved once all the requests are processed.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BasicCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-basiccrawleroptions" class="table-of-contents__link toc-highlight"><code>new BasicCrawler(options)</code></a></li><li><a href="#basiccrawlerlog" class="table-of-contents__link toc-highlight"><code>basicCrawler.log</code></a></li><li><a href="#basiccrawlersessionpooloptions" class="table-of-contents__link toc-highlight"><code>basicCrawler.sessionPoolOptions</code></a></li><li><a href="#basiccrawlerrun" class="table-of-contents__link toc-highlight"><code>basicCrawler.run()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="exports.basiccrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-basiccrawleroptions"><code>new BasicCrawler(options)</code><a href="#new-basiccrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/basic-crawler-options"><code>BasicCrawlerOptions</code></a> - All <code>BasicCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="log"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerlog"><code>basicCrawler.log</code><a href="#basiccrawlerlog" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="sessionpooloptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlersessionpooloptions"><code>basicCrawler.sessionPoolOptions</code><a href="#basiccrawlersessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="run"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerrun"><code>basicCrawler.run()</code><a href="#basiccrawlerrun" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Runs the crawler. Returns a promise that gets resolved once all the requests are processed.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BasicCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-basiccrawleroptions" class="table-of-contents__link toc-highlight"><code>new BasicCrawler(options)</code></a></li><li><a href="#basiccrawlerlog" class="table-of-contents__link toc-highlight"><code>basicCrawler.log</code></a></li><li><a href="#basiccrawlersessionpooloptions" class="table-of-contents__link toc-highlight"><code>basicCrawler.sessionPoolOptions</code></a></li><li><a href="#basiccrawlerrun" class="table-of-contents__link toc-highlight"><code>basicCrawler.run()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/browser-plugin.html b/docs/1.3/api/browser-plugin.html index 58c823b6e5..43b8acc196 100644 --- a/docs/1.3/api/browser-plugin.html +++ b/docs/1.3/api/browser-plugin.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/browser-plugin">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/browser-plugin">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserPlugin</h1></header><a name="browserplugin"></a><hr><a name="exports.browserplugin"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-browserpluginlauncher-context"><code>new BrowserPlugin(launcher, context)</code><a href="#new-browserpluginlauncher-context" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>launcher</code></strong>: <code>*</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BrowserPlugin.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-browserpluginlauncher-context" class="table-of-contents__link toc-highlight"><code>new BrowserPlugin(launcher, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/browser-plugin">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/browser-plugin">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserPlugin</h1></header><a name="browserplugin"></a><hr><a name="exports.browserplugin"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-browserpluginlauncher-context"><code>new BrowserPlugin(launcher, context)</code><a href="#new-browserpluginlauncher-context" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>launcher</code></strong>: <code>*</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/BrowserPlugin.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-browserpluginlauncher-context" class="table-of-contents__link toc-highlight"><code>new BrowserPlugin(launcher, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/cheerio-crawler.html b/docs/1.3/api/cheerio-crawler.html index f0ff9ab003..71fac4d3a2 100644 --- a/docs/1.3/api/cheerio-crawler.html +++ b/docs/1.3/api/cheerio-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -42,8 +42,8 @@ the crawler.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>A reference to the underlying <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/1.3/api/cheerio-crawler#run"><code>CheerioCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling -<a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="cheeriocrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-cheeriocrawleroptions"><code>new CheerioCrawler(options)</code><a href="#new-cheeriocrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"><code>CheerioCrawlerOptions</code></a> - All <code>CheerioCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="prenavigationhooks"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawlerprenavigationhooks"><code>cheerioCrawler.preNavigationHooks</code><a href="#cheeriocrawlerprenavigationhooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="postnavigationhooks"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawlerpostnavigationhooks"><code>cheerioCrawler.postNavigationHooks</code><a href="#cheeriocrawlerpostnavigationhooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="defaultrequestasbrowseroptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawlerdefaultrequestasbrowseroptions"><code>cheerioCrawler.defaultRequestAsBrowserOptions</code><a href="#cheeriocrawlerdefaultrequestasbrowseroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="use"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawleruseextension"><code>cheerioCrawler.use(extension)</code><a href="#cheeriocrawleruseextension" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>EXPERIMENTAL</strong> Function for attaching CrawlerExtensions such as the Unblockers.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>extension</code></strong>: <code>CrawlerExtension</code> - Crawler extension that overrides the crawler configuration.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/CheerioCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-cheeriocrawleroptions" class="table-of-contents__link toc-highlight"><code>new CheerioCrawler(options)</code></a></li><li><a href="#cheeriocrawlerprenavigationhooks" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.preNavigationHooks</code></a></li><li><a href="#cheeriocrawlerpostnavigationhooks" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.postNavigationHooks</code></a></li><li><a href="#cheeriocrawlerdefaultrequestasbrowseroptions" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.defaultRequestAsBrowserOptions</code></a></li><li><a href="#cheeriocrawleruseextension" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.use(extension)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="cheeriocrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-cheeriocrawleroptions"><code>new CheerioCrawler(options)</code><a href="#new-cheeriocrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"><code>CheerioCrawlerOptions</code></a> - All <code>CheerioCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="prenavigationhooks"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawlerprenavigationhooks"><code>cheerioCrawler.preNavigationHooks</code><a href="#cheeriocrawlerprenavigationhooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="postnavigationhooks"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawlerpostnavigationhooks"><code>cheerioCrawler.postNavigationHooks</code><a href="#cheeriocrawlerpostnavigationhooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="defaultrequestasbrowseroptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawlerdefaultrequestasbrowseroptions"><code>cheerioCrawler.defaultRequestAsBrowserOptions</code><a href="#cheeriocrawlerdefaultrequestasbrowseroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="use"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawleruseextension"><code>cheerioCrawler.use(extension)</code><a href="#cheeriocrawleruseextension" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>EXPERIMENTAL</strong> Function for attaching CrawlerExtensions such as the Unblockers.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>extension</code></strong>: <code>CrawlerExtension</code> - Crawler extension that overrides the crawler configuration.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/CheerioCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-cheeriocrawleroptions" class="table-of-contents__link toc-highlight"><code>new CheerioCrawler(options)</code></a></li><li><a href="#cheeriocrawlerprenavigationhooks" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.preNavigationHooks</code></a></li><li><a href="#cheeriocrawlerpostnavigationhooks" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.postNavigationHooks</code></a></li><li><a href="#cheeriocrawlerdefaultrequestasbrowseroptions" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.defaultRequestAsBrowserOptions</code></a></li><li><a href="#cheeriocrawleruseextension" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.use(extension)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/configuration.html b/docs/1.3/api/configuration.html index ffd10cd9b4..b81157f861 100644 --- a/docs/1.3/api/configuration.html +++ b/docs/1.3/api/configuration.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -27,8 +27,8 @@ <strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[storageDir]</code></strong>: <code>string</code></li><li><strong><code>[enableWalMode]</code></strong>: <code>boolean</code> <code> = true</code></li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/apify"><code>ApifyStorageLocal</code></a></p><hr><a name="createclient"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configurationcreateclientoptions"><code>configuration.createClient([options])</code><a href="#configurationcreateclientoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Creates an instance of ApifyClient using options as defined in the environment variables or in this <code>Configuration</code> instance.</p><p><strong>Internal</strong>: <strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[token]</code></strong>: <code>string</code></li><li><strong><code>[maxRetries]</code></strong>: <code>string</code></li><li><strong><code>[minDelayBetweenRetriesMillis]</code></strong>: <code>string</code></li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/apify"><code>ApifyClient</code></a></p><hr><a name="createstoragelocal"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configurationcreatestoragelocaloptions"><code>configuration.createStorageLocal([options])</code><a href="#configurationcreatestoragelocaloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Creates an instance of ApifyStorageLocal using options as defined in the environment variables or in this <code>Configuration</code> instance.</p><p><strong>Internal</strong>: <strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[storageDir]</code></strong>: <code>string</code></li><li><strong><code>[enableWalMode]</code></strong>: <code>boolean</code> <code> = true</code></li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/apify"><code>ApifyStorageLocal</code></a></p><hr><a name="getglobalconfig"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configurationgetglobalconfig"><code>Configuration.getGlobalConfig()</code><a href="#configurationgetglobalconfig" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the global configuration instance. It will respect the environment variables. As opposed to this method, we can also get the SDK instance -configuration via <code>sdk.config</code> property.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/configuration"><code>Configuration</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Configuration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/apify"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#supported-configuration-options" class="table-of-contents__link toc-highlight">Supported Configuration Options</a></li><li><a href="#advanced-configuration-options" class="table-of-contents__link toc-highlight">Advanced Configuration Options</a></li><li><a href="#not-supported-environment-variables" class="table-of-contents__link toc-highlight">Not Supported environment variables</a></li><li><a href="#new-configurationoptions" class="table-of-contents__link toc-highlight"><code>new Configuration(options)</code></a></li><li><a href="#configurationgetkey-defaultvalue" class="table-of-contents__link toc-highlight"><code>configuration.get(key, [defaultValue])</code></a></li><li><a href="#configurationsetkey-value" class="table-of-contents__link toc-highlight"><code>configuration.set(key, [value])</code></a></li><li><a href="#configurationgetclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.getClient([options])</code></a></li><li><a href="#configurationgetstoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.getStorageLocal([options])</code></a></li><li><a href="#configurationcreateclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.createClient([options])</code></a></li><li><a href="#configurationcreatestoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.createStorageLocal([options])</code></a></li><li><a href="#configurationgetglobalconfig" class="table-of-contents__link toc-highlight"><code>Configuration.getGlobalConfig()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +configuration via <code>sdk.config</code> property.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/configuration"><code>Configuration</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Configuration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/apify"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#supported-configuration-options" class="table-of-contents__link toc-highlight">Supported Configuration Options</a></li><li><a href="#advanced-configuration-options" class="table-of-contents__link toc-highlight">Advanced Configuration Options</a></li><li><a href="#not-supported-environment-variables" class="table-of-contents__link toc-highlight">Not Supported environment variables</a></li><li><a href="#new-configurationoptions" class="table-of-contents__link toc-highlight"><code>new Configuration(options)</code></a></li><li><a href="#configurationgetkey-defaultvalue" class="table-of-contents__link toc-highlight"><code>configuration.get(key, [defaultValue])</code></a></li><li><a href="#configurationsetkey-value" class="table-of-contents__link toc-highlight"><code>configuration.set(key, [value])</code></a></li><li><a href="#configurationgetclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.getClient([options])</code></a></li><li><a href="#configurationgetstoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.getStorageLocal([options])</code></a></li><li><a href="#configurationcreateclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.createClient([options])</code></a></li><li><a href="#configurationcreatestoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.createStorageLocal([options])</code></a></li><li><a href="#configurationgetglobalconfig" class="table-of-contents__link toc-highlight"><code>Configuration.getGlobalConfig()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/dataset.html b/docs/1.3/api/dataset.html index 9c80073891..bf1420d1d1 100644 --- a/docs/1.3/api/dataset.html +++ b/docs/1.3/api/dataset.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -42,8 +42,8 @@ <code>forEach</code> function throws the error.</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-results'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">item</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Item at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation known-class-name class-name">JSON</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation method function property-access" style="color:#d73a49">stringify</span><span class="token template-string interpolation punctuation" style="color:#393A34">(</span><span class="token template-string interpolation">item</span><span class="token template-string interpolation punctuation" style="color:#393A34">)</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/dataset-consumer"><code>DatasetConsumer</code></a> - A function that is called for every item in the dataset.</li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>forEach()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by <code>createdAt</code> in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys.</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li><li><strong><code>[index]</code></strong>: <code>number</code> <code> = 0</code> - Specifies the initial index number passed to the <code>iteratee</code> function.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="map"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetmapiteratee-options"><code>dataset.map(iteratee, [options])</code><a href="#datasetmapiteratee-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Produces a new array of values by mapping each value in list through a transformation function <code>iteratee()</code>. Each invocation of <code>iteratee()</code> is called with two arguments: <code>(element, index)</code>.</p><p>If <code>iteratee</code> returns a <code>Promise</code> then it's awaited before a next call.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/dataset-mapper"><code>DatasetMapper</code></a></li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>map()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by createdAt in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<Array<object>></code></p><hr><a name="reduce"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetreduceiteratee-memo-options"><code>dataset.reduce(iteratee, memo, [options])</code><a href="#datasetreduceiteratee-memo-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Reduces a list of values down to a single value.</p><p>Memo is the initial state of the reduction, and each successive step of it should be returned by <code>iteratee()</code>. The <code>iteratee()</code> is passed three arguments: the <code>memo</code>, then the <code>value</code> and <code>index</code> of the iteration.</p><p>If no <code>memo</code> is passed to the initial invocation of reduce, the <code>iteratee()</code> is not invoked on the first element of the list. The first element is -instead passed as the memo in the invocation of the <code>iteratee()</code> on the next element in the list.</p><p>If <code>iteratee()</code> returns a <code>Promise</code> then it's awaited before a next call.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/dataset-reducer"><code>DatasetReducer</code></a></li><li><strong><code>memo</code></strong>: <code>object</code> - Initial state of the reduction.</li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>reduce()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by createdAt in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<object></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetdrop"><code>dataset.drop()</code><a href="#datasetdrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/statistics"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Statistics</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/key-value-store"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#datasetpushdatadata" class="table-of-contents__link toc-highlight"><code>dataset.pushData(data)</code></a></li><li><a href="#datasetgetdataoptions" class="table-of-contents__link toc-highlight"><code>dataset.getData([options])</code></a></li><li><a href="#datasetgetinfo" class="table-of-contents__link toc-highlight"><code>dataset.getInfo()</code></a></li><li><a href="#datasetforeachiteratee-options-index" class="table-of-contents__link toc-highlight"><code>dataset.forEach(iteratee, [options], [index])</code></a></li><li><a href="#datasetmapiteratee-options" class="table-of-contents__link toc-highlight"><code>dataset.map(iteratee, [options])</code></a></li><li><a href="#datasetreduceiteratee-memo-options" class="table-of-contents__link toc-highlight"><code>dataset.reduce(iteratee, memo, [options])</code></a></li><li><a href="#datasetdrop" class="table-of-contents__link toc-highlight"><code>dataset.drop()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +instead passed as the memo in the invocation of the <code>iteratee()</code> on the next element in the list.</p><p>If <code>iteratee()</code> returns a <code>Promise</code> then it's awaited before a next call.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/dataset-reducer"><code>DatasetReducer</code></a></li><li><strong><code>memo</code></strong>: <code>object</code> - Initial state of the reduction.</li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>reduce()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by createdAt in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<object></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetdrop"><code>dataset.drop()</code><a href="#datasetdrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/statistics"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Statistics</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/key-value-store"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#datasetpushdatadata" class="table-of-contents__link toc-highlight"><code>dataset.pushData(data)</code></a></li><li><a href="#datasetgetdataoptions" class="table-of-contents__link toc-highlight"><code>dataset.getData([options])</code></a></li><li><a href="#datasetgetinfo" class="table-of-contents__link toc-highlight"><code>dataset.getInfo()</code></a></li><li><a href="#datasetforeachiteratee-options-index" class="table-of-contents__link toc-highlight"><code>dataset.forEach(iteratee, [options], [index])</code></a></li><li><a href="#datasetmapiteratee-options" class="table-of-contents__link toc-highlight"><code>dataset.map(iteratee, [options])</code></a></li><li><a href="#datasetreduceiteratee-memo-options" class="table-of-contents__link toc-highlight"><code>dataset.reduce(iteratee, memo, [options])</code></a></li><li><a href="#datasetdrop" class="table-of-contents__link toc-highlight"><code>dataset.drop()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/key-value-store.html b/docs/1.3/api/key-value-store.html index 1579a7b1f1..0ad78030b6 100644 --- a/docs/1.3/api/key-value-store.html +++ b/docs/1.3/api/key-value-store.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -38,8 +38,8 @@ other value an error will be thrown.</li></ul></li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[contentType]</code></strong>: <code>string</code> - Specifies a custom MIME content type of the record.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="keyvaluestoredrop"><code>keyValueStore.drop()</code><a href="#keyvaluestoredrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the key-value store either from the Apify cloud storage or from the local directory, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="getpublicurl"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="keyvaluestoregetpublicurlkey"><code>keyValueStore.getPublicUrl(key)</code><a href="#keyvaluestoregetpublicurlkey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a URL for the given key that may be used to publicly access the value in the remote key-value store.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code></p><hr><a name="foreachkey"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="keyvaluestoreforeachkeyiteratee-options"><code>keyValueStore.forEachKey(iteratee, [options])</code><a href="#keyvaluestoreforeachkeyiteratee-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Iterates over key-value store keys, yielding each in turn to an <code>iteratee</code> function. Each invocation of <code>iteratee</code> is called with three arguments: <code>(key, index, info)</code>, where <code>key</code> is the record key, <code>index</code> is a zero-based index of the key in the current iteration (regardless of <code>options.exclusiveStartKey</code>) and <code>info</code> is an object that contains a single property <code>size</code> indicating size of the record in bytes.</p><p>If the <code>iteratee</code> function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the -<code>forEachKey</code> function throws the error.</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> keyValueStore </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openKeyValueStore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> keyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEachKey</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">key</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Key at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">key</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> has size </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">info</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">size</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/key-consumer"><code>KeyConsumer</code></a> - A function that is called for every key in the key-value store.</li><li><strong><code>[options]</code></strong>: <code>object</code> - All <code>forEachKey()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[exclusiveStartKey]</code></strong>: <code>string</code> - All keys up to this one (including) are skipped from the result.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/KeyValueStore.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#keyvaluestoregetvaluekey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getValue(key)</code></a></li><li><a href="#keyvaluestoresetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.setValue(key, value, [options])</code></a></li><li><a href="#keyvaluestoredrop" class="table-of-contents__link toc-highlight"><code>keyValueStore.drop()</code></a></li><li><a href="#keyvaluestoregetpublicurlkey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getPublicUrl(key)</code></a></li><li><a href="#keyvaluestoreforeachkeyiteratee-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.forEachKey(iteratee, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>forEachKey</code> function throws the error.</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> keyValueStore </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openKeyValueStore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> keyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEachKey</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">key</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Key at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">key</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> has size </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">info</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">size</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/key-consumer"><code>KeyConsumer</code></a> - A function that is called for every key in the key-value store.</li><li><strong><code>[options]</code></strong>: <code>object</code> - All <code>forEachKey()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[exclusiveStartKey]</code></strong>: <code>string</code> - All keys up to this one (including) are skipped from the result.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/KeyValueStore.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#keyvaluestoregetvaluekey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getValue(key)</code></a></li><li><a href="#keyvaluestoresetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.setValue(key, value, [options])</code></a></li><li><a href="#keyvaluestoredrop" class="table-of-contents__link toc-highlight"><code>keyValueStore.drop()</code></a></li><li><a href="#keyvaluestoregetpublicurlkey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getPublicUrl(key)</code></a></li><li><a href="#keyvaluestoreforeachkeyiteratee-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.forEachKey(iteratee, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/log.html b/docs/1.3/api/log.html index 3fa81306e8..db149b865a 100644 --- a/docs/1.3/api/log.html +++ b/docs/1.3/api/log.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -28,8 +28,8 @@ message.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="info"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="loginfomessage-data"><code>log.info(message, [data])</code><a href="#loginfomessage-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs an <code>INFO</code> message. <code>INFO</code> is the default log level so info messages will be always logged, unless the log level is changed. Data are stringified and appended to the message.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="warning"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logwarningmessage-data"><code>log.warning(message, [data])</code><a href="#logwarningmessage-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs a <code>WARNING</code> level message. Data are stringified and appended to the message.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="error"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logerrormessage-data"><code>log.error(message, [data])</code><a href="#logerrormessage-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs an <code>ERROR</code> message. Use this method to log error messages that are not directly connected to an exception. For logging exceptions, use the <code>log.exception</code> method.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="exception"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logexceptionexception-message-data"><code>log.exception(exception, [message], [data])</code><a href="#logexceptionexception-message-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs an <code>ERROR</code> level message with a nicely formatted exception. Note that the exception is the first parameter here and an additional message is only -optional.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>exception</code></strong>: <code>Error</code></li><li><strong><code>[message]</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/log.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/utils"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/playwright"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.playwright</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#loglevels" class="table-of-contents__link toc-highlight"><code>log.LEVELS</code></a></li><li><a href="#logsetlevellevel" class="table-of-contents__link toc-highlight"><code>log.setLevel(level)</code></a></li><li><a href="#loggetlevel" class="table-of-contents__link toc-highlight"><code>log.getLevel()</code></a></li><li><a href="#logsetoptionsoptions" class="table-of-contents__link toc-highlight"><code>log.setOptions(options)</code></a></li><li><a href="#logchildoptions" class="table-of-contents__link toc-highlight"><code>log.child([options])</code></a></li><li><a href="#loggetoptions" class="table-of-contents__link toc-highlight"><code>log.getOptions()</code></a></li><li><a href="#logdebugmessage-data" class="table-of-contents__link toc-highlight"><code>log.debug(message, [data])</code></a></li><li><a href="#loginfomessage-data" class="table-of-contents__link toc-highlight"><code>log.info(message, [data])</code></a></li><li><a href="#logwarningmessage-data" class="table-of-contents__link toc-highlight"><code>log.warning(message, [data])</code></a></li><li><a href="#logerrormessage-data" class="table-of-contents__link toc-highlight"><code>log.error(message, [data])</code></a></li><li><a href="#logexceptionexception-message-data" class="table-of-contents__link toc-highlight"><code>log.exception(exception, [message], [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +optional.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>exception</code></strong>: <code>Error</code></li><li><strong><code>[message]</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/log.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/utils"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/playwright"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.playwright</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#loglevels" class="table-of-contents__link toc-highlight"><code>log.LEVELS</code></a></li><li><a href="#logsetlevellevel" class="table-of-contents__link toc-highlight"><code>log.setLevel(level)</code></a></li><li><a href="#loggetlevel" class="table-of-contents__link toc-highlight"><code>log.getLevel()</code></a></li><li><a href="#logsetoptionsoptions" class="table-of-contents__link toc-highlight"><code>log.setOptions(options)</code></a></li><li><a href="#logchildoptions" class="table-of-contents__link toc-highlight"><code>log.child([options])</code></a></li><li><a href="#loggetoptions" class="table-of-contents__link toc-highlight"><code>log.getOptions()</code></a></li><li><a href="#logdebugmessage-data" class="table-of-contents__link toc-highlight"><code>log.debug(message, [data])</code></a></li><li><a href="#loginfomessage-data" class="table-of-contents__link toc-highlight"><code>log.info(message, [data])</code></a></li><li><a href="#logwarningmessage-data" class="table-of-contents__link toc-highlight"><code>log.warning(message, [data])</code></a></li><li><a href="#logerrormessage-data" class="table-of-contents__link toc-highlight"><code>log.error(message, [data])</code></a></li><li><a href="#logexceptionexception-message-data" class="table-of-contents__link toc-highlight"><code>log.exception(exception, [message], [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/playwright-crawler.html b/docs/1.3/api/playwright-crawler.html index 2f8d644b2e..ac54c2ed42 100644 --- a/docs/1.3/api/playwright-crawler.html +++ b/docs/1.3/api/playwright-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -39,8 +39,8 @@ only initialized after calling the <a href="/sdk/js/docs/1.3/api/cheerio-crawler#run"><code>CheerioCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="playwrightcrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-playwrightcrawleroptions"><code>new PlaywrightCrawler(options)</code><a href="#new-playwrightcrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options"><code>PlaywrightCrawlerOptions</code></a> - All <code>PlaywrightCrawler</code> parameters are passed via an options -object.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PlaywrightCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-playwrightcrawleroptions" class="table-of-contents__link toc-highlight"><code>new PlaywrightCrawler(options)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +object.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PlaywrightCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-playwrightcrawleroptions" class="table-of-contents__link toc-highlight"><code>new PlaywrightCrawler(options)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/playwright.html b/docs/1.3/api/playwright.html index 3150013739..4c94d50fe4 100644 --- a/docs/1.3/api/playwright.html +++ b/docs/1.3/api/playwright.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/playwright">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/playwright">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify">Apify</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/configuration">Configuration</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/basic-crawler">Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/dataset">Result Stores</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/autoscaled-pool">Scaling</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/request">Sources</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/api/utils">Utilities</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/utils">utils</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/log">utils.log</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/api/playwright">utils.playwright</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/puppeteer">utils.puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/social">utils.social</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">API Reference</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Utilities</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>utils.playwright</h1></header><a name="playwright"></a><p>A namespace that contains various utilities for <a href="https://github.com/microsoft/playwright" target="_blank" rel="noopener">Playwright</a> - the headless Chrome Node API.</p><p><strong>Example usage:</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> playwright </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to https://www.example.com in Playwright with a POST request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">gotoExtended</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> 'https</span><span class="token operator" style="color:#393A34">:</span><span class="token operator" style="color:#393A34">/</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">example</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">com</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">method</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'POST'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><a name="gotoextended"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="playwrightgotoextended"><code>playwright.gotoExtended</code><a href="#playwrightgotoextended" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Extended version of Playwright's <code>page.goto()</code> allowing to perform requests with HTTP method other than GET, with custom headers and POST payload. URL, method, headers and payload are taken from request parameter that must be an instance of Apify.Request class.</p><p><em>NOTE:</em> In recent versions of Playwright using requests other than GET, overriding headers and adding payloads disables browser cache which degrades -performance.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code> - Puppeteer <a href="https://playwright.dev/docs/api/class-page" target="_blank" rel="noopener"><code>Page</code></a> object.</li><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></li><li><strong><code>[gotoOptions]</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/direct-navigation-options"><code>DirectNavigationOptions</code></a> - Custom options for <code>page.goto()</code>.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<(Response|null)></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/playwright.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/log"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.log</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/puppeteer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.puppeteer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#playwrightgotoextended" class="table-of-contents__link toc-highlight"><code>playwright.gotoExtended</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +performance.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code> - Puppeteer <a href="https://playwright.dev/docs/api/class-page" target="_blank" rel="noopener"><code>Page</code></a> object.</li><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></li><li><strong><code>[gotoOptions]</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/direct-navigation-options"><code>DirectNavigationOptions</code></a> - Custom options for <code>page.goto()</code>.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<(Response|null)></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/playwright.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/log"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.log</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/puppeteer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.puppeteer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#playwrightgotoextended" class="table-of-contents__link toc-highlight"><code>playwright.gotoExtended</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/proxy-configuration.html b/docs/1.3/api/proxy-configuration.html index 9fbfe01847..071abfad71 100644 --- a/docs/1.3/api/proxy-configuration.html +++ b/docs/1.3/api/proxy-configuration.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -31,8 +31,8 @@ <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> or you can use the Apify Proxy <a href="https://docs.apify.com/proxy#sessions" target="_blank" rel="noopener">Session</a> identifier. When the provided sessionId is a number, it's converted to a string.</li></ul><p>All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p><p><strong>Returns</strong>:</p><p><code>string</code> - A string with a proxy URL, including authentication credentials and port number. For example, -<code>http://bob:password123@proxy.example.com:8000</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ProxyConfiguration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/session-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/snapshotter"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Snapshotter</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#proxyconfigurationinitialize" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.initialize()</code></a></li><li><a href="#proxyconfigurationnewproxyinfosessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newProxyInfo([sessionId])</code></a></li><li><a href="#proxyconfigurationnewurlsessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newUrl([sessionId])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>http://bob:password123@proxy.example.com:8000</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/ProxyConfiguration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/session-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/snapshotter"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Snapshotter</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#proxyconfigurationinitialize" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.initialize()</code></a></li><li><a href="#proxyconfigurationnewproxyinfosessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newProxyInfo([sessionId])</code></a></li><li><a href="#proxyconfigurationnewurlsessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newUrl([sessionId])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/pseudo-url.html b/docs/1.3/api/pseudo-url.html index edab04d675..e5045a2ce6 100644 --- a/docs/1.3/api/pseudo-url.html +++ b/docs/1.3/api/pseudo-url.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ such as making the matching case sensitive.</li><li><strong><code>requestTemplate</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/request-options"><code>RequestOptions</code></a> - Options for the new <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> instances created for matching URLs by the <a href="/sdk/js/docs/1.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a> function.</li></ul><hr><a name="matches"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="pseudourlmatchesurl"><code>pseudoUrl.matches(url)</code><a href="#pseudourlmatchesurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Determines whether a URL matches this pseudo-URL pattern.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code> - URL to be matched.</li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code> - Returns <code>true</code> if given URL matches pseudo-URL.</p><hr><a name="createrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="pseudourlcreaterequesturlorprops"><code>pseudoUrl.createRequest(urlOrProps)</code><a href="#pseudourlcreaterequesturlorprops" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Creates a Request object from a provided <code>requestTemplate</code> and a given URL or an object that specifies \$<a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> properties. In case of a collision the properties will override the template, except for <code>userData</code>, which will be merged together, with the <code>userData</code> property -having preference over the template. This enables dynamic overriding of the template.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>urlOrProps</code></strong>: <code>string</code> | <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PseudoUrl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/request-queue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/utils"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-pseudourlpurl-requesttemplate" class="table-of-contents__link toc-highlight"><code>new PseudoUrl(purl, requestTemplate)</code></a></li><li><a href="#pseudourlmatchesurl" class="table-of-contents__link toc-highlight"><code>pseudoUrl.matches(url)</code></a></li><li><a href="#pseudourlcreaterequesturlorprops" class="table-of-contents__link toc-highlight"><code>pseudoUrl.createRequest(urlOrProps)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +having preference over the template. This enables dynamic overriding of the template.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>urlOrProps</code></strong>: <code>string</code> | <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PseudoUrl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/request-queue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/utils"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-pseudourlpurl-requesttemplate" class="table-of-contents__link toc-highlight"><code>new PseudoUrl(purl, requestTemplate)</code></a></li><li><a href="#pseudourlmatchesurl" class="table-of-contents__link toc-highlight"><code>pseudoUrl.matches(url)</code></a></li><li><a href="#pseudourlcreaterequesturlorprops" class="table-of-contents__link toc-highlight"><code>pseudoUrl.createRequest(urlOrProps)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/puppeteer-crawler.html b/docs/1.3/api/puppeteer-crawler.html index 8c27f6a9bd..c55ee6a65e 100644 --- a/docs/1.3/api/puppeteer-crawler.html +++ b/docs/1.3/api/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -37,8 +37,8 @@ only initialized after calling the <a href="/sdk/js/docs/1.3/api/cheerio-crawler#run"><code>CheerioCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="puppeteercrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-puppeteercrawleroptions"><code>new PuppeteerCrawler(options)</code><a href="#new-puppeteercrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"><code>PuppeteerCrawlerOptions</code></a> - All <code>PuppeteerCrawler</code> parameters are passed via an options -object.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/statistics"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Statistics</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-puppeteercrawleroptions" class="table-of-contents__link toc-highlight"><code>new PuppeteerCrawler(options)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +object.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/statistics"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Statistics</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-puppeteercrawleroptions" class="table-of-contents__link toc-highlight"><code>new PuppeteerCrawler(options)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/puppeteer-pool.html b/docs/1.3/api/puppeteer-pool.html index 1baf6fe54c..c8f7c0ebdf 100644 --- a/docs/1.3/api/puppeteer-pool.html +++ b/docs/1.3/api/puppeteer-pool.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ one of the available browsers when no idle pages are available.</p><p>To spawn a new browser tab for each page, set the <code>reusePages</code> constructor option to false.</p><p><strong>Returns</strong>:</p><p><code>Promise<Page></code></p><hr><a name="destroy"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpooldestroy"><code>puppeteerPool.destroy()</code><a href="#puppeteerpooldestroy" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Closes all open browsers.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="retire"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpoolretirebrowser"><code>puppeteerPool.retire(browser)</code><a href="#puppeteerpoolretirebrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Manually retires a Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-browser" target="_blank" rel="noopener"><code>Browser</code></a> instance from the pool. The browser will continue to process open pages so that they may gracefully finish. This is unlike <code>browser.close()</code> which will forcibly terminate the browser and all open pages will be closed.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>browser</code></strong>: <code>Browser</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="recyclepage"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpoolrecyclepagepage"><code>puppeteerPool.recyclePage(page)</code><a href="#puppeteerpoolrecyclepagepage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Closes the page, unless the <code>reuseTabs</code> option is set to true. Then it would only flag the page for a future reuse, without actually closing it.</p><p>NOTE: LiveView snapshotting is tied to this function. When <code>useLiveView</code> option is set to true, a snapshot of the page will be taken just before -closing the page or flagging it for reuse.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="serveliveviewsnapshot"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpoolserveliveviewsnapshotpage"><code>puppeteerPool.serveLiveViewSnapshot(page)</code><a href="#puppeteerpoolserveliveviewsnapshotpage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Tells the connected LiveViewServer to serve a snapshot when available.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-puppeteerpooloptions" class="table-of-contents__link toc-highlight"><code>new PuppeteerPool([options])</code></a></li><li><a href="#puppeteerpoolnewpage" class="table-of-contents__link toc-highlight"><code>puppeteerPool.newPage()</code></a></li><li><a href="#puppeteerpooldestroy" class="table-of-contents__link toc-highlight"><code>puppeteerPool.destroy()</code></a></li><li><a href="#puppeteerpoolretirebrowser" class="table-of-contents__link toc-highlight"><code>puppeteerPool.retire(browser)</code></a></li><li><a href="#puppeteerpoolrecyclepagepage" class="table-of-contents__link toc-highlight"><code>puppeteerPool.recyclePage(page)</code></a></li><li><a href="#puppeteerpoolserveliveviewsnapshotpage" class="table-of-contents__link toc-highlight"><code>puppeteerPool.serveLiveViewSnapshot(page)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +closing the page or flagging it for reuse.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="serveliveviewsnapshot"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpoolserveliveviewsnapshotpage"><code>puppeteerPool.serveLiveViewSnapshot(page)</code><a href="#puppeteerpoolserveliveviewsnapshotpage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Tells the connected LiveViewServer to serve a snapshot when available.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/PuppeteerPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-puppeteerpooloptions" class="table-of-contents__link toc-highlight"><code>new PuppeteerPool([options])</code></a></li><li><a href="#puppeteerpoolnewpage" class="table-of-contents__link toc-highlight"><code>puppeteerPool.newPage()</code></a></li><li><a href="#puppeteerpooldestroy" class="table-of-contents__link toc-highlight"><code>puppeteerPool.destroy()</code></a></li><li><a href="#puppeteerpoolretirebrowser" class="table-of-contents__link toc-highlight"><code>puppeteerPool.retire(browser)</code></a></li><li><a href="#puppeteerpoolrecyclepagepage" class="table-of-contents__link toc-highlight"><code>puppeteerPool.recyclePage(page)</code></a></li><li><a href="#puppeteerpoolserveliveviewsnapshotpage" class="table-of-contents__link toc-highlight"><code>puppeteerPool.serveLiveViewSnapshot(page)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/puppeteer.html b/docs/1.3/api/puppeteer.html index 6d5faad500..2e1869714d 100644 --- a/docs/1.3/api/puppeteer.html +++ b/docs/1.3/api/puppeteer.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -74,8 +74,8 @@ the compiled function is the return value of the function body = the <code>scriptString</code> parameter.</p><p>As a security measure, no globals such as <code>process</code> or <code>require</code> are accessible from within the function body. Note that the function does not provide a safe sandbox and even though globals are not easily accessible, malicious code may still execute in the main process via prototype manipulation. Therefore you should only use this function to execute sanitized or safe code.</p><p>Custom context may also be provided using the <code>context</code> parameter. To improve security, make sure to only pass the really necessary objects to the -context. Preferably making secured copies beforehand.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>scriptString</code></strong>: <code>string</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/compiled-script-function"><code>CompiledScriptFunction</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/puppeteer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/playwright"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.playwright</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/social"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.social</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#puppeteeraddinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.addInterceptRequestHandler</code></a></li><li><a href="#puppeteerremoveinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.removeInterceptRequestHandler</code></a></li><li><a href="#puppeteergotoextended" class="table-of-contents__link toc-highlight"><code>puppeteer.gotoExtended</code></a></li><li><a href="#puppeteerinfinitescroll" class="table-of-contents__link toc-highlight"><code>puppeteer.infiniteScroll</code></a></li><li><a href="#puppeteersavesnapshot" class="table-of-contents__link toc-highlight"><code>puppeteer.saveSnapshot</code></a></li><li><a href="#puppeteerenqueuelinksbyclickingelementsoptions" class="table-of-contents__link toc-highlight"><code>puppeteer.enqueueLinksByClickingElements(options)</code></a></li><li><a href="#puppeteerinjectfilepage-filepath-options" class="table-of-contents__link toc-highlight"><code>puppeteer.injectFile(page, filePath, [options])</code></a></li><li><a href="#puppeteerinjectjquerypage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectJQuery(page)</code></a></li><li><a href="#puppeteerinjectunderscorepage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectUnderscore(page)</code></a></li><li><a href="#puppeteerblockrequestspage-options" class="table-of-contents__link toc-highlight"><code>puppeteer.blockRequests(page, [options])</code></a></li><li><a href="#puppeteercacheresponsespage-cache-responseurlrules" class="table-of-contents__link toc-highlight"><del><code>puppeteer.cacheResponses(page, cache, responseUrlRules)</code></del></a></li><li><a href="#puppeteercompilescriptscriptstring-context" class="table-of-contents__link toc-highlight"><code>puppeteer.compileScript(scriptString, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +context. Preferably making secured copies beforehand.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>scriptString</code></strong>: <code>string</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/compiled-script-function"><code>CompiledScriptFunction</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/puppeteer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/playwright"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.playwright</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/social"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.social</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#puppeteeraddinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.addInterceptRequestHandler</code></a></li><li><a href="#puppeteerremoveinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.removeInterceptRequestHandler</code></a></li><li><a href="#puppeteergotoextended" class="table-of-contents__link toc-highlight"><code>puppeteer.gotoExtended</code></a></li><li><a href="#puppeteerinfinitescroll" class="table-of-contents__link toc-highlight"><code>puppeteer.infiniteScroll</code></a></li><li><a href="#puppeteersavesnapshot" class="table-of-contents__link toc-highlight"><code>puppeteer.saveSnapshot</code></a></li><li><a href="#puppeteerenqueuelinksbyclickingelementsoptions" class="table-of-contents__link toc-highlight"><code>puppeteer.enqueueLinksByClickingElements(options)</code></a></li><li><a href="#puppeteerinjectfilepage-filepath-options" class="table-of-contents__link toc-highlight"><code>puppeteer.injectFile(page, filePath, [options])</code></a></li><li><a href="#puppeteerinjectjquerypage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectJQuery(page)</code></a></li><li><a href="#puppeteerinjectunderscorepage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectUnderscore(page)</code></a></li><li><a href="#puppeteerblockrequestspage-options" class="table-of-contents__link toc-highlight"><code>puppeteer.blockRequests(page, [options])</code></a></li><li><a href="#puppeteercacheresponsespage-cache-responseurlrules" class="table-of-contents__link toc-highlight"><del><code>puppeteer.cacheResponses(page, cache, responseUrlRules)</code></del></a></li><li><a href="#puppeteercompilescriptscriptstring-context" class="table-of-contents__link toc-highlight"><code>puppeteer.compileScript(scriptString, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/request-list.html b/docs/1.3/api/request-list.html index 6097e7a06b..f41519677a 100644 --- a/docs/1.3/api/request-list.html +++ b/docs/1.3/api/request-list.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ regular intervals, but calling this method manually is useful in cases where you want to have the most current state available after you pause or stop fetching its requests. For example after you pause or abort a crawl. Or just before a server migration.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="getstate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistgetstate"><code>requestList.getState()</code><a href="#requestlistgetstate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an object representing the internal state of the <code>RequestList</code> instance. Note that the object's fields can change in future releases.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-list-state"><code>RequestListState</code></a></p><hr><a name="isempty"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistisempty"><code>requestList.isEmpty()</code><a href="#requestlistisempty" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Resolves to <code>true</code> if the next call to <a href="/sdk/js/docs/1.3/api/request-list#fetchnextrequest"><code>RequestList.fetchNextRequest()</code></a> function would return <code>null</code>, otherwise it resolves to <code>false</code>. Note that even if the list is empty, there might be some pending requests currently being processed.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="isfinished"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistisfinished"><code>requestList.isFinished()</code><a href="#requestlistisfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns <code>true</code> if all requests were already handled and there are no more left.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="fetchnextrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistfetchnextrequest"><code>requestList.fetchNextRequest()</code><a href="#requestlistfetchnextrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Gets the next <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> to process. First, the function gets a request previously reclaimed using the -<a href="/sdk/js/docs/1.3/api/request-list#reclaimrequest"><code>RequestList.reclaimRequest()</code></a> function, if there is any. Otherwise it gets the next request from sources.</p><p>The function's <code>Promise</code> resolves to <code>null</code> if there are no more requests to process.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/request"><code>Promise<(Request|null)></code></a></p><hr><a name="markrequesthandled"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistmarkrequesthandledrequest"><code>requestList.markRequestHandled(request)</code><a href="#requestlistmarkrequesthandledrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Marks request as handled after successful processing.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="reclaimrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistreclaimrequestrequest"><code>requestList.reclaimRequest(request)</code><a href="#requestlistreclaimrequestrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Reclaims request to the list if its processing failed. The request will become available in the next <code>this.fetchNextRequest()</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="length"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistlength"><code>requestList.length()</code><a href="#requestlistlength" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the total number of unique requests present in the <code>RequestList</code>.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr><a name="handledcount"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlisthandledcount"><code>requestList.handledCount()</code><a href="#requestlisthandledcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns number of handled requests.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestList.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/request-queue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-requestlistoptions" class="table-of-contents__link toc-highlight"><code>new RequestList(options)</code></a></li><li><a href="#requestlistrequests" class="table-of-contents__link toc-highlight"><code>requestList.requests</code></a></li><li><a href="#requestlistinitialize" class="table-of-contents__link toc-highlight"><code>requestList.initialize()</code></a></li><li><a href="#requestlistpersiststate" class="table-of-contents__link toc-highlight"><code>requestList.persistState()</code></a></li><li><a href="#requestlistgetstate" class="table-of-contents__link toc-highlight"><code>requestList.getState()</code></a></li><li><a href="#requestlistisempty" class="table-of-contents__link toc-highlight"><code>requestList.isEmpty()</code></a></li><li><a href="#requestlistisfinished" class="table-of-contents__link toc-highlight"><code>requestList.isFinished()</code></a></li><li><a href="#requestlistfetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestList.fetchNextRequest()</code></a></li><li><a href="#requestlistmarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestList.markRequestHandled(request)</code></a></li><li><a href="#requestlistreclaimrequestrequest" class="table-of-contents__link toc-highlight"><code>requestList.reclaimRequest(request)</code></a></li><li><a href="#requestlistlength" class="table-of-contents__link toc-highlight"><code>requestList.length()</code></a></li><li><a href="#requestlisthandledcount" class="table-of-contents__link toc-highlight"><code>requestList.handledCount()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/request-list#reclaimrequest"><code>RequestList.reclaimRequest()</code></a> function, if there is any. Otherwise it gets the next request from sources.</p><p>The function's <code>Promise</code> resolves to <code>null</code> if there are no more requests to process.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/request"><code>Promise<(Request|null)></code></a></p><hr><a name="markrequesthandled"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistmarkrequesthandledrequest"><code>requestList.markRequestHandled(request)</code><a href="#requestlistmarkrequesthandledrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Marks request as handled after successful processing.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="reclaimrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistreclaimrequestrequest"><code>requestList.reclaimRequest(request)</code><a href="#requestlistreclaimrequestrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Reclaims request to the list if its processing failed. The request will become available in the next <code>this.fetchNextRequest()</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="length"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistlength"><code>requestList.length()</code><a href="#requestlistlength" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the total number of unique requests present in the <code>RequestList</code>.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr><a name="handledcount"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlisthandledcount"><code>requestList.handledCount()</code><a href="#requestlisthandledcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns number of handled requests.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestList.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/request-queue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-requestlistoptions" class="table-of-contents__link toc-highlight"><code>new RequestList(options)</code></a></li><li><a href="#requestlistrequests" class="table-of-contents__link toc-highlight"><code>requestList.requests</code></a></li><li><a href="#requestlistinitialize" class="table-of-contents__link toc-highlight"><code>requestList.initialize()</code></a></li><li><a href="#requestlistpersiststate" class="table-of-contents__link toc-highlight"><code>requestList.persistState()</code></a></li><li><a href="#requestlistgetstate" class="table-of-contents__link toc-highlight"><code>requestList.getState()</code></a></li><li><a href="#requestlistisempty" class="table-of-contents__link toc-highlight"><code>requestList.isEmpty()</code></a></li><li><a href="#requestlistisfinished" class="table-of-contents__link toc-highlight"><code>requestList.isFinished()</code></a></li><li><a href="#requestlistfetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestList.fetchNextRequest()</code></a></li><li><a href="#requestlistmarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestList.markRequestHandled(request)</code></a></li><li><a href="#requestlistreclaimrequestrequest" class="table-of-contents__link toc-highlight"><code>requestList.reclaimRequest(request)</code></a></li><li><a href="#requestlistlength" class="table-of-contents__link toc-highlight"><code>requestList.length()</code></a></li><li><a href="#requestlisthandledcount" class="table-of-contents__link toc-highlight"><code>requestList.handledCount()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/request-queue.html b/docs/1.3/api/request-queue.html index 98b8f2be17..e5d4af5a7b 100644 --- a/docs/1.3/api/request-queue.html +++ b/docs/1.3/api/request-queue.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -40,8 +40,8 @@ resolves to <code>false</code>. Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that there is no activity in the queue, use <a href="/sdk/js/docs/1.3/api/request-queue#isfinished"><code>RequestQueue.isFinished()</code></a>.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="isfinished"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueueisfinished"><code>requestQueue.isFinished()</code><a href="#requestqueueisfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Resolves to <code>true</code> if all requests were already handled and there are no more left. Due to the nature of distributed storage used by the queue, the function might occasionally return a false negative, but it will never return a false positive.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueuedrop"><code>requestQueue.drop()</code><a href="#requestqueuedrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the queue either from the Apify Cloud storage or from the local database, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="handledcount"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueuehandledcount"><code>requestQueue.handledCount()</code><a href="#requestqueuehandledcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the number of handled requests.</p><p>This function is just a convenient shortcut for:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> handledRequestCount </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInfo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Returns</strong>:</p><p><code>Promise<number></code></p><hr><a name="getinfo"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueuegetinfo"><code>requestQueue.getInfo()</code><a href="#requestqueuegetinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an object containing general information about the request queue.</p><p>The function returns the same object as the Apify API Client's <a href="https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues" target="_blank" rel="noopener">getQueue</a> -function, which in turn calls the <a href="https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue" target="_blank" rel="noopener">Get request queue</a> API endpoint.</p><p><strong>Example:</strong></p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"WkzbQMuFYuamGv3YF"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"my-queue"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> userId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"wRsJZtadYvn4mBZmm"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> createdAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-12T07:34:14.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> modifiedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-13T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> accessedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-14T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> totalRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handledRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pendingRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">20</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-queue-info"><code>Promise<RequestQueueInfo></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestQueue.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/request-list"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestList</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/pseudo-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PseudoUrl</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestqueueaddrequestrequestlike-options" class="table-of-contents__link toc-highlight"><code>requestQueue.addRequest(requestLike, [options])</code></a></li><li><a href="#requestqueuegetrequestid" class="table-of-contents__link toc-highlight"><code>requestQueue.getRequest(id)</code></a></li><li><a href="#requestqueuefetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.fetchNextRequest()</code></a></li><li><a href="#requestqueuemarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.markRequestHandled(request)</code></a></li><li><a href="#requestqueuereclaimrequestrequest-options" class="table-of-contents__link toc-highlight"><code>requestQueue.reclaimRequest(request, [options])</code></a></li><li><a href="#requestqueueisempty" class="table-of-contents__link toc-highlight"><code>requestQueue.isEmpty()</code></a></li><li><a href="#requestqueueisfinished" class="table-of-contents__link toc-highlight"><code>requestQueue.isFinished()</code></a></li><li><a href="#requestqueuedrop" class="table-of-contents__link toc-highlight"><code>requestQueue.drop()</code></a></li><li><a href="#requestqueuehandledcount" class="table-of-contents__link toc-highlight"><code>requestQueue.handledCount()</code></a></li><li><a href="#requestqueuegetinfo" class="table-of-contents__link toc-highlight"><code>requestQueue.getInfo()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +function, which in turn calls the <a href="https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue" target="_blank" rel="noopener">Get request queue</a> API endpoint.</p><p><strong>Example:</strong></p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"WkzbQMuFYuamGv3YF"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"my-queue"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> userId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"wRsJZtadYvn4mBZmm"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> createdAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-12T07:34:14.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> modifiedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-13T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> accessedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-14T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> totalRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handledRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pendingRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">20</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-queue-info"><code>Promise<RequestQueueInfo></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/RequestQueue.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/request-list"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestList</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/pseudo-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PseudoUrl</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestqueueaddrequestrequestlike-options" class="table-of-contents__link toc-highlight"><code>requestQueue.addRequest(requestLike, [options])</code></a></li><li><a href="#requestqueuegetrequestid" class="table-of-contents__link toc-highlight"><code>requestQueue.getRequest(id)</code></a></li><li><a href="#requestqueuefetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.fetchNextRequest()</code></a></li><li><a href="#requestqueuemarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.markRequestHandled(request)</code></a></li><li><a href="#requestqueuereclaimrequestrequest-options" class="table-of-contents__link toc-highlight"><code>requestQueue.reclaimRequest(request, [options])</code></a></li><li><a href="#requestqueueisempty" class="table-of-contents__link toc-highlight"><code>requestQueue.isEmpty()</code></a></li><li><a href="#requestqueueisfinished" class="table-of-contents__link toc-highlight"><code>requestQueue.isFinished()</code></a></li><li><a href="#requestqueuedrop" class="table-of-contents__link toc-highlight"><code>requestQueue.drop()</code></a></li><li><a href="#requestqueuehandledcount" class="table-of-contents__link toc-highlight"><code>requestQueue.handledCount()</code></a></li><li><a href="#requestqueuegetinfo" class="table-of-contents__link toc-highlight"><code>requestQueue.getInfo()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/request.html b/docs/1.3/api/request.html index b6a78e6b15..e2aa4b0f5c 100644 --- a/docs/1.3/api/request.html +++ b/docs/1.3/api/request.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ or may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but delayed redirects will not.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="uniquekey"><code>uniqueKey</code><a href="#uniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>A unique key identifying the request. Two requests with the same <code>uniqueKey</code> are considered as pointing to the same URL.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="method"><code>method</code><a href="#method" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>HTTP method, e.g. <code>GET</code> or <code>POST</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Buffer</code></p><p>HTTP request payload, e.g. for POST requests.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="noretry"><code>noRetry</code><a href="#noretry" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>The <code>true</code> value indicates that the request will not be automatically retried on error.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="retrycount"><code>retryCount</code><a href="#retrycount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Indicates the number of times the crawling of the request has been retried on error.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errormessages"><code>errorMessages</code><a href="#errormessages" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><p>An array of error messages from request processing.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="headers"><code>headers</code><a href="#headers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, string></code></p><p>Object with HTTP headers. Key is header name, value is the value.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Custom user data assigned to the request.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="handledat"><code>handledAt</code><a href="#handledat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Indicates the time when the request has been processed. Is <code>null</code> if the request has not been crawled yet.</p><hr><a name="request"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-requestoptions"><code>new Request(options)</code><a href="#new-requestoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/request-options"><code>RequestOptions</code></a> - <code>Request</code> parameters including the URL, HTTP method and headers, and others.</li></ul><hr><a name="headers"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestheaders"><code>request.headers</code><a href="#requestheaders" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="userdata"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestuserdata"><code>request.userData</code><a href="#requestuserdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="pusherrormessage"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestpusherrormessageerrorormessage-options"><code>request.pushErrorMessage(errorOrMessage, [options])</code><a href="#requestpusherrormessageerrorormessage-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stores information about an error that occurred during processing of this request.</p><p>You should always use Error instances when throwing errors in JavaScript.</p><p>Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs a type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any -debugging rather difficult.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>errorOrMessage</code></strong>: <code>Error</code> | <code>string</code> - Error object or error message to be stored in the request.</li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[omitStack]</code></strong>: <code>boolean</code> <code> = false</code> - Only push the error message without stack trace when true.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Request.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/system-status"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatus</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/request-list"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestList</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#loadedurl" class="table-of-contents__link toc-highlight"><code>loadedUrl</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#noretry" class="table-of-contents__link toc-highlight"><code>noRetry</code></a></li><li><a href="#retrycount" class="table-of-contents__link toc-highlight"><code>retryCount</code></a></li><li><a href="#errormessages" class="table-of-contents__link toc-highlight"><code>errorMessages</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#handledat" class="table-of-contents__link toc-highlight"><code>handledAt</code></a></li></ul></li><li><a href="#new-requestoptions" class="table-of-contents__link toc-highlight"><code>new Request(options)</code></a></li><li><a href="#requestheaders" class="table-of-contents__link toc-highlight"><code>request.headers</code></a></li><li><a href="#requestuserdata" class="table-of-contents__link toc-highlight"><code>request.userData</code></a></li><li><a href="#requestpusherrormessageerrorormessage-options" class="table-of-contents__link toc-highlight"><code>request.pushErrorMessage(errorOrMessage, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +debugging rather difficult.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>errorOrMessage</code></strong>: <code>Error</code> | <code>string</code> - Error object or error message to be stored in the request.</li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[omitStack]</code></strong>: <code>boolean</code> <code> = false</code> - Only push the error message without stack trace when true.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Request.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/system-status"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatus</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/request-list"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestList</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#loadedurl" class="table-of-contents__link toc-highlight"><code>loadedUrl</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#noretry" class="table-of-contents__link toc-highlight"><code>noRetry</code></a></li><li><a href="#retrycount" class="table-of-contents__link toc-highlight"><code>retryCount</code></a></li><li><a href="#errormessages" class="table-of-contents__link toc-highlight"><code>errorMessages</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#handledat" class="table-of-contents__link toc-highlight"><code>handledAt</code></a></li></ul></li><li><a href="#new-requestoptions" class="table-of-contents__link toc-highlight"><code>new Request(options)</code></a></li><li><a href="#requestheaders" class="table-of-contents__link toc-highlight"><code>request.headers</code></a></li><li><a href="#requestuserdata" class="table-of-contents__link toc-highlight"><code>request.userData</code></a></li><li><a href="#requestpusherrormessageerrorormessage-options" class="table-of-contents__link toc-highlight"><code>request.pushErrorMessage(errorOrMessage, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/session-pool.html b/docs/1.3/api/session-pool.html index 410820894c..24b0137faf 100644 --- a/docs/1.3/api/session-pool.html +++ b/docs/1.3/api/session-pool.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ sessions once the max pool size is reached. This also allows you to add session with overridden session options (e.g. with specific session id).</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a> | <a href="/sdk/js/docs/1.3/typedefs/session-options"><code>SessionOptions</code></a> - The configuration options for the session being added to the session pool.</li></ul><hr><a name="getsession"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolgetsessionsessionid"><code>sessionPool.getSession([sessionId])</code><a href="#sessionpoolgetsessionsessionid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Gets session. If there is space for new session, it creates and returns new session. If the session pool is full, it picks a session from the pool, If the picked session is usable it is returned, otherwise it creates and returns a new one.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sessionId]</code></strong>: <code>String</code> - If provided, it returns the usable session with this id, <code>undefined</code> otherwise.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/session"><code>Promise<Session></code></a></p><hr><a name="getstate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolgetstate"><code>sessionPool.getState()</code><a href="#sessionpoolgetstate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an object representing the internal state of the <code>SessionPool</code> instance. Note that the object's fields can change in future releases.</p><hr><a name="persiststate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolpersiststate"><code>sessionPool.persistState()</code><a href="#sessionpoolpersiststate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Persists the current state of the <code>SessionPool</code> into the default <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a>. The state is persisted automatically in -regular intervals.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="teardown"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolteardown"><code>sessionPool.teardown()</code><a href="#sessionpoolteardown" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes listener from <code>persistState</code> event. This function should be called after you are done with using the <code>SessionPool</code> instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SessionPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sessionpoolsessions" class="table-of-contents__link toc-highlight"><code>sessionPool.sessions</code></a></li><li><a href="#sessionpoolusablesessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.usableSessionsCount</code></a></li><li><a href="#sessionpoolretiredsessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.retiredSessionsCount</code></a></li><li><a href="#sessionpoolinitialize" class="table-of-contents__link toc-highlight"><code>sessionPool.initialize()</code></a></li><li><a href="#sessionpooladdsessionoptions" class="table-of-contents__link toc-highlight"><code>sessionPool.addSession([options])</code></a></li><li><a href="#sessionpoolgetsessionsessionid" class="table-of-contents__link toc-highlight"><code>sessionPool.getSession([sessionId])</code></a></li><li><a href="#sessionpoolgetstate" class="table-of-contents__link toc-highlight"><code>sessionPool.getState()</code></a></li><li><a href="#sessionpoolpersiststate" class="table-of-contents__link toc-highlight"><code>sessionPool.persistState()</code></a></li><li><a href="#sessionpoolteardown" class="table-of-contents__link toc-highlight"><code>sessionPool.teardown()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +regular intervals.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="teardown"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolteardown"><code>sessionPool.teardown()</code><a href="#sessionpoolteardown" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes listener from <code>persistState</code> event. This function should be called after you are done with using the <code>SessionPool</code> instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SessionPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sessionpoolsessions" class="table-of-contents__link toc-highlight"><code>sessionPool.sessions</code></a></li><li><a href="#sessionpoolusablesessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.usableSessionsCount</code></a></li><li><a href="#sessionpoolretiredsessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.retiredSessionsCount</code></a></li><li><a href="#sessionpoolinitialize" class="table-of-contents__link toc-highlight"><code>sessionPool.initialize()</code></a></li><li><a href="#sessionpooladdsessionoptions" class="table-of-contents__link toc-highlight"><code>sessionPool.addSession([options])</code></a></li><li><a href="#sessionpoolgetsessionsessionid" class="table-of-contents__link toc-highlight"><code>sessionPool.getSession([sessionId])</code></a></li><li><a href="#sessionpoolgetstate" class="table-of-contents__link toc-highlight"><code>sessionPool.getState()</code></a></li><li><a href="#sessionpoolpersiststate" class="table-of-contents__link toc-highlight"><code>sessionPool.persistState()</code></a></li><li><a href="#sessionpoolteardown" class="table-of-contents__link toc-highlight"><code>sessionPool.teardown()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/session.html b/docs/1.3/api/session.html index e0fe01e5f6..2bee649857 100644 --- a/docs/1.3/api/session.html +++ b/docs/1.3/api/session.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ by retiring the session when such code is received. Optionally the default status codes can be extended in the second parameter.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>statusCode</code></strong>: <code>number</code> - HTTP status code</li><li><strong><code>[blockedStatusCodes]</code></strong>: <code>Array<number></code> - Custom HTTP status codes that means blocking on particular website.</li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code> - whether the session was retired.</p><hr><a name="setcookiesfromresponse"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionsetcookiesfromresponseresponse"><code>session.setCookiesFromResponse(response)</code><a href="#sessionsetcookiesfromresponseresponse" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Saves cookies from an HTTP response to be used with the session. It expects an object with a <code>headers</code> property that's either an <code>Object</code> (typical Node.js responses) or a <code>Function</code> (Puppeteer Response).</p><p>It then parses and saves the cookies from the <code>set-cookie</code> header, if available.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>response</code></strong>: <code>PuppeteerResponse</code> | <code>IncomingMessage</code></li></ul><hr><a name="setpuppeteercookies"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionsetpuppeteercookiescookies-url"><code>session.setPuppeteerCookies(cookies, url)</code><a href="#sessionsetpuppeteercookiescookies-url" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Saves an array with cookie objects to be used with the session. The objects should be in the format that <a href="https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-pagecookiesurls" target="_blank" rel="noopener">Puppeteer uses</a>, but you can also use this function to set cookies -manually:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'your-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>cookies</code></strong>: <code>Array<PuppeteerCookie></code></li><li><strong><code>url</code></strong>: <code>string</code></li></ul><hr><a name="getpuppeteercookies"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetpuppeteercookiesurl"><code>session.getPuppeteerCookies(url)</code><a href="#sessiongetpuppeteercookiesurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies in a format compatible with puppeteer and ready to be used with <code>page.setCookie</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code> - website url. Only cookies stored for this url will be returned</li></ul><p><strong>Returns</strong>:</p><p><code>Array<PuppeteerCookie></code></p><hr><a name="getcookiestring"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetcookiestringurl"><code>session.getCookieString(url)</code><a href="#sessiongetcookiestringurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - represents <code>Cookie</code> header.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Session.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/session-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-sessionoptions" class="table-of-contents__link toc-highlight"><code>new Session(options)</code></a></li><li><a href="#sessionuserdata" class="table-of-contents__link toc-highlight"><code>session.userData</code></a></li><li><a href="#sessionisblocked" class="table-of-contents__link toc-highlight"><code>session.isBlocked()</code></a></li><li><a href="#sessionisexpired" class="table-of-contents__link toc-highlight"><code>session.isExpired()</code></a></li><li><a href="#sessionismaxusagecountreached" class="table-of-contents__link toc-highlight"><code>session.isMaxUsageCountReached()</code></a></li><li><a href="#sessionisusable" class="table-of-contents__link toc-highlight"><code>session.isUsable()</code></a></li><li><a href="#sessionmarkgood" class="table-of-contents__link toc-highlight"><code>session.markGood()</code></a></li><li><a href="#sessiongetstate" class="table-of-contents__link toc-highlight"><code>session.getState()</code></a></li><li><a href="#sessionretire" class="table-of-contents__link toc-highlight"><code>session.retire()</code></a></li><li><a href="#sessionmarkbad" class="table-of-contents__link toc-highlight"><code>session.markBad()</code></a></li><li><a href="#sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes" class="table-of-contents__link toc-highlight"><code>session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])</code></a></li><li><a href="#sessionsetcookiesfromresponseresponse" class="table-of-contents__link toc-highlight"><code>session.setCookiesFromResponse(response)</code></a></li><li><a href="#sessionsetpuppeteercookiescookies-url" class="table-of-contents__link toc-highlight"><code>session.setPuppeteerCookies(cookies, url)</code></a></li><li><a href="#sessiongetpuppeteercookiesurl" class="table-of-contents__link toc-highlight"><code>session.getPuppeteerCookies(url)</code></a></li><li><a href="#sessiongetcookiestringurl" class="table-of-contents__link toc-highlight"><code>session.getCookieString(url)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +manually:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'your-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>cookies</code></strong>: <code>Array<PuppeteerCookie></code></li><li><strong><code>url</code></strong>: <code>string</code></li></ul><hr><a name="getpuppeteercookies"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetpuppeteercookiesurl"><code>session.getPuppeteerCookies(url)</code><a href="#sessiongetpuppeteercookiesurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies in a format compatible with puppeteer and ready to be used with <code>page.setCookie</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code> - website url. Only cookies stored for this url will be returned</li></ul><p><strong>Returns</strong>:</p><p><code>Array<PuppeteerCookie></code></p><hr><a name="getcookiestring"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetcookiestringurl"><code>session.getCookieString(url)</code><a href="#sessiongetcookiestringurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - represents <code>Cookie</code> header.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Session.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/session-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-sessionoptions" class="table-of-contents__link toc-highlight"><code>new Session(options)</code></a></li><li><a href="#sessionuserdata" class="table-of-contents__link toc-highlight"><code>session.userData</code></a></li><li><a href="#sessionisblocked" class="table-of-contents__link toc-highlight"><code>session.isBlocked()</code></a></li><li><a href="#sessionisexpired" class="table-of-contents__link toc-highlight"><code>session.isExpired()</code></a></li><li><a href="#sessionismaxusagecountreached" class="table-of-contents__link toc-highlight"><code>session.isMaxUsageCountReached()</code></a></li><li><a href="#sessionisusable" class="table-of-contents__link toc-highlight"><code>session.isUsable()</code></a></li><li><a href="#sessionmarkgood" class="table-of-contents__link toc-highlight"><code>session.markGood()</code></a></li><li><a href="#sessiongetstate" class="table-of-contents__link toc-highlight"><code>session.getState()</code></a></li><li><a href="#sessionretire" class="table-of-contents__link toc-highlight"><code>session.retire()</code></a></li><li><a href="#sessionmarkbad" class="table-of-contents__link toc-highlight"><code>session.markBad()</code></a></li><li><a href="#sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes" class="table-of-contents__link toc-highlight"><code>session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])</code></a></li><li><a href="#sessionsetcookiesfromresponseresponse" class="table-of-contents__link toc-highlight"><code>session.setCookiesFromResponse(response)</code></a></li><li><a href="#sessionsetpuppeteercookiescookies-url" class="table-of-contents__link toc-highlight"><code>session.setPuppeteerCookies(cookies, url)</code></a></li><li><a href="#sessiongetpuppeteercookiesurl" class="table-of-contents__link toc-highlight"><code>session.getPuppeteerCookies(url)</code></a></li><li><a href="#sessiongetcookiestringurl" class="table-of-contents__link toc-highlight"><code>session.getCookieString(url)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/snapshotter.html b/docs/1.3/api/snapshotter.html index 777453cab7..a8cfa0a292 100644 --- a/docs/1.3/api/snapshotter.html +++ b/docs/1.3/api/snapshotter.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sampleDurationMillis]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr><a name="geteventloopsample"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="snapshottergeteventloopsamplesampledurationmillis"><code>snapshotter.getEventLoopSample([sampleDurationMillis])</code><a href="#snapshottergeteventloopsamplesampledurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a sample of latest event loop snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sampleDurationMillis]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr><a name="getcpusample"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="snapshottergetcpusamplesampledurationmillis"><code>snapshotter.getCpuSample([sampleDurationMillis])</code><a href="#snapshottergetcpusamplesampledurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a sample of latest CPU snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sampleDurationMillis]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr><a name="getclientsample"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="snapshottergetclientsamplesampledurationmillis"><code>snapshotter.getClientSample(sampleDurationMillis)</code><a href="#snapshottergetclientsamplesampledurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a sample of latest Client snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full -snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sampleDurationMillis</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Snapshotter.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/system-status"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatus</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-snapshotteroptions" class="table-of-contents__link toc-highlight"><code>new Snapshotter([options])</code></a></li><li><a href="#snapshotterlog" class="table-of-contents__link toc-highlight"><code>snapshotter.log</code></a></li><li><a href="#snapshotterstart" class="table-of-contents__link toc-highlight"><code>snapshotter.start()</code></a></li><li><a href="#snapshotterstop" class="table-of-contents__link toc-highlight"><code>snapshotter.stop()</code></a></li><li><a href="#snapshottergetmemorysamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getMemorySample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergeteventloopsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getEventLoopSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetcpusamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getCpuSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetclientsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getClientSample(sampleDurationMillis)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sampleDurationMillis</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Snapshotter.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/system-status"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatus</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-snapshotteroptions" class="table-of-contents__link toc-highlight"><code>new Snapshotter([options])</code></a></li><li><a href="#snapshotterlog" class="table-of-contents__link toc-highlight"><code>snapshotter.log</code></a></li><li><a href="#snapshotterstart" class="table-of-contents__link toc-highlight"><code>snapshotter.start()</code></a></li><li><a href="#snapshotterstop" class="table-of-contents__link toc-highlight"><code>snapshotter.stop()</code></a></li><li><a href="#snapshottergetmemorysamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getMemorySample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergeteventloopsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getEventLoopSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetcpusamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getCpuSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetclientsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getClientSample(sampleDurationMillis)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/social.html b/docs/1.3/api/social.html index c43055c145..40b4d4e0f4 100644 --- a/docs/1.3/api/social.html +++ b/docs/1.3/api/social.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ Facebook profile URLs. The function removes duplicates from the resulting arrays and sorts the items alphabetically.</p><p>Note that the <code>phones</code> field contains phone numbers extracted from the special phone links such as <code>[call us](tel:+1234556789)</code> (see <a href="/sdk/js/docs/1.3/api/social#phonesfromurls"><code>social.phonesFromUrls()</code></a>) and potentially other sources with high certainty, while <code>phonesUncertain</code> contains phone numbers extracted from the plain text, which might be very inaccurate.</p><p><strong>Example usage:</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'http://www.example.com'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">content</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">social</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">parseHandlesFromHtml</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Social handles:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>html</code></strong>: <code>string</code> - HTML text</li><li><strong><code>[data]</code></strong>: <code>*</code> | <code>null</code> <code> = </code> - Optional object which will receive the <code>text</code> and <code>$</code> properties that contain text content of the -HTML and <code>cheerio</code> object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/social-handles"><code>SocialHandles</code></a> - An object with the social handles.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/social.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/puppeteer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sociallinkedin_regex" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX</code></a></li><li><a href="#sociallinkedin_regex_global" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX_GLOBAL</code></a></li><li><a href="#socialinstagram_regex" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX</code></a></li><li><a href="#socialinstagram_regex_global" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX_GLOBAL</code></a></li><li><a href="#socialtwitter_regex" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX</code></a></li><li><a href="#socialtwitter_regex_global" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX_GLOBAL</code></a></li><li><a href="#socialfacebook_regex" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX</code></a></li><li><a href="#socialfacebook_regex_global" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX_GLOBAL</code></a></li><li><a href="#socialyoutube_regex" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX</code></a></li><li><a href="#socialyoutube_regex_global" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX_GLOBAL</code></a></li><li><a href="#socialemail_regex" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX</code></a></li><li><a href="#socialemail_regex_global" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX_GLOBAL</code></a></li><li><a href="#socialemailsfromtexttext" class="table-of-contents__link toc-highlight"><code>social.emailsFromText(text)</code></a></li><li><a href="#socialemailsfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.emailsFromUrls(urls)</code></a></li><li><a href="#socialphonesfromtexttext" class="table-of-contents__link toc-highlight"><code>social.phonesFromText(text)</code></a></li><li><a href="#socialphonesfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.phonesFromUrls(urls)</code></a></li><li><a href="#socialparsehandlesfromhtmlhtml-data" class="table-of-contents__link toc-highlight"><code>social.parseHandlesFromHtml(html, [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +HTML and <code>cheerio</code> object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/social-handles"><code>SocialHandles</code></a> - An object with the social handles.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/social.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/puppeteer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sociallinkedin_regex" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX</code></a></li><li><a href="#sociallinkedin_regex_global" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX_GLOBAL</code></a></li><li><a href="#socialinstagram_regex" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX</code></a></li><li><a href="#socialinstagram_regex_global" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX_GLOBAL</code></a></li><li><a href="#socialtwitter_regex" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX</code></a></li><li><a href="#socialtwitter_regex_global" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX_GLOBAL</code></a></li><li><a href="#socialfacebook_regex" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX</code></a></li><li><a href="#socialfacebook_regex_global" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX_GLOBAL</code></a></li><li><a href="#socialyoutube_regex" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX</code></a></li><li><a href="#socialyoutube_regex_global" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX_GLOBAL</code></a></li><li><a href="#socialemail_regex" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX</code></a></li><li><a href="#socialemail_regex_global" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX_GLOBAL</code></a></li><li><a href="#socialemailsfromtexttext" class="table-of-contents__link toc-highlight"><code>social.emailsFromText(text)</code></a></li><li><a href="#socialemailsfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.emailsFromUrls(urls)</code></a></li><li><a href="#socialphonesfromtexttext" class="table-of-contents__link toc-highlight"><code>social.phonesFromText(text)</code></a></li><li><a href="#socialphonesfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.phonesFromUrls(urls)</code></a></li><li><a href="#socialparsehandlesfromhtmlhtml-data" class="table-of-contents__link toc-highlight"><code>social.parseHandlesFromHtml(html, [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/statistics.html b/docs/1.3/api/statistics.html index 4059aa9979..e3e512d616 100644 --- a/docs/1.3/api/statistics.html +++ b/docs/1.3/api/statistics.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/statistics">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/statistics">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify">Apify</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/configuration">Configuration</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/api/basic-crawler">Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/basic-crawler">BasicCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/cheerio-crawler">CheerioCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/playwright-crawler">PlaywrightCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/puppeteer-crawler">PuppeteerCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/api/statistics">Statistics</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/dataset">Result Stores</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/autoscaled-pool">Scaling</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/request">Sources</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/utils">Utilities</a></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">API Reference</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Statistics</h1></header><a name="statistics"></a><p>The statistics class provides an interface to collecting and logging run statistics for requests.</p><p>All statistic information is saved on key value store under the key SDK<em>CRAWLER_STATISTICS</em>*<!-- -->, persists between migrations and abort/resurrect</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="state"><code>state</code><a href="#state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/statistic-state"><code>StatisticState</code></a></p><p>Current statistic state used for doing calculations on <a href="/sdk/js/docs/1.3/api/statistics#calculate"><code>Statistics.calculate()</code></a> calls</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Statistic instance id</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><p>Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on</p><hr><a name="reset"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsreset"><code>statistics.reset()</code><a href="#statisticsreset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Set the current statistic instance to pristine values</p><hr><a name="calculate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticscalculate"><code>statistics.calculate()</code><a href="#statisticscalculate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Calculate the current statistics</p><hr><a name="startcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstartcapturing"><code>statistics.startCapturing()</code><a href="#statisticsstartcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals</p><hr><a name="stopcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstopcapturing"><code>statistics.stopCapturing()</code><a href="#statisticsstopcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stops logging and remove event listeners, then persist</p><hr><a name="persiststate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticspersiststate"><code>statistics.persistState()</code><a href="#statisticspersiststate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Persist internal state to the key value store</p><hr><a name="tojson"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticstojson"><code>statistics.toJSON()</code><a href="#statisticstojson" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Make this class serializable when called with <code>JSON.stringify(statsInstance)</code> directly or through <code>keyValueStore.setValue('KEY', statsInstance)</code></p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/statistic-persisted-state"><code>StatisticPersistedState</code></a> <!-- -->|<!-- --> <a href="/sdk/js/docs/1.3/typedefs/statistic-state"><code>StatisticState</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Statistics.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li></ul></li><li><a href="#statisticsreset" class="table-of-contents__link toc-highlight"><code>statistics.reset()</code></a></li><li><a href="#statisticscalculate" class="table-of-contents__link toc-highlight"><code>statistics.calculate()</code></a></li><li><a href="#statisticsstartcapturing" class="table-of-contents__link toc-highlight"><code>statistics.startCapturing()</code></a></li><li><a href="#statisticsstopcapturing" class="table-of-contents__link toc-highlight"><code>statistics.stopCapturing()</code></a></li><li><a href="#statisticspersiststate" class="table-of-contents__link toc-highlight"><code>statistics.persistState()</code></a></li><li><a href="#statisticstojson" class="table-of-contents__link toc-highlight"><code>statistics.toJSON()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/api/statistics">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/api/statistics">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify">Apify</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/configuration">Configuration</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/api/basic-crawler">Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/basic-crawler">BasicCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/cheerio-crawler">CheerioCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/playwright-crawler">PlaywrightCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/puppeteer-crawler">PuppeteerCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/api/statistics">Statistics</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/dataset">Result Stores</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/autoscaled-pool">Scaling</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/request">Sources</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/api/utils">Utilities</a></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">API Reference</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Statistics</h1></header><a name="statistics"></a><p>The statistics class provides an interface to collecting and logging run statistics for requests.</p><p>All statistic information is saved on key value store under the key SDK<em>CRAWLER_STATISTICS</em>*<!-- -->, persists between migrations and abort/resurrect</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="state"><code>state</code><a href="#state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/statistic-state"><code>StatisticState</code></a></p><p>Current statistic state used for doing calculations on <a href="/sdk/js/docs/1.3/api/statistics#calculate"><code>Statistics.calculate()</code></a> calls</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Statistic instance id</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><p>Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on</p><hr><a name="reset"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsreset"><code>statistics.reset()</code><a href="#statisticsreset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Set the current statistic instance to pristine values</p><hr><a name="calculate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticscalculate"><code>statistics.calculate()</code><a href="#statisticscalculate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Calculate the current statistics</p><hr><a name="startcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstartcapturing"><code>statistics.startCapturing()</code><a href="#statisticsstartcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals</p><hr><a name="stopcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstopcapturing"><code>statistics.stopCapturing()</code><a href="#statisticsstopcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stops logging and remove event listeners, then persist</p><hr><a name="persiststate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticspersiststate"><code>statistics.persistState()</code><a href="#statisticspersiststate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Persist internal state to the key value store</p><hr><a name="tojson"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticstojson"><code>statistics.toJSON()</code><a href="#statisticstojson" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Make this class serializable when called with <code>JSON.stringify(statsInstance)</code> directly or through <code>keyValueStore.setValue('KEY', statsInstance)</code></p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/statistic-persisted-state"><code>StatisticPersistedState</code></a> <!-- -->|<!-- --> <a href="/sdk/js/docs/1.3/typedefs/statistic-state"><code>StatisticState</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/Statistics.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li></ul></li><li><a href="#statisticsreset" class="table-of-contents__link toc-highlight"><code>statistics.reset()</code></a></li><li><a href="#statisticscalculate" class="table-of-contents__link toc-highlight"><code>statistics.calculate()</code></a></li><li><a href="#statisticsstartcapturing" class="table-of-contents__link toc-highlight"><code>statistics.startCapturing()</code></a></li><li><a href="#statisticsstopcapturing" class="table-of-contents__link toc-highlight"><code>statistics.stopCapturing()</code></a></li><li><a href="#statisticspersiststate" class="table-of-contents__link toc-highlight"><code>statistics.persistState()</code></a></li><li><a href="#statisticstojson" class="table-of-contents__link toc-highlight"><code>statistics.toJSON()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/system-status.html b/docs/1.3/api/system-status.html index 2092a0bb6a..21e9bd11d3 100644 --- a/docs/1.3/api/system-status.html +++ b/docs/1.3/api/system-status.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ for the calculation.</p><p><a href="/sdk/js/docs/1.3/api/system-status#gethistoricalstatus"><code>SystemStatus.getHistoricalStatus()</code></a> returns a boolean that represents the long-term status of the system. It considers the full snapshot history available in the <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a> instance.</p><hr><a name="systemstatus"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-systemstatusoptions"><code>new SystemStatus([options])</code><a href="#new-systemstatusoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/system-status-options"><code>SystemStatusOptions</code></a> - All <code>SystemStatus</code> configuration options.</li></ul><hr><a name="getcurrentstatus"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="systemstatusgetcurrentstatus"><code>systemStatus.getCurrentStatus()</code><a href="#systemstatusgetcurrentstatus" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an <a href="/sdk/js/docs/1.3/typedefs/system-info"><code>SystemInfo</code></a> object with the following structure:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">isSystemIdle</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Boolean</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">memInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">eventLoopInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">cpuInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Where the <code>isSystemIdle</code> property is set to <code>false</code> if the system has been overloaded in the last <code>options.currentHistorySecs</code> seconds, and <code>true</code> otherwise.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/system-info"><code>SystemInfo</code></a></p><hr><a name="gethistoricalstatus"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="systemstatusgethistoricalstatus"><code>systemStatus.getHistoricalStatus()</code><a href="#systemstatusgethistoricalstatus" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an <a href="/sdk/js/docs/1.3/typedefs/system-info"><code>SystemInfo</code></a> object with the following structure:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">isSystemIdle</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Boolean</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">memInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">eventLoopInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">cpuInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Where the <code>isSystemIdle</code> property is set to <code>false</code> if the system has been overloaded in the full history of the <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a> -(which is configurable in the <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a>) and <code>true</code> otherwise.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/system-info"><code>SystemInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SystemStatus.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/snapshotter"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Snapshotter</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-systemstatusoptions" class="table-of-contents__link toc-highlight"><code>new SystemStatus([options])</code></a></li><li><a href="#systemstatusgetcurrentstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getCurrentStatus()</code></a></li><li><a href="#systemstatusgethistoricalstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getHistoricalStatus()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +(which is configurable in the <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a>) and <code>true</code> otherwise.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/system-info"><code>SystemInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/SystemStatus.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/snapshotter"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Snapshotter</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-systemstatusoptions" class="table-of-contents__link toc-highlight"><code>new SystemStatus([options])</code></a></li><li><a href="#systemstatusgetcurrentstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getCurrentStatus()</code></a></li><li><a href="#systemstatusgethistoricalstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getHistoricalStatus()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/api/utils.html b/docs/1.3/api/utils.html index c2a83cd880..77583bb04c 100644 --- a/docs/1.3/api/utils.html +++ b/docs/1.3/api/utils.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -47,8 +47,8 @@ newlines and whitespaces in and around HTML elements to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g. phone numbers).</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">htmlToText</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'<html><body>Some text</body></html>'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that the function uses <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">cheerio</a> to parse the HTML. Optionally, to avoid duplicate parsing of HTML and thus improve performance, you can pass an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed with the -<code>decodeEntities</code> option set to <code>true</code>. For example:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> cheerio </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'cheerio'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'<html><body>Some text</body></html>'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">htmlToText</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cheerio</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">load</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">decodeEntities</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>html</code></strong>: <code>string</code> | <code>cheerio.Root</code> - HTML text or parsed HTML represented using a <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">cheerio</a> function.</li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - Plain text</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/utils.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/pseudo-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PseudoUrl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#utilsurl_no_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_NO_COMMAS_REGEX</code></a></li><li><a href="#utilsurl_with_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_WITH_COMMAS_REGEX</code></a></li><li><a href="#utilsenqueuelinksoptions" class="table-of-contents__link toc-highlight"><code>utils.enqueueLinks(options)</code></a></li><li><a href="#utilsrequestasbrowseroptions" class="table-of-contents__link toc-highlight"><code>utils.requestAsBrowser(options)</code></a></li><li><a href="#utilsisdockerforcereset" class="table-of-contents__link toc-highlight"><code>utils.isDocker(forceReset)</code></a></li><li><a href="#utilssleepmillis" class="table-of-contents__link toc-highlight"><code>utils.sleep(millis)</code></a></li><li><a href="#utilsdownloadlistofurlsoptions" class="table-of-contents__link toc-highlight"><code>utils.downloadListOfUrls(options)</code></a></li><li><a href="#utilsextracturlsoptions" class="table-of-contents__link toc-highlight"><code>utils.extractUrls(options)</code></a></li><li><a href="#utilshtmltotexthtml" class="table-of-contents__link toc-highlight"><code>utils.htmlToText(html)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>decodeEntities</code> option set to <code>true</code>. For example:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> cheerio </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'cheerio'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'<html><body>Some text</body></html>'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">htmlToText</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cheerio</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">load</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">decodeEntities</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>html</code></strong>: <code>string</code> | <code>cheerio.Root</code> - HTML text or parsed HTML represented using a <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">cheerio</a> function.</li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - Plain text</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/api/utils.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/pseudo-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PseudoUrl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#utilsurl_no_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_NO_COMMAS_REGEX</code></a></li><li><a href="#utilsurl_with_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_WITH_COMMAS_REGEX</code></a></li><li><a href="#utilsenqueuelinksoptions" class="table-of-contents__link toc-highlight"><code>utils.enqueueLinks(options)</code></a></li><li><a href="#utilsrequestasbrowseroptions" class="table-of-contents__link toc-highlight"><code>utils.requestAsBrowser(options)</code></a></li><li><a href="#utilsisdockerforcereset" class="table-of-contents__link toc-highlight"><code>utils.isDocker(forceReset)</code></a></li><li><a href="#utilssleepmillis" class="table-of-contents__link toc-highlight"><code>utils.sleep(millis)</code></a></li><li><a href="#utilsdownloadlistofurlsoptions" class="table-of-contents__link toc-highlight"><code>utils.downloadListOfUrls(options)</code></a></li><li><a href="#utilsextracturlsoptions" class="table-of-contents__link toc-highlight"><code>utils.extractUrls(options)</code></a></li><li><a href="#utilshtmltotexthtml" class="table-of-contents__link toc-highlight"><code>utils.htmlToText(html)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/changelog.html b/docs/1.3/changelog.html index 5d817bb036..d0ffc94be7 100644 --- a/docs/1.3/changelog.html +++ b/docs/1.3/changelog.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/changelog">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/changelog">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/changelog">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/changelog">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/changelog">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/changelog">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Changelog</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.12" target="_blank" rel="noopener">apify@3.1.12</a><a href="#apify3112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3112-2023-10-05"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.11...apify@3.1.12" target="_blank" rel="noopener">3.1.12</a> (2023-10-05)<a href="#3112-2023-10-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add more logging to <code>Actor.init</code> and <code>Actor.exit</code> (<a href="https://github.com/apify/apify-sdk-js/issues/236" target="_blank" rel="noopener">#236</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/b7e01fc649de84d6f1391bf95e0f349f7ca32536" target="_blank" rel="noopener">b7e01fc</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3111"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.11" target="_blank" rel="noopener">apify@3.1.11</a><a href="#apify3111" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3111-2023-10-04"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.10...apify@3.1.11" target="_blank" rel="noopener">3.1.11</a> (2023-10-04)<a href="#3111-2023-10-04" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-1">Bug Fixes<a href="#bug-fixes-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>run the whole <code>Actor.exit()</code> code inside a timeout handler (<a href="https://github.com/apify/apify-sdk-js/issues/235" target="_blank" rel="noopener">#235</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c8aabaee5f2de1ab40947f47f95f54ccff37cad0" target="_blank" rel="noopener">c8aabae</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features">Features<a href="#features" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use <code>.reboot()</code> instead of <code>.metamorph()</code> for reboot (<a href="https://github.com/apify/apify-sdk-js/issues/227" target="_blank" rel="noopener">#227</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/8c0bff5a8d3ea65e532b3700b34b9c563856158a" target="_blank" rel="noopener">8c0bff5</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.10" target="_blank" rel="noopener">apify@3.1.10</a><a href="#apify3110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3110-2023-09-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.9...apify@3.1.10" target="_blank" rel="noopener">3.1.10</a> (2023-09-07)<a href="#3110-2023-09-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-2">Bug Fixes<a href="#bug-fixes-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of crawlee to fix possible issues with <code>purgeDefaultStorages</code> (<a href="https://github.com/apify/apify-sdk-js/issues/226" target="_blank" rel="noopener">#226</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/95cf31f3d1d054a1c8e3daac89f41bbb0aaddbba" target="_blank" rel="noopener">95cf31f</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify319"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.9" target="_blank" rel="noopener">apify@3.1.9</a><a href="#apify319" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="319-2023-09-06"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.8...apify@3.1.9" target="_blank" rel="noopener">3.1.9</a> (2023-09-06)<a href="#319-2023-09-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">@apify/scraper-tools@1.1.2</a><a href="#apifyscraper-tools112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="112-2023-07-28"><a href="https://github.com/apify/apify-sdk-js/compare/@apify/scraper-tools@1.1.1...@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">1.1.2</a> (2023-07-28)<a href="#112-2023-07-28" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-3">Bug Fixes<a href="#bug-fixes-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-1">Features<a href="#features-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify318"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.8" target="_blank" rel="noopener">apify@3.1.8</a><a href="#apify318" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="318-2023-07-20"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.7...apify@3.1.8" target="_blank" rel="noopener">3.1.8</a> (2023-07-20)<a href="#318-2023-07-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-4">Bug Fixes<a href="#bug-fixes-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of apify-client and other packages (<a href="https://github.com/apify/apify-sdk-js/commit/24a3a4b5bf2f61e690348727e7f24c06c45a0999" target="_blank" rel="noopener">24a3a4b</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-2">Features<a href="#features-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use Actor env vars (<a href="https://github.com/apify/apify-sdk-js/issues/216" target="_blank" rel="noopener">#216</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/11ff740ad3d2bdd37fce011d94b64ea01413b0d9" target="_blank" rel="noopener">11ff740</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify317"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.7" target="_blank" rel="noopener">apify@3.1.7</a><a href="#apify317" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="317-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.6...apify@3.1.7" target="_blank" rel="noopener">3.1.7</a> (2023-06-09)<a href="#317-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify316"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.6" target="_blank" rel="noopener">apify@3.1.6</a><a href="#apify316" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="316-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.5...apify@3.1.6" target="_blank" rel="noopener">3.1.6</a> (2023-06-09)<a href="#316-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-5">Bug Fixes<a href="#bug-fixes-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>only print status message when explicitly provided in <code>Actor.exit()</code> (<a href="https://github.com/apify/apify-sdk-js/issues/203" target="_blank" rel="noopener">#203</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/85159e499984c78eee90b6d92332ea63b9f46c8c" target="_blank" rel="noopener">85159e4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify315"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.5" target="_blank" rel="noopener">apify@3.1.5</a><a href="#apify315" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="315-2023-05-31"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.4...apify@3.1.5" target="_blank" rel="noopener">3.1.5</a> (2023-05-31)<a href="#315-2023-05-31" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-6">Bug Fixes<a href="#bug-fixes-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add missing <code>options</code> parameter to <code>Actor.setStatusMessage()</code> (<a href="https://github.com/apify/apify-sdk-js/commit/712e8c66755ac8baeb35fcc1ad000487da8b2c48" target="_blank" rel="noopener">712e8c6</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-3">Features<a href="#features-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.getInputOrThrow()</code> method (<a href="https://github.com/apify/apify-sdk-js/issues/198" target="_blank" rel="noopener">#198</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/5fbbfe4960a79fbbd23f4fdd7d07a1a5063820f4" target="_blank" rel="noopener">5fbbfe4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify314"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.4" target="_blank" rel="noopener">apify@3.1.4</a><a href="#apify314" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="314-2023-03-23"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.3...apify@3.1.4" target="_blank" rel="noopener">3.1.4</a> (2023-03-23)<a href="#314-2023-03-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-7">Bug Fixes<a href="#bug-fixes-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>log status message only once and without prefix (<a href="https://github.com/apify/apify-sdk-js/issues/179" target="_blank" rel="noopener">#179</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1f11a6ad8ebc8a0cfaef58be47ba8b12c75018f1" target="_blank" rel="noopener">1f11a6a</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify313"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.3" target="_blank" rel="noopener">apify@3.1.3</a><a href="#apify313" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="313-2023-03-22"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.2...apify@3.1.3" target="_blank" rel="noopener">3.1.3</a> (2023-03-22)<a href="#313-2023-03-22" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-8">Bug Fixes<a href="#bug-fixes-8" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><code>call/callTask</code> accept <code>waitSecs</code> instead of <code>waitForFinish</code> (<a href="https://github.com/apify/apify-sdk-js/issues/176" target="_blank" rel="noopener">#176</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/f0c73d8765091212f2abb4b4faaf109f9447d90a" target="_blank" rel="noopener">f0c73d8</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-4">Features<a href="#features-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify312"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.2" target="_blank" rel="noopener">apify@3.1.2</a><a href="#apify312" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="312-2023-02-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.1...apify@3.1.2" target="_blank" rel="noopener">3.1.2</a> (2023-02-07)<a href="#312-2023-02-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-9">Bug Fixes<a href="#bug-fixes-9" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li><li>remove unused export of <code>QueueOperationInfoOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/b29fe4853d637ab527a7f7e3e53c7a5b0fe27a32" target="_blank" rel="noopener">b29fe48</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify311"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.1" target="_blank" rel="noopener">apify@3.1.1</a><a href="#apify311" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="311-2022-11-13"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.0...apify@3.1.1" target="_blank" rel="noopener">3.1.1</a> (2022-11-13)<a href="#311-2022-11-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-5">Features<a href="#features-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>statusMessage</code> to <code>AbortOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/fb10bb60c12c0af97e41ae88adcf0b2000286235" target="_blank" rel="noopener">fb10bb6</a>)</li><li>warn about actor not being initialized before using storage methods (<a href="https://github.com/apify/apify-sdk-js/issues/126" target="_blank" rel="noopener">#126</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/91cd2467d111de19490a6bf47b4a9138f26a37d4" target="_blank" rel="noopener">91cd246</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify310"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.0" target="_blank" rel="noopener">apify@3.1.0</a><a href="#apify310" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="310-2022-10-13">3.1.0 (2022-10-13)<a href="#310-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-10">Bug Fixes<a href="#bug-fixes-10" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><strong>apify:</strong> add <code>@apify/timeout</code> to dependencies (<a href="https://github.com/apify/apify-sdk-js/issues/76" target="_blank" rel="noopener">#76</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1d64a1fa8f0e88a96eb82c2669e85b09dd4f372d" target="_blank" rel="noopener">1d64a1f</a>)</li><li>use correct event manager for actor methods (<a href="https://github.com/apify/apify-sdk-js/issues/49" target="_blank" rel="noopener">#49</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/ef3a0c54359be64c89e76b0cac600cd780281321" target="_blank" rel="noopener">ef3a0c5</a>)</li><li>wait for memory storage to write changes before <code>Actor.exit</code> exists the process (<a href="https://github.com/apify/apify-sdk-js/commit/c721d988141cf5b7aa170fddeffb792ded769622" target="_blank" rel="noopener">c721d98</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-6">Features<a href="#features-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li><strong>apify:</strong> add decryption for input secrets (<a href="https://github.com/apify/apify-sdk-js/issues/83" target="_blank" rel="noopener">#83</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/78bb990817c01254de19c828937181c1263e21eb" target="_blank" rel="noopener">78bb990</a>)</li><li>re-export the logger in actor sdk (<a href="https://github.com/apify/apify-sdk-js/issues/54" target="_blank" rel="noopener">#54</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c78d8a44d7af5de7fda7bf2e436fefda752a4b1a" target="_blank" rel="noopener">c78d8a4</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.0" target="_blank" rel="noopener">@apify/scraper-tools@1.1.0</a><a href="#apifyscraper-tools110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="110-2022-10-13">1.1.0 (2022-10-13)<a href="#110-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-7">Features<a href="#features-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li>add playwright scraper (<a href="https://github.com/apify/apify-sdk-js/issues/26" target="_blank" rel="noopener">#26</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/2dcd50ded777ae13bc7b75e6e0bc21a6a11315b7" target="_blank" rel="noopener">2dcd50d</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/changelog.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/system-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify3112" class="table-of-contents__link toc-highlight">apify@3.1.12</a></li><li><a href="#apify3111" class="table-of-contents__link toc-highlight">apify@3.1.11</a></li><li><a href="#apify3110" class="table-of-contents__link toc-highlight">apify@3.1.10</a></li><li><a href="#apify319" class="table-of-contents__link toc-highlight">apify@3.1.9</a></li><li><a href="#apifyscraper-tools112" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.2</a></li><li><a href="#apify318" class="table-of-contents__link toc-highlight">apify@3.1.8</a></li><li><a href="#apify317" class="table-of-contents__link toc-highlight">apify@3.1.7</a></li><li><a href="#apify316" class="table-of-contents__link toc-highlight">apify@3.1.6</a></li><li><a href="#apify315" class="table-of-contents__link toc-highlight">apify@3.1.5</a></li><li><a href="#apify314" class="table-of-contents__link toc-highlight">apify@3.1.4</a></li><li><a href="#apify313" class="table-of-contents__link toc-highlight">apify@3.1.3</a></li><li><a href="#apify312" class="table-of-contents__link toc-highlight">apify@3.1.2</a></li><li><a href="#apify311" class="table-of-contents__link toc-highlight">apify@3.1.1</a></li><li><a href="#apify310" class="table-of-contents__link toc-highlight">apify@3.1.0</a></li><li><a href="#apifyscraper-tools110" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.0</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples.html b/docs/1.3/examples.html index eeccd87f8d..d4efe261b1 100644 --- a/docs/1.3/examples.html +++ b/docs/1.3/examples.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><header><h1 class="title_kItE">Examples</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/accept-user-input"><h2 class="text--truncate cardTitle_rnsV" title="Accept user input">📄️<!-- --> <!-- -->Accept user input</h2><p class="text--truncate cardDescription_PWke" title="This example accepts and logs user input:">This example accepts and logs user input:</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/add-data-to-dataset"><h2 class="text--truncate cardTitle_rnsV" title="Add data to dataset">📄️<!-- --> <!-- -->Add data to dataset</h2><p class="text--truncate cardDescription_PWke" title="This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using">This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/basic-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Basic crawler">📄️<!-- --> <!-- -->Basic crawler</h2><p class="text--truncate cardDescription_PWke" title="This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the">This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/call-actor"><h2 class="text--truncate cardTitle_rnsV" title="Call actor">📄️<!-- --> <!-- -->Call actor</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to start an Apify actor using Apify.call() and how to call the Apify API using">This example demonstrates how to start an Apify actor using Apify.call() and how to call the Apify API using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/capture-screenshot"><h2 class="text--truncate cardTitle_rnsV" title="Capture a screenshot">📄️<!-- --> <!-- -->Capture a screenshot</h2><p class="text--truncate cardDescription_PWke" title="To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.">To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/cheerio-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Cheerio crawler">📄️<!-- --> <!-- -->Cheerio crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using">This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/crawl-all-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl all links on a website">📄️<!-- --> <!-- -->Crawl all links on a website</h2><p class="text--truncate cardDescription_PWke" title="This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the">This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls"><h2 class="text--truncate cardTitle_rnsV" title="Crawl multiple URLs">📄️<!-- --> <!-- -->Crawl multiple URLs</h2><p class="text--truncate cardDescription_PWke" title="This example crawls the specified list of URLs.">This example crawls the specified list of URLs.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/crawl-relative-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a website with relative links">📄️<!-- --> <!-- -->Crawl a website with relative links</h2><p class="text--truncate cardDescription_PWke" title="If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may have trouble following them. This is">If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may have trouble following them. This is</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/crawl-single-url"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a single URL">📄️<!-- --> <!-- -->Crawl a single URL</h2><p class="text--truncate cardDescription_PWke" title="This example uses the Apify.utils.requestAsBrowser() function to grab the HTML of a web page.">This example uses the Apify.utils.requestAsBrowser() function to grab the HTML of a web page.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/crawl-sitemap"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a sitemap">📄️<!-- --> <!-- -->Crawl a sitemap</h2><p class="text--truncate cardDescription_PWke" title="This example downloads and crawls the URLs from a sitemap.">This example downloads and crawls the URLs from a sitemap.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/crawl-some-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl some links on a website">📄️<!-- --> <!-- -->Crawl some links on a website</h2><p class="text--truncate cardDescription_PWke" title="This CheerioCrawler example uses the pseudoUrls property in the Apify.enqueueLinks() method">This CheerioCrawler example uses the pseudoUrls property in the Apify.enqueueLinks() method</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/forms"><h2 class="text--truncate cardTitle_rnsV" title="Forms">📄️<!-- --> <!-- -->Forms</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler to automatically fill and submit a search form to look up">This example demonstrates how to use PuppeteerCrawler to automatically fill and submit a search form to look up</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/handle-broken-links"><h2 class="text--truncate cardTitle_rnsV" title="Handle broken links">📄️<!-- --> <!-- -->Handle broken links</h2><p class="text--truncate cardDescription_PWke" title="This example uses the handleFailedRequestFunction function to log failed requests. In a real-world project, you might choose to keep track of these">This example uses the handleFailedRequestFunction function to log failed requests. In a real-world project, you might choose to keep track of these</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/map-and-reduce"><h2 class="text--truncate cardTitle_rnsV" title="Dataset Map and Reduce methods">📄️<!-- --> <!-- -->Dataset Map and Reduce methods</h2><p class="text--truncate cardDescription_PWke" title="This example shows an easy use-case of the Apify dataset map and">This example shows an easy use-case of the Apify dataset map and</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/playwright-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Playwright crawler">📄️<!-- --> <!-- -->Playwright crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PlaywrightCrawler in combination with RequestQueue to">This example demonstrates how to use PlaywrightCrawler in combination with RequestQueue to</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/puppeteer-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer crawler">📄️<!-- --> <!-- -->Puppeteer crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler in combination with RequestQueue">This example demonstrates how to use PuppeteerCrawler in combination with RequestQueue</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer recursive crawl">📄️<!-- --> <!-- -->Puppeteer recursive crawl</h2><p class="text--truncate cardDescription_PWke" title="Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.">Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer sitemap">📄️<!-- --> <!-- -->Puppeteer sitemap</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler to crawl a list of web pages specified in a sitemap. The">This example demonstrates how to use PuppeteerCrawler to crawl a list of web pages specified in a sitemap. The</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer with proxy">📄️<!-- --> <!-- -->Puppeteer with proxy</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy. To make it work, you'll">This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy. To make it work, you'll</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/screenshots"><h2 class="text--truncate cardTitle_rnsV" title="Screenshots">📄️<!-- --> <!-- -->Screenshots</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to read and write data to the default key-value store using Apify.getValue() and">This example demonstrates how to read and write data to the default key-value store using Apify.getValue() and</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/synchronous-run"><h2 class="text--truncate cardTitle_rnsV" title="Synchronous run">📄️<!-- --> <!-- -->Synchronous run</h2><p class="text--truncate cardDescription_PWke" title="This example shows a quick actor that has a run time of just a few seconds. It opens a web page (the Wikipedia home page),">This example shows a quick actor that has a run time of just a few seconds. It opens a web page (the Wikipedia home page),</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/1.3/examples/use-stealth-mode"><h2 class="text--truncate cardTitle_rnsV" title="Use stealth mode">📄️<!-- --> <!-- -->Use stealth mode</h2><p class="text--truncate cardDescription_PWke" title="Stealth mode allows you to bypass anti-scraping techniques that use">Stealth mode allows you to bypass anti-scraping techniques that use</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Migration to version 1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/accept-user-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Accept user input</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/accept-user-input.html b/docs/1.3/examples/accept-user-input.html index b71369e101..ba8510a3c0 100644 --- a/docs/1.3/examples/accept-user-input.html +++ b/docs/1.3/examples/accept-user-input.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/accept_user_input.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/accept_user_input.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/add-data-to-dataset.html b/docs/1.3/examples/add-data-to-dataset.html index 13e2ec5c57..71d5e70cc6 100644 --- a/docs/1.3/examples/add-data-to-dataset.html +++ b/docs/1.3/examples/add-data-to-dataset.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/add-data-to-dataset">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/add-data-to-dataset">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/add-data-to-dataset">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Add data to dataset</h1></header><p>This example saves data to the default dataset. If the dataset doesn't exist, it will be created. You can save data to custom datasets by using -<a href="/sdk/js/docs/1.3/api/apify#opendataset"><code>Apify.openDataset()</code></a></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> body </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/add_data_to_dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/apify#opendataset"><code>Apify.openDataset()</code></a></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> body </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/add_data_to_dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/basic-crawler.html b/docs/1.3/examples/basic-crawler.html index 27f4133848..9190046fc6 100644 --- a/docs/1.3/examples/basic-crawler.html +++ b/docs/1.3/examples/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ featured crawlers like <a href="https://sdk.apify.com/docs/examples/cheerio-crawler"><code>CheerioCrawler</code></a> or <a href="https://sdk.apify.com/docs/examples/playwright-crawler"><code>PlaywrightCrawler</code></a>.</p><p>The script simply downloads several web pages with plain HTTP requests using the <a href="/sdk/js/docs/api/utils#requestasbrowser"><code>Apify.utils.requestAsBrowser()</code></a> convenience function and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in -<code>./apify_storage/datasets/default</code>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and initialize an instance of the RequestList class that contains</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// a list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils requestAsBrowser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/basic_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>./apify_storage/datasets/default</code>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and initialize an instance of the RequestList class that contains</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// a list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils requestAsBrowser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/basic_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/call-actor.html b/docs/1.3/examples/call-actor.html index f37bcfb687..aac3cea216 100644 --- a/docs/1.3/examples/call-actor.html +++ b/docs/1.3/examples/call-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ <a href="https://my.apify.com/account#/integrations" target="_blank" rel="noopener">Account - Integrations</a> page to obtain your API token and set it to the <a href="/sdk/js/docs/guides/environment-variables#APIFY_TOKEN"><code>APIFY_TOKEN</code></a> environment variable, or run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>Node.js 12 + Chrome on Debian (apify/actor-node-chrome)</code> base image on the <strong>Source</strong> tab -when configuring the actor.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> user </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">el</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Apify.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> user</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/call_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +when configuring the actor.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> user </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">el</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Apify.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> user</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/call_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/capture-screenshot.html b/docs/1.3/examples/capture-screenshot.html index 0eeb54cd2a..c6902158f7 100644 --- a/docs/1.3/examples/capture-screenshot.html +++ b/docs/1.3/examples/capture-screenshot.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ Using <code>Apify.utils.puppeteer.saveSnapshot()</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">key</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This example captures a screenshot of multiple web pages when using <code>PuppeteerCrawler</code>:</p><p>\ Using <code>page.screenshot()</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot with Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>Apify.utils.puppeteer.saveSnapshot()</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>In both examples using <code>page.screenshot()</code>, a <code>key</code> variable is created based on the URL of the web page. This variable is used as the key when saving -each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/capture_screenshot.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/capture_screenshot.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/cheerio-crawler.html b/docs/1.3/examples/cheerio-crawler.html index 1ee39d3cec..dd3d365778 100644 --- a/docs/1.3/examples/cheerio-crawler.html +++ b/docs/1.3/examples/cheerio-crawler.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/cheerio-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="/sdk/js/docs/api/cheerio-crawler"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title -and all <code>h1</code> tags.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.utils contains various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">LEVELS</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the RequestList class that contains a list of URLs to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">handlePageTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./apify_storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/cheerio_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +and all <code>h1</code> tags.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.utils contains various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">LEVELS</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the RequestList class that contains a list of URLs to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">handlePageTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./apify_storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/cheerio_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/crawl-all-links.html b/docs/1.3/examples/crawl-all-links.html index 1ad424facc..10dc62b86a 100644 --- a/docs/1.3/examples/crawl-all-links.html +++ b/docs/1.3/examples/crawl-all-links.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ required parameters are defined, all links will be crawled.</p><p>\ Using <code>CheerioCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>PuppeteerCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ -Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_all_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_all_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/crawl-multiple-urls.html b/docs/1.3/examples/crawl-multiple-urls.html index 078274f422..b80907aa3e 100644 --- a/docs/1.3/examples/crawl-multiple-urls.html +++ b/docs/1.3/examples/crawl-multiple-urls.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-multiple-urls">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><p>\ Using <code>CheerioCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>PuppeteerCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ -Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_multiple_urls.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_multiple_urls.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/crawl-relative-links.html b/docs/1.3/examples/crawl-relative-links.html index d83eb56a14..3c328f07af 100644 --- a/docs/1.3/examples/crawl-relative-links.html +++ b/docs/1.3/examples/crawl-relative-links.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-relative-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-relative-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-relative-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-relative-links">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/crawl-relative-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-relative-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a website with relative links</h1></header><p>If a website uses relative links, <a href="/sdk/js/docs/api/cheerio-crawler"><code>CheerioCrawler</code></a> and <code>Apify.enqueueLinks()</code> may have trouble following them. This is -why it is important to set the <code>baseUrl</code> property within <code>Apify.enqueueLinks()</code> to <code>request.loadedUrl</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <-------------- important to set the base url here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_relative_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +why it is important to set the <code>baseUrl</code> property within <code>Apify.enqueueLinks()</code> to <code>request.loadedUrl</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <-------------- important to set the base url here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_relative_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/crawl-single-url.html b/docs/1.3/examples/crawl-single-url.html index fdc3945eea..67af069c1d 100644 --- a/docs/1.3/examples/crawl-single-url.html +++ b/docs/1.3/examples/crawl-single-url.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-single-url">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-single-url">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-single-url">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-single-url">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/crawl-single-url">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-single-url">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a single URL</h1></header><p>This example uses the <a href="/sdk/js/docs/api/utils#utilsrequestasbrowseroptions"><code>Apify.utils.requestAsBrowser()</code></a> function to grab the HTML of a web page.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/1.3/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_single_url.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-single-url">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-single-url">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-single-url">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-single-url">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/crawl-single-url">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-single-url">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a single URL</h1></header><p>This example uses the <a href="/sdk/js/docs/api/utils#utilsrequestasbrowseroptions"><code>Apify.utils.requestAsBrowser()</code></a> function to grab the HTML of a web page.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/1.3/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_single_url.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/crawl-sitemap.html b/docs/1.3/examples/crawl-sitemap.html index aecc678154..87dc2af742 100644 --- a/docs/1.3/examples/crawl-sitemap.html +++ b/docs/1.3/examples/crawl-sitemap.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-sitemap">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><p>\ Using <code>CheerioCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that uses Cheerio</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>PuppeteerCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that runs Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ -Using <code>PlaywrightCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that runs Playwright</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_sitemap.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Using <code>PlaywrightCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that runs Playwright</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_sitemap.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/crawl-some-links.html b/docs/1.3/examples/crawl-some-links.html index 855bad21da..cd65c54d34 100644 --- a/docs/1.3/examples/crawl-some-links.html +++ b/docs/1.3/examples/crawl-some-links.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-some-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="/sdk/js/docs/api/cheerio-crawler"><code>CheerioCrawler</code></a> example uses the <a href="/sdk/js/docs/api/pseudo-url"><code>pseudoUrls</code></a> property in the <code>Apify.enqueueLinks()</code> method -to only add links to the <code>RequestList</code> queue if they match the specified regular expression.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_some_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +to only add links to the <code>RequestList</code> queue if they match the specified regular expression.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/crawl_some_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/forms.html b/docs/1.3/examples/forms.html index cc08183eaa..e8d5a304e5 100644 --- a/docs/1.3/examples/forms.html +++ b/docs/1.3/examples/forms.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/forms">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/forms">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/forms">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/forms">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/forms">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/forms">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Forms</h1></header><p>This example demonstrates how to use <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a> to automatically fill and submit a search form to look up repositories on <a href="https://github.com" target="_blank" rel="noopener">GitHub</a> using headless Chrome / Puppeteer. The actor first fills in the search term, repository owner, start date and language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the -default <a href="/sdk/js/docs/api/dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./apify_storage/datasets/default</code>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">nodes</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/forms.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/handle-broken-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Handle broken links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +default <a href="/sdk/js/docs/api/dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./apify_storage/datasets/default</code>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">nodes</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/forms.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/handle-broken-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Handle broken links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/handle-broken-links.html b/docs/1.3/examples/handle-broken-links.html index 036d881ca7..c27f259757 100644 --- a/docs/1.3/examples/handle-broken-links.html +++ b/docs/1.3/examples/handle-broken-links.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/handle-broken-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Handle broken links</h1></header><p>This example uses the <code>handleFailedRequestFunction</code> function to log failed requests. In a real-world project, you might choose to keep track of these -failed requests by <a href="/sdk/js/docs/1.3/examples/add-data-to-dataset">saving them to a dataset</a>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each successful request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Request function failed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">[success] </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each failed request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> error </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">[failed] </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> with error: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">error</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handleRequestFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handleFailedRequestFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/handle_broken_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +failed requests by <a href="/sdk/js/docs/1.3/examples/add-data-to-dataset">saving them to a dataset</a>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each successful request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Request function failed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">[success] </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each failed request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> error </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">[failed] </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> with error: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">error</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handleRequestFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handleFailedRequestFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/handle_broken_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/map-and-reduce.html b/docs/1.3/examples/map-and-reduce.html index c4e9f79672..1e54ccc725 100644 --- a/docs/1.3/examples/map-and-reduce.html +++ b/docs/1.3/examples/map-and-reduce.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ array through a transformation function and an options parameter.</p><p>The <code>map</code> method used to check if are there more than 5 header elements on each page:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// open default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataSet </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// calling map function and filtering through mapped items</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> moreThan5headers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataSet</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">item</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">count</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_with_more_than_5_headers'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> moreThan5headers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The <code>moreThan5headers</code> variable is an array of <code>headingCount</code> attributes where the number of headers is greater than 5.</p><p>The <code>map</code> method's result value saved to the <a href="/sdk/js/docs/api/key-value-store"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="reduce">Reduce<a href="#reduce" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The dataset <code>reduce</code> method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through the items in the dataset using the <a href="/sdk/js/docs/api/dataset#datasetreduceiteratee-memo-options"><code>memo</code> argument</a>. After performing the necessary calculation, the <code>memo</code> is sent to the next iteration, while the item just processed is reduced (removed).</p><p>Using the <code>reduce</code> method to get the total number of headers scraped (all items in the dataset):</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// open default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataSet </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// calling reduce function and using memo to calculate number of headers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> pagesHeadingCount </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataSet</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">memo</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> memo </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headingCount</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> memo</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// saving result of reduce to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_heading_count'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pagesHeadingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The original dataset will be reduced to a single value, <code>pagesHeadingCount</code>, which contains the count of all headers for all scraped pages (all -dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/docs/api/key-value-store">key-value store</a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/map_and_reduce.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/handle-broken-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Handle broken links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/docs/api/key-value-store">key-value store</a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/map_and_reduce.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/handle-broken-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Handle broken links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/playwright-crawler.html b/docs/1.3/examples/playwright-crawler.html index adfc546077..889eff2252 100644 --- a/docs/1.3/examples/playwright-crawler.html +++ b/docs/1.3/examples/playwright-crawler.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/playwright-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/playwright-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/playwright-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/playwright-crawler">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/playwright-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/playwright-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Playwright crawler</h1></header><p>This example demonstrates how to use <a href="/sdk/js/docs/1.3/api/playwright-crawler"><code>PlaywrightCrawler</code></a> in combination with <a href="/sdk/js/docs/1.3/api/request-queue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Playwright.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">$posts</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/playwright_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">$posts</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/playwright_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/puppeteer-crawler.html b/docs/1.3/examples/puppeteer-crawler.html index 00490dfad7..4f936ed9f6 100644 --- a/docs/1.3/examples/puppeteer-crawler.html +++ b/docs/1.3/examples/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer crawler</h1></header><p>This example demonstrates how to use <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a> in combination with <a href="/sdk/js/docs/api/request-queue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Puppeteer. The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results are stored to the default dataset. In -local configuration, the results are stored as JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the Apify.launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">$posts</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +local configuration, the results are stored as JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the Apify.launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">$posts</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/puppeteer-recursive-crawl.html b/docs/1.3/examples/puppeteer-recursive-crawl.html index cf4d6932ea..4c619ee4c3 100644 --- a/docs/1.3/examples/puppeteer-recursive-crawl.html +++ b/docs/1.3/examples/puppeteer-recursive-crawl.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_recursive_crawl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_recursive_crawl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/puppeteer-sitemap.html b/docs/1.3/examples/puppeteer-sitemap.html index 6ab4ede768..f5fc502ded 100644 --- a/docs/1.3/examples/puppeteer-sitemap.html +++ b/docs/1.3/examples/puppeteer-sitemap.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer sitemap</h1></header><p>This example demonstrates how to use <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a> to crawl a list of web pages specified in a sitemap. The crawler extracts the page title and URL from each page and stores them as a record in the default dataset. In local configuration, the results are stored as JSON files in <code>./apify_storage/datasets/default</code>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>Node.js 12 + Chrome on Debian (apify/actor-node-chrome)</code> base image on the <strong>Source</strong> tab -when configuring the actor.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">RequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sources</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemaps.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">initialize</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">content</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Done.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_sitemap.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +when configuring the actor.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">RequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sources</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemaps.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">initialize</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">content</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Done.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_sitemap.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/puppeteer-with-proxy.html b/docs/1.3/examples/puppeteer-with-proxy.html index 70725b74eb..8f37463656 100644 --- a/docs/1.3/examples/puppeteer-with-proxy.html +++ b/docs/1.3/examples/puppeteer-with-proxy.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-with-proxy">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>. To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your -account from the SDK.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">el</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_with_proxy.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/screenshots"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Screenshots</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +account from the SDK.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">el</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/puppeteer_with_proxy.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/screenshots"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Screenshots</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/screenshots.html b/docs/1.3/examples/screenshots.html index 6414aaf28a..b6347f5432 100644 --- a/docs/1.3/examples/screenshots.html +++ b/docs/1.3/examples/screenshots.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ <code>./apify_storage/key_value_stores/default/INPUT.json</code>. You need to create the file and set it with the following content:</p><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token property" style="color:#36acaa">"sources"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token property" style="color:#36acaa">"url"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"https://www.google.com"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token property" style="color:#36acaa">"url"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"https://www.duckduckgo.com"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>On the Apify cloud, the input can be either set manually in the UI app or passed as the POST payload to the <a href="https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor" target="_blank" rel="noopener">Run actor API call</a>. For more details, see <a href="https://docs.apify.com/actor/run#input-and-output" target="_blank" rel="noopener">Input and output</a> in the Apify Actor documentation.</p><blockquote><p>To run this example on the Apify Platform, select the <code>Node.js 12 + Chrome on Debian (apify/actor-node-chrome)</code> base image on the source tab of your -actor configuration.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Read the actor input configuration containing the URLs for the screenshot.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// By convention, the input is present in the actor's default key-value store under the "INPUT" key.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Have you passed the correct INPUT ?'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sources </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> input</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">RequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sources </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">initialize</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This is a Puppeteer function that takes a screenshot of the page and returns its buffer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshotBuffer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The record key may only include the following characters: a-zA-Z0-9!-_.'()</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot. Choosing the right content type will automatically</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// assign the local file the right extension, in this case .png.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The screenshots will be stored in ./apify_storage/key_value_stores/default/</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshotBuffer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Screenshot of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> saved.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run crawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/screenshots.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Synchronous run</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +actor configuration.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Read the actor input configuration containing the URLs for the screenshot.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// By convention, the input is present in the actor's default key-value store under the "INPUT" key.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Have you passed the correct INPUT ?'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sources </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> input</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">RequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sources </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">initialize</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This is a Puppeteer function that takes a screenshot of the page and returns its buffer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshotBuffer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The record key may only include the following characters: a-zA-Z0-9!-_.'()</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot. Choosing the right content type will automatically</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// assign the local file the right extension, in this case .png.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The screenshots will be stored in ./apify_storage/key_value_stores/default/</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshotBuffer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Screenshot of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> saved.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run crawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/screenshots.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Synchronous run</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/synchronous-run.html b/docs/1.3/examples/synchronous-run.html index abd08be383..81a281b649 100644 --- a/docs/1.3/examples/synchronous-run.html +++ b/docs/1.3/examples/synchronous-run.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/synchronous-run">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/examples/synchronous-run">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/handle-broken-links">Handle broken links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-sitemap">Puppeteer sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/screenshots">Screenshots</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/1.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Synchronous run</h1></header><p>This example shows a quick actor that has a run time of just a few seconds. It opens a <a href="https://en.wikipedia.org" target="_blank" rel="noopener">web page</a> (the Wikipedia home page), which contains a list of "Did you know" texts that change daily. The actor scrapes all the "Did you know" items and saves them to the default dataset.</p><p>This actor can be invoked synchronously using a single HTTP request to directly obtain its output as a response, using the -<a href="https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input" target="_blank" rel="noopener">Run actor synchronously</a> Apify API endpoint.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load https://en.wikipedia.org and get all "Did you know" texts.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Opening web page...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://en.wikipedia.org'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get all "Did you know" items from the page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Getting "Did you know" items from the page.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div#mp-dyk > ul li'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">nodes</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Did you know'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save all the items to the Apify dataSet.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Actor finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/synchronous_run.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/screenshots"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Screenshots</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Use stealth mode</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input" target="_blank" rel="noopener">Run actor synchronously</a> Apify API endpoint.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load https://en.wikipedia.org and get all "Did you know" texts.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Opening web page...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://en.wikipedia.org'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get all "Did you know" items from the page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Getting "Did you know" items from the page.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div#mp-dyk > ul li'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">nodes</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Did you know'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save all the items to the Apify dataSet.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Actor finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/synchronous_run.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/screenshots"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Screenshots</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Use stealth mode</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/examples/use-stealth-mode.html b/docs/1.3/examples/use-stealth-mode.html index 4c28c12169..45a5cb5c1a 100644 --- a/docs/1.3/examples/use-stealth-mode.html +++ b/docs/1.3/examples/use-stealth-mode.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ the full Chrome browser.</p><p>To activate stealth mode, you need to <code>useChrome</code>, run <code>headless</code> and turn <code>stealth</code> on in your <a href="https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext"><code>launchContext</code></a>.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> launchContext </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">stealth</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">stealth</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You can override default stealth options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// stealthOptions: {</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// addLanguage: false,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// },</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token parameter">$posts</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the title of each post on Hacker News</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">The title is: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the data array to the Apify dataSet</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You can then specify the <a href="https://sdk.apify.com/docs/typedefs/stealth-options"><code>stealthOptions</code></a>, which allow you to adapt to different anti-scraping techniques. All the options are set to <code>true</code> by default. The number of options does not affect performance.</p><p>While the default configuration will be fine in many cases, you can adapt the options to your use case.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="single-browser-instances">Single-browser instances<a href="#single-browser-instances" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>You can also use stealth mode in single-browser instances when using <a href="https://sdk.apify.com/docs/api/apify#launchpuppeteer"><code>Apify.launchPuppeteer</code></a>. -The <code>launchContext</code> is the same.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/use_stealth_mode.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Synchronous run</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/apify"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#single-browser-instances" class="table-of-contents__link toc-highlight">Single-browser instances</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +The <code>launchContext</code> is the same.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/examples/use_stealth_mode.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Synchronous run</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/apify"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#single-browser-instances" class="table-of-contents__link toc-highlight">Single-browser instances</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/apify-platform.html b/docs/1.3/guides/apify-platform.html index 8793f17d47..e98e513186 100644 --- a/docs/1.3/guides/apify-platform.html +++ b/docs/1.3/guides/apify-platform.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -38,8 +38,8 @@ as filling out a web form or sending an email, to complex operations such as crawling an entire website and removing duplicates from a large dataset.</p><p>Actors can be shared in the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a> so that other people can use them. But don't worry, if you share your actor in the store and somebody uses it, it runs under their account, -not yours.</p><p><strong>Related links</strong></p><ul><li><a href="https://apify.com/store" target="_blank" rel="noopener">Store of existing actors</a></li><li><a href="https://docs.apify.com/actor" target="_blank" rel="noopener">Documentation</a></li><li><a href="https://my.apify.com/actors" target="_blank" rel="noopener">View actors in Apify app</a></li><li><a href="https://apify.com/docs/api/v2#/reference/actors" target="_blank" rel="noopener">API reference</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/apify_platform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/quick-start"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Quick Start</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/getting-started"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Getting Started</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-apify-sdk" class="table-of-contents__link toc-highlight">Logging into Apify platform from Apify SDK</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +not yours.</p><p><strong>Related links</strong></p><ul><li><a href="https://apify.com/store" target="_blank" rel="noopener">Store of existing actors</a></li><li><a href="https://docs.apify.com/actor" target="_blank" rel="noopener">Documentation</a></li><li><a href="https://my.apify.com/actors" target="_blank" rel="noopener">View actors in Apify app</a></li><li><a href="https://apify.com/docs/api/v2#/reference/actors" target="_blank" rel="noopener">API reference</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/apify_platform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/quick-start"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Quick Start</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/getting-started"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Getting Started</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-apify-sdk" class="table-of-contents__link toc-highlight">Logging into Apify platform from Apify SDK</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/data-storage.html b/docs/1.3/guides/data-storage.html index 5f28b7acca..e742ff48b0 100644 --- a/docs/1.3/guides/data-storage.html +++ b/docs/1.3/guides/data-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -40,8 +40,8 @@ recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.</p><p>Each actor run is associated with a <strong>default request queue</strong>, which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional.</p><p>In Apify SDK, the request queue is represented by the <a href="/sdk/js/docs/1.3/api/request-queue"><code>RequestQueue</code></a> class.</p><p>In local configuration, the request queue data is stored in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">request_queues</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">QUEUE_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">STATE</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">NUMBER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{QUEUE_ID}</code> is the name or ID of the request queue. The default queue has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code> environment variable. Each request in the queue is stored as a separate JSON file, where <code>{STATE}</code> is either -<code>handled</code> or <code>pending</code>, and <code>{NUMBER}</code> is an integer indicating the position of the request in the queue.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> queue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named request queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> queueWithName </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue few requests</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://example.com/aaa'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://example.com/bbb'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://example.com/foo/bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">forefront</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get requests from queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> request1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">fetchNextRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> request2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">fetchNextRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> request3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">fetchNextRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Mark a request as handled</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markRequestHandled</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// If processing fails then reclaim the request back to the queue, so that it's crawled again</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">reclaimRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the request queue with a crawler, see the <a href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/data_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>handled</code> or <code>pending</code>, and <code>{NUMBER}</code> is an integer indicating the position of the request in the queue.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> queue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named request queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> queueWithName </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue few requests</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://example.com/aaa'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://example.com/bbb'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://example.com/foo/bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">forefront</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get requests from queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> request1 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">fetchNextRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> request2 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">fetchNextRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> request3 </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">fetchNextRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Mark a request as handled</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markRequestHandled</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// If processing fails then reclaim the request back to the queue, so that it's crawled again</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">reclaimRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request2</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the request queue with a crawler, see the <a href="/sdk/js/docs/1.3/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/data_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/docker-images.html b/docs/1.3/guides/docker-images.html index 576f418eb0..0502dd1028 100644 --- a/docs/1.3/guides/docker-images.html +++ b/docs/1.3/guides/docker-images.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -27,8 +27,8 @@ If you want more browsers, either choose the <a href="#actor-node-playwright"><code>actor-node-playwright</code></a> image or override this env var.</p><p>The image supports XVFB by default, so you can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-firefox">actor-node-playwright-firefox<a href="#actor-node-playwright-firefox" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with Firefox pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-firefox:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-webkit">actor-node-playwright-webkit<a href="#actor-node-playwright-webkit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with WebKit -pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/docker_images.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Migration to version 1</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/docker_images.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Migration to version 1</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/environment-variables.html b/docs/1.3/guides/environment-variables.html index 4922e8fabc..3d80af096d 100644 --- a/docs/1.3/guides/environment-variables.html +++ b/docs/1.3/guides/environment-variables.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -43,8 +43,8 @@ in the Apify app. The password is automatically inferred using the <code>APIFY_TOKEN</code> env var, so in most cases, you don't need to touch it. You should use it when, for some reason, you need access to Apify Proxy, but no access to Apify API, or when you need access to -proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/environment_variables.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars:</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars:</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/environment_variables.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars:</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars:</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/getting-started.html b/docs/1.3/guides/getting-started.html index ff00ebc281..b4cf9c6481 100644 --- a/docs/1.3/guides/getting-started.html +++ b/docs/1.3/guides/getting-started.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -277,8 +277,8 @@ spans tens or hundreds of lines of code.</p><p>It's good practice in any programming to split your logic into bite-sized chunks that are easy to read and reason about. Scrolling through a thousand line long <code>handlePageFunction()</code> where everything interacts with everything and variables can be used everywhere is not a beautiful thing to do and a pain to debug. That's why we prefer the separation of routes into a special file and with large routes, we would even suggest having one file -per route.</p><blockquote><p>TO BE CONTINUED with details on <code>PuppeteerCrawler</code> and other features...</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/getting_started.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#intro" class="table-of-contents__link toc-highlight">Intro</a></li><li><a href="#setting-up-locally" class="table-of-contents__link toc-highlight">Setting up locally</a><ul><li><a href="#creating-a-new-project" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#setting-up-on-the-apify-platform" class="table-of-contents__link toc-highlight">Setting up on the Apify Platform</a><ul><li><a href="#creating-a-new-project-1" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#first-crawler" class="table-of-contents__link toc-highlight">First crawler</a><ul><li><a href="#the-general-idea" class="table-of-contents__link toc-highlight">The general idea</a></li><li><a href="#the-where---request-requestlist-and-requestqueue" class="table-of-contents__link toc-highlight">The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code></a></li><li><a href="#the-what---handlepagefunction" class="table-of-contents__link toc-highlight">The What - <code>handlePageFunction</code></a></li><li><a href="#putting-it-all-together" class="table-of-contents__link toc-highlight">Putting it all together</a></li></ul></li><li><a href="#cheeriocrawler-aka-jquery-crawler" class="table-of-contents__link toc-highlight">CheerioCrawler aka jQuery crawler</a><ul><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#when-to-use-cheeriocrawler" class="table-of-contents__link toc-highlight">When to use <code>CheerioCrawler</code></a></li><li><a href="#basic-use-of-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>CheerioCrawler</code></a></li></ul></li><li><a href="#using-apify-sdk-to-enqueue-links-like-a-boss" class="table-of-contents__link toc-highlight">Using Apify SDK to enqueue links like a boss</a><ul><li><a href="#meet-apifyutils" class="table-of-contents__link toc-highlight">Meet <code>Apify.utils</code></a></li><li><a href="#introduction-to-apifyutilsenqueuelinks" class="table-of-contents__link toc-highlight">Introduction to <code>Apify.utils.enqueueLinks()</code></a></li><li><a href="#basic-use-of-enqueuelinks-with-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code></a></li></ul></li><li><a href="#getting-some-real-world-data" class="table-of-contents__link toc-highlight">Getting some real-world data</a><ul><li><a href="#the-importance-of-having-a-plan" class="table-of-contents__link toc-highlight">The importance of having a plan</a></li><li><a href="#the-crawling-strategy" class="table-of-contents__link toc-highlight">The crawling strategy</a></li><li><a href="#scraping-data" class="table-of-contents__link toc-highlight">Scraping data</a></li><li><a href="#saving-the-scraped-data" class="table-of-contents__link toc-highlight">Saving the scraped data</a></li><li><a href="#final-touch" class="table-of-contents__link toc-highlight">Final touch</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +per route.</p><blockquote><p>TO BE CONTINUED with details on <code>PuppeteerCrawler</code> and other features...</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/getting_started.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#intro" class="table-of-contents__link toc-highlight">Intro</a></li><li><a href="#setting-up-locally" class="table-of-contents__link toc-highlight">Setting up locally</a><ul><li><a href="#creating-a-new-project" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#setting-up-on-the-apify-platform" class="table-of-contents__link toc-highlight">Setting up on the Apify Platform</a><ul><li><a href="#creating-a-new-project-1" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#first-crawler" class="table-of-contents__link toc-highlight">First crawler</a><ul><li><a href="#the-general-idea" class="table-of-contents__link toc-highlight">The general idea</a></li><li><a href="#the-where---request-requestlist-and-requestqueue" class="table-of-contents__link toc-highlight">The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code></a></li><li><a href="#the-what---handlepagefunction" class="table-of-contents__link toc-highlight">The What - <code>handlePageFunction</code></a></li><li><a href="#putting-it-all-together" class="table-of-contents__link toc-highlight">Putting it all together</a></li></ul></li><li><a href="#cheeriocrawler-aka-jquery-crawler" class="table-of-contents__link toc-highlight">CheerioCrawler aka jQuery crawler</a><ul><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#when-to-use-cheeriocrawler" class="table-of-contents__link toc-highlight">When to use <code>CheerioCrawler</code></a></li><li><a href="#basic-use-of-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>CheerioCrawler</code></a></li></ul></li><li><a href="#using-apify-sdk-to-enqueue-links-like-a-boss" class="table-of-contents__link toc-highlight">Using Apify SDK to enqueue links like a boss</a><ul><li><a href="#meet-apifyutils" class="table-of-contents__link toc-highlight">Meet <code>Apify.utils</code></a></li><li><a href="#introduction-to-apifyutilsenqueuelinks" class="table-of-contents__link toc-highlight">Introduction to <code>Apify.utils.enqueueLinks()</code></a></li><li><a href="#basic-use-of-enqueuelinks-with-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code></a></li></ul></li><li><a href="#getting-some-real-world-data" class="table-of-contents__link toc-highlight">Getting some real-world data</a><ul><li><a href="#the-importance-of-having-a-plan" class="table-of-contents__link toc-highlight">The importance of having a plan</a></li><li><a href="#the-crawling-strategy" class="table-of-contents__link toc-highlight">The crawling strategy</a></li><li><a href="#scraping-data" class="table-of-contents__link toc-highlight">Scraping data</a></li><li><a href="#saving-the-scraped-data" class="table-of-contents__link toc-highlight">Saving the scraped data</a></li><li><a href="#final-touch" class="table-of-contents__link toc-highlight">Final touch</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/migration-to-v1.html b/docs/1.3/guides/migration-to-v1.html index 3dd547c356..c7efc56e33 100644 --- a/docs/1.3/guides/migration-to-v1.html +++ b/docs/1.3/guides/migration-to-v1.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -81,8 +81,8 @@ the functions also have access to the <code>crawlingContext</code> of the <code>request</code> that triggered the launch.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> preLaunchHooks </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">maybeLaunchChrome</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">pageId</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> launchContext</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">crawlingContexts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">pageId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">userData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">useHeadful</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">launchOptions</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headless</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="launch-functions">Launch functions<a href="#launch-functions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In addition to <code>Apify.launchPuppeteer()</code> we now also have <code>Apify.launchPlaywright()</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="updated-arguments">Updated arguments<a href="#updated-arguments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We <a href="#launchpuppeteeroptions--launchcontext">updated the launch options object</a> because it was a frequent source of confusion.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// OLD</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// NEW</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-modules">Custom modules<a href="#custom-modules" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><code>Apify.launchPuppeteer</code> already supported the <code>puppeteerModule</code> option. With Playwright, we normalized the name to <code>launcher</code> because the <code>playwright</code> module itself does not -launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/migration_to_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/migration_to_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/motivation.html b/docs/1.3/guides/motivation.html index 5cdbf35de5..e7d245fc6f 100644 --- a/docs/1.3/guides/motivation.html +++ b/docs/1.3/guides/motivation.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ the web</strong>. The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a browser.</p><p>The goal of the Apify SDK is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't reinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing -commonalities.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/motivation.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/quick-start"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Quick Start</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +commonalities.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/motivation.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/quick-start"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Quick Start</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/proxy-management.html b/docs/1.3/guides/proxy-management.html index 8ec0d4f1d0..cff7d55b1f 100644 --- a/docs/1.3/guides/proxy-management.html +++ b/docs/1.3/guides/proxy-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -47,8 +47,8 @@ in the <a href="https://my.apify.com/proxy" target="_blank" rel="noopener">proxy dashboard</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="inspecting-current-proxy-in-crawlers">Inspecting current proxy in Crawlers<a href="#inspecting-current-proxy-in-crawlers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><code>CheerioCrawler</code> and <code>PuppeteerCrawler</code> grant access to information about the currently used proxy in their <code>handlePageFunction</code> using a <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>proxyInfo</code></a> object. With the object, you can easily access the proxy URL. If you're using Apify Proxy, the other -configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/proxy_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/proxy_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/quick-start.html b/docs/1.3/guides/quick-start.html index 9e2c830f23..bf0efd346e 100644 --- a/docs/1.3/guides/quick-start.html +++ b/docs/1.3/guides/quick-start.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,8 +26,8 @@ be in the default key-value store in <code>./apify_storage/key_value_stores/default/INPUT.json</code>.</p><p>Now you can easily deploy your code to the Apify platform by running:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">apify login</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">apify push</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the <a href="https://docs.apify.com/cli" target="_blank" rel="noopener">Apify Actor</a> documentation.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="usage-on-the-apify-platform">Usage on the Apify platform<a href="#usage-on-the-apify-platform" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>You can also develop your web scraping project in an online code editor directly on the <a href="/sdk/js/docs/1.3/guides/apify-platform">Apify platform</a>. You'll need to have an Apify Account. Go to the <a href="https://my.apify.com/actors" target="_blank" rel="noopener">Actors</a> page in the app, click <i>Create new</i> -and then go to the <i>Source</i> tab and start writing your code or paste one of the examples from the Examples section.</p><p>For more information, view the <a href="https://docs.apify.com/actor/quick-start" target="_blank" rel="noopener">Apify actors quick start guide</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/quick_start.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/motivation"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Motivation</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#local-stand-alone-usage" class="table-of-contents__link toc-highlight">Local stand-alone usage</a></li><li><a href="#local-usage-with-apify-command-line-interface-cli" class="table-of-contents__link toc-highlight">Local usage with Apify command-line interface (CLI)</a></li><li><a href="#usage-on-the-apify-platform" class="table-of-contents__link toc-highlight">Usage on the Apify platform</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +and then go to the <i>Source</i> tab and start writing your code or paste one of the examples from the Examples section.</p><p>For more information, view the <a href="https://docs.apify.com/actor/quick-start" target="_blank" rel="noopener">Apify actors quick start guide</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/quick_start.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/motivation"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Motivation</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#local-stand-alone-usage" class="table-of-contents__link toc-highlight">Local stand-alone usage</a></li><li><a href="#local-usage-with-apify-command-line-interface-cli" class="table-of-contents__link toc-highlight">Local usage with Apify command-line interface (CLI)</a></li><li><a href="#usage-on-the-apify-platform" class="table-of-contents__link toc-highlight">Usage on the Apify platform</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/request-storage.html b/docs/1.3/guides/request-storage.html index 3a4de99660..b81951b69b 100644 --- a/docs/1.3/guides/request-storage.html +++ b/docs/1.3/guides/request-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable, or on the <a href="/sdk/js/docs/guides/apify-platform">Apify platform</a> under the user account identified by the API token defined by the <code>APIFY_TOKEN</code> environment variable. If neither of these variables is defined, by default Apify SDK sets <code>APIFY_LOCAL_STORAGE_DIR</code> to <code>./apify_storage</code> in the current working directory and prints a warning.</p><p>Typically, you will be developing the code on your local computer and thus set the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the <code>APIFY_TOKEN</code> environment variable and thus use cloud storage. No code changes are needed.</p><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/storage" target="_blank" rel="noopener">Apify platform storage documentation</a></li><li><a href="https://my.apify.com/storage" target="_blank" rel="noopener">View storage in Apify app</a></li><li><a href="https://docs.apify.com/api/v2#/reference/request-queues" target="_blank" rel="noopener">Request queues API reference</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-queue">Request queue<a href="#request-queue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.</p><p>Each actor run is associated with a <strong>default request queue</strong>, which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional.</p><p>In Apify SDK, the request queue is represented by the <a href="/sdk/js/docs/api/request-queue"><code>RequestQueue</code></a> class.</p><p>In local configuration, the request queue is emulated by <a href="https://github.com/apify/apify-storage-local-js" target="_blank" rel="noopener">@apify/storage-local</a> NPM package and its data is stored in SQLite database in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">request_queues</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">QUEUE_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">db</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sqlite</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{QUEUE_ID}</code> is the name or ID of the request queue. The default queue has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code> environment variable.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue the initial request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request queue with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-list">Request list<a href="#request-list" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default <a href="/sdk/js/docs/1.3/guides/results-storage#key-value-store">Key-Value Store</a> associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web.</p><p>Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional.</p><p>In Apify SDK, the request list is represented by the <a href="/sdk/js/docs/api/request-list"><code>RequestList</code></a> class.</p><p>The following code demonstrates basic operations of the request list:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// List name is used to persist the sources and the list state in the key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Process the page (extract data, take page screenshot, etc).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the request list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request list with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="which-one-to-choose">Which one to choose?<a href="#which-one-to-choose" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either.</p><p>On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue.</p><p>Note that Request queue and Request list can be used together by the same crawler. In such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue). -In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/request_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/getting-started"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Getting Started</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/request_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/getting-started"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Getting Started</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/result-storage.html b/docs/1.3/guides/result-storage.html index 41ecfac42b..a3f0feca5b 100644 --- a/docs/1.3/guides/result-storage.html +++ b/docs/1.3/guides/result-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -36,8 +36,8 @@ results specific for the actor run. Its usage is optional.</p><p>In the Apify SDK, the dataset is represented by the <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> class. In order to simplify writes to the default dataset, the SDK also provides the <a href="/sdk/js/docs/1.3/api/apify#pushdata"><code>Apify.pushData()</code></a> function.</p><p>In local configuration, the data is stored in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">datasets</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">DATASET_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">INDEX</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{DATASET_ID}</code> is the name or ID of the dataset. The default dataset has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_DATASET_ID</code> environment variable. Each dataset item is stored as a separate JSON file, where <code>{INDEX}</code> is a zero-based index of the -item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/result_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/1.3/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/result_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/session-management.html b/docs/1.3/guides/session-management.html index 0322db2743..b2cfe7573d 100644 --- a/docs/1.3/guides/session-management.html +++ b/docs/1.3/guides/session-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ Last but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly, which should prevent burning out a small pool of available IPs.</p><p>Now let's take a look at how to use a Session pool.</p><p><strong>Example usage in <a href="/sdk/js/docs/1.3/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookies to page before navigation automatically.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in puppeteer pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookie header to request automatically...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"title"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in BasicCrawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="/sdk/js/docs/1.3/api/basic-crawler"><code>BasicCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Allows access to proxyInfo object in handleRequestFunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">throwHttpErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the cookieJar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This way you get the Cookie headers string from session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">Cookie</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getCookieString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> response</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">requestOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"SomeNetworkError"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If a network error happens, such as timeout, socket hangup etc...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// There is usually a chance that it was just bad luck and the proxy works.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to throw it away.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Automatically retires the session based on response HTTP status code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retireOnBlockedStatusCodes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">statusCode</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">body</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">blocked</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You are sure it is blocked.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This will throw away the session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Everything is ok, you can get the data.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to call session.markGood -> BasicCrawler calls it for you.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the CookieJar in session you need.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setCookiesFromResponse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example solo usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPoolOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openSessionPool</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">sessionPoolOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> session </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> sessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getSession</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the errorScore.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Throw away the session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Lower the errorScore and marks the session good.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markGood</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These are the basics of configuring SessionPool. Please, bear in mind that a Session pool needs time to find working IPs and build up the pool, -so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/session_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/session_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/guides/type-script-actor.html b/docs/1.3/guides/type-script-actor.html index f82352291f..1b88ac550f 100644 --- a/docs/1.3/guides/type-script-actor.html +++ b/docs/1.3/guides/type-script-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -30,8 +30,8 @@ return types, in the Apify SDK.</p><h1>Caveats</h1><p>As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties and parameters annotated with <code>any</code> type, therefore the settings <code>noImplicitAny</code> and <code>strictNullChecks</code>, set to <code>true</code>, may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary.</p><p>Besides the <em>implicit any</em> errors that might occur in the code when writing in TypeScript, the current typings doesn't offer generics that make outputs type-safe, so you need to declare your -types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/typescript_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/guides/typescript_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/abort-function.html b/docs/1.3/typedefs/abort-function.html index 14ee2c478b..b44c0a3ea8 100644 --- a/docs/1.3/typedefs/abort-function.html +++ b/docs/1.3/typedefs/abort-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/abort-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/abort-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>AbortFunction</h1></header><a name="abortfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>response</code></strong>: <code>IncomingMessage</code></li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AbortFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/abort-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/abort-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>AbortFunction</h1></header><a name="abortfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>response</code></strong>: <code>IncomingMessage</code></li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AbortFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/actor-run.html b/docs/1.3/typedefs/actor-run.html index afdad4fce8..563c2b1987 100644 --- a/docs/1.3/typedefs/actor-run.html +++ b/docs/1.3/typedefs/actor-run.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ <a href="https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor" target="_blank" rel="noopener">Actor run</a> Apify API endpoint and extended with certain fields. For more details, see <a href="https://docs.apify.com/actor/run" target="_blank" rel="noopener">Runs.</a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Actor run ID</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actid"><code>actId</code><a href="#actid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Actor ID</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="startedat"><code>startedAt</code><a href="#startedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Time when the actor run started</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="finishedat"><code>finishedAt</code><a href="#finishedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Time when the actor run finished. Contains <code>null</code> for running actors.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="status"><code>status</code><a href="#status" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Status of the run. For possible values, see <a href="https://docs.apify.com/actor/run#lifecycle" target="_blank" rel="noopener">Run lifecycle</a> in Apify actor documentation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meta"><code>meta</code><a href="#meta" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, string></code></p><p>Actor run meta-data. For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"origin"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"API"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"clientIp"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"1.2.3.4"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"userAgent"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ApifyClient/0.2.13 (Linux; Node/v8.11.3)"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stats"><code>stats</code><a href="#stats" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, number></code></p><p>An object containing various actor run statistics. For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"inputBodyLen"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">22</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"restartCount"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"workersUsed"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Beware that object fields might change in future releases.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="options"><code>options</code><a href="#options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Actor run options. For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"build"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"latest"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"waitSecs"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"memoryMbytes"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">256</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"diskMbytes"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">512</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="buildid"><code>buildId</code><a href="#buildid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the actor build used for the run. For details, see <a href="https://docs.apify.com/actor/build" target="_blank" rel="noopener">Builds</a> in Apify actor documentation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="buildnumber"><code>buildNumber</code><a href="#buildnumber" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Number of the actor build used for the run. For example, <code>0.0.10</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="exitcode"><code>exitCode</code><a href="#exitcode" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Exit code of the actor run process. It's <code>null</code> if actor is still running.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultkeyvaluestoreid"><code>defaultKeyValueStoreId</code><a href="#defaultkeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the default key-value store associated with the actor run. See <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a> for details.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultdatasetid"><code>defaultDatasetId</code><a href="#defaultdatasetid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the default dataset associated with the actor run. See <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> for details.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultrequestqueueid"><code>defaultRequestQueueId</code><a href="#defaultrequestqueueid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the default request queue associated with the actor run. See <a href="/sdk/js/docs/1.3/api/request-queue"><code>RequestQueue</code></a> for details.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="containerurl"><code>containerUrl</code><a href="#containerurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>URL on which the web server running inside actor run's Docker container can be accessed. For more details, see <a href="https://docs.apify.com/actor/run#container-web-server" target="_blank" rel="noopener">Container web server</a> in Apify actor documentation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="output"><code>output</code><a href="#output" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code> | <code>null</code> | <code>undefined</code></p><p>Contains output of the actor run. The value is <code>null</code> or <code>undefined</code> in case the actor is still running, or if you pass <code>false</code> to the <code>fetchOutput</code> -option of <a href="/sdk/js/docs/1.3/api/apify#call"><code>Apify.call()</code></a>.</p><p>For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"contentType"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"application/json; charset=utf-8"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"body"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"message"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Hello world!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ActorRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestTransform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/apify-call-error"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyCallError</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#actid" class="table-of-contents__link toc-highlight"><code>actId</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#finishedat" class="table-of-contents__link toc-highlight"><code>finishedAt</code></a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><code>status</code></a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><code>meta</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><code>options</code></a></li><li><a href="#buildid" class="table-of-contents__link toc-highlight"><code>buildId</code></a></li><li><a href="#buildnumber" class="table-of-contents__link toc-highlight"><code>buildNumber</code></a></li><li><a href="#exitcode" class="table-of-contents__link toc-highlight"><code>exitCode</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#defaultrequestqueueid" class="table-of-contents__link toc-highlight"><code>defaultRequestQueueId</code></a></li><li><a href="#containerurl" class="table-of-contents__link toc-highlight"><code>containerUrl</code></a></li><li><a href="#output" class="table-of-contents__link toc-highlight"><code>output</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +option of <a href="/sdk/js/docs/1.3/api/apify#call"><code>Apify.call()</code></a>.</p><p>For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"contentType"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"application/json; charset=utf-8"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"body"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"message"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Hello world!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ActorRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestTransform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/api/apify-call-error"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyCallError</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#actid" class="table-of-contents__link toc-highlight"><code>actId</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#finishedat" class="table-of-contents__link toc-highlight"><code>finishedAt</code></a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><code>status</code></a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><code>meta</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><code>options</code></a></li><li><a href="#buildid" class="table-of-contents__link toc-highlight"><code>buildId</code></a></li><li><a href="#buildnumber" class="table-of-contents__link toc-highlight"><code>buildNumber</code></a></li><li><a href="#exitcode" class="table-of-contents__link toc-highlight"><code>exitCode</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#defaultrequestqueueid" class="table-of-contents__link toc-highlight"><code>defaultRequestQueueId</code></a></li><li><a href="#containerurl" class="table-of-contents__link toc-highlight"><code>containerUrl</code></a></li><li><a href="#output" class="table-of-contents__link toc-highlight"><code>output</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/adhoc-webhook.html b/docs/1.3/typedefs/adhoc-webhook.html index 96c0d0f62f..5e56827d8c 100644 --- a/docs/1.3/typedefs/adhoc-webhook.html +++ b/docs/1.3/typedefs/adhoc-webhook.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/adhoc-webhook">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/adhoc-webhook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>AdhocWebhook</h1></header><a name="adhocwebhook"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="idempotencykey"><code>idempotencyKey</code><a href="#idempotencykey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AdhocWebhook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#idempotencykey" class="table-of-contents__link toc-highlight"><code>idempotencyKey</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/adhoc-webhook">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/adhoc-webhook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>AdhocWebhook</h1></header><a name="adhocwebhook"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="idempotencykey"><code>idempotencyKey</code><a href="#idempotencykey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AdhocWebhook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#idempotencykey" class="table-of-contents__link toc-highlight"><code>idempotencyKey</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/apify-env.html b/docs/1.3/typedefs/apify-env.html index 99efb8d610..5ef053d817 100644 --- a/docs/1.3/typedefs/apify-env.html +++ b/docs/1.3/typedefs/apify-env.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/apify-env">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/apify-env">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyEnv</h1></header><a name="apifyenv"></a><p>Parsed representation of the <code>APIFY_XXX</code> environmental variables. This object is returned by the <a href="/sdk/js/docs/1.3/api/apify#getenv"><code>Apify.getEnv()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorid"><code>actorId</code><a href="#actorid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor (APIFY_ACTOR_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorrunid"><code>actorRunId</code><a href="#actorrunid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor run (APIFY_ACTOR_RUN_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actortaskid"><code>actorTaskId</code><a href="#actortaskid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor task (APIFY_ACTOR_TASK_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="token"><code>token</code><a href="#token" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="startedat"><code>startedAt</code><a href="#startedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor was started (APIFY_STARTED_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutat"><code>timeoutAt</code><a href="#timeoutat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor will time out (APIFY_TIMEOUT_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultkeyvaluestoreid"><code>defaultKeyValueStoreId</code><a href="#defaultkeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultdatasetid"><code>defaultDatasetId</code><a href="#defaultdatasetid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="memorymbytes"><code>memoryMbytes</code><a href="#memorymbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> | <code>null</code></p><p>Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ApifyEnv.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/apify-call-error"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyCallError</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#actorid" class="table-of-contents__link toc-highlight"><code>actorId</code></a></li><li><a href="#actorrunid" class="table-of-contents__link toc-highlight"><code>actorRunId</code></a></li><li><a href="#actortaskid" class="table-of-contents__link toc-highlight"><code>actorTaskId</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><code>token</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#timeoutat" class="table-of-contents__link toc-highlight"><code>timeoutAt</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#memorymbytes" class="table-of-contents__link toc-highlight"><code>memoryMbytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/apify-env">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/apify-env">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyEnv</h1></header><a name="apifyenv"></a><p>Parsed representation of the <code>APIFY_XXX</code> environmental variables. This object is returned by the <a href="/sdk/js/docs/1.3/api/apify#getenv"><code>Apify.getEnv()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorid"><code>actorId</code><a href="#actorid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor (APIFY_ACTOR_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorrunid"><code>actorRunId</code><a href="#actorrunid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor run (APIFY_ACTOR_RUN_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actortaskid"><code>actorTaskId</code><a href="#actortaskid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor task (APIFY_ACTOR_TASK_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="token"><code>token</code><a href="#token" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="startedat"><code>startedAt</code><a href="#startedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor was started (APIFY_STARTED_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutat"><code>timeoutAt</code><a href="#timeoutat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor will time out (APIFY_TIMEOUT_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultkeyvaluestoreid"><code>defaultKeyValueStoreId</code><a href="#defaultkeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultdatasetid"><code>defaultDatasetId</code><a href="#defaultdatasetid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="memorymbytes"><code>memoryMbytes</code><a href="#memorymbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> | <code>null</code></p><p>Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ApifyEnv.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/apify-call-error"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyCallError</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#actorid" class="table-of-contents__link toc-highlight"><code>actorId</code></a></li><li><a href="#actorrunid" class="table-of-contents__link toc-highlight"><code>actorRunId</code></a></li><li><a href="#actortaskid" class="table-of-contents__link toc-highlight"><code>actorTaskId</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><code>token</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#timeoutat" class="table-of-contents__link toc-highlight"><code>timeoutAt</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#memorymbytes" class="table-of-contents__link toc-highlight"><code>memoryMbytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/autoscaled-pool-options.html b/docs/1.3/typedefs/autoscaled-pool-options.html index 16b05c1537..d236c1c7ff 100644 --- a/docs/1.3/typedefs/autoscaled-pool-options.html +++ b/docs/1.3/typedefs/autoscaled-pool-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ <code>minConcurrency</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="desiredconcurrencyratio"><code>desiredConcurrencyRatio</code><a href="#desiredconcurrencyratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.95</code></p><p>Minimum level of desired concurrency to reach before more scaling up is allowed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="scaleupstepratio"><code>scaleUpStepRatio</code><a href="#scaleupstepratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.05</code></p><p>Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="scaledownstepratio"><code>scaleDownStepRatio</code><a href="#scaledownstepratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.05</code></p><p>Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mayberunintervalsecs"><code>maybeRunIntervalSecs</code><a href="#mayberunintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.5</code></p><p>Indicates how often the pool should call the <code>runTaskFunction()</code> to start a new task, in seconds. This has no effect on starting new tasks immediately after a task completes.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="loggingintervalsecs"><code>loggingIntervalSecs</code><a href="#loggingintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 60</code></p><p>Specifies a period in which the instance logs its state, in seconds. Set to <code>null</code> to disable periodic logging.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaleintervalsecs"><code>autoscaleIntervalSecs</code><a href="#autoscaleintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 10</code></p><p>Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1 might have a severe impact on performance. We suggest using a value from 5 to 20.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="tasktimeoutsecs"><code>taskTimeoutSecs</code><a href="#tasktimeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Timeout in which the <code>runTaskFunction</code> needs to finish, given in seconds.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshotteroptions"><code>snapshotterOptions</code><a href="#snapshotteroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/snapshotter-options"><code>SnapshotterOptions</code></a></p><p>Options to be passed down to the <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a> constructor. This is useful for fine-tuning the snapshot intervals and history.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="systemstatusoptions"><code>systemStatusOptions</code><a href="#systemstatusoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/system-status-options"><code>SystemStatusOptions</code></a></p><p>Options to be passed down to the <a href="/sdk/js/docs/1.3/api/system-status"><code>SystemStatus</code></a> constructor. This is useful for fine-tuning the system status reports. If a -custom snapshotter is set in the options, it will be used by the pool.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AutoscaledPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/social"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.social</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#runtaskfunction" class="table-of-contents__link toc-highlight"><code>runTaskFunction</code></a></li><li><a href="#istaskreadyfunction" class="table-of-contents__link toc-highlight"><code>isTaskReadyFunction</code></a></li><li><a href="#isfinishedfunction" class="table-of-contents__link toc-highlight"><code>isFinishedFunction</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#desiredconcurrency" class="table-of-contents__link toc-highlight"><code>desiredConcurrency</code></a></li><li><a href="#desiredconcurrencyratio" class="table-of-contents__link toc-highlight"><code>desiredConcurrencyRatio</code></a></li><li><a href="#scaleupstepratio" class="table-of-contents__link toc-highlight"><code>scaleUpStepRatio</code></a></li><li><a href="#scaledownstepratio" class="table-of-contents__link toc-highlight"><code>scaleDownStepRatio</code></a></li><li><a href="#mayberunintervalsecs" class="table-of-contents__link toc-highlight"><code>maybeRunIntervalSecs</code></a></li><li><a href="#loggingintervalsecs" class="table-of-contents__link toc-highlight"><code>loggingIntervalSecs</code></a></li><li><a href="#autoscaleintervalsecs" class="table-of-contents__link toc-highlight"><code>autoscaleIntervalSecs</code></a></li><li><a href="#tasktimeoutsecs" class="table-of-contents__link toc-highlight"><code>taskTimeoutSecs</code></a></li><li><a href="#snapshotteroptions" class="table-of-contents__link toc-highlight"><code>snapshotterOptions</code></a></li><li><a href="#systemstatusoptions" class="table-of-contents__link toc-highlight"><code>systemStatusOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +custom snapshotter is set in the options, it will be used by the pool.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/AutoscaledPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/api/social"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.social</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#runtaskfunction" class="table-of-contents__link toc-highlight"><code>runTaskFunction</code></a></li><li><a href="#istaskreadyfunction" class="table-of-contents__link toc-highlight"><code>isTaskReadyFunction</code></a></li><li><a href="#isfinishedfunction" class="table-of-contents__link toc-highlight"><code>isFinishedFunction</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#desiredconcurrency" class="table-of-contents__link toc-highlight"><code>desiredConcurrency</code></a></li><li><a href="#desiredconcurrencyratio" class="table-of-contents__link toc-highlight"><code>desiredConcurrencyRatio</code></a></li><li><a href="#scaleupstepratio" class="table-of-contents__link toc-highlight"><code>scaleUpStepRatio</code></a></li><li><a href="#scaledownstepratio" class="table-of-contents__link toc-highlight"><code>scaleDownStepRatio</code></a></li><li><a href="#mayberunintervalsecs" class="table-of-contents__link toc-highlight"><code>maybeRunIntervalSecs</code></a></li><li><a href="#loggingintervalsecs" class="table-of-contents__link toc-highlight"><code>loggingIntervalSecs</code></a></li><li><a href="#autoscaleintervalsecs" class="table-of-contents__link toc-highlight"><code>autoscaleIntervalSecs</code></a></li><li><a href="#tasktimeoutsecs" class="table-of-contents__link toc-highlight"><code>taskTimeoutSecs</code></a></li><li><a href="#snapshotteroptions" class="table-of-contents__link toc-highlight"><code>snapshotterOptions</code></a></li><li><a href="#systemstatusoptions" class="table-of-contents__link toc-highlight"><code>systemStatusOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/basic-crawler-options.html b/docs/1.3/typedefs/basic-crawler-options.html index 0a7892e3d9..c152dc48f2 100644 --- a/docs/1.3/typedefs/basic-crawler-options.html +++ b/docs/1.3/typedefs/basic-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ <code>isTaskReadyFunction</code> options are provided by <code>BasicCrawler</code> and cannot be overridden. However, you can provide a custom implementation of <code>isFinishedFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Basic crawler will initialize the <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> with the corresponding <code>sessionPoolOptions</code>. The session instance will be than -available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BasicCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlerequestfunction" class="table-of-contents__link toc-highlight"><code>handleRequestFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#handlerequesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>handleRequestTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BasicCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlerequestfunction" class="table-of-contents__link toc-highlight"><code>handleRequestFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#handlerequesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>handleRequestTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/browser-crawling-context.html b/docs/1.3/typedefs/browser-crawling-context.html index 1017ae86b0..ce5d7a7692 100644 --- a/docs/1.3/typedefs/browser-crawling-context.html +++ b/docs/1.3/typedefs/browser-crawling-context.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/browser-crawling-context">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/browser-crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserCrawlingContext</h1></header><a name="browsercrawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="browsercontroller"><code>browserController</code><a href="#browsercontroller" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>BrowserController</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserCrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#browsercontroller" class="table-of-contents__link toc-highlight"><code>browserController</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/browser-crawling-context">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/browser-crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserCrawlingContext</h1></header><a name="browsercrawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="browsercontroller"><code>browserController</code><a href="#browsercontroller" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>BrowserController</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserCrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#browsercontroller" class="table-of-contents__link toc-highlight"><code>browserController</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/browser-handle-page-function.html b/docs/1.3/typedefs/browser-handle-page-function.html index f6966b9353..2392d4573e 100644 --- a/docs/1.3/typedefs/browser-handle-page-function.html +++ b/docs/1.3/typedefs/browser-handle-page-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/browser-handle-page-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/browser-handle-page-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>BrowserHandlePageFunction</h1></header><a name="browserhandlepagefunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/browser-handle-page-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/browser-handle-page-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>BrowserHandlePageFunction</h1></header><a name="browserhandlepagefunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/browser-launch-context.html b/docs/1.3/typedefs/browser-launch-context.html index 58045b6bcb..5688685552 100644 --- a/docs/1.3/typedefs/browser-launch-context.html +++ b/docs/1.3/typedefs/browser-launch-context.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/browser-launch-context">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/browser-launch-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserLaunchContext</h1></header><a name="browserlaunchcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launchoptions"><code>launchOptions</code><a href="#launchoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>`Options passed to the browser launcher function. Options are based on underlying library.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyurl"><code>proxyUrl</code><a href="#proxyurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password.</p><p>Example: <code>http://bob:pass123@proxy.example.com:1234</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usechrome"><code>useChrome</code><a href="#usechrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If <code>true</code> and <code>executablePath</code> is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled Chromium. The path to Chrome executable is taken from the <code>APIFY_CHROME_EXECUTABLE_PATH</code> environment variable if provided, or defaults to the typical Google Chrome executable location specific for the operating system. By default, this option is <code>false</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launcher"><code>launcher</code><a href="#launcher" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>By default this function uses -require("playwright").chromium<code>. If you want to use a different browser you can pass it by this property as</code>require("playwright").firefox</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +require("playwright").chromium<code>. If you want to use a different browser you can pass it by this property as</code>require("playwright").firefox</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/BrowserLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/cheerio-crawler-options.html b/docs/1.3/typedefs/cheerio-crawler-options.html index 77ab82af34..5604f4300f 100644 --- a/docs/1.3/typedefs/cheerio-crawler-options.html +++ b/docs/1.3/typedefs/cheerio-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -41,8 +41,8 @@ event loop.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If set to true Crawler will automatically use Session Pool. It will automatically retire sessions on 403, 401 and 429 status codes. It also marks Session as bad after a request timeout.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>Custom options passed to the underlying <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> constructor.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="persistcookiespersession"><code>persistCookiesPerSession</code><a href="#persistcookiespersession" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Automatically saves cookies to Session. Works only if Session Pool is used.</p><p>It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request. It passes the -"Cookie" header to the request with the session cookies.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#preparerequestfunction" class="table-of-contents__link toc-highlight"><code>prepareRequestFunction</code></a></li><li><a href="#postresponsefunction" class="table-of-contents__link toc-highlight"><code>postResponseFunction</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#requesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>requestTimeoutSecs</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#additionalmimetypes" class="table-of-contents__link toc-highlight"><code>additionalMimeTypes</code></a></li><li><a href="#suggestresponseencoding" class="table-of-contents__link toc-highlight"><code>suggestResponseEncoding</code></a></li><li><a href="#forceresponseencoding" class="table-of-contents__link toc-highlight"><code>forceResponseEncoding</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +"Cookie" header to the request with the session cookies.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#preparerequestfunction" class="table-of-contents__link toc-highlight"><code>prepareRequestFunction</code></a></li><li><a href="#postresponsefunction" class="table-of-contents__link toc-highlight"><code>postResponseFunction</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#requesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>requestTimeoutSecs</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#additionalmimetypes" class="table-of-contents__link toc-highlight"><code>additionalMimeTypes</code></a></li><li><a href="#suggestresponseencoding" class="table-of-contents__link toc-highlight"><code>suggestResponseEncoding</code></a></li><li><a href="#forceresponseencoding" class="table-of-contents__link toc-highlight"><code>forceResponseEncoding</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/cheerio-handle-page-inputs.html b/docs/1.3/typedefs/cheerio-handle-page-inputs.html index 2ee100c705..ba371238b9 100644 --- a/docs/1.3/typedefs/cheerio-handle-page-inputs.html +++ b/docs/1.3/typedefs/cheerio-handle-page-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePageInputs</h1></header><a name="cheeriohandlepageinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3><code>$</code></h3><p><strong>Type</strong>: <code>cheerio.Root</code></p><p>The <a href="https://cheerio.js.org/" target="_blank" rel="noopener">Cheerio</a> object with parsed HTML.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="body"><code>body</code><a href="#body" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Buffer</code></p><p>The request body of the web page.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="json"><code>json</code><a href="#json" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>The parsed object from JSON string if the response contains the content type application/json.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="contenttype"><code>contentType</code><a href="#contenttype" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object</code></p><p>Parsed <code>Content-Type header: { type, encoding }</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code></p><p>An instance of Node's <a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage" target="_blank" rel="noopener">http.IncomingMessage</a> object,</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePageInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#" class="table-of-contents__link toc-highlight"><code>$</code></a></li><li><a href="#body" class="table-of-contents__link toc-highlight"><code>body</code></a></li><li><a href="#json" class="table-of-contents__link toc-highlight"><code>json</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#contenttype" class="table-of-contents__link toc-highlight"><code>contentType</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePageInputs</h1></header><a name="cheeriohandlepageinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3><code>$</code></h3><p><strong>Type</strong>: <code>cheerio.Root</code></p><p>The <a href="https://cheerio.js.org/" target="_blank" rel="noopener">Cheerio</a> object with parsed HTML.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="body"><code>body</code><a href="#body" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Buffer</code></p><p>The request body of the web page.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="json"><code>json</code><a href="#json" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>The parsed object from JSON string if the response contains the content type application/json.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="contenttype"><code>contentType</code><a href="#contenttype" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object</code></p><p>Parsed <code>Content-Type header: { type, encoding }</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code></p><p>An instance of Node's <a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage" target="_blank" rel="noopener">http.IncomingMessage</a> object,</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePageInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#" class="table-of-contents__link toc-highlight"><code>$</code></a></li><li><a href="#body" class="table-of-contents__link toc-highlight"><code>body</code></a></li><li><a href="#json" class="table-of-contents__link toc-highlight"><code>json</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#contenttype" class="table-of-contents__link toc-highlight"><code>contentType</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/cheerio-handle-page.html b/docs/1.3/typedefs/cheerio-handle-page.html index d58edc6866..7a47a4d581 100644 --- a/docs/1.3/typedefs/cheerio-handle-page.html +++ b/docs/1.3/typedefs/cheerio-handle-page.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePage</h1></header><a name="cheeriohandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"><code>CheerioHandlePageInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatusOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePage</h1></header><a name="cheeriohandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"><code>CheerioHandlePageInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CheerioHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatusOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/compiled-script-function.html b/docs/1.3/typedefs/compiled-script-function.html index e540ef829e..0accfc1667 100644 --- a/docs/1.3/typedefs/compiled-script-function.html +++ b/docs/1.3/typedefs/compiled-script-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/compiled-script-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/compiled-script-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptFunction</h1></header><a name="compiledscriptfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>params</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/compiled-script-params"><code>CompiledScriptParams</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/compiled-script-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/compiled-script-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptFunction</h1></header><a name="compiledscriptfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>params</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/compiled-script-params"><code>CompiledScriptParams</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/compiled-script-params.html b/docs/1.3/typedefs/compiled-script-params.html index 4a2174dcef..9add662b75 100644 --- a/docs/1.3/typedefs/compiled-script-params.html +++ b/docs/1.3/typedefs/compiled-script-params.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/compiled-script-params">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/compiled-script-params">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptParams</h1></header><a name="compiledscriptparams"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramspage"><code>params.page</code><a href="#paramspage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramsrequest"><code>params.request</code><a href="#paramsrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptParams.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#paramspage" class="table-of-contents__link toc-highlight"><code>params.page</code></a></li><li><a href="#paramsrequest" class="table-of-contents__link toc-highlight"><code>params.request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/compiled-script-params">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/compiled-script-params">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptParams</h1></header><a name="compiledscriptparams"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramspage"><code>params.page</code><a href="#paramspage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramsrequest"><code>params.request</code><a href="#paramsrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CompiledScriptParams.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#paramspage" class="table-of-contents__link toc-highlight"><code>params.page</code></a></li><li><a href="#paramsrequest" class="table-of-contents__link toc-highlight"><code>params.request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/crawling-context.html b/docs/1.3/typedefs/crawling-context.html index 0517b2cfdc..1752bc74c2 100644 --- a/docs/1.3/typedefs/crawling-context.html +++ b/docs/1.3/typedefs/crawling-context.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/crawling-context">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CrawlingContext</h1></header><a name="crawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/crawling-context">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CrawlingContext</h1></header><a name="crawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/create-session.html b/docs/1.3/typedefs/create-session.html index 0bead96f3c..25930fa5d2 100644 --- a/docs/1.3/typedefs/create-session.html +++ b/docs/1.3/typedefs/create-session.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/create-session">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/create-session">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">CreateSession</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Sessions</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>CreateSession</h1></header><a name="createsession"></a><p>Factory user-function which creates customized <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a> instances.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionPool</code></strong>: <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> - Pool requesting the new session.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/session"><code>Promise<Session></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CreateSession.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestTransform</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/create-session">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/create-session">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">CreateSession</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Sessions</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>CreateSession</h1></header><a name="createsession"></a><p>Factory user-function which creates customized <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a> instances.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionPool</code></strong>: <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> - Pool requesting the new session.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/api/session"><code>Promise<Session></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/CreateSession.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestTransform</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/dataset-consumer.html b/docs/1.3/typedefs/dataset-consumer.html index f38a997e66..0c71fc9718 100644 --- a/docs/1.3/typedefs/dataset-consumer.html +++ b/docs/1.3/typedefs/dataset-consumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetConsumer</h1></header><a name="datasetconsumer"></a><p>User-function used in the <code>Dataset.forEach()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Current <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePageInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetConsumer</h1></header><a name="datasetconsumer"></a><p>User-function used in the <code>Dataset.forEach()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Current <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePageInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/dataset-content.html b/docs/1.3/typedefs/dataset-content.html index b07ac9043d..6932f5b1ff 100644 --- a/docs/1.3/typedefs/dataset-content.html +++ b/docs/1.3/typedefs/dataset-content.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-content">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-content">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>DatasetContent</h1></header><a name="datasetcontent"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="items"><code>items</code><a href="#items" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<object></code></p><p>Dataset entries based on chosen format parameter.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="total"><code>total</code><a href="#total" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total count of entries in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="offset"><code>offset</code><a href="#offset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the first returned entry in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="count"><code>count</code><a href="#count" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Count of dataset entries returned in this set.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="limit"><code>limit</code><a href="#limit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Maximum number of dataset entries requested.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetContent.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MemoryInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#items" class="table-of-contents__link toc-highlight"><code>items</code></a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><code>total</code></a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><code>offset</code></a></li><li><a href="#count" class="table-of-contents__link toc-highlight"><code>count</code></a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><code>limit</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-content">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-content">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>DatasetContent</h1></header><a name="datasetcontent"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="items"><code>items</code><a href="#items" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<object></code></p><p>Dataset entries based on chosen format parameter.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="total"><code>total</code><a href="#total" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total count of entries in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="offset"><code>offset</code><a href="#offset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the first returned entry in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="count"><code>count</code><a href="#count" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Count of dataset entries returned in this set.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="limit"><code>limit</code><a href="#limit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Maximum number of dataset entries requested.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetContent.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MemoryInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#items" class="table-of-contents__link toc-highlight"><code>items</code></a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><code>total</code></a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><code>offset</code></a></li><li><a href="#count" class="table-of-contents__link toc-highlight"><code>count</code></a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><code>limit</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/dataset-mapper.html b/docs/1.3/typedefs/dataset-mapper.html index ea1d08319f..3676de4e93 100644 --- a/docs/1.3/typedefs/dataset-mapper.html +++ b/docs/1.3/typedefs/dataset-mapper.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetMapper</h1></header><a name="datasetmapper"></a><p>User-function used in the <code>Dataset.map()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetMapper.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetMapper</h1></header><a name="datasetmapper"></a><p>User-function used in the <code>Dataset.map()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetMapper.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/dataset-reducer.html b/docs/1.3/typedefs/dataset-reducer.html index 4d8a6a18a3..56ee97f45a 100644 --- a/docs/1.3/typedefs/dataset-reducer.html +++ b/docs/1.3/typedefs/dataset-reducer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetReducer</h1></header><a name="datasetreducer"></a><p>User-function used in the <code>Dataset.reduce()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>memo</code></strong>: <code>object</code> - Previous state of the reduction.</li><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetReducer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetReducer</h1></header><a name="datasetreducer"></a><p>User-function used in the <code>Dataset.reduce()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>memo</code></strong>: <code>object</code> - Previous state of the reduction.</li><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/1.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DatasetReducer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/direct-navigation-options.html b/docs/1.3/typedefs/direct-navigation-options.html index 536de3714e..68b31519ed 100644 --- a/docs/1.3/typedefs/direct-navigation-options.html +++ b/docs/1.3/typedefs/direct-navigation-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ browserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="waituntil"><code>waitUntil</code><a href="#waituntil" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>&quot;domcontentloaded&quot;</code> | <code>&quot;load&quot;</code> | <code>&quot;networkidle&quot;</code></p><p>When to consider operation succeeded, defaults to <code>load</code>. Events can be either: - <code>'domcontentloaded'</code> - consider operation to be finished when the <code>DOMContentLoaded</code> event is fired. - <code>'load'</code> - consider operation to be finished when the <code>load</code> event is fired. - <code>'networkidle'</code> - consider -operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DirectNavigationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/DirectNavigationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/event-types.html b/docs/1.3/typedefs/event-types.html index 2359b53eac..9898163faa 100644 --- a/docs/1.3/typedefs/event-types.html +++ b/docs/1.3/typedefs/event-types.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/event-types">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/event-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>EventTypes</h1></header><a name="eventtypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/EventTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/event-types">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/event-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>EventTypes</h1></header><a name="eventtypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/EventTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/goto-function.html b/docs/1.3/typedefs/goto-function.html index d2fa9e70d8..70d4fdd2dc 100644 --- a/docs/1.3/typedefs/goto-function.html +++ b/docs/1.3/typedefs/goto-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/goto-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/goto-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>GotoFunction</h1></header><a name="gotofunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/GotoFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/goto-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/goto-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>GotoFunction</h1></header><a name="gotofunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/GotoFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/handle-failed-request-input.html b/docs/1.3/typedefs/handle-failed-request-input.html index f859832e1f..5c45b26245 100644 --- a/docs/1.3/typedefs/handle-failed-request-input.html +++ b/docs/1.3/typedefs/handle-failed-request-input.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequestInput</h1></header><a name="handlefailedrequestinput"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="error"><code>error</code><a href="#error" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Error</code></p><p>The Error thrown by <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original {Request} object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequestInput.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#error" class="table-of-contents__link toc-highlight"><code>error</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequestInput</h1></header><a name="handlefailedrequestinput"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="error"><code>error</code><a href="#error" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Error</code></p><p>The Error thrown by <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original {Request} object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequestInput.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#error" class="table-of-contents__link toc-highlight"><code>error</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/handle-failed-request.html b/docs/1.3/typedefs/handle-failed-request.html index 6620d2342a..1ee224262b 100644 --- a/docs/1.3/typedefs/handle-failed-request.html +++ b/docs/1.3/typedefs/handle-failed-request.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequest</h1></header><a name="handlefailedrequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input"><code>HandleFailedRequestInput</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequest</h1></header><a name="handlefailedrequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input"><code>HandleFailedRequestInput</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleFailedRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/handle-request-inputs.html b/docs/1.3/typedefs/handle-request-inputs.html index 7fbb1bc81c..6c210d10fe 100644 --- a/docs/1.3/typedefs/handle-request-inputs.html +++ b/docs/1.3/typedefs/handle-request-inputs.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>HandleRequestInputs</h1></header><a name="handlerequestinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original {Request} object. A reference to the underlying <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/1.3/api/basic-crawler#run"><code>BasicCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by -calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/basic-crawler"><code>BasicCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/basic-crawler"><code>BasicCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/handle-request.html b/docs/1.3/typedefs/handle-request.html index bcf79c1e7e..562cfc4bf8 100644 --- a/docs/1.3/typedefs/handle-request.html +++ b/docs/1.3/typedefs/handle-request.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-request">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleRequest</h1></header><a name="handlerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/handle-request-inputs"><code>HandleRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/handle-request">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/handle-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleRequest</h1></header><a name="handlerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/handle-request-inputs"><code>HandleRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/HandleRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/hook.html b/docs/1.3/typedefs/hook.html index 1b437922b5..db5c776d24 100644 --- a/docs/1.3/typedefs/hook.html +++ b/docs/1.3/typedefs/hook.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/hook">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Hook</h1></header><a name="hook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/Hook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/hook">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>Hook</h1></header><a name="hook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/Hook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/intercept-handler.html b/docs/1.3/typedefs/intercept-handler.html index 1baf4c1f49..52a4aabd0c 100644 --- a/docs/1.3/typedefs/intercept-handler.html +++ b/docs/1.3/typedefs/intercept-handler.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/intercept-handler">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/intercept-handler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>InterceptHandler</h1></header><a name="intercepthandler"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>PuppeteerRequest</code></a></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/InterceptHandler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/intercept-handler">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/intercept-handler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>InterceptHandler</h1></header><a name="intercepthandler"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/1.3/api/request"><code>PuppeteerRequest</code></a></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/InterceptHandler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/key-consumer.html b/docs/1.3/typedefs/key-consumer.html index 509e98e16d..a6f2273f50 100644 --- a/docs/1.3/typedefs/key-consumer.html +++ b/docs/1.3/typedefs/key-consumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/key-consumer">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/key-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">KeyConsumer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - KeyValueStore</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyConsumer</h1></header><a name="keyconsumer"></a><p>User-function used in the <a href="/sdk/js/docs/1.3/api/key-value-store#foreachkey"><code>KeyValueStore.forEachKey()</code></a> method.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code> - Current {KeyValue} key being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of the current key in <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a>.</li><li><strong><code>info</code></strong>: <code>*</code> - Information about the current <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a> entry.<ul><li><strong><code>size</code></strong>: <code>number</code> - Size of the value associated with the current key in bytes.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/create-session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CreateSession</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/key-consumer">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/key-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">KeyConsumer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - KeyValueStore</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyConsumer</h1></header><a name="keyconsumer"></a><p>User-function used in the <a href="/sdk/js/docs/1.3/api/key-value-store#foreachkey"><code>KeyValueStore.forEachKey()</code></a> method.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code> - Current {KeyValue} key being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of the current key in <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a>.</li><li><strong><code>info</code></strong>: <code>*</code> - Information about the current <a href="/sdk/js/docs/1.3/api/key-value-store"><code>KeyValueStore</code></a> entry.<ul><li><strong><code>size</code></strong>: <code>number</code> - Size of the value associated with the current key in bytes.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/create-session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CreateSession</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/key-value-store-value-types.html b/docs/1.3/typedefs/key-value-store-value-types.html index ef2c25e252..85c6613e17 100644 --- a/docs/1.3/typedefs/key-value-store-value-types.html +++ b/docs/1.3/typedefs/key-value-store-value-types.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/key-value-store-value-types">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/key-value-store-value-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyValueStoreValueTypes</h1></header><a name="keyvaluestorevaluetypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyValueStoreValueTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/key-value-store-value-types">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/key-value-store-value-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyValueStoreValueTypes</h1></header><a name="keyvaluestorevaluetypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/KeyValueStoreValueTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/launch-puppeteer-function.html b/docs/1.3/typedefs/launch-puppeteer-function.html index 3456cb44b6..adce3391db 100644 --- a/docs/1.3/typedefs/launch-puppeteer-function.html +++ b/docs/1.3/typedefs/launch-puppeteer-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/launch-puppeteer-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>LaunchPuppeteerFunction</h1></header><a name="launchpuppeteerfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/launch-puppeteer-options"><code>LaunchPuppeteerOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<Browser></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/launch-puppeteer-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>LaunchPuppeteerFunction</h1></header><a name="launchpuppeteerfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/launch-puppeteer-options"><code>LaunchPuppeteerOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<Browser></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/launch-puppeteer-options.html b/docs/1.3/typedefs/launch-puppeteer-options.html index e8a02f5cd6..e9dce91251 100644 --- a/docs/1.3/typedefs/launch-puppeteer-options.html +++ b/docs/1.3/typedefs/launch-puppeteer-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ Chrome executable location specific for the operating system. By default, this option is <code>false</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteermodule"><code>puppeteerModule</code><a href="#puppeteermodule" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Object</code></p><p>Either a require path (<code>string</code>) to a package to be used instead of default <code>puppeteer</code>, or an already required module (<code>Object</code>). This enables usage of various Puppeteer wrappers such as <code>puppeteer-extra</code>.</p><p>Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides <code>puppeteer</code> itself.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealth"><code>stealth</code><a href="#stealth" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>This setting hides most of the known properties that identify headless Chrome and makes it nearly undetectable. It is recommended to use it together -with the <code>useChrome</code> set to <code>true</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealthoptions"><code>stealthOptions</code><a href="#stealthoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/stealth-options"><code>StealthOptions</code></a></p><p>Using this configuration, you can disable some of the hiding tricks. For these settings to take effect <code>stealth</code> must be set to true</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#puppeteermodule" class="table-of-contents__link toc-highlight"><code>puppeteerModule</code></a></li><li><a href="#stealth" class="table-of-contents__link toc-highlight"><code>stealth</code></a></li><li><a href="#stealthoptions" class="table-of-contents__link toc-highlight"><code>stealthOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +with the <code>useChrome</code> set to <code>true</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealthoptions"><code>stealthOptions</code><a href="#stealthoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/stealth-options"><code>StealthOptions</code></a></p><p>Using this configuration, you can disable some of the hiding tricks. For these settings to take effect <code>stealth</code> must be set to true</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#puppeteermodule" class="table-of-contents__link toc-highlight"><code>puppeteerModule</code></a></li><li><a href="#stealth" class="table-of-contents__link toc-highlight"><code>stealth</code></a></li><li><a href="#stealthoptions" class="table-of-contents__link toc-highlight"><code>stealthOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/launch-puppeteer.html b/docs/1.3/typedefs/launch-puppeteer.html index 5d0911c3c0..22455398e9 100644 --- a/docs/1.3/typedefs/launch-puppeteer.html +++ b/docs/1.3/typedefs/launch-puppeteer.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/launch-puppeteer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>LaunchPuppeteer</h1></header><a name="launchpuppeteer"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/launch-puppeteer-options"><code>LaunchPuppeteerOptions</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<Browser></code> - Promise that resolves to Puppeteer's <code>Browser</code> instance. This might be obtained by calling <a href="https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-puppeteerlaunchoptions" target="_blank" rel="noopener">puppeteer.launch()</a> directly, or by delegating to -<a href="/sdk/js/docs/1.3/api/apify#launchpuppeteer"><code>Apify.launchPuppeteer()</code></a>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/apify#launchpuppeteer"><code>Apify.launchPuppeteer()</code></a>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LaunchPuppeteer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/logger-options.html b/docs/1.3/typedefs/logger-options.html index 84ed0d462f..bcb184625e 100644 --- a/docs/1.3/typedefs/logger-options.html +++ b/docs/1.3/typedefs/logger-options.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/logger-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/logger-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>LoggerOptions</h1></header><a name="loggeroptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="level"><code>level</code><a href="#level" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 4</code></p><p>Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with the <code>log.LEVELS</code> constants.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxdepth"><code>maxDepth</code><a href="#maxdepth" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 4</code></p><p>Max depth of data object that will be logged. Anything deeper than the limit will be stripped off.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxstringlength"><code>maxStringLength</code><a href="#maxstringlength" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 2000</code></p><p>Max length of the string to be logged. Longer strings will be truncated.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="prefix"><code>prefix</code><a href="#prefix" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Prefix to be prepended the each logged line.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="suffix"><code>suffix</code><a href="#suffix" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Suffix that will be appended the each logged line.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="logger"><code>logger</code><a href="#logger" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Logger</code></p><p>Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use <code>log.LoggerJson</code> -that formats each log line as a JSON.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="data"><code>data</code><a href="#data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Record<string, unknown></code></p><p>Additional data to be added to each log line.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LoggerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#level" class="table-of-contents__link toc-highlight"><code>level</code></a></li><li><a href="#maxdepth" class="table-of-contents__link toc-highlight"><code>maxDepth</code></a></li><li><a href="#maxstringlength" class="table-of-contents__link toc-highlight"><code>maxStringLength</code></a></li><li><a href="#prefix" class="table-of-contents__link toc-highlight"><code>prefix</code></a></li><li><a href="#suffix" class="table-of-contents__link toc-highlight"><code>suffix</code></a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><code>logger</code></a></li><li><a href="#data" class="table-of-contents__link toc-highlight"><code>data</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +that formats each log line as a JSON.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="data"><code>data</code><a href="#data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Record<string, unknown></code></p><p>Additional data to be added to each log line.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/LoggerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#level" class="table-of-contents__link toc-highlight"><code>level</code></a></li><li><a href="#maxdepth" class="table-of-contents__link toc-highlight"><code>maxDepth</code></a></li><li><a href="#maxstringlength" class="table-of-contents__link toc-highlight"><code>maxStringLength</code></a></li><li><a href="#prefix" class="table-of-contents__link toc-highlight"><code>prefix</code></a></li><li><a href="#suffix" class="table-of-contents__link toc-highlight"><code>suffix</code></a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><code>logger</code></a></li><li><a href="#data" class="table-of-contents__link toc-highlight"><code>data</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/memory-info.html b/docs/1.3/typedefs/memory-info.html index 7949142824..4729d86468 100644 --- a/docs/1.3/typedefs/memory-info.html +++ b/docs/1.3/typedefs/memory-info.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/memory-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/memory-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>MemoryInfo</h1></header><a name="memoryinfo"></a><p>Describes memory usage of an Actor.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalbytes"><code>totalBytes</code><a href="#totalbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total memory available in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="freebytes"><code>freeBytes</code><a href="#freebytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of free memory in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usedbytes"><code>usedBytes</code><a href="#usedbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used (= totalBytes - freeBytes)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mainprocessbytes"><code>mainProcessBytes</code><a href="#mainprocessbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used the current Node.js process</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="childprocessesbytes"><code>childProcessesBytes</code><a href="#childprocessesbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used by child processes of the current Node.js process</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/MemoryInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#totalbytes" class="table-of-contents__link toc-highlight"><code>totalBytes</code></a></li><li><a href="#freebytes" class="table-of-contents__link toc-highlight"><code>freeBytes</code></a></li><li><a href="#usedbytes" class="table-of-contents__link toc-highlight"><code>usedBytes</code></a></li><li><a href="#mainprocessbytes" class="table-of-contents__link toc-highlight"><code>mainProcessBytes</code></a></li><li><a href="#childprocessesbytes" class="table-of-contents__link toc-highlight"><code>childProcessesBytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/memory-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/memory-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>MemoryInfo</h1></header><a name="memoryinfo"></a><p>Describes memory usage of an Actor.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalbytes"><code>totalBytes</code><a href="#totalbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total memory available in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="freebytes"><code>freeBytes</code><a href="#freebytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of free memory in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usedbytes"><code>usedBytes</code><a href="#usedbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used (= totalBytes - freeBytes)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mainprocessbytes"><code>mainProcessBytes</code><a href="#mainprocessbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used the current Node.js process</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="childprocessesbytes"><code>childProcessesBytes</code><a href="#childprocessesbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used by child processes of the current Node.js process</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/MemoryInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#totalbytes" class="table-of-contents__link toc-highlight"><code>totalBytes</code></a></li><li><a href="#freebytes" class="table-of-contents__link toc-highlight"><code>freeBytes</code></a></li><li><a href="#usedbytes" class="table-of-contents__link toc-highlight"><code>usedBytes</code></a></li><li><a href="#mainprocessbytes" class="table-of-contents__link toc-highlight"><code>mainProcessBytes</code></a></li><li><a href="#childprocessesbytes" class="table-of-contents__link toc-highlight"><code>childProcessesBytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/playwright-crawler-options.html b/docs/1.3/typedefs/playwright-crawler-options.html index 1ba1db7242..f55af3f6f3 100644 --- a/docs/1.3/typedefs/playwright-crawler-options.html +++ b/docs/1.3/typedefs/playwright-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -34,8 +34,8 @@ <code>isTaskReadyFunction</code> options are provided by <code>BasicCrawler</code> and cannot be overridden. However, you can provide a custom implementation of <code>isFinishedFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Playwright crawler will initialize the <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> with the corresponding <code>sessionPoolOptions</code>. The session instance will be -than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/playwright-goto-options.html b/docs/1.3/typedefs/playwright-goto-options.html index 0cd323c133..5d6d222ff9 100644 --- a/docs/1.3/typedefs/playwright-goto-options.html +++ b/docs/1.3/typedefs/playwright-goto-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ browserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="waituntil"><code>waitUntil</code><a href="#waituntil" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>&quot;domcontentloaded&quot;</code> | <code>&quot;load&quot;</code> | <code>&quot;networkidle&quot;</code></p><p>When to consider operation succeeded, defaults to <code>load</code>. Events can be either: - <code>'domcontentloaded'</code> - consider operation to be finished when the <code>DOMContentLoaded</code> event is fired. - <code>'load'</code> - consider operation to be finished when the <code>load</code> event is fired. - <code>'networkidle'</code> - consider -operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightGotoOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightGotoOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/playwright-handle-page-function-param.html b/docs/1.3/typedefs/playwright-handle-page-function-param.html index 3058107aee..b3fabf07f4 100644 --- a/docs/1.3/typedefs/playwright-handle-page-function-param.html +++ b/docs/1.3/typedefs/playwright-handle-page-function-param.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHandlePageFunctionParam</h1></header><a name="playwrighthandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/playwright-crawler"><code>PlaywrightCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHandlePageFunctionParam</h1></header><a name="playwrighthandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/playwright-crawler"><code>PlaywrightCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/playwright-handle-page-function.html b/docs/1.3/typedefs/playwright-handle-page-function.html index 50165f3971..eb7b7d4a79 100644 --- a/docs/1.3/typedefs/playwright-handle-page-function.html +++ b/docs/1.3/typedefs/playwright-handle-page-function.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHandlePageFunction</h1></header><a name="playwrighthandlepagefunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"><code>PlaywrightHandlePageFunctionParam</code></a> | -<a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/playwright-hook.html b/docs/1.3/typedefs/playwright-hook.html index 1e714ee52d..58e0dfc8b9 100644 --- a/docs/1.3/typedefs/playwright-hook.html +++ b/docs/1.3/typedefs/playwright-hook.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/playwright-hook">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/playwright-hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHook</h1></header><a name="playwrighthook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <code>Object</code> | <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | -<a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/playwright-goto-options"><code>PlaywrightGotoOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/playwright-goto-options"><code>PlaywrightGotoOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/playwright-launch-context.html b/docs/1.3/typedefs/playwright-launch-context.html index d096425df7..a498f86ef9 100644 --- a/docs/1.3/typedefs/playwright-launch-context.html +++ b/docs/1.3/typedefs/playwright-launch-context.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ <a href="https://playwright.dev/docs/api/class-browsertype#browsertypelaunchoptions" target="_blank" rel="noopener"><code>LaunchOptions</code></a> options by providing the <code>launchOptions</code> property.</p><p><strong>Example:</strong></p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// launch a headless Chrome (not Chromium)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> launchContext </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify helpers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">proxyUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://user:password@some.proxy.com'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Native Playwright options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">args</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'--some-flag'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launchoptions"><code>launchOptions</code><a href="#launchoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>LaunchOptions</code></p><p><code>browserType.launch</code> <a href="https://playwright.dev/docs/api/class-browsertype?_highlight=launch#browsertypelaunchoptions" target="_blank" rel="noopener">options</a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyurl"><code>proxyUrl</code><a href="#proxyurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>URL to a HTTP proxy server. It must define the port number, and it may also contain proxy username and password.</p><p>Example: <code>http://bob:pass123@proxy.example.com:1234</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usechrome"><code>useChrome</code><a href="#usechrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If <code>true</code> and <code>executablePath</code> is not set, Playwright will launch full Google Chrome browser available on the machine rather than the bundled Chromium. The path to Chrome executable is taken from the <code>APIFY_CHROME_EXECUTABLE_PATH</code> environment variable if provided, or defaults to the typical Google Chrome executable location specific for the operating system. By default, this option is <code>false</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launcher"><code>launcher</code><a href="#launcher" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>By default this function uses <code>require("playwright").chromium</code>. If you want to use a different browser you can pass it by this property as e.g. -<code>require("playwright").firefox</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>require("playwright").firefox</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PlaywrightLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/post-response-inputs.html b/docs/1.3/typedefs/post-response-inputs.html index eee8a2a9a3..d94555b29e 100644 --- a/docs/1.3/typedefs/post-response-inputs.html +++ b/docs/1.3/typedefs/post-response-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/post-response-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/post-response-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PostResponseInputs</h1></header><a name="postresponseinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code> | <code>Readable</code></p><p>stream</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponseInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/post-response-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/post-response-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PostResponseInputs</h1></header><a name="postresponseinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code> | <code>Readable</code></p><p>stream</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponseInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/post-response.html b/docs/1.3/typedefs/post-response.html index f15d6410f1..78f42c3a6d 100644 --- a/docs/1.3/typedefs/post-response.html +++ b/docs/1.3/typedefs/post-response.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/post-response">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/post-response">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PostResponse</h1></header><a name="postresponse"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/post-response-inputs"><code>PostResponseInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponse.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/post-response">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/post-response">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PostResponse</h1></header><a name="postresponse"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/post-response-inputs"><code>PostResponseInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PostResponse.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/prepare-request-inputs.html b/docs/1.3/typedefs/prepare-request-inputs.html index f9c82740a2..cd2c925dec 100644 --- a/docs/1.3/typedefs/prepare-request-inputs.html +++ b/docs/1.3/typedefs/prepare-request-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PrepareRequestInputs</h1></header><a name="preparerequestinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PrepareRequestInputs</h1></header><a name="preparerequestinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/prepare-request.html b/docs/1.3/typedefs/prepare-request.html index 3e63cfa73d..176bd7880b 100644 --- a/docs/1.3/typedefs/prepare-request.html +++ b/docs/1.3/typedefs/prepare-request.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/prepare-request">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/prepare-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PrepareRequest</h1></header><a name="preparerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs"><code>PrepareRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/prepare-request">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/prepare-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PrepareRequest</h1></header><a name="preparerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs"><code>PrepareRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PrepareRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/proxy-configuration-function.html b/docs/1.3/typedefs/proxy-configuration-function.html index b46eb9c0eb..ece7682b49 100644 --- a/docs/1.3/typedefs/proxy-configuration-function.html +++ b/docs/1.3/typedefs/proxy-configuration-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>ProxyConfigurationFunction</h1></header><a name="proxyconfigurationfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionId</code></strong>: <code>string</code> | <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>ProxyConfigurationFunction</h1></header><a name="proxyconfigurationfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionId</code></strong>: <code>string</code> | <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/proxy-configuration-options.html b/docs/1.3/typedefs/proxy-configuration-options.html index 6dc8e4b976..3898e800bd 100644 --- a/docs/1.3/typedefs/proxy-configuration-options.html +++ b/docs/1.3/typedefs/proxy-configuration-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,8 +26,8 @@ code.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyurls"><code>proxyUrls</code><a href="#proxyurls" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><p>An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will cause an error to be thrown on initialize.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="newurlfunction"><code>newUrlFunction</code><a href="#newurlfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-configuration-function"><code>ProxyConfigurationFunction</code></a></p><p>Custom function that allows you to generate the new proxy URL dynamically. It gets the <code>sessionId</code> as a parameter and should always return stringified proxy URL. This function is used to generate the URL when <a href="/sdk/js/docs/1.3/api/proxy-configuration#newurl"><code>ProxyConfiguration.newUrl</code></a> or -<a href="/sdk/js/docs/1.3/api/proxy-configuration#newproxyinfo"><code>ProxyConfiguration.newProxyInfo</code></a> is called.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#apifyproxygroups" class="table-of-contents__link toc-highlight"><code>apifyProxyGroups</code></a></li><li><a href="#apifyproxycountry" class="table-of-contents__link toc-highlight"><code>apifyProxyCountry</code></a></li><li><a href="#proxyurls" class="table-of-contents__link toc-highlight"><code>proxyUrls</code></a></li><li><a href="#newurlfunction" class="table-of-contents__link toc-highlight"><code>newUrlFunction</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/proxy-configuration#newproxyinfo"><code>ProxyConfiguration.newProxyInfo</code></a> is called.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyConfigurationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#apifyproxygroups" class="table-of-contents__link toc-highlight"><code>apifyProxyGroups</code></a></li><li><a href="#apifyproxycountry" class="table-of-contents__link toc-highlight"><code>apifyProxyCountry</code></a></li><li><a href="#proxyurls" class="table-of-contents__link toc-highlight"><code>proxyUrls</code></a></li><li><a href="#newurlfunction" class="table-of-contents__link toc-highlight"><code>newUrlFunction</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/proxy-info.html b/docs/1.3/typedefs/proxy-info.html index a5f3abd06c..bca7e91679 100644 --- a/docs/1.3/typedefs/proxy-info.html +++ b/docs/1.3/typedefs/proxy-info.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ assigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" target="_blank" rel="noopener">full list of available country codes</a>. This parameter is optional, by default, the proxy uses all available proxy servers from all countries.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="password"><code>password</code><a href="#password" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>User's password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> environment variable, which is automatically set by the system -when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener">Apify CLI</a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hostname"><code>hostname</code><a href="#hostname" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Hostname of your proxy.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="port"><code>port</code><a href="#port" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Proxy port.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sessionid" class="table-of-contents__link toc-highlight"><code>sessionId</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><code>hostname</code></a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><code>port</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener">Apify CLI</a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hostname"><code>hostname</code><a href="#hostname" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Hostname of your proxy.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="port"><code>port</code><a href="#port" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Proxy port.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/ProxyInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sessionid" class="table-of-contents__link toc-highlight"><code>sessionId</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><code>hostname</code></a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><code>port</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-crawler-options.html b/docs/1.3/typedefs/puppeteer-crawler-options.html index c9d41bfe11..f0803e78fb 100644 --- a/docs/1.3/typedefs/puppeteer-crawler-options.html +++ b/docs/1.3/typedefs/puppeteer-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ <code>isTaskReadyFunction</code> options are provided by the crawler and cannot be overridden. However, you can provide a custom implementation of <code>isFinishedFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Puppeteer crawler will initialize the <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> with the corresponding <code>sessionPoolOptions</code>. The session instance will be -than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-goto-inputs.html b/docs/1.3/typedefs/puppeteer-goto-inputs.html index d465aa360e..1fa5a7cc56 100644 --- a/docs/1.3/typedefs/puppeteer-goto-inputs.html +++ b/docs/1.3/typedefs/puppeteer-goto-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-goto-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PuppeteerGotoInputs</h1></header><a name="puppeteergotoinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>PuppeteerPage</code></p><p>is an instance of the Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-page" target="_blank" rel="noopener"><code>Page</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>An instance of the <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> object with details about the URL to open, HTTP method etc.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>An instance of the <code>AutoscaledPool</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpool"><code>puppeteerPool</code><a href="#puppeteerpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/puppeteer-pool"><code>PuppeteerPool</code></a></p><p>An instance of the <a href="/sdk/js/docs/1.3/api/puppeteer-pool"><code>PuppeteerPool</code></a> used by this <code>PuppeteerCrawler</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><p><code>Session</code> object for this request.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>Proxy info object</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGotoInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li><li><a href="#puppeteerpool" class="table-of-contents__link toc-highlight"><code>puppeteerPool</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-goto-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PuppeteerGotoInputs</h1></header><a name="puppeteergotoinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>PuppeteerPage</code></p><p>is an instance of the Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-page" target="_blank" rel="noopener"><code>Page</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>An instance of the <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> object with details about the URL to open, HTTP method etc.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>An instance of the <code>AutoscaledPool</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpool"><code>puppeteerPool</code><a href="#puppeteerpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/puppeteer-pool"><code>PuppeteerPool</code></a></p><p>An instance of the <a href="/sdk/js/docs/1.3/api/puppeteer-pool"><code>PuppeteerPool</code></a> used by this <code>PuppeteerCrawler</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><p><code>Session</code> object for this request.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>Proxy info object</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGotoInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li><li><a href="#puppeteerpool" class="table-of-contents__link toc-highlight"><code>puppeteerPool</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-goto.html b/docs/1.3/typedefs/puppeteer-goto.html index a78f30a3b2..ab6f14f325 100644 --- a/docs/1.3/typedefs/puppeteer-goto.html +++ b/docs/1.3/typedefs/puppeteer-goto.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-goto">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerGoto</h1></header><a name="puppeteergoto"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/puppeteer-goto-inputs"><code>PuppeteerGotoInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<(PuppeteerResponse|null)></code> - An instance of the Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-response" target="_blank" rel="noopener"><code>Response</code></a>, which -is the main resource response as returned by <code>page.goto(request.url)</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGoto.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +is the main resource response as returned by <code>page.goto(request.url)</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerGoto.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-handle-page-function-param.html b/docs/1.3/typedefs/puppeteer-handle-page-function-param.html index 38480be810..ecc61d3a55 100644 --- a/docs/1.3/typedefs/puppeteer-handle-page-function-param.html +++ b/docs/1.3/typedefs/puppeteer-handle-page-function-param.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePageFunctionParam</h1></header><a name="puppeteerhandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePageFunctionParam</h1></header><a name="puppeteerhandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-handle-page-inputs.html b/docs/1.3/typedefs/puppeteer-handle-page-inputs.html index 638280d25f..cf74ebc217 100644 --- a/docs/1.3/typedefs/puppeteer-handle-page-inputs.html +++ b/docs/1.3/typedefs/puppeteer-handle-page-inputs.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ returned by <code>page.goto(request.url)</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>PuppeteerPage</code></p><p>is an instance of the Puppeteer <a href="https://pptr.dev/#?product=Puppeteer&show=api-class-page" target="_blank" rel="noopener"><code>Page</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteerpool"><code>puppeteerPool</code><a href="#puppeteerpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/puppeteer-pool"><code>PuppeteerPool</code></a></p><p>An instance of the <a href="/sdk/js/docs/1.3/api/puppeteer-pool"><code>PuppeteerPool</code></a> used by this <code>PuppeteerCrawler</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>A reference to the underlying <a href="/sdk/js/docs/1.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/1.3/api/puppeteer-crawler#run"><code>PuppeteerCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/1.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling -<a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#puppeteerpool" class="table-of-contents__link toc-highlight"><code>puppeteerPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePageInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#puppeteerpool" class="table-of-contents__link toc-highlight"><code>puppeteerPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-handle-page.html b/docs/1.3/typedefs/puppeteer-handle-page.html index 06fcbb811a..e31ec1c4d1 100644 --- a/docs/1.3/typedefs/puppeteer-handle-page.html +++ b/docs/1.3/typedefs/puppeteer-handle-page.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePage</h1></header><a name="puppeteerhandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <code>Object</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePageInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs">PuppeteerHandlePageInputs</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePage</h1></header><a name="puppeteerhandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a> | <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <code>Object</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePageInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-hook.html b/docs/1.3/typedefs/puppeteer-hook.html index 1013f6a817..afa4a4fe33 100644 --- a/docs/1.3/typedefs/puppeteer-hook.html +++ b/docs/1.3/typedefs/puppeteer-hook.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/puppeteer-hook">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/puppeteer-hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHook</h1></header><a name="puppeteerhook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <code>Object</code> | <a href="/sdk/js/docs/1.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | -<a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/direct-navigation-options"><code>DirectNavigationOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/direct-navigation-options"><code>DirectNavigationOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-launch-context.html b/docs/1.3/typedefs/puppeteer-launch-context.html index 17b4712625..6c67efc925 100644 --- a/docs/1.3/typedefs/puppeteer-launch-context.html +++ b/docs/1.3/typedefs/puppeteer-launch-context.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ The path to Chrome executable is taken from the <code>APIFY_CHROME_EXECUTABLE_PATH</code> environment variable if provided, or defaults to the typical Google Chrome executable location specific for the operating system. By default, this option is <code>false</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launcher"><code>launcher</code><a href="#launcher" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>Already required module (<code>Object</code>). This enables usage of various Puppeteer wrappers such as <code>puppeteer-extra</code>.</p><p>Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides <code>puppeteer</code> itself.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealth"><code>stealth</code><a href="#stealth" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>This setting hides most of the known properties that identify headless Chrome and makes it nearly undetectable. It is recommended to use it together -with the <code>useChrome</code> set to <code>true</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealthoptions"><code>stealthOptions</code><a href="#stealthoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/stealth-options"><code>StealthOptions</code></a></p><p>Using this configuration, you can disable some of the hiding tricks. For these settings to take effect <code>stealth</code> must be set to true</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li><li><a href="#stealth" class="table-of-contents__link toc-highlight"><code>stealth</code></a></li><li><a href="#stealthoptions" class="table-of-contents__link toc-highlight"><code>stealthOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +with the <code>useChrome</code> set to <code>true</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealthoptions"><code>stealthOptions</code><a href="#stealthoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/stealth-options"><code>StealthOptions</code></a></p><p>Using this configuration, you can disable some of the hiding tricks. For these settings to take effect <code>stealth</code> must be set to true</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li><li><a href="#stealth" class="table-of-contents__link toc-highlight"><code>stealth</code></a></li><li><a href="#stealthoptions" class="table-of-contents__link toc-highlight"><code>stealthOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/puppeteer-pool-options.html b/docs/1.3/typedefs/puppeteer-pool-options.html index b4ffa45a90..b880a7cc58 100644 --- a/docs/1.3/typedefs/puppeteer-pool-options.html +++ b/docs/1.3/typedefs/puppeteer-pool-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ usage. Note that the new browser starts with empty cookies, local storage etc. so this setting doesn't affect anonymity of your crawler.</p><p>Beware that the disk cache directories can consume a lot of disk space. To limit the space consumed, you can pass the <code>--disk-cache-size=X</code> argument to <code>launchPuppeteer</code> <code>args</code>, where <code>X</code> is the approximate maximum number of bytes for disk cache.</p><p>Do not use the <code>recycleDiskCache</code> setting together with <code>--disk-cache-dir</code> argument in <code>launchPuppeteer</code> <code>args</code>, the behavior is undefined.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="useincognitopages"><code>useIncognitoPages</code><a href="#useincognitopages" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>With this option selected, all pages will be opened in a new incognito browser context, which means that they will not share cookies or cache and their resources will not be throttled by one another.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpool"><code>sessionPool</code><a href="#sessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a></p><p>A pool of Session instances.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyconfiguration"><code>proxyConfiguration</code><a href="#proxyconfiguration" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/proxy-configuration"><code>ProxyConfiguration</code></a></p><p>If set, <code>PuppeteerPool</code> will be configured for all connections to use <a href="https://my.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a> or your own Proxy URLs provided and -rotated according to the configuration. For more information, see the <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">documentation</a>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#maxopenpagesperinstance" class="table-of-contents__link toc-highlight"><code>maxOpenPagesPerInstance</code></a></li><li><a href="#retireinstanceafterrequestcount" class="table-of-contents__link toc-highlight"><code>retireInstanceAfterRequestCount</code></a></li><li><a href="#puppeteeroperationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>puppeteerOperationTimeoutSecs</code></a></li><li><a href="#instancekillerintervalsecs" class="table-of-contents__link toc-highlight"><code>instanceKillerIntervalSecs</code></a></li><li><a href="#killinstanceaftersecs" class="table-of-contents__link toc-highlight"><code>killInstanceAfterSecs</code></a></li><li><a href="#launchpuppeteerfunction" class="table-of-contents__link toc-highlight"><code>launchPuppeteerFunction</code></a></li><li><a href="#launchpuppeteeroptions" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code></a></li><li><a href="#recyclediskcache" class="table-of-contents__link toc-highlight"><code>recycleDiskCache</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +rotated according to the configuration. For more information, see the <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">documentation</a>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/PuppeteerPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#maxopenpagesperinstance" class="table-of-contents__link toc-highlight"><code>maxOpenPagesPerInstance</code></a></li><li><a href="#retireinstanceafterrequestcount" class="table-of-contents__link toc-highlight"><code>retireInstanceAfterRequestCount</code></a></li><li><a href="#puppeteeroperationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>puppeteerOperationTimeoutSecs</code></a></li><li><a href="#instancekillerintervalsecs" class="table-of-contents__link toc-highlight"><code>instanceKillerIntervalSecs</code></a></li><li><a href="#killinstanceaftersecs" class="table-of-contents__link toc-highlight"><code>killInstanceAfterSecs</code></a></li><li><a href="#launchpuppeteerfunction" class="table-of-contents__link toc-highlight"><code>launchPuppeteerFunction</code></a></li><li><a href="#launchpuppeteeroptions" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code></a></li><li><a href="#recyclediskcache" class="table-of-contents__link toc-highlight"><code>recycleDiskCache</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/queue-operation-info.html b/docs/1.3/typedefs/queue-operation-info.html index 364114b2fd..522e70fe09 100644 --- a/docs/1.3/typedefs/queue-operation-info.html +++ b/docs/1.3/typedefs/queue-operation-info.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>QueueOperationInfo</h1></header><a name="queueoperationinfo"></a><p>A helper class that is used to report results from various <a href="/sdk/js/docs/1.3/api/request-queue"><code>RequestQueue</code></a> functions as well as -<a href="/sdk/js/docs/1.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadypresent"><code>wasAlreadyPresent</code><a href="#wasalreadypresent" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already present in the queue.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadyhandled"><code>wasAlreadyHandled</code><a href="#wasalreadyhandled" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already marked as handled.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestid"><code>requestId</code><a href="#requestid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>The ID of the added request</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> object passed to the <code>RequestQueue</code> function.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/QueueOperationInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MemoryInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#wasalreadypresent" class="table-of-contents__link toc-highlight"><code>wasAlreadyPresent</code></a></li><li><a href="#wasalreadyhandled" class="table-of-contents__link toc-highlight"><code>wasAlreadyHandled</code></a></li><li><a href="#requestid" class="table-of-contents__link toc-highlight"><code>requestId</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadypresent"><code>wasAlreadyPresent</code><a href="#wasalreadypresent" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already present in the queue.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadyhandled"><code>wasAlreadyHandled</code><a href="#wasalreadyhandled" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already marked as handled.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestid"><code>requestId</code><a href="#requestid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>The ID of the added request</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> object passed to the <code>RequestQueue</code> function.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/QueueOperationInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MemoryInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#wasalreadypresent" class="table-of-contents__link toc-highlight"><code>wasAlreadyPresent</code></a></li><li><a href="#wasalreadyhandled" class="table-of-contents__link toc-highlight"><code>wasAlreadyHandled</code></a></li><li><a href="#requestid" class="table-of-contents__link toc-highlight"><code>requestId</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-as-browser-options.html b/docs/1.3/typedefs/request-as-browser-options.html index 052d58d293..92980bec6f 100644 --- a/docs/1.3/typedefs/request-as-browser-options.html +++ b/docs/1.3/typedefs/request-as-browser-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ vulnerabilities, although the risk should be negligible as these vulnerabilities mainly relate to server applications, not clients. Learn more in this <a href="https://snyk.io/blog/node-js-release-fixes-a-critical-http-security-vulnerability/" target="_blank" rel="noopener">blog post</a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/abort-function"><code>AbortFunction</code></a></p><p>Function accepts <code>response</code> object as a single parameter and should return <code>true</code> or <code>false</code>. If function returns true, request gets aborted.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usehttp2"><code>useHttp2</code><a href="#usehttp2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If set to false, it will prevent use of HTTP2 requests. This is strongly discouraged. Websites expect HTTP2 connections, because browsers use HTTP2 by default. It will automatically downgrade to HTTP/1.1 for websites that do not support HTTP2. For Node 10 this option is always set to <code>false</code> because -Node 10 does not support HTTP2 very well. Upgrade to Node 12 for better performance.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="forceurlencoding"><code>forceUrlEncoding</code><a href="#forceurlencoding" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Automatically encode URLs via <code>encodeURI()</code> before resolving them.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/session-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#headergeneratoroptions" class="table-of-contents__link toc-highlight"><code>headerGeneratorOptions</code></a></li><li><a href="#languagecode" class="table-of-contents__link toc-highlight"><code>languageCode</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#usemobileversion" class="table-of-contents__link toc-highlight"><code>useMobileVersion</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#useinsecurehttpparser" class="table-of-contents__link toc-highlight"><code>useInsecureHttpParser</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li><li><a href="#usehttp2" class="table-of-contents__link toc-highlight"><code>useHttp2</code></a></li><li><a href="#forceurlencoding" class="table-of-contents__link toc-highlight"><code>forceUrlEncoding</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Node 10 does not support HTTP2 very well. Upgrade to Node 12 for better performance.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="forceurlencoding"><code>forceUrlEncoding</code><a href="#forceurlencoding" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Automatically encode URLs via <code>encodeURI()</code> before resolving them.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/session-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#headergeneratoroptions" class="table-of-contents__link toc-highlight"><code>headerGeneratorOptions</code></a></li><li><a href="#languagecode" class="table-of-contents__link toc-highlight"><code>languageCode</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#usemobileversion" class="table-of-contents__link toc-highlight"><code>useMobileVersion</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#useinsecurehttpparser" class="table-of-contents__link toc-highlight"><code>useInsecureHttpParser</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li><li><a href="#usehttp2" class="table-of-contents__link toc-highlight"><code>useHttp2</code></a></li><li><a href="#forceurlencoding" class="table-of-contents__link toc-highlight"><code>forceUrlEncoding</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-as-browser-result.html b/docs/1.3/typedefs/request-as-browser-result.html index c64ec55793..d61ee33753 100644 --- a/docs/1.3/typedefs/request-as-browser-result.html +++ b/docs/1.3/typedefs/request-as-browser-result.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-as-browser-result">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-as-browser-result">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestAsBrowserResult</h1></header><a name="requestasbrowserresult"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserResult.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-as-browser-result">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-as-browser-result">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestAsBrowserResult</h1></header><a name="requestasbrowserresult"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestAsBrowserResult.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-list-options.html b/docs/1.3/typedefs/request-list-options.html index 1125294b83..46b4b1a22e 100644 --- a/docs/1.3/typedefs/request-list-options.html +++ b/docs/1.3/typedefs/request-list-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -31,8 +31,8 @@ <a href="/sdk/js/docs/1.3/api/request"><code>Request</code></a> objects.</p><p>If the property is not present, it is generated by normalizing the URL. If present, it is kept intact. In any case, only one request per <code>uniqueKey</code> is added to the <code>RequestList</code> resulting in removal of duplicate URLs / unique keys.</p><p>Setting <code>keepDuplicateUrls</code> to <code>true</code> will append an additional identifier to the <code>uniqueKey</code> of each request that does not already include a <code>uniqueKey</code>. Therefore, duplicate URLs will be kept in the list. It does not protect the user from having duplicates in user set <code>uniqueKey</code>s however. -It is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the <code>RequestList</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sources" class="table-of-contents__link toc-highlight"><code>sources</code></a></li><li><a href="#sourcesfunction" class="table-of-contents__link toc-highlight"><code>sourcesFunction</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#persistrequestskey" class="table-of-contents__link toc-highlight"><code>persistRequestsKey</code></a></li><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#keepduplicateurls" class="table-of-contents__link toc-highlight"><code>keepDuplicateUrls</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +It is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the <code>RequestList</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sources" class="table-of-contents__link toc-highlight"><code>sources</code></a></li><li><a href="#sourcesfunction" class="table-of-contents__link toc-highlight"><code>sourcesFunction</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#persistrequestskey" class="table-of-contents__link toc-highlight"><code>persistRequestsKey</code></a></li><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#keepduplicateurls" class="table-of-contents__link toc-highlight"><code>keepDuplicateUrls</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-list-sources-function.html b/docs/1.3/typedefs/request-list-sources-function.html index 98ef13d748..02d7be39d7 100644 --- a/docs/1.3/typedefs/request-list-sources-function.html +++ b/docs/1.3/typedefs/request-list-sources-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-list-sources-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-list-sources-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestListSourcesFunction</h1></header><a name="requestlistsourcesfunction"></a><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-options"><code>Promise<Array<(RequestOptions|Request|string)>></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListSourcesFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-list-sources-function">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-list-sources-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestListSourcesFunction</h1></header><a name="requestlistsourcesfunction"></a><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-options"><code>Promise<Array<(RequestOptions|Request|string)>></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListSourcesFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-list-state.html b/docs/1.3/typedefs/request-list-state.html index 988bad843c..c31cb06a1c 100644 --- a/docs/1.3/typedefs/request-list-state.html +++ b/docs/1.3/typedefs/request-list-state.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-list-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-list-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>RequestListState</h1></header><a name="requestliststate"></a><p>Represents state of a <a href="/sdk/js/docs/1.3/api/request-list"><code>RequestList</code></a>. It can be used to resume a <a href="/sdk/js/docs/1.3/api/request-list"><code>RequestList</code></a> which has been previously processed. You can obtain the state by calling <a href="/sdk/js/docs/1.3/api/request-list#getstate"><code>RequestList.getState()</code></a> and receive an object with the following -structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextIndex</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextUniqueKey</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'unique-key-5'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> inProgress</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-1'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-4'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextindex"><code>nextIndex</code><a href="#nextindex" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextuniquekey"><code>nextUniqueKey</code><a href="#nextuniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Key of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="inprogress"><code>inProgress</code><a href="#inprogress" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, boolean></code></p><p>An object mapping request keys to a boolean value respresenting whether they are being processed at the moment.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/session-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#nextindex" class="table-of-contents__link toc-highlight"><code>nextIndex</code></a></li><li><a href="#nextuniquekey" class="table-of-contents__link toc-highlight"><code>nextUniqueKey</code></a></li><li><a href="#inprogress" class="table-of-contents__link toc-highlight"><code>inProgress</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextIndex</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextUniqueKey</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'unique-key-5'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> inProgress</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-1'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-4'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextindex"><code>nextIndex</code><a href="#nextindex" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextuniquekey"><code>nextUniqueKey</code><a href="#nextuniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Key of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="inprogress"><code>inProgress</code><a href="#inprogress" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, boolean></code></p><p>An object mapping request keys to a boolean value respresenting whether they are being processed at the moment.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestListState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/session-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#nextindex" class="table-of-contents__link toc-highlight"><code>nextIndex</code></a></li><li><a href="#nextuniquekey" class="table-of-contents__link toc-highlight"><code>nextUniqueKey</code></a></li><li><a href="#inprogress" class="table-of-contents__link toc-highlight"><code>inProgress</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-options.html b/docs/1.3/typedefs/request-options.html index 733bc65251..f4f7f86804 100644 --- a/docs/1.3/typedefs/request-options.html +++ b/docs/1.3/typedefs/request-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ failures etc.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="keepurlfragment"><code>keepUrlFragment</code><a href="#keepurlfragment" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If <code>false</code> then the hash part of a URL is removed when computing the <code>uniqueKey</code> property. For example, this causes the <code>http://www.example.com#foo</code> and <code>http://www.example.com#bar</code> URLs to have the same <code>uniqueKey</code> of <code>http://www.example.com</code> and thus the URLs are considered equal. Note that this option only has an effect if <code>uniqueKey</code> is not set.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="useextendeduniquekey"><code>useExtendedUniqueKey</code><a href="#useextendeduniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If <code>true</code> then the <code>uniqueKey</code> is computed not only from the URL, but also from the method and payload properties. This is useful when making requests -to the same URL that are differentiated by method or payload, such as form submit navigations in browsers.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#keepurlfragment" class="table-of-contents__link toc-highlight"><code>keepUrlFragment</code></a></li><li><a href="#useextendeduniquekey" class="table-of-contents__link toc-highlight"><code>useExtendedUniqueKey</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +to the same URL that are differentiated by method or payload, such as form submit navigations in browsers.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#keepurlfragment" class="table-of-contents__link toc-highlight"><code>keepUrlFragment</code></a></li><li><a href="#useextendeduniquekey" class="table-of-contents__link toc-highlight"><code>useExtendedUniqueKey</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-queue-info.html b/docs/1.3/typedefs/request-queue-info.html index d78f5bad82..56abe6c00a 100644 --- a/docs/1.3/typedefs/request-queue-info.html +++ b/docs/1.3/typedefs/request-queue-info.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-queue-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-queue-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>RequestQueueInfo</h1></header><a name="requestqueueinfo"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="accessedat"><code>accessedAt</code><a href="#accessedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalrequestcount"><code>totalRequestCount</code><a href="#totalrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="handledrequestcount"><code>handledRequestCount</code><a href="#handledrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pendingrequestcount"><code>pendingRequestCount</code><a href="#pendingrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestQueueInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#accessedat" class="table-of-contents__link toc-highlight"><code>accessedAt</code></a></li><li><a href="#totalrequestcount" class="table-of-contents__link toc-highlight"><code>totalRequestCount</code></a></li><li><a href="#handledrequestcount" class="table-of-contents__link toc-highlight"><code>handledRequestCount</code></a></li><li><a href="#pendingrequestcount" class="table-of-contents__link toc-highlight"><code>pendingRequestCount</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-queue-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-queue-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>RequestQueueInfo</h1></header><a name="requestqueueinfo"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="accessedat"><code>accessedAt</code><a href="#accessedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalrequestcount"><code>totalRequestCount</code><a href="#totalrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="handledrequestcount"><code>handledRequestCount</code><a href="#handledrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pendingrequestcount"><code>pendingRequestCount</code><a href="#pendingrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestQueueInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#accessedat" class="table-of-contents__link toc-highlight"><code>accessedAt</code></a></li><li><a href="#totalrequestcount" class="table-of-contents__link toc-highlight"><code>totalRequestCount</code></a></li><li><a href="#handledrequestcount" class="table-of-contents__link toc-highlight"><code>handledRequestCount</code></a></li><li><a href="#pendingrequestcount" class="table-of-contents__link toc-highlight"><code>pendingRequestCount</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/request-transform.html b/docs/1.3/typedefs/request-transform.html index d8b3ed5793..d565c4e942 100644 --- a/docs/1.3/typedefs/request-transform.html +++ b/docs/1.3/typedefs/request-transform.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/request-transform">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/request-transform">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">RequestTransform</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Utilities</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestTransform</h1></header><a name="requesttransform"></a><p>Takes an Apify {RequestOptions} object and changes it's attributes in a desired way. This user-function is used -<a href="/sdk/js/docs/1.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a> to modify requests before enqueuing them.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>original</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/request-options"><code>RequestOptions</code></a> - Request options to be modified.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-options"><code>RequestOptions</code></a> - The modified request options to enqueue.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestTransform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/create-session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CreateSession</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/1.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a> to modify requests before enqueuing them.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>original</code></strong>: <a href="/sdk/js/docs/1.3/typedefs/request-options"><code>RequestOptions</code></a> - Request options to be modified.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/1.3/typedefs/request-options"><code>RequestOptions</code></a> - The modified request options to enqueue.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/RequestTransform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/create-session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CreateSession</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/session-options.html b/docs/1.3/typedefs/session-options.html index 975f1c6fe6..8e89458d26 100644 --- a/docs/1.3/typedefs/session-options.html +++ b/docs/1.3/typedefs/session-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/session-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/session-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionOptions</h1></header><a name="sessionoptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Id of session used for generating fingerprints. It is used as proxy session name.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxagesecs"><code>maxAgeSecs</code><a href="#maxagesecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 3000</code></p><p>Number of seconds after which the session is considered as expired.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Object where custom user data can be stored. For example custom headers.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxerrorscore"><code>maxErrorScore</code><a href="#maxerrorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 3</code></p><p>Maximum number of marking session as blocked usage. If the <code>errorScore</code> reaches the <code>maxErrorScore</code> session is marked as block and it is thrown away. It starts at 0. Calling the <code>markBad</code> function increases the <code>errorScore</code> by 1. Calling the <code>markGood</code> will decrease the <code>errorScore</code> by <code>errorScoreDecrement</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscoredecrement"><code>errorScoreDecrement</code><a href="#errorscoredecrement" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.5</code></p><p>It is used for healing the session. For example: if your session is marked bad two times, but it is successful on the third attempt it's errorScore is -decremented by this number.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of creation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of expiration.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session has been used.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorcount"><code>errorCount</code><a href="#errorcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session is marked bad.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusagecount"><code>maxUsageCount</code><a href="#maxusagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 50</code></p><p>Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpool"><code>sessionPool</code><a href="#sessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a></p><p>SessionPool instance. Session will emit the <code>sessionRetired</code> event on this instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#maxagesecs" class="table-of-contents__link toc-highlight"><code>maxAgeSecs</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#errorcount" class="table-of-contents__link toc-highlight"><code>errorCount</code></a></li><li><a href="#maxusagecount" class="table-of-contents__link toc-highlight"><code>maxUsageCount</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +decremented by this number.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of creation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of expiration.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session has been used.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorcount"><code>errorCount</code><a href="#errorcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session is marked bad.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusagecount"><code>maxUsageCount</code><a href="#maxusagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 50</code></p><p>Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpool"><code>sessionPool</code><a href="#sessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/session-pool"><code>SessionPool</code></a></p><p>SessionPool instance. Session will emit the <code>sessionRetired</code> event on this instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#maxagesecs" class="table-of-contents__link toc-highlight"><code>maxAgeSecs</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#errorcount" class="table-of-contents__link toc-highlight"><code>errorCount</code></a></li><li><a href="#maxusagecount" class="table-of-contents__link toc-highlight"><code>maxUsageCount</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/session-pool-options.html b/docs/1.3/typedefs/session-pool-options.html index 503a53ad85..c1c353133d 100644 --- a/docs/1.3/typedefs/session-pool-options.html +++ b/docs/1.3/typedefs/session-pool-options.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/session-pool-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/session-pool-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionPoolOptions</h1></header><a name="sessionpooloptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxpoolsize"><code>maxPoolSize</code><a href="#maxpoolsize" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Maximum size of the pool. Indicates how many sessions are rotated.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionoptions"><code>sessionOptions</code><a href="#sessionoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/session-options"><code>SessionOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a> instances.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="persiststatekeyvaluestoreid"><code>persistStateKeyValueStoreId</code><a href="#persiststatekeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Name or Id of <code>KeyValueStore</code> where is the <code>SessionPool</code> state stored.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="persiststatekey"><code>persistStateKey</code><a href="#persiststatekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> <code> = <!-- -->"<!-- -->\<!-- -->"<!-- -->SESSION_POOL_STATE\<!-- -->"<!-- -->"</code></p><p>Session pool persists it's state under this key in Key value store.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createsessionfunction"><code>createSessionFunction</code><a href="#createsessionfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/create-session"><code>CreateSession</code></a></p><p>Custom function that should return <code>Session</code> instance. Any error thrown from this function will terminate the process. Function receives <code>SessionPool</code> -instance as a parameter</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/session-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SnapshotterOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#maxpoolsize" class="table-of-contents__link toc-highlight"><code>maxPoolSize</code></a></li><li><a href="#sessionoptions" class="table-of-contents__link toc-highlight"><code>sessionOptions</code></a></li><li><a href="#persiststatekeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>persistStateKeyValueStoreId</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#createsessionfunction" class="table-of-contents__link toc-highlight"><code>createSessionFunction</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +instance as a parameter</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/session-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SnapshotterOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#maxpoolsize" class="table-of-contents__link toc-highlight"><code>maxPoolSize</code></a></li><li><a href="#sessionoptions" class="table-of-contents__link toc-highlight"><code>sessionOptions</code></a></li><li><a href="#persiststatekeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>persistStateKeyValueStoreId</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#createsessionfunction" class="table-of-contents__link toc-highlight"><code>createSessionFunction</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/session-state.html b/docs/1.3/typedefs/session-state.html index 2af5f3655b..fcbe0e3a7a 100644 --- a/docs/1.3/typedefs/session-state.html +++ b/docs/1.3/typedefs/session-state.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/session-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/session-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionState</h1></header><a name="sessionstate"></a><p>Persistable <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a> state.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cookiejar"><code>cookieJar</code><a href="#cookiejar" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>CookieJar</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>object</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscore"><code>errorScore</code><a href="#errorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxerrorscore"><code>maxErrorScore</code><a href="#maxerrorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscoredecrement"><code>errorScoreDecrement</code><a href="#errorscoredecrement" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SocialHandles</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#cookiejar" class="table-of-contents__link toc-highlight"><code>cookieJar</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#errorscore" class="table-of-contents__link toc-highlight"><code>errorScore</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/session-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/session-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionState</h1></header><a name="sessionstate"></a><p>Persistable <a href="/sdk/js/docs/1.3/api/session"><code>Session</code></a> state.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cookiejar"><code>cookieJar</code><a href="#cookiejar" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>CookieJar</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>object</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscore"><code>errorScore</code><a href="#errorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxerrorscore"><code>maxErrorScore</code><a href="#maxerrorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscoredecrement"><code>errorScoreDecrement</code><a href="#errorscoredecrement" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SessionState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SocialHandles</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#cookiejar" class="table-of-contents__link toc-highlight"><code>cookieJar</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#errorscore" class="table-of-contents__link toc-highlight"><code>errorScore</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/snapshotter-options.html b/docs/1.3/typedefs/snapshotter-options.html index dc9311ed75..6ee07bf961 100644 --- a/docs/1.3/typedefs/snapshotter-options.html +++ b/docs/1.3/typedefs/snapshotter-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SnapshotterOptions</h1></header><a name="snapshotteroptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventloopsnapshotintervalsecs"><code>eventLoopSnapshotIntervalSecs</code><a href="#eventloopsnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.5</code></p><p>Defines the interval of measuring the event loop response time.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="clientsnapshotintervalsecs"><code>clientSnapshotIntervalSecs</code><a href="#clientsnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the interval of checking the current state of the remote API client.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxblockedmillis"><code>maxBlockedMillis</code><a href="#maxblockedmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 50</code></p><p>Maximum allowed delay of the event loop in milliseconds. Exceeding this limit overloads the event loop.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cpusnapshotintervalsecs"><code>cpuSnapshotIntervalSecs</code><a href="#cpusnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the interval of measuring CPU usage. This is only used when running locally. On the Apify platform, the statistics are provided externally at a fixed interval.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusedcpuratio"><code>maxUsedCpuRatio</code><a href="#maxusedcpuratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.95</code></p><p>Defines the maximum usage of CPU. Exceeding this limit overloads the CPU.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="memorysnapshotintervalsecs"><code>memorySnapshotIntervalSecs</code><a href="#memorysnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the interval of measuring memory consumption. This is only used when running locally. On the Apify platform, the statistics are provided externally at a fixed interval. The measurement itself is resource intensive (25 - 50ms async). Therefore, setting this interval below 1 second is not -recommended.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusedmemoryratio"><code>maxUsedMemoryRatio</code><a href="#maxusedmemoryratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.7</code></p><p>Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclienterrors"><code>maxClientErrors</code><a href="#maxclienterrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the maximum number of new rate limit errors within the given interval.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshothistorysecs"><code>snapshotHistorySecs</code><a href="#snapshothistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 60</code></p><p>Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SnapshotterOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">StealthOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventloopsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>eventLoopSnapshotIntervalSecs</code></a></li><li><a href="#clientsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>clientSnapshotIntervalSecs</code></a></li><li><a href="#maxblockedmillis" class="table-of-contents__link toc-highlight"><code>maxBlockedMillis</code></a></li><li><a href="#cpusnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>cpuSnapshotIntervalSecs</code></a></li><li><a href="#maxusedcpuratio" class="table-of-contents__link toc-highlight"><code>maxUsedCpuRatio</code></a></li><li><a href="#memorysnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>memorySnapshotIntervalSecs</code></a></li><li><a href="#maxusedmemoryratio" class="table-of-contents__link toc-highlight"><code>maxUsedMemoryRatio</code></a></li><li><a href="#maxclienterrors" class="table-of-contents__link toc-highlight"><code>maxClientErrors</code></a></li><li><a href="#snapshothistorysecs" class="table-of-contents__link toc-highlight"><code>snapshotHistorySecs</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +recommended.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusedmemoryratio"><code>maxUsedMemoryRatio</code><a href="#maxusedmemoryratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.7</code></p><p>Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclienterrors"><code>maxClientErrors</code><a href="#maxclienterrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the maximum number of new rate limit errors within the given interval.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshothistorysecs"><code>snapshotHistorySecs</code><a href="#snapshothistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 60</code></p><p>Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SnapshotterOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">StealthOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventloopsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>eventLoopSnapshotIntervalSecs</code></a></li><li><a href="#clientsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>clientSnapshotIntervalSecs</code></a></li><li><a href="#maxblockedmillis" class="table-of-contents__link toc-highlight"><code>maxBlockedMillis</code></a></li><li><a href="#cpusnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>cpuSnapshotIntervalSecs</code></a></li><li><a href="#maxusedcpuratio" class="table-of-contents__link toc-highlight"><code>maxUsedCpuRatio</code></a></li><li><a href="#memorysnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>memorySnapshotIntervalSecs</code></a></li><li><a href="#maxusedmemoryratio" class="table-of-contents__link toc-highlight"><code>maxUsedMemoryRatio</code></a></li><li><a href="#maxclienterrors" class="table-of-contents__link toc-highlight"><code>maxClientErrors</code></a></li><li><a href="#snapshothistorysecs" class="table-of-contents__link toc-highlight"><code>snapshotHistorySecs</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/social-handles.html b/docs/1.3/typedefs/social-handles.html index 3bd9a57e0e..cea76208e9 100644 --- a/docs/1.3/typedefs/social-handles.html +++ b/docs/1.3/typedefs/social-handles.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/social-handles">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/social-handles">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SocialHandles</h1></header><a name="socialhandles"></a><p>Representation of social handles parsed from a HTML page.</p><p>The object has the following structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> emails</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phones</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phonesUncertain</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> linkedIns</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> twitters</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> instagrams</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> facebooks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> youtubes</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emails"><code>emails</code><a href="#emails" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phones"><code>phones</code><a href="#phones" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phonesuncertain"><code>phonesUncertain</code><a href="#phonesuncertain" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="linkedins"><code>linkedIns</code><a href="#linkedins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="twitters"><code>twitters</code><a href="#twitters" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="instagrams"><code>instagrams</code><a href="#instagrams" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="facebooks"><code>facebooks</code><a href="#facebooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="youtubes"><code>youtubes</code><a href="#youtubes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SocialHandles.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/session-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/system-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#emails" class="table-of-contents__link toc-highlight"><code>emails</code></a></li><li><a href="#phones" class="table-of-contents__link toc-highlight"><code>phones</code></a></li><li><a href="#phonesuncertain" class="table-of-contents__link toc-highlight"><code>phonesUncertain</code></a></li><li><a href="#linkedins" class="table-of-contents__link toc-highlight"><code>linkedIns</code></a></li><li><a href="#twitters" class="table-of-contents__link toc-highlight"><code>twitters</code></a></li><li><a href="#instagrams" class="table-of-contents__link toc-highlight"><code>instagrams</code></a></li><li><a href="#facebooks" class="table-of-contents__link toc-highlight"><code>facebooks</code></a></li><li><a href="#youtubes" class="table-of-contents__link toc-highlight"><code>youtubes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/social-handles">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/social-handles">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SocialHandles</h1></header><a name="socialhandles"></a><p>Representation of social handles parsed from a HTML page.</p><p>The object has the following structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> emails</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phones</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phonesUncertain</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> linkedIns</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> twitters</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> instagrams</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> facebooks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> youtubes</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emails"><code>emails</code><a href="#emails" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phones"><code>phones</code><a href="#phones" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phonesuncertain"><code>phonesUncertain</code><a href="#phonesuncertain" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="linkedins"><code>linkedIns</code><a href="#linkedins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="twitters"><code>twitters</code><a href="#twitters" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="instagrams"><code>instagrams</code><a href="#instagrams" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="facebooks"><code>facebooks</code><a href="#facebooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="youtubes"><code>youtubes</code><a href="#youtubes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SocialHandles.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/session-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/system-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#emails" class="table-of-contents__link toc-highlight"><code>emails</code></a></li><li><a href="#phones" class="table-of-contents__link toc-highlight"><code>phones</code></a></li><li><a href="#phonesuncertain" class="table-of-contents__link toc-highlight"><code>phonesUncertain</code></a></li><li><a href="#linkedins" class="table-of-contents__link toc-highlight"><code>linkedIns</code></a></li><li><a href="#twitters" class="table-of-contents__link toc-highlight"><code>twitters</code></a></li><li><a href="#instagrams" class="table-of-contents__link toc-highlight"><code>instagrams</code></a></li><li><a href="#facebooks" class="table-of-contents__link toc-highlight"><code>facebooks</code></a></li><li><a href="#youtubes" class="table-of-contents__link toc-highlight"><code>youtubes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/statistic-persisted-state.html b/docs/1.3/typedefs/statistic-persisted-state.html index c3207b2762..ec539f416d 100644 --- a/docs/1.3/typedefs/statistic-persisted-state.html +++ b/docs/1.3/typedefs/statistic-persisted-state.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/statistic-persisted-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/statistic-persisted-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticPersistedState</h1></header><a name="statisticpersistedstate"></a><p>Format of the persisted stats</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statsid"><code>statsId</code><a href="#statsid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfaileddurationmillis"><code>requestAvgFailedDurationMillis</code><a href="#requestavgfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfinisheddurationmillis"><code>requestAvgFinishedDurationMillis</code><a href="#requestavgfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotaldurationmillis"><code>requestTotalDurationMillis</code><a href="#requesttotaldurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requeststotal"><code>requestsTotal</code><a href="#requeststotal" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerlaststarttimestamp"><code>crawlerLastStartTimestamp</code><a href="#crawlerlaststarttimestamp" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticPersistedState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li><li><a href="#statsid" class="table-of-contents__link toc-highlight"><code>statsId</code></a></li><li><a href="#requestavgfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFailedDurationMillis</code></a></li><li><a href="#requestavgfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFinishedDurationMillis</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requesttotaldurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalDurationMillis</code></a></li><li><a href="#requeststotal" class="table-of-contents__link toc-highlight"><code>requestsTotal</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#crawlerlaststarttimestamp" class="table-of-contents__link toc-highlight"><code>crawlerLastStartTimestamp</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/statistic-persisted-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/statistic-persisted-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticPersistedState</h1></header><a name="statisticpersistedstate"></a><p>Format of the persisted stats</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statsid"><code>statsId</code><a href="#statsid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfaileddurationmillis"><code>requestAvgFailedDurationMillis</code><a href="#requestavgfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfinisheddurationmillis"><code>requestAvgFinishedDurationMillis</code><a href="#requestavgfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotaldurationmillis"><code>requestTotalDurationMillis</code><a href="#requesttotaldurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requeststotal"><code>requestsTotal</code><a href="#requeststotal" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerlaststarttimestamp"><code>crawlerLastStartTimestamp</code><a href="#crawlerlaststarttimestamp" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticPersistedState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li><li><a href="#statsid" class="table-of-contents__link toc-highlight"><code>statsId</code></a></li><li><a href="#requestavgfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFailedDurationMillis</code></a></li><li><a href="#requestavgfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFinishedDurationMillis</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requesttotaldurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalDurationMillis</code></a></li><li><a href="#requeststotal" class="table-of-contents__link toc-highlight"><code>requestsTotal</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#crawlerlaststarttimestamp" class="table-of-contents__link toc-highlight"><code>crawlerLastStartTimestamp</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/statistic-state.html b/docs/1.3/typedefs/statistic-state.html index a5d2005f60..f8d0d26b30 100644 --- a/docs/1.3/typedefs/statistic-state.html +++ b/docs/1.3/typedefs/statistic-state.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/statistic-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/statistic-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticState</h1></header><a name="statisticstate"></a><p>Contains the statistics state</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinished"><code>requestsFinished</code><a href="#requestsfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailed"><code>requestsFailed</code><a href="#requestsfailed" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsretries"><code>requestsRetries</code><a href="#requestsretries" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmindurationmillis"><code>requestMinDurationMillis</code><a href="#requestmindurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmaxdurationmillis"><code>requestMaxDurationMillis</code><a href="#requestmaxdurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfaileddurationmillis"><code>requestTotalFailedDurationMillis</code><a href="#requesttotalfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfinisheddurationmillis"><code>requestTotalFinishedDurationMillis</code><a href="#requesttotalfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerstartedat"><code>crawlerStartedAt</code><a href="#crawlerstartedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerfinishedat"><code>crawlerFinishedAt</code><a href="#crawlerfinishedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestsfinished" class="table-of-contents__link toc-highlight"><code>requestsFinished</code></a></li><li><a href="#requestsfailed" class="table-of-contents__link toc-highlight"><code>requestsFailed</code></a></li><li><a href="#requestsretries" class="table-of-contents__link toc-highlight"><code>requestsRetries</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestmindurationmillis" class="table-of-contents__link toc-highlight"><code>requestMinDurationMillis</code></a></li><li><a href="#requestmaxdurationmillis" class="table-of-contents__link toc-highlight"><code>requestMaxDurationMillis</code></a></li><li><a href="#requesttotalfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFailedDurationMillis</code></a></li><li><a href="#requesttotalfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFinishedDurationMillis</code></a></li><li><a href="#crawlerstartedat" class="table-of-contents__link toc-highlight"><code>crawlerStartedAt</code></a></li><li><a href="#crawlerfinishedat" class="table-of-contents__link toc-highlight"><code>crawlerFinishedAt</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/statistic-state">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/statistic-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticState</h1></header><a name="statisticstate"></a><p>Contains the statistics state</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinished"><code>requestsFinished</code><a href="#requestsfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailed"><code>requestsFailed</code><a href="#requestsfailed" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsretries"><code>requestsRetries</code><a href="#requestsretries" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmindurationmillis"><code>requestMinDurationMillis</code><a href="#requestmindurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmaxdurationmillis"><code>requestMaxDurationMillis</code><a href="#requestmaxdurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfaileddurationmillis"><code>requestTotalFailedDurationMillis</code><a href="#requesttotalfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfinisheddurationmillis"><code>requestTotalFinishedDurationMillis</code><a href="#requesttotalfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerstartedat"><code>crawlerStartedAt</code><a href="#crawlerstartedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerfinishedat"><code>crawlerFinishedAt</code><a href="#crawlerfinishedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StatisticState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestsfinished" class="table-of-contents__link toc-highlight"><code>requestsFinished</code></a></li><li><a href="#requestsfailed" class="table-of-contents__link toc-highlight"><code>requestsFailed</code></a></li><li><a href="#requestsretries" class="table-of-contents__link toc-highlight"><code>requestsRetries</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestmindurationmillis" class="table-of-contents__link toc-highlight"><code>requestMinDurationMillis</code></a></li><li><a href="#requestmaxdurationmillis" class="table-of-contents__link toc-highlight"><code>requestMaxDurationMillis</code></a></li><li><a href="#requesttotalfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFailedDurationMillis</code></a></li><li><a href="#requesttotalfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFinishedDurationMillis</code></a></li><li><a href="#crawlerstartedat" class="table-of-contents__link toc-highlight"><code>crawlerStartedAt</code></a></li><li><a href="#crawlerfinishedat" class="table-of-contents__link toc-highlight"><code>crawlerFinishedAt</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/stealth-options.html b/docs/1.3/typedefs/stealth-options.html index 6181ecab41..060c5ab187 100644 --- a/docs/1.3/typedefs/stealth-options.html +++ b/docs/1.3/typedefs/stealth-options.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/stealth-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/stealth-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StealthOptions</h1></header><a name="stealthoptions"></a><p>Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the <code>stealth</code> option -is set to <code>true</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addplugins"><code>addPlugins</code><a href="#addplugins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If plugins should be added to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewindowframe"><code>emulateWindowFrame</code><a href="#emulatewindowframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates window Iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewebgl"><code>emulateWebGL</code><a href="#emulatewebgl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates graphic card.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulateconsoledebug"><code>emulateConsoleDebug</code><a href="#emulateconsoledebug" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates console.debug to return null.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addlanguage"><code>addLanguage</code><a href="#addlanguage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds languages to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hidewebdriver"><code>hideWebDriver</code><a href="#hidewebdriver" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Hides the webdriver by changing the navigator proto.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hackpermissions"><code>hackPermissions</code><a href="#hackpermissions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Fakes interaction with permissions.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchrome"><code>mockChrome</code><a href="#mockchrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchromeiniframe"><code>mockChromeInIframe</code><a href="#mockchromeiniframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties inside the every newly created iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockdevicememory"><code>mockDeviceMemory</code><a href="#mockdevicememory" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Sets device memory to other value than 0.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StealthOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SnapshotterOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatusOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#addplugins" class="table-of-contents__link toc-highlight"><code>addPlugins</code></a></li><li><a href="#emulatewindowframe" class="table-of-contents__link toc-highlight"><code>emulateWindowFrame</code></a></li><li><a href="#emulatewebgl" class="table-of-contents__link toc-highlight"><code>emulateWebGL</code></a></li><li><a href="#emulateconsoledebug" class="table-of-contents__link toc-highlight"><code>emulateConsoleDebug</code></a></li><li><a href="#addlanguage" class="table-of-contents__link toc-highlight"><code>addLanguage</code></a></li><li><a href="#hidewebdriver" class="table-of-contents__link toc-highlight"><code>hideWebDriver</code></a></li><li><a href="#hackpermissions" class="table-of-contents__link toc-highlight"><code>hackPermissions</code></a></li><li><a href="#mockchrome" class="table-of-contents__link toc-highlight"><code>mockChrome</code></a></li><li><a href="#mockchromeiniframe" class="table-of-contents__link toc-highlight"><code>mockChromeInIframe</code></a></li><li><a href="#mockdevicememory" class="table-of-contents__link toc-highlight"><code>mockDeviceMemory</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +is set to <code>true</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addplugins"><code>addPlugins</code><a href="#addplugins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If plugins should be added to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewindowframe"><code>emulateWindowFrame</code><a href="#emulatewindowframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates window Iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewebgl"><code>emulateWebGL</code><a href="#emulatewebgl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates graphic card.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulateconsoledebug"><code>emulateConsoleDebug</code><a href="#emulateconsoledebug" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates console.debug to return null.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addlanguage"><code>addLanguage</code><a href="#addlanguage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds languages to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hidewebdriver"><code>hideWebDriver</code><a href="#hidewebdriver" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Hides the webdriver by changing the navigator proto.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hackpermissions"><code>hackPermissions</code><a href="#hackpermissions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Fakes interaction with permissions.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchrome"><code>mockChrome</code><a href="#mockchrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchromeiniframe"><code>mockChromeInIframe</code><a href="#mockchromeiniframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties inside the every newly created iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockdevicememory"><code>mockDeviceMemory</code><a href="#mockdevicememory" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Sets device memory to other value than 0.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/StealthOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SnapshotterOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatusOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#addplugins" class="table-of-contents__link toc-highlight"><code>addPlugins</code></a></li><li><a href="#emulatewindowframe" class="table-of-contents__link toc-highlight"><code>emulateWindowFrame</code></a></li><li><a href="#emulatewebgl" class="table-of-contents__link toc-highlight"><code>emulateWebGL</code></a></li><li><a href="#emulateconsoledebug" class="table-of-contents__link toc-highlight"><code>emulateConsoleDebug</code></a></li><li><a href="#addlanguage" class="table-of-contents__link toc-highlight"><code>addLanguage</code></a></li><li><a href="#hidewebdriver" class="table-of-contents__link toc-highlight"><code>hideWebDriver</code></a></li><li><a href="#hackpermissions" class="table-of-contents__link toc-highlight"><code>hackPermissions</code></a></li><li><a href="#mockchrome" class="table-of-contents__link toc-highlight"><code>mockChrome</code></a></li><li><a href="#mockchromeiniframe" class="table-of-contents__link toc-highlight"><code>mockChromeInIframe</code></a></li><li><a href="#mockdevicememory" class="table-of-contents__link toc-highlight"><code>mockDeviceMemory</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/system-info.html b/docs/1.3/typedefs/system-info.html index 8a44329ff8..6b16ddf21b 100644 --- a/docs/1.3/typedefs/system-info.html +++ b/docs/1.3/typedefs/system-info.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/system-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/system-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemInfo</h1></header><a name="systeminfo"></a><p>Represents the current status of the system.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="issystemidle"><code>isSystemIdle</code><a href="#issystemidle" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>If true, system is being overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meminfo"><code>memInfo</code><a href="#meminfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Memory</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventloopinfo"><code>eventLoopInfo</code><a href="#eventloopinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cpuinfo"><code>cpuInfo</code><a href="#cpuinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SocialHandles</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#issystemidle" class="table-of-contents__link toc-highlight"><code>isSystemIdle</code></a></li><li><a href="#meminfo" class="table-of-contents__link toc-highlight"><code>memInfo</code></a></li><li><a href="#eventloopinfo" class="table-of-contents__link toc-highlight"><code>eventLoopInfo</code></a></li><li><a href="#cpuinfo" class="table-of-contents__link toc-highlight"><code>cpuInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/system-info">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/system-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemInfo</h1></header><a name="systeminfo"></a><p>Represents the current status of the system.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="issystemidle"><code>isSystemIdle</code><a href="#issystemidle" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>If true, system is being overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meminfo"><code>memInfo</code><a href="#meminfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Memory</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventloopinfo"><code>eventLoopInfo</code><a href="#eventloopinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cpuinfo"><code>cpuInfo</code><a href="#cpuinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SocialHandles</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#issystemidle" class="table-of-contents__link toc-highlight"><code>isSystemIdle</code></a></li><li><a href="#meminfo" class="table-of-contents__link toc-highlight"><code>memInfo</code></a></li><li><a href="#eventloopinfo" class="table-of-contents__link toc-highlight"><code>eventLoopInfo</code></a></li><li><a href="#cpuinfo" class="table-of-contents__link toc-highlight"><code>cpuInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/system-status-options.html b/docs/1.3/typedefs/system-status-options.html index a0e4593bc4..4c69f3fda0 100644 --- a/docs/1.3/typedefs/system-status-options.html +++ b/docs/1.3/typedefs/system-status-options.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/system-status-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/system-status-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemStatusOptions</h1></header><a name="systemstatusoptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="currenthistorysecs"><code>currentHistorySecs</code><a href="#currenthistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 5</code></p><p>Defines max age of snapshots used in the <a href="/sdk/js/docs/1.3/api/system-status#getcurrentstatus"><code>SystemStatus.getCurrentStatus()</code></a> measurement.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxmemoryoverloadedratio"><code>maxMemoryOverloadedRatio</code><a href="#maxmemoryoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.2</code></p><p>Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxeventloopoverloadedratio"><code>maxEventLoopOverloadedRatio</code><a href="#maxeventloopoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.6</code></p><p>Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxcpuoverloadedratio"><code>maxCpuOverloadedRatio</code><a href="#maxcpuoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.4</code></p><p>Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclientoverloadedratio"><code>maxClientOverloadedRatio</code><a href="#maxclientoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.3</code></p><p>Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshotter"><code>snapshotter</code><a href="#snapshotter" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a></p><p>The <code>Snapshotter</code> instance to be queried for <code>SystemStatus</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemStatusOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">StealthOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#currenthistorysecs" class="table-of-contents__link toc-highlight"><code>currentHistorySecs</code></a></li><li><a href="#maxmemoryoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxMemoryOverloadedRatio</code></a></li><li><a href="#maxeventloopoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxEventLoopOverloadedRatio</code></a></li><li><a href="#maxcpuoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxCpuOverloadedRatio</code></a></li><li><a href="#maxclientoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxClientOverloadedRatio</code></a></li><li><a href="#snapshotter" class="table-of-contents__link toc-highlight"><code>snapshotter</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/system-status-options">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/system-status-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/1.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/1.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/1.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/1.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/1.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/1.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemStatusOptions</h1></header><a name="systemstatusoptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="currenthistorysecs"><code>currentHistorySecs</code><a href="#currenthistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 5</code></p><p>Defines max age of snapshots used in the <a href="/sdk/js/docs/1.3/api/system-status#getcurrentstatus"><code>SystemStatus.getCurrentStatus()</code></a> measurement.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxmemoryoverloadedratio"><code>maxMemoryOverloadedRatio</code><a href="#maxmemoryoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.2</code></p><p>Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxeventloopoverloadedratio"><code>maxEventLoopOverloadedRatio</code><a href="#maxeventloopoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.6</code></p><p>Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxcpuoverloadedratio"><code>maxCpuOverloadedRatio</code><a href="#maxcpuoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.4</code></p><p>Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclientoverloadedratio"><code>maxClientOverloadedRatio</code><a href="#maxclientoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.3</code></p><p>Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshotter"><code>snapshotter</code><a href="#snapshotter" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/api/snapshotter"><code>Snapshotter</code></a></p><p>The <code>Snapshotter</code> instance to be queried for <code>SystemStatus</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/SystemStatusOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/1.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">StealthOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#currenthistorysecs" class="table-of-contents__link toc-highlight"><code>currentHistorySecs</code></a></li><li><a href="#maxmemoryoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxMemoryOverloadedRatio</code></a></li><li><a href="#maxeventloopoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxEventLoopOverloadedRatio</code></a></li><li><a href="#maxcpuoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxCpuOverloadedRatio</code></a></li><li><a href="#maxclientoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxClientOverloadedRatio</code></a></li><li><a href="#snapshotter" class="table-of-contents__link toc-highlight"><code>snapshotter</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/user-func.html b/docs/1.3/typedefs/user-func.html index 35f12c8921..5e81b2b334 100644 --- a/docs/1.3/typedefs/user-func.html +++ b/docs/1.3/typedefs/user-func.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/user-func">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/user-func">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>UserFunc</h1></header><a name="userfunc"></a><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/UserFunc.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/user-func">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/user-func">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="theme-doc-markdown markdown"><header><h1>UserFunc</h1></header><a name="userfunc"></a><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/UserFunc.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/1.3/typedefs/webhook-run.html b/docs/1.3/typedefs/webhook-run.html index 2c2733f09b..f4b9b4ea6b 100644 --- a/docs/1.3/typedefs/webhook-run.html +++ b/docs/1.3/typedefs/webhook-run.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/webhook-run">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/webhook-run">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>WebhookRun</h1></header><a name="webhookrun"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="isadhoc"><code>isAdHoc</code><a href="#isadhoc" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="condition"><code>condition</code><a href="#condition" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="donotretry"><code>doNotRetry</code><a href="#donotretry" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="lastdispatch"><code>lastDispatch</code><a href="#lastdispatch" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stats"><code>stats</code><a href="#stats" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/WebhookRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#isadhoc" class="table-of-contents__link toc-highlight"><code>isAdHoc</code></a></li><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#condition" class="table-of-contents__link toc-highlight"><code>condition</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#donotretry" class="table-of-contents__link toc-highlight"><code>doNotRetry</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li><li><a href="#lastdispatch" class="table-of-contents__link toc-highlight"><code>lastDispatch</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/1.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/1.3/guides/motivation">1.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/typedefs/webhook-run">2.3</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/1.3/typedefs/webhook-run">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>1.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 1.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>WebhookRun</h1></header><a name="webhookrun"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="isadhoc"><code>isAdHoc</code><a href="#isadhoc" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/1.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="condition"><code>condition</code><a href="#condition" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="donotretry"><code>doNotRetry</code><a href="#donotretry" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="lastdispatch"><code>lastDispatch</code><a href="#lastdispatch" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stats"><code>stats</code><a href="#stats" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-1.3/typedefs/WebhookRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#isadhoc" class="table-of-contents__link toc-highlight"><code>isAdHoc</code></a></li><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#condition" class="table-of-contents__link toc-highlight"><code>condition</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#donotretry" class="table-of-contents__link toc-highlight"><code>doNotRetry</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li><li><a href="#lastdispatch" class="table-of-contents__link toc-highlight"><code>lastDispatch</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/apify-call-error.html b/docs/2.3/api/apify-call-error.html index 21e6e0078c..0ca47c0e52 100644 --- a/docs/2.3/api/apify-call-error.html +++ b/docs/2.3/api/apify-call-error.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/api/apify-call-error">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/api/apify-call-error">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyCallError</h1></header><a name="apifycallerror"></a><p>The class represents exceptions thrown by the <a href="/sdk/js/docs/2.3/api/apify#call"><code>Apify.call()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="message"><code>message</code><a href="#message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Error message</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="run"><code>run</code><a href="#run" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/actor-run"><code>ActorRun</code></a></p><p>Object representing the failed actor run.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Contains <code>"ApifyCallError"</code></p><hr><a name="exports.apifycallerror"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-apifycallerrorrun-message"><code>new ApifyCallError(run, [message])</code><a href="#new-apifycallerrorrun-message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>run</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/actor-run"><code>ActorRun</code></a></li><li><strong><code>[message]</code></strong>: <code>string</code> <code> = <!-- -->"<!-- -->The actor invoked by Apify.call() did not succeed<!-- -->"</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ApifyCallError.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#message" class="table-of-contents__link toc-highlight"><code>message</code></a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><code>run</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li></ul></li><li><a href="#new-apifycallerrorrun-message" class="table-of-contents__link toc-highlight"><code>new ApifyCallError(run, [message])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/api/apify-call-error">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/api/apify-call-error">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyCallError</h1></header><a name="apifycallerror"></a><p>The class represents exceptions thrown by the <a href="/sdk/js/docs/2.3/api/apify#call"><code>Apify.call()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="message"><code>message</code><a href="#message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Error message</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="run"><code>run</code><a href="#run" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/actor-run"><code>ActorRun</code></a></p><p>Object representing the failed actor run.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Contains <code>"ApifyCallError"</code></p><hr><a name="exports.apifycallerror"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-apifycallerrorrun-message"><code>new ApifyCallError(run, [message])</code><a href="#new-apifycallerrorrun-message" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>run</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/actor-run"><code>ActorRun</code></a></li><li><strong><code>[message]</code></strong>: <code>string</code> <code> = <!-- -->"<!-- -->The actor invoked by Apify.call() did not succeed<!-- -->"</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ApifyCallError.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#message" class="table-of-contents__link toc-highlight"><code>message</code></a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><code>run</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li></ul></li><li><a href="#new-apifycallerrorrun-message" class="table-of-contents__link toc-highlight"><code>new ApifyCallError(run, [message])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/apify.html b/docs/2.3/api/apify.html index d532908782..b748e2aec0 100644 --- a/docs/2.3/api/apify.html +++ b/docs/2.3/api/apify.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -137,8 +137,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable is set. This way it is possible to combine local and cloud storage.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/request-queue"><code>Promise<RequestQueue></code></a></p><hr><a name="opensessionpool"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyopensessionpoolsessionpooloptions"><code>Apify.openSessionPool(sessionPoolOptions)</code><a href="#apifyopensessionpoolsessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Opens a SessionPool and returns a promise resolving to an instance of the <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> class that is already initialized.</p><p>For more details and code examples, see the <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> class.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionPoolOptions</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/session-pool"><code>Promise<SessionPool></code></a></p><hr><a name="pushdata"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifypushdataitem"><code>Apify.pushData(item)</code><a href="#apifypushdataitem" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stores an object or an array of objects to the default <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> of the current actor run.</p><p>This is just a convenient shortcut for <a href="/sdk/js/docs/2.3/api/dataset#pushdata"><code>Dataset.pushData()</code></a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myValue</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>is equivalent to:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myValue</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>For more information, see <a href="/sdk/js/docs/2.3/api/apify#opendataset"><code>Apify.openDataset()</code></a> and <a href="/sdk/js/docs/2.3/api/dataset#pushdata"><code>Dataset.pushData()</code></a></p><p><strong>IMPORTANT</strong>: Make sure to use the <code>await</code> keyword when calling <code>pushData()</code>, otherwise the actor process might finish before the data are stored!</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Object or array of objects containing data to be stored in the default dataset. The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="setvalue"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifysetvaluekey-value-options"><code>Apify.setValue(key, value, [options])</code><a href="#apifysetvaluekey-value-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stores or deletes a value in the default <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a> associated with the current actor run.</p><p>This is just a convenient shortcut for <a href="/sdk/js/docs/2.3/api/key-value-store#setvalue"><code>KeyValueStore.setValue()</code></a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'OUTPUT'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>is equivalent to:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> store </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openKeyValueStore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> store</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'OUTPUT'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To get a value from the default key-value store, you can use the <a href="/sdk/js/docs/2.3/api/apify#getvalue"><code>Apify.getValue()</code></a> function.</p><p>For more information, see <a href="/sdk/js/docs/2.3/api/apify#openkeyvaluestore"><code>Apify.openKeyValueStore()</code></a> and <a href="/sdk/js/docs/2.3/api/key-value-store#getvalue"><code>KeyValueStore.getValue()</code></a>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code> - Unique record key.</li><li><strong><code>value</code></strong>: <code>*</code> - Record data, which can be one of the following values:<ul><li>If <code>null</code>, the record in the key-value store is deleted.</li><li>If no <code>options.contentType</code> is specified, <code>value</code> can be any JavaScript object and it will be stringified to JSON.</li><li>If <code>options.contentType</code> is set, <code>value</code> is taken as is and it must be a <code>String</code> or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener"><code>Buffer</code></a>. For any -other value an error will be thrown.</li></ul></li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[contentType]</code></strong>: <code>string</code> - Specifies a custom MIME content type of the record.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Apify.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Use stealth mode</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify-class" class="table-of-contents__link toc-highlight"><code>Apify</code> Class</a></li><li><a href="#apifyaddwebhookoptions" class="table-of-contents__link toc-highlight"><code>Apify.addWebhook(options)</code></a></li><li><a href="#apifycallactid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.call(actId, [input], [options])</code></a></li><li><a href="#apifycalltasktaskid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.callTask(taskId, [input], [options])</code></a></li><li><a href="#apifycreateproxyconfigurationproxyconfigurationoptions" class="table-of-contents__link toc-highlight"><code>Apify.createProxyConfiguration([proxyConfigurationOptions])</code></a></li><li><a href="#apifyevents" class="table-of-contents__link toc-highlight"><code>Apify.events</code></a></li><li><a href="#apifygetenv" class="table-of-contents__link toc-highlight"><code>Apify.getEnv()</code></a></li><li><a href="#apifygetinput" class="table-of-contents__link toc-highlight"><code>Apify.getInput()</code></a></li><li><a href="#apifygetmemoryinfo" class="table-of-contents__link toc-highlight"><code>Apify.getMemoryInfo()</code></a></li><li><a href="#apifygetvaluekey" class="table-of-contents__link toc-highlight"><code>Apify.getValue(key)</code></a></li><li><a href="#apifyisathome" class="table-of-contents__link toc-highlight"><code>Apify.isAtHome()</code></a></li><li><a href="#apifylaunchplaywrightlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPlaywright([launchContext])</code></a></li><li><a href="#apifylaunchpuppeteerlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPuppeteer([launchContext])</code></a></li><li><a href="#apifymainuserfunc" class="table-of-contents__link toc-highlight"><code>Apify.main(userFunc)</code></a></li><li><a href="#apifymetamorphtargetactorid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.metamorph(targetActorId, [input], [options])</code></a></li><li><a href="#apifynewclientoptions" class="table-of-contents__link toc-highlight"><code>Apify.newClient([options])</code></a></li><li><a href="#apifyopendatasetdatasetidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openDataset([datasetIdOrName], [options])</code></a></li><li><a href="#apifyopenkeyvaluestorestoreidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openKeyValueStore([storeIdOrName], [options])</code></a></li><li><a href="#apifyopenrequestlistlistname-sources-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestList(listName, sources, [options])</code></a></li><li><a href="#apifyopenrequestqueuequeueidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestQueue([queueIdOrName], [options])</code></a></li><li><a href="#apifyopensessionpoolsessionpooloptions" class="table-of-contents__link toc-highlight"><code>Apify.openSessionPool(sessionPoolOptions)</code></a></li><li><a href="#apifypushdataitem" class="table-of-contents__link toc-highlight"><code>Apify.pushData(item)</code></a></li><li><a href="#apifysetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>Apify.setValue(key, value, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +other value an error will be thrown.</li></ul></li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[contentType]</code></strong>: <code>string</code> - Specifies a custom MIME content type of the record.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Apify.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Use stealth mode</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify-class" class="table-of-contents__link toc-highlight"><code>Apify</code> Class</a></li><li><a href="#apifyaddwebhookoptions" class="table-of-contents__link toc-highlight"><code>Apify.addWebhook(options)</code></a></li><li><a href="#apifycallactid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.call(actId, [input], [options])</code></a></li><li><a href="#apifycalltasktaskid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.callTask(taskId, [input], [options])</code></a></li><li><a href="#apifycreateproxyconfigurationproxyconfigurationoptions" class="table-of-contents__link toc-highlight"><code>Apify.createProxyConfiguration([proxyConfigurationOptions])</code></a></li><li><a href="#apifyevents" class="table-of-contents__link toc-highlight"><code>Apify.events</code></a></li><li><a href="#apifygetenv" class="table-of-contents__link toc-highlight"><code>Apify.getEnv()</code></a></li><li><a href="#apifygetinput" class="table-of-contents__link toc-highlight"><code>Apify.getInput()</code></a></li><li><a href="#apifygetmemoryinfo" class="table-of-contents__link toc-highlight"><code>Apify.getMemoryInfo()</code></a></li><li><a href="#apifygetvaluekey" class="table-of-contents__link toc-highlight"><code>Apify.getValue(key)</code></a></li><li><a href="#apifyisathome" class="table-of-contents__link toc-highlight"><code>Apify.isAtHome()</code></a></li><li><a href="#apifylaunchplaywrightlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPlaywright([launchContext])</code></a></li><li><a href="#apifylaunchpuppeteerlaunchcontext" class="table-of-contents__link toc-highlight"><code>Apify.launchPuppeteer([launchContext])</code></a></li><li><a href="#apifymainuserfunc" class="table-of-contents__link toc-highlight"><code>Apify.main(userFunc)</code></a></li><li><a href="#apifymetamorphtargetactorid-input-options" class="table-of-contents__link toc-highlight"><code>Apify.metamorph(targetActorId, [input], [options])</code></a></li><li><a href="#apifynewclientoptions" class="table-of-contents__link toc-highlight"><code>Apify.newClient([options])</code></a></li><li><a href="#apifyopendatasetdatasetidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openDataset([datasetIdOrName], [options])</code></a></li><li><a href="#apifyopenkeyvaluestorestoreidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openKeyValueStore([storeIdOrName], [options])</code></a></li><li><a href="#apifyopenrequestlistlistname-sources-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestList(listName, sources, [options])</code></a></li><li><a href="#apifyopenrequestqueuequeueidorname-options" class="table-of-contents__link toc-highlight"><code>Apify.openRequestQueue([queueIdOrName], [options])</code></a></li><li><a href="#apifyopensessionpoolsessionpooloptions" class="table-of-contents__link toc-highlight"><code>Apify.openSessionPool(sessionPoolOptions)</code></a></li><li><a href="#apifypushdataitem" class="table-of-contents__link toc-highlight"><code>Apify.pushData(item)</code></a></li><li><a href="#apifysetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>Apify.setValue(key, value, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/autoscaled-pool.html b/docs/2.3/api/autoscaled-pool.html index b20bdd0ec8..b40a35f05a 100644 --- a/docs/2.3/api/autoscaled-pool.html +++ b/docs/2.3/api/autoscaled-pool.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -34,8 +34,8 @@ <a href="/sdk/js/docs/2.3/api/autoscaled-pool#resume"><code>AutoscaledPool.resume()</code></a></p><p>The function's promise will resolve once all running tasks have completed and the pool is effectively idle. If the <code>timeoutSecs</code> argument is provided, the promise will reject with a timeout error after the <code>timeoutSecs</code> seconds.</p><p>The promise returned from the <a href="/sdk/js/docs/2.3/api/autoscaled-pool#run"><code>AutoscaledPool.run()</code></a> function will not resolve when <code>.pause()</code> is invoked (unlike abort, which resolves it).</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[timeoutSecs]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="resume"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpoolresume"><code>autoscaledPool.resume()</code><a href="#autoscaledpoolresume" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Resumes the operation of the autoscaled-pool by allowing more tasks to be run. Used together with -<a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a></p><p>Tasks will automatically start running again in <code>options.maybeRunIntervalSecs</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/AutoscaledPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/key-value-store"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>new AutoscaledPool(options)</code></a></li><li><a href="#autoscaledpoollog" class="table-of-contents__link toc-highlight"><code>autoscaledPool.log</code></a></li><li><a href="#autoscaledpoolminconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolminconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpoolcurrentconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.currentConcurrency</code></a></li><li><a href="#autoscaledpoolrun" class="table-of-contents__link toc-highlight"><code>autoscaledPool.run()</code></a></li><li><a href="#autoscaledpoolabort" class="table-of-contents__link toc-highlight"><code>autoscaledPool.abort()</code></a></li><li><a href="#autoscaledpoolpausetimeoutsecs" class="table-of-contents__link toc-highlight"><code>autoscaledPool.pause([timeoutSecs])</code></a></li><li><a href="#autoscaledpoolresume" class="table-of-contents__link toc-highlight"><code>autoscaledPool.resume()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a></p><p>Tasks will automatically start running again in <code>options.maybeRunIntervalSecs</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/AutoscaledPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/key-value-store"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>new AutoscaledPool(options)</code></a></li><li><a href="#autoscaledpoollog" class="table-of-contents__link toc-highlight"><code>autoscaledPool.log</code></a></li><li><a href="#autoscaledpoolminconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolminconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.minConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpoolmaxconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.maxConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpooldesiredconcurrency-1" class="table-of-contents__link toc-highlight"><code>autoscaledPool.desiredConcurrency</code></a></li><li><a href="#autoscaledpoolcurrentconcurrency" class="table-of-contents__link toc-highlight"><code>autoscaledPool.currentConcurrency</code></a></li><li><a href="#autoscaledpoolrun" class="table-of-contents__link toc-highlight"><code>autoscaledPool.run()</code></a></li><li><a href="#autoscaledpoolabort" class="table-of-contents__link toc-highlight"><code>autoscaledPool.abort()</code></a></li><li><a href="#autoscaledpoolpausetimeoutsecs" class="table-of-contents__link toc-highlight"><code>autoscaledPool.pause([timeoutSecs])</code></a></li><li><a href="#autoscaledpoolresume" class="table-of-contents__link toc-highlight"><code>autoscaledPool.resume()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/basic-crawler.html b/docs/2.3/api/basic-crawler.html index 0d1cdc10a4..041e204fbb 100644 --- a/docs/2.3/api/basic-crawler.html +++ b/docs/2.3/api/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -33,8 +33,8 @@ used by the crawler.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>A reference to the underlying <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/2.3/api/basic-crawler#run"><code>BasicCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling -<a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="exports.basiccrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-basiccrawleroptions"><code>new BasicCrawler(options)</code><a href="#new-basiccrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/basic-crawler-options"><code>BasicCrawlerOptions</code></a> - All <code>BasicCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawleroptionsshape"><code>basicCrawler.optionsShape</code><a href="#basiccrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr><a name="log"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerlog"><code>basicCrawler.log</code><a href="#basiccrawlerlog" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="sessionpooloptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlersessionpooloptions"><code>basicCrawler.sessionPoolOptions</code><a href="#basiccrawlersessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="run"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerrun"><code>basicCrawler.run()</code><a href="#basiccrawlerrun" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Runs the crawler. Returns a promise that gets resolved once all the requests are processed.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BasicCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-basiccrawleroptions" class="table-of-contents__link toc-highlight"><code>new BasicCrawler(options)</code></a></li><li><a href="#basiccrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>basicCrawler.optionsShape</code></a></li><li><a href="#basiccrawlerlog" class="table-of-contents__link toc-highlight"><code>basicCrawler.log</code></a></li><li><a href="#basiccrawlersessionpooloptions" class="table-of-contents__link toc-highlight"><code>basicCrawler.sessionPoolOptions</code></a></li><li><a href="#basiccrawlerrun" class="table-of-contents__link toc-highlight"><code>basicCrawler.run()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="exports.basiccrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-basiccrawleroptions"><code>new BasicCrawler(options)</code><a href="#new-basiccrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/basic-crawler-options"><code>BasicCrawlerOptions</code></a> - All <code>BasicCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawleroptionsshape"><code>basicCrawler.optionsShape</code><a href="#basiccrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr><a name="log"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerlog"><code>basicCrawler.log</code><a href="#basiccrawlerlog" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="sessionpooloptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlersessionpooloptions"><code>basicCrawler.sessionPoolOptions</code><a href="#basiccrawlersessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="run"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="basiccrawlerrun"><code>basicCrawler.run()</code><a href="#basiccrawlerrun" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Runs the crawler. Returns a promise that gets resolved once all the requests are processed.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BasicCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-basiccrawleroptions" class="table-of-contents__link toc-highlight"><code>new BasicCrawler(options)</code></a></li><li><a href="#basiccrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>basicCrawler.optionsShape</code></a></li><li><a href="#basiccrawlerlog" class="table-of-contents__link toc-highlight"><code>basicCrawler.log</code></a></li><li><a href="#basiccrawlersessionpooloptions" class="table-of-contents__link toc-highlight"><code>basicCrawler.sessionPoolOptions</code></a></li><li><a href="#basiccrawlerrun" class="table-of-contents__link toc-highlight"><code>basicCrawler.run()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/browser-plugin.html b/docs/2.3/api/browser-plugin.html index 3f2453f991..cae70c7956 100644 --- a/docs/2.3/api/browser-plugin.html +++ b/docs/2.3/api/browser-plugin.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/api/browser-plugin">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/api/browser-plugin">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserPlugin</h1></header><a name="browserplugin"></a><hr><a name="exports.browserplugin"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-browserpluginlauncher-context"><code>new BrowserPlugin(launcher, context)</code><a href="#new-browserpluginlauncher-context" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>launcher</code></strong>: <code>*</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BrowserPlugin.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-browserpluginlauncher-context" class="table-of-contents__link toc-highlight"><code>new BrowserPlugin(launcher, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/api/browser-plugin">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/api/browser-plugin">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserPlugin</h1></header><a name="browserplugin"></a><hr><a name="exports.browserplugin"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-browserpluginlauncher-context"><code>new BrowserPlugin(launcher, context)</code><a href="#new-browserpluginlauncher-context" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>launcher</code></strong>: <code>*</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/BrowserPlugin.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-browserpluginlauncher-context" class="table-of-contents__link toc-highlight"><code>new BrowserPlugin(launcher, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/cheerio-crawler.html b/docs/2.3/api/cheerio-crawler.html index 7d328f0403..392f825fb5 100644 --- a/docs/2.3/api/cheerio-crawler.html +++ b/docs/2.3/api/cheerio-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -42,8 +42,8 @@ the crawler.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaledpool"><code>autoscaledPool</code><a href="#autoscaledpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a></p><p>A reference to the underlying <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/2.3/api/cheerio-crawler#run"><code>CheerioCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling -<a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="cheeriocrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-cheeriocrawleroptions"><code>new CheerioCrawler(options)</code><a href="#new-cheeriocrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"><code>CheerioCrawlerOptions</code></a> - All <code>CheerioCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawleroptionsshape"><code>cheerioCrawler.optionsShape</code><a href="#cheeriocrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr><a name="use"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawleruseextension"><code>cheerioCrawler.use(extension)</code><a href="#cheeriocrawleruseextension" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>EXPERIMENTAL</strong> Function for attaching CrawlerExtensions such as the Unblockers.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>extension</code></strong>: <code>CrawlerExtension</code> - Crawler extension that overrides the crawler configuration.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/CheerioCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-cheeriocrawleroptions" class="table-of-contents__link toc-highlight"><code>new CheerioCrawler(options)</code></a></li><li><a href="#cheeriocrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.optionsShape</code></a></li><li><a href="#cheeriocrawleruseextension" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.use(extension)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="cheeriocrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-cheeriocrawleroptions"><code>new CheerioCrawler(options)</code><a href="#new-cheeriocrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"><code>CheerioCrawlerOptions</code></a> - All <code>CheerioCrawler</code> parameters are passed via an options object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawleroptionsshape"><code>cheerioCrawler.optionsShape</code><a href="#cheeriocrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr><a name="use"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="cheeriocrawleruseextension"><code>cheerioCrawler.use(extension)</code><a href="#cheeriocrawleruseextension" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>EXPERIMENTAL</strong> Function for attaching CrawlerExtensions such as the Unblockers.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>extension</code></strong>: <code>CrawlerExtension</code> - Crawler extension that overrides the crawler configuration.</li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/CheerioCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-cheeriocrawleroptions" class="table-of-contents__link toc-highlight"><code>new CheerioCrawler(options)</code></a></li><li><a href="#cheeriocrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.optionsShape</code></a></li><li><a href="#cheeriocrawleruseextension" class="table-of-contents__link toc-highlight"><code>cheerioCrawler.use(extension)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/configuration.html b/docs/2.3/api/configuration.html index 2370adbb07..d8f8ee749c 100644 --- a/docs/2.3/api/configuration.html +++ b/docs/2.3/api/configuration.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -27,8 +27,8 @@ <strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[storageDir]</code></strong>: <code>string</code></li><li><strong><code>[enableWalMode]</code></strong>: <code>boolean</code> <code> = true</code></li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/apify"><code>ApifyStorageLocal</code></a></p><hr><a name="createclient"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configurationcreateclientoptions"><code>configuration.createClient([options])</code><a href="#configurationcreateclientoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Creates an instance of ApifyClient using options as defined in the environment variables or in this <code>Configuration</code> instance.</p><p><strong>Internal</strong>:<br> <strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[token]</code></strong>: <code>string</code></li><li><strong><code>[maxRetries]</code></strong>: <code>string</code></li><li><strong><code>[minDelayBetweenRetriesMillis]</code></strong>: <code>string</code></li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/apify"><code>ApifyClient</code></a></p><hr><a name="createstoragelocal"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configurationcreatestoragelocaloptions"><code>configuration.createStorageLocal([options])</code><a href="#configurationcreatestoragelocaloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Creates an instance of ApifyStorageLocal using options as defined in the environment variables or in this <code>Configuration</code> instance.</p><p><strong>Internal</strong>:<br> <strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[storageDir]</code></strong>: <code>string</code></li><li><strong><code>[enableWalMode]</code></strong>: <code>boolean</code> <code> = true</code></li></ul></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/apify"><code>ApifyStorageLocal</code></a></p><hr><a name="getglobalconfig"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="configurationgetglobalconfig"><code>Configuration.getGlobalConfig()</code><a href="#configurationgetglobalconfig" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the global configuration instance. It will respect the environment variables. When used inside SDK instance (<code>sdk.main()</code>), the return value -is equal to <code>sdk.config</code>.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/configuration"><code>Configuration</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Configuration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/apify"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#supported-configuration-options" class="table-of-contents__link toc-highlight">Supported Configuration Options</a></li><li><a href="#advanced-configuration-options" class="table-of-contents__link toc-highlight">Advanced Configuration Options</a></li><li><a href="#not-supported-environment-variables" class="table-of-contents__link toc-highlight">Not Supported environment variables</a></li><li><a href="#new-configurationoptions" class="table-of-contents__link toc-highlight"><code>new Configuration(options)</code></a></li><li><a href="#configurationstorage" class="table-of-contents__link toc-highlight"><code>configuration.storage</code></a></li><li><a href="#configurationgetkey-defaultvalue" class="table-of-contents__link toc-highlight"><code>configuration.get(key, [defaultValue])</code></a></li><li><a href="#configurationsetkey-value" class="table-of-contents__link toc-highlight"><code>configuration.set(key, [value])</code></a></li><li><a href="#configurationgetclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.getClient([options])</code></a></li><li><a href="#configurationgetstoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.getStorageLocal([options])</code></a></li><li><a href="#configurationcreateclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.createClient([options])</code></a></li><li><a href="#configurationcreatestoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.createStorageLocal([options])</code></a></li><li><a href="#configurationgetglobalconfig" class="table-of-contents__link toc-highlight"><code>Configuration.getGlobalConfig()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +is equal to <code>sdk.config</code>.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/configuration"><code>Configuration</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Configuration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/apify"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#supported-configuration-options" class="table-of-contents__link toc-highlight">Supported Configuration Options</a></li><li><a href="#advanced-configuration-options" class="table-of-contents__link toc-highlight">Advanced Configuration Options</a></li><li><a href="#not-supported-environment-variables" class="table-of-contents__link toc-highlight">Not Supported environment variables</a></li><li><a href="#new-configurationoptions" class="table-of-contents__link toc-highlight"><code>new Configuration(options)</code></a></li><li><a href="#configurationstorage" class="table-of-contents__link toc-highlight"><code>configuration.storage</code></a></li><li><a href="#configurationgetkey-defaultvalue" class="table-of-contents__link toc-highlight"><code>configuration.get(key, [defaultValue])</code></a></li><li><a href="#configurationsetkey-value" class="table-of-contents__link toc-highlight"><code>configuration.set(key, [value])</code></a></li><li><a href="#configurationgetclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.getClient([options])</code></a></li><li><a href="#configurationgetstoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.getStorageLocal([options])</code></a></li><li><a href="#configurationcreateclientoptions" class="table-of-contents__link toc-highlight"><code>configuration.createClient([options])</code></a></li><li><a href="#configurationcreatestoragelocaloptions" class="table-of-contents__link toc-highlight"><code>configuration.createStorageLocal([options])</code></a></li><li><a href="#configurationgetglobalconfig" class="table-of-contents__link toc-highlight"><code>Configuration.getGlobalConfig()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/dataset.html b/docs/2.3/api/dataset.html index a8bb4e17c6..280ab083d0 100644 --- a/docs/2.3/api/dataset.html +++ b/docs/2.3/api/dataset.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -41,8 +41,8 @@ <code>forEach</code> function throws the error.</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-results'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">item</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Item at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation known-class-name class-name">JSON</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation method function property-access" style="color:#d73a49">stringify</span><span class="token template-string interpolation punctuation" style="color:#393A34">(</span><span class="token template-string interpolation">item</span><span class="token template-string interpolation punctuation" style="color:#393A34">)</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/dataset-consumer"><code>DatasetConsumer</code></a> - A function that is called for every item in the dataset.</li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>forEach()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by <code>createdAt</code> in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys.</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li><li><strong><code>[index]</code></strong>: <code>number</code> <code> = 0</code> - Specifies the initial index number passed to the <code>iteratee</code> function.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="map"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetmapiteratee-options"><code>dataset.map(iteratee, [options])</code><a href="#datasetmapiteratee-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Produces a new array of values by mapping each value in list through a transformation function <code>iteratee()</code>. Each invocation of <code>iteratee()</code> is called with two arguments: <code>(element, index)</code>.</p><p>If <code>iteratee</code> returns a <code>Promise</code> then it's awaited before a next call.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/dataset-mapper"><code>DatasetMapper</code></a></li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>map()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by createdAt in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<Array<object>></code></p><hr><a name="reduce"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetreduceiteratee-memo-options"><code>dataset.reduce(iteratee, memo, [options])</code><a href="#datasetreduceiteratee-memo-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Reduces a list of values down to a single value.</p><p>Memo is the initial state of the reduction, and each successive step of it should be returned by <code>iteratee()</code>. The <code>iteratee()</code> is passed three arguments: the <code>memo</code>, then the <code>value</code> and <code>index</code> of the iteration.</p><p>If no <code>memo</code> is passed to the initial invocation of reduce, the <code>iteratee()</code> is not invoked on the first element of the list. The first element is -instead passed as the memo in the invocation of the <code>iteratee()</code> on the next element in the list.</p><p>If <code>iteratee()</code> returns a <code>Promise</code> then it's awaited before a next call.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/dataset-reducer"><code>DatasetReducer</code></a></li><li><strong><code>memo</code></strong>: <code>object</code> - Initial state of the reduction.</li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>reduce()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by createdAt in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<object></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetdrop"><code>dataset.drop()</code><a href="#datasetdrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/statistics"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Statistics</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/key-value-store"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#datasetpushdatadata" class="table-of-contents__link toc-highlight"><code>dataset.pushData(data)</code></a></li><li><a href="#datasetgetdataoptions" class="table-of-contents__link toc-highlight"><code>dataset.getData([options])</code></a></li><li><a href="#datasetgetinfo" class="table-of-contents__link toc-highlight"><code>dataset.getInfo()</code></a></li><li><a href="#datasetforeachiteratee-options-index" class="table-of-contents__link toc-highlight"><code>dataset.forEach(iteratee, [options], [index])</code></a></li><li><a href="#datasetmapiteratee-options" class="table-of-contents__link toc-highlight"><code>dataset.map(iteratee, [options])</code></a></li><li><a href="#datasetreduceiteratee-memo-options" class="table-of-contents__link toc-highlight"><code>dataset.reduce(iteratee, memo, [options])</code></a></li><li><a href="#datasetdrop" class="table-of-contents__link toc-highlight"><code>dataset.drop()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +instead passed as the memo in the invocation of the <code>iteratee()</code> on the next element in the list.</p><p>If <code>iteratee()</code> returns a <code>Promise</code> then it's awaited before a next call.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/dataset-reducer"><code>DatasetReducer</code></a></li><li><strong><code>memo</code></strong>: <code>object</code> - Initial state of the reduction.</li><li><strong><code>[options]</code></strong>: <code>Object</code> - All <code>reduce()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[desc]</code></strong>: <code>boolean</code> <code> = false</code> - If <code>true</code> then the objects are sorted by createdAt in descending order.</li><li><strong><code>[fields]</code></strong>: <code>Array<string></code> - If provided then returned objects will only contain specified keys</li><li><strong><code>[unwind]</code></strong>: <code>string</code> - If provided then objects will be unwound based on provided field.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<object></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="datasetdrop"><code>dataset.drop()</code><a href="#datasetdrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the dataset either from the Apify cloud storage or from the local directory, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/statistics"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Statistics</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/key-value-store"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#datasetpushdatadata" class="table-of-contents__link toc-highlight"><code>dataset.pushData(data)</code></a></li><li><a href="#datasetgetdataoptions" class="table-of-contents__link toc-highlight"><code>dataset.getData([options])</code></a></li><li><a href="#datasetgetinfo" class="table-of-contents__link toc-highlight"><code>dataset.getInfo()</code></a></li><li><a href="#datasetforeachiteratee-options-index" class="table-of-contents__link toc-highlight"><code>dataset.forEach(iteratee, [options], [index])</code></a></li><li><a href="#datasetmapiteratee-options" class="table-of-contents__link toc-highlight"><code>dataset.map(iteratee, [options])</code></a></li><li><a href="#datasetreduceiteratee-memo-options" class="table-of-contents__link toc-highlight"><code>dataset.reduce(iteratee, memo, [options])</code></a></li><li><a href="#datasetdrop" class="table-of-contents__link toc-highlight"><code>dataset.drop()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/key-value-store.html b/docs/2.3/api/key-value-store.html index bf0b9ae291..df3ffcd4f6 100644 --- a/docs/2.3/api/key-value-store.html +++ b/docs/2.3/api/key-value-store.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -38,8 +38,8 @@ other value an error will be thrown.</li></ul></li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[contentType]</code></strong>: <code>string</code> - Specifies a custom MIME content type of the record.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="keyvaluestoredrop"><code>keyValueStore.drop()</code><a href="#keyvaluestoredrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the key-value store either from the Apify cloud storage or from the local directory, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="getpublicurl"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="keyvaluestoregetpublicurlkey"><code>keyValueStore.getPublicUrl(key)</code><a href="#keyvaluestoregetpublicurlkey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a URL for the given key that may be used to publicly access the value in the remote key-value store.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code></p><hr><a name="foreachkey"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="keyvaluestoreforeachkeyiteratee-options"><code>keyValueStore.forEachKey(iteratee, [options])</code><a href="#keyvaluestoreforeachkeyiteratee-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Iterates over key-value store keys, yielding each in turn to an <code>iteratee</code> function. Each invocation of <code>iteratee</code> is called with three arguments: <code>(key, index, info)</code>, where <code>key</code> is the record key, <code>index</code> is a zero-based index of the key in the current iteration (regardless of <code>options.exclusiveStartKey</code>) and <code>info</code> is an object that contains a single property <code>size</code> indicating size of the record in bytes.</p><p>If the <code>iteratee</code> function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the -<code>forEachKey</code> function throws the error.</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> keyValueStore </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openKeyValueStore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> keyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEachKey</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">key</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Key at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">key</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> has size </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">info</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">size</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/key-consumer"><code>KeyConsumer</code></a> - A function that is called for every key in the key-value store.</li><li><strong><code>[options]</code></strong>: <code>object</code> - All <code>forEachKey()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[exclusiveStartKey]</code></strong>: <code>string</code> - All keys up to this one (including) are skipped from the result.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/KeyValueStore.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#keyvaluestoregetvaluekey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getValue(key)</code></a></li><li><a href="#keyvaluestoresetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.setValue(key, value, [options])</code></a></li><li><a href="#keyvaluestoredrop" class="table-of-contents__link toc-highlight"><code>keyValueStore.drop()</code></a></li><li><a href="#keyvaluestoregetpublicurlkey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getPublicUrl(key)</code></a></li><li><a href="#keyvaluestoreforeachkeyiteratee-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.forEachKey(iteratee, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>forEachKey</code> function throws the error.</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> keyValueStore </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openKeyValueStore</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> keyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEachKey</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">key</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Key at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">key</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> has size </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">info</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">size</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>iteratee</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/key-consumer"><code>KeyConsumer</code></a> - A function that is called for every key in the key-value store.</li><li><strong><code>[options]</code></strong>: <code>object</code> - All <code>forEachKey()</code> parameters are passed via an options object with the following keys:<ul><li><strong><code>[exclusiveStartKey]</code></strong>: <code>string</code> - All keys up to this one (including) are skipped from the result.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/KeyValueStore.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#keyvaluestoregetvaluekey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getValue(key)</code></a></li><li><a href="#keyvaluestoresetvaluekey-value-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.setValue(key, value, [options])</code></a></li><li><a href="#keyvaluestoredrop" class="table-of-contents__link toc-highlight"><code>keyValueStore.drop()</code></a></li><li><a href="#keyvaluestoregetpublicurlkey" class="table-of-contents__link toc-highlight"><code>keyValueStore.getPublicUrl(key)</code></a></li><li><a href="#keyvaluestoreforeachkeyiteratee-options" class="table-of-contents__link toc-highlight"><code>keyValueStore.forEachKey(iteratee, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/log.html b/docs/2.3/api/log.html index cb6e60e67c..25af9af17d 100644 --- a/docs/2.3/api/log.html +++ b/docs/2.3/api/log.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -28,8 +28,8 @@ message.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="info"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="loginfomessage-data"><code>log.info(message, [data])</code><a href="#loginfomessage-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs an <code>INFO</code> message. <code>INFO</code> is the default log level so info messages will be always logged, unless the log level is changed. Data are stringified and appended to the message.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="warning"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logwarningmessage-data"><code>log.warning(message, [data])</code><a href="#logwarningmessage-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs a <code>WARNING</code> level message. Data are stringified and appended to the message.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="error"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logerrormessage-data"><code>log.error(message, [data])</code><a href="#logerrormessage-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs an <code>ERROR</code> message. Use this method to log error messages that are not directly connected to an exception. For logging exceptions, use the <code>log.exception</code> method.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>message</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr><a name="exception"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logexceptionexception-message-data"><code>log.exception(exception, [message], [data])</code><a href="#logexceptionexception-message-data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Logs an <code>ERROR</code> level message with a nicely formatted exception. Note that the exception is the first parameter here and an additional message is only -optional.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>exception</code></strong>: <code>Error</code></li><li><strong><code>[message]</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/log.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/utils"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/playwright"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.playwright</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#loglevels" class="table-of-contents__link toc-highlight"><code>log.LEVELS</code></a></li><li><a href="#logsetlevellevel" class="table-of-contents__link toc-highlight"><code>log.setLevel(level)</code></a></li><li><a href="#loggetlevel" class="table-of-contents__link toc-highlight"><code>log.getLevel()</code></a></li><li><a href="#logsetoptionsoptions" class="table-of-contents__link toc-highlight"><code>log.setOptions(options)</code></a></li><li><a href="#logchildoptions" class="table-of-contents__link toc-highlight"><code>log.child([options])</code></a></li><li><a href="#loggetoptions" class="table-of-contents__link toc-highlight"><code>log.getOptions()</code></a></li><li><a href="#logdebugmessage-data" class="table-of-contents__link toc-highlight"><code>log.debug(message, [data])</code></a></li><li><a href="#loginfomessage-data" class="table-of-contents__link toc-highlight"><code>log.info(message, [data])</code></a></li><li><a href="#logwarningmessage-data" class="table-of-contents__link toc-highlight"><code>log.warning(message, [data])</code></a></li><li><a href="#logerrormessage-data" class="table-of-contents__link toc-highlight"><code>log.error(message, [data])</code></a></li><li><a href="#logexceptionexception-message-data" class="table-of-contents__link toc-highlight"><code>log.exception(exception, [message], [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +optional.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>exception</code></strong>: <code>Error</code></li><li><strong><code>[message]</code></strong>: <code>string</code></li><li><strong><code>[data]</code></strong>: <code>object</code></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/log.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/utils"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/playwright"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.playwright</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#loglevels" class="table-of-contents__link toc-highlight"><code>log.LEVELS</code></a></li><li><a href="#logsetlevellevel" class="table-of-contents__link toc-highlight"><code>log.setLevel(level)</code></a></li><li><a href="#loggetlevel" class="table-of-contents__link toc-highlight"><code>log.getLevel()</code></a></li><li><a href="#logsetoptionsoptions" class="table-of-contents__link toc-highlight"><code>log.setOptions(options)</code></a></li><li><a href="#logchildoptions" class="table-of-contents__link toc-highlight"><code>log.child([options])</code></a></li><li><a href="#loggetoptions" class="table-of-contents__link toc-highlight"><code>log.getOptions()</code></a></li><li><a href="#logdebugmessage-data" class="table-of-contents__link toc-highlight"><code>log.debug(message, [data])</code></a></li><li><a href="#loginfomessage-data" class="table-of-contents__link toc-highlight"><code>log.info(message, [data])</code></a></li><li><a href="#logwarningmessage-data" class="table-of-contents__link toc-highlight"><code>log.warning(message, [data])</code></a></li><li><a href="#logerrormessage-data" class="table-of-contents__link toc-highlight"><code>log.error(message, [data])</code></a></li><li><a href="#logexceptionexception-message-data" class="table-of-contents__link toc-highlight"><code>log.exception(exception, [message], [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/playwright-crawler.html b/docs/2.3/api/playwright-crawler.html index 1ca533dee0..87efda7558 100644 --- a/docs/2.3/api/playwright-crawler.html +++ b/docs/2.3/api/playwright-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -39,8 +39,8 @@ only initialized after calling the <a href="/sdk/js/docs/2.3/api/cheerio-crawler#run"><code>CheerioCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="playwrightcrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-playwrightcrawleroptions"><code>new PlaywrightCrawler(options)</code><a href="#new-playwrightcrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options"><code>PlaywrightCrawlerOptions</code></a> - All <code>PlaywrightCrawler</code> parameters are passed via an options -object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="playwrightcrawleroptionsshape"><code>playwrightCrawler.optionsShape</code><a href="#playwrightcrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PlaywrightCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-playwrightcrawleroptions" class="table-of-contents__link toc-highlight"><code>new PlaywrightCrawler(options)</code></a></li><li><a href="#playwrightcrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>playwrightCrawler.optionsShape</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="playwrightcrawleroptionsshape"><code>playwrightCrawler.optionsShape</code><a href="#playwrightcrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PlaywrightCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-playwrightcrawleroptions" class="table-of-contents__link toc-highlight"><code>new PlaywrightCrawler(options)</code></a></li><li><a href="#playwrightcrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>playwrightCrawler.optionsShape</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/playwright.html b/docs/2.3/api/playwright.html index f8d877df00..6354abff13 100644 --- a/docs/2.3/api/playwright.html +++ b/docs/2.3/api/playwright.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ navigation before any other scripts get the chance to execute.</li></ul></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr><a name="injectjquery"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="playwrightinjectjquerypage"><code>playwright.injectJQuery(page)</code><a href="#playwrightinjectjquerypage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Injects the <a href="https://jquery.com/" target="_blank" rel="noopener">jQuery</a> library into a Playwright page. jQuery is often useful for various web scraping and crawling tasks. For example, it can help extract text from HTML elements using CSS selectors.</p><p>Beware that the injected jQuery object will be set to the <code>window.$</code> variable and thus it might cause conflicts with other libraries included by the page that use the same variable name (e.g. another version of jQuery). This can affect functionality of page's scripts.</p><p>The injected jQuery will survive page navigations and reloads.</p><p><strong>Example usage:</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">injectJQuery</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">evaluate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'head title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>injectJQuery()</code> does not affect the Playwright <a href="https://playwright.dev/docs/api/class-page#page-query-selector" target="_blank" rel="noopener"><code>page.$()</code></a> function in any -way.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code> - Playwright <a href="https://playwright.dev/docs/api/class-page" target="_blank" rel="noopener"><code>Page</code></a> object.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/playwright.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/log"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.log</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/puppeteer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.puppeteer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#playwrightgotoextended" class="table-of-contents__link toc-highlight"><code>playwright.gotoExtended</code></a></li><li><a href="#playwrightinjectfilepage-filepath-options" class="table-of-contents__link toc-highlight"><code>playwright.injectFile(page, filePath, [options])</code></a></li><li><a href="#playwrightinjectjquerypage" class="table-of-contents__link toc-highlight"><code>playwright.injectJQuery(page)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +way.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>page</code></strong>: <code>Page</code> - Playwright <a href="https://playwright.dev/docs/api/class-page" target="_blank" rel="noopener"><code>Page</code></a> object.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/playwright.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/log"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.log</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/puppeteer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.puppeteer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#playwrightgotoextended" class="table-of-contents__link toc-highlight"><code>playwright.gotoExtended</code></a></li><li><a href="#playwrightinjectfilepage-filepath-options" class="table-of-contents__link toc-highlight"><code>playwright.injectFile(page, filePath, [options])</code></a></li><li><a href="#playwrightinjectjquerypage" class="table-of-contents__link toc-highlight"><code>playwright.injectJQuery(page)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/proxy-configuration.html b/docs/2.3/api/proxy-configuration.html index d38e286beb..d3c4beb6c0 100644 --- a/docs/2.3/api/proxy-configuration.html +++ b/docs/2.3/api/proxy-configuration.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -31,8 +31,8 @@ <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> or you can use the Apify Proxy <a href="https://docs.apify.com/proxy#sessions" target="_blank" rel="noopener">Session</a> identifier. When the provided sessionId is a number, it's converted to a string.</li></ul><p>All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p><p><strong>Returns</strong>:</p><p><code>string</code> - A string with a proxy URL, including authentication credentials and port number. For example, -<code>http://bob:password123@proxy.example.com:8000</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ProxyConfiguration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/session-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/snapshotter"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Snapshotter</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#proxyconfigurationinitialize" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.initialize()</code></a></li><li><a href="#proxyconfigurationnewproxyinfosessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newProxyInfo([sessionId])</code></a></li><li><a href="#proxyconfigurationnewurlsessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newUrl([sessionId])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>http://bob:password123@proxy.example.com:8000</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/ProxyConfiguration.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/session-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/snapshotter"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Snapshotter</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#proxyconfigurationinitialize" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.initialize()</code></a></li><li><a href="#proxyconfigurationnewproxyinfosessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newProxyInfo([sessionId])</code></a></li><li><a href="#proxyconfigurationnewurlsessionid" class="table-of-contents__link toc-highlight"><code>proxyConfiguration.newUrl([sessionId])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/pseudo-url.html b/docs/2.3/api/pseudo-url.html index d2a1e85558..89f17725f4 100644 --- a/docs/2.3/api/pseudo-url.html +++ b/docs/2.3/api/pseudo-url.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ such as making the matching case sensitive.</li><li><strong><code>requestTemplate</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/request-options"><code>RequestOptions</code></a> - Options for the new <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> instances created for matching URLs by the <a href="/sdk/js/docs/2.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a> function.</li></ul><hr><a name="matches"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="pseudourlmatchesurl"><code>pseudoUrl.matches(url)</code><a href="#pseudourlmatchesurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Determines whether a URL matches this pseudo-URL pattern.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code> - URL to be matched.</li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code> - Returns <code>true</code> if given URL matches pseudo-URL.</p><hr><a name="createrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="pseudourlcreaterequesturlorprops"><code>pseudoUrl.createRequest(urlOrProps)</code><a href="#pseudourlcreaterequesturlorprops" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Creates a Request object from a provided <code>requestTemplate</code> and a given URL or an object that specifies \$<a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> properties. In case of a collision the properties will override the template, except for <code>userData</code>, which will be merged together, with the <code>userData</code> property -having preference over the template. This enables dynamic overriding of the template.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>urlOrProps</code></strong>: <code>string</code> | <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PseudoUrl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/request-queue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/utils"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-pseudourlpurl-requesttemplate" class="table-of-contents__link toc-highlight"><code>new PseudoUrl(purl, requestTemplate)</code></a></li><li><a href="#pseudourlmatchesurl" class="table-of-contents__link toc-highlight"><code>pseudoUrl.matches(url)</code></a></li><li><a href="#pseudourlcreaterequesturlorprops" class="table-of-contents__link toc-highlight"><code>pseudoUrl.createRequest(urlOrProps)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +having preference over the template. This enables dynamic overriding of the template.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>urlOrProps</code></strong>: <code>string</code> | <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PseudoUrl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/request-queue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/utils"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-pseudourlpurl-requesttemplate" class="table-of-contents__link toc-highlight"><code>new PseudoUrl(purl, requestTemplate)</code></a></li><li><a href="#pseudourlmatchesurl" class="table-of-contents__link toc-highlight"><code>pseudoUrl.matches(url)</code></a></li><li><a href="#pseudourlcreaterequesturlorprops" class="table-of-contents__link toc-highlight"><code>pseudoUrl.createRequest(urlOrProps)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/puppeteer-crawler.html b/docs/2.3/api/puppeteer-crawler.html index 4326885d1c..a558be9ce8 100644 --- a/docs/2.3/api/puppeteer-crawler.html +++ b/docs/2.3/api/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -37,8 +37,8 @@ only initialized after calling the <a href="/sdk/js/docs/2.3/api/cheerio-crawler#run"><code>CheerioCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><a name="puppeteercrawler"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-puppeteercrawleroptions"><code>new PuppeteerCrawler(options)</code><a href="#new-puppeteercrawleroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"><code>PuppeteerCrawlerOptions</code></a> - All <code>PuppeteerCrawler</code> parameters are passed via an options -object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteercrawleroptionsshape"><code>puppeteerCrawler.optionsShape</code><a href="#puppeteercrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PuppeteerCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/statistics"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Statistics</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-puppeteercrawleroptions" class="table-of-contents__link toc-highlight"><code>new PuppeteerCrawler(options)</code></a></li><li><a href="#puppeteercrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>puppeteerCrawler.optionsShape</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +object.</li></ul><hr><a name="optionsshape"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="puppeteercrawleroptionsshape"><code>puppeteerCrawler.optionsShape</code><a href="#puppeteercrawleroptionsshape" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/PuppeteerCrawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/statistics"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Statistics</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#browserpool" class="table-of-contents__link toc-highlight"><code>browserPool</code></a></li><li><a href="#autoscaledpool" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code></a></li></ul></li><li><a href="#new-puppeteercrawleroptions" class="table-of-contents__link toc-highlight"><code>new PuppeteerCrawler(options)</code></a></li><li><a href="#puppeteercrawleroptionsshape" class="table-of-contents__link toc-highlight"><code>puppeteerCrawler.optionsShape</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/puppeteer.html b/docs/2.3/api/puppeteer.html index c9b669fbb3..943d5b5a8d 100644 --- a/docs/2.3/api/puppeteer.html +++ b/docs/2.3/api/puppeteer.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -75,8 +75,8 @@ the compiled function is the return value of the function body = the <code>scriptString</code> parameter.</p><p>As a security measure, no globals such as <code>process</code> or <code>require</code> are accessible from within the function body. Note that the function does not provide a safe sandbox and even though globals are not easily accessible, malicious code may still execute in the main process via prototype manipulation. Therefore you should only use this function to execute sanitized or safe code.</p><p>Custom context may also be provided using the <code>context</code> parameter. To improve security, make sure to only pass the really necessary objects to the -context. Preferably making secured copies beforehand.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>scriptString</code></strong>: <code>string</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/compiled-script-function"><code>CompiledScriptFunction</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/puppeteer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/playwright"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.playwright</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/social"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.social</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#puppeteeraddinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.addInterceptRequestHandler</code></a></li><li><a href="#puppeteerremoveinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.removeInterceptRequestHandler</code></a></li><li><a href="#puppeteergotoextended" class="table-of-contents__link toc-highlight"><code>puppeteer.gotoExtended</code></a></li><li><a href="#puppeteerinfinitescroll" class="table-of-contents__link toc-highlight"><code>puppeteer.infiniteScroll</code></a></li><li><a href="#puppeteersavesnapshot" class="table-of-contents__link toc-highlight"><code>puppeteer.saveSnapshot</code></a></li><li><a href="#puppeteerenqueuelinksbyclickingelementsoptions" class="table-of-contents__link toc-highlight"><code>puppeteer.enqueueLinksByClickingElements(options)</code></a></li><li><a href="#puppeteerinjectfilepage-filepath-options" class="table-of-contents__link toc-highlight"><code>puppeteer.injectFile(page, filePath, [options])</code></a></li><li><a href="#puppeteerinjectjquerypage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectJQuery(page)</code></a></li><li><a href="#puppeteerinjectunderscorepage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectUnderscore(page)</code></a></li><li><a href="#puppeteerblockrequestspage-options" class="table-of-contents__link toc-highlight"><code>puppeteer.blockRequests(page, [options])</code></a></li><li><a href="#puppeteercacheresponsespage-cache-responseurlrules" class="table-of-contents__link toc-highlight"><del><code>puppeteer.cacheResponses(page, cache, responseUrlRules)</code></del></a></li><li><a href="#puppeteercompilescriptscriptstring-context" class="table-of-contents__link toc-highlight"><code>puppeteer.compileScript(scriptString, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +context. Preferably making secured copies beforehand.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>scriptString</code></strong>: <code>string</code></li><li><strong><code>context</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/compiled-script-function"><code>CompiledScriptFunction</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/puppeteer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/playwright"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.playwright</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/social"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.social</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#puppeteeraddinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.addInterceptRequestHandler</code></a></li><li><a href="#puppeteerremoveinterceptrequesthandler" class="table-of-contents__link toc-highlight"><code>puppeteer.removeInterceptRequestHandler</code></a></li><li><a href="#puppeteergotoextended" class="table-of-contents__link toc-highlight"><code>puppeteer.gotoExtended</code></a></li><li><a href="#puppeteerinfinitescroll" class="table-of-contents__link toc-highlight"><code>puppeteer.infiniteScroll</code></a></li><li><a href="#puppeteersavesnapshot" class="table-of-contents__link toc-highlight"><code>puppeteer.saveSnapshot</code></a></li><li><a href="#puppeteerenqueuelinksbyclickingelementsoptions" class="table-of-contents__link toc-highlight"><code>puppeteer.enqueueLinksByClickingElements(options)</code></a></li><li><a href="#puppeteerinjectfilepage-filepath-options" class="table-of-contents__link toc-highlight"><code>puppeteer.injectFile(page, filePath, [options])</code></a></li><li><a href="#puppeteerinjectjquerypage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectJQuery(page)</code></a></li><li><a href="#puppeteerinjectunderscorepage" class="table-of-contents__link toc-highlight"><code>puppeteer.injectUnderscore(page)</code></a></li><li><a href="#puppeteerblockrequestspage-options" class="table-of-contents__link toc-highlight"><code>puppeteer.blockRequests(page, [options])</code></a></li><li><a href="#puppeteercacheresponsespage-cache-responseurlrules" class="table-of-contents__link toc-highlight"><del><code>puppeteer.cacheResponses(page, cache, responseUrlRules)</code></del></a></li><li><a href="#puppeteercompilescriptscriptstring-context" class="table-of-contents__link toc-highlight"><code>puppeteer.compileScript(scriptString, context)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/request-list.html b/docs/2.3/api/request-list.html index fc302be6db..a69599d032 100644 --- a/docs/2.3/api/request-list.html +++ b/docs/2.3/api/request-list.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ regular intervals, but calling this method manually is useful in cases where you want to have the most current state available after you pause or stop fetching its requests. For example after you pause or abort a crawl. Or just before a server migration.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="getstate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistgetstate"><code>requestList.getState()</code><a href="#requestlistgetstate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an object representing the internal state of the <code>RequestList</code> instance. Note that the object's fields can change in future releases.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-list-state"><code>RequestListState</code></a></p><hr><a name="isempty"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistisempty"><code>requestList.isEmpty()</code><a href="#requestlistisempty" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Resolves to <code>true</code> if the next call to <a href="/sdk/js/docs/2.3/api/request-list#fetchnextrequest"><code>RequestList.fetchNextRequest()</code></a> function would return <code>null</code>, otherwise it resolves to <code>false</code>. Note that even if the list is empty, there might be some pending requests currently being processed.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="isfinished"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistisfinished"><code>requestList.isFinished()</code><a href="#requestlistisfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns <code>true</code> if all requests were already handled and there are no more left.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="fetchnextrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistfetchnextrequest"><code>requestList.fetchNextRequest()</code><a href="#requestlistfetchnextrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Gets the next <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> to process. First, the function gets a request previously reclaimed using the -<a href="/sdk/js/docs/2.3/api/request-list#reclaimrequest"><code>RequestList.reclaimRequest()</code></a> function, if there is any. Otherwise it gets the next request from sources.</p><p>The function's <code>Promise</code> resolves to <code>null</code> if there are no more requests to process.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/request"><code>Promise<(Request|null)></code></a></p><hr><a name="markrequesthandled"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistmarkrequesthandledrequest"><code>requestList.markRequestHandled(request)</code><a href="#requestlistmarkrequesthandledrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Marks request as handled after successful processing.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="reclaimrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistreclaimrequestrequest"><code>requestList.reclaimRequest(request)</code><a href="#requestlistreclaimrequestrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Reclaims request to the list if its processing failed. The request will become available in the next <code>this.fetchNextRequest()</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="length"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistlength"><code>requestList.length()</code><a href="#requestlistlength" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the total number of unique requests present in the <code>RequestList</code>.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr><a name="handledcount"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlisthandledcount"><code>requestList.handledCount()</code><a href="#requestlisthandledcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns number of handled requests.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestList.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/request-queue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-requestlistoptions" class="table-of-contents__link toc-highlight"><code>new RequestList(options)</code></a></li><li><a href="#requestlistrequests" class="table-of-contents__link toc-highlight"><code>requestList.requests</code></a></li><li><a href="#requestlistinitialize" class="table-of-contents__link toc-highlight"><code>requestList.initialize()</code></a></li><li><a href="#requestlistpersiststate" class="table-of-contents__link toc-highlight"><code>requestList.persistState()</code></a></li><li><a href="#requestlistgetstate" class="table-of-contents__link toc-highlight"><code>requestList.getState()</code></a></li><li><a href="#requestlistisempty" class="table-of-contents__link toc-highlight"><code>requestList.isEmpty()</code></a></li><li><a href="#requestlistisfinished" class="table-of-contents__link toc-highlight"><code>requestList.isFinished()</code></a></li><li><a href="#requestlistfetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestList.fetchNextRequest()</code></a></li><li><a href="#requestlistmarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestList.markRequestHandled(request)</code></a></li><li><a href="#requestlistreclaimrequestrequest" class="table-of-contents__link toc-highlight"><code>requestList.reclaimRequest(request)</code></a></li><li><a href="#requestlistlength" class="table-of-contents__link toc-highlight"><code>requestList.length()</code></a></li><li><a href="#requestlisthandledcount" class="table-of-contents__link toc-highlight"><code>requestList.handledCount()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/request-list#reclaimrequest"><code>RequestList.reclaimRequest()</code></a> function, if there is any. Otherwise it gets the next request from sources.</p><p>The function's <code>Promise</code> resolves to <code>null</code> if there are no more requests to process.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/request"><code>Promise<(Request|null)></code></a></p><hr><a name="markrequesthandled"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistmarkrequesthandledrequest"><code>requestList.markRequestHandled(request)</code><a href="#requestlistmarkrequesthandledrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Marks request as handled after successful processing.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="reclaimrequest"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistreclaimrequestrequest"><code>requestList.reclaimRequest(request)</code><a href="#requestlistreclaimrequestrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Reclaims request to the list if its processing failed. The request will become available in the next <code>this.fetchNextRequest()</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="length"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlistlength"><code>requestList.length()</code><a href="#requestlistlength" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the total number of unique requests present in the <code>RequestList</code>.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr><a name="handledcount"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlisthandledcount"><code>requestList.handledCount()</code><a href="#requestlisthandledcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns number of handled requests.</p><p><strong>Returns</strong>:</p><p><code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestList.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/request-queue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-requestlistoptions" class="table-of-contents__link toc-highlight"><code>new RequestList(options)</code></a></li><li><a href="#requestlistrequests" class="table-of-contents__link toc-highlight"><code>requestList.requests</code></a></li><li><a href="#requestlistinitialize" class="table-of-contents__link toc-highlight"><code>requestList.initialize()</code></a></li><li><a href="#requestlistpersiststate" class="table-of-contents__link toc-highlight"><code>requestList.persistState()</code></a></li><li><a href="#requestlistgetstate" class="table-of-contents__link toc-highlight"><code>requestList.getState()</code></a></li><li><a href="#requestlistisempty" class="table-of-contents__link toc-highlight"><code>requestList.isEmpty()</code></a></li><li><a href="#requestlistisfinished" class="table-of-contents__link toc-highlight"><code>requestList.isFinished()</code></a></li><li><a href="#requestlistfetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestList.fetchNextRequest()</code></a></li><li><a href="#requestlistmarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestList.markRequestHandled(request)</code></a></li><li><a href="#requestlistreclaimrequestrequest" class="table-of-contents__link toc-highlight"><code>requestList.reclaimRequest(request)</code></a></li><li><a href="#requestlistlength" class="table-of-contents__link toc-highlight"><code>requestList.length()</code></a></li><li><a href="#requestlisthandledcount" class="table-of-contents__link toc-highlight"><code>requestList.handledCount()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/request-queue.html b/docs/2.3/api/request-queue.html index ad1f79e2c9..e0ad352e25 100644 --- a/docs/2.3/api/request-queue.html +++ b/docs/2.3/api/request-queue.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -40,8 +40,8 @@ resolves to <code>false</code>. Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that there is no activity in the queue, use <a href="/sdk/js/docs/2.3/api/request-queue#isfinished"><code>RequestQueue.isFinished()</code></a>.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="isfinished"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueueisfinished"><code>requestQueue.isFinished()</code><a href="#requestqueueisfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Resolves to <code>true</code> if all requests were already handled and there are no more left. Due to the nature of distributed storage used by the queue, the function might occasionally return a false negative, but it will never return a false positive.</p><p><strong>Returns</strong>:</p><p><code>Promise<boolean></code></p><hr><a name="_reset"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueue_reset"><code>requestQueue._reset()</code><a href="#requestqueue_reset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Internal</strong>:</p><hr><a name="drop"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueuedrop"><code>requestQueue.drop()</code><a href="#requestqueuedrop" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes the queue either from the Apify Cloud storage or from the local database, depending on the mode of operation.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="handledcount"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueuehandledcount"><code>requestQueue.handledCount()</code><a href="#requestqueuehandledcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns the number of handled requests.</p><p>This function is just a convenient shortcut for:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> handledRequestCount </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> queue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInfo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Returns</strong>:</p><p><code>Promise<number></code></p><hr><a name="getinfo"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestqueuegetinfo"><code>requestQueue.getInfo()</code><a href="#requestqueuegetinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an object containing general information about the request queue.</p><p>The function returns the same object as the Apify API Client's <a href="https://docs.apify.com/api/apify-client-js/latest#ApifyClient-requestQueues" target="_blank" rel="noopener">getQueue</a> -function, which in turn calls the <a href="https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue" target="_blank" rel="noopener">Get request queue</a> API endpoint.</p><p><strong>Example:</strong></p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"WkzbQMuFYuamGv3YF"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"my-queue"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> userId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"wRsJZtadYvn4mBZmm"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> createdAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-12T07:34:14.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> modifiedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-13T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> accessedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-14T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> totalRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handledRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pendingRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">20</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-queue-info"><code>Promise<RequestQueueInfo></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestQueue.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/request-list"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestList</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/pseudo-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PseudoUrl</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestqueueaddrequestrequestlike-options" class="table-of-contents__link toc-highlight"><code>requestQueue.addRequest(requestLike, [options])</code></a></li><li><a href="#requestqueuegetrequestid" class="table-of-contents__link toc-highlight"><code>requestQueue.getRequest(id)</code></a></li><li><a href="#requestqueuefetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.fetchNextRequest()</code></a></li><li><a href="#requestqueuemarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.markRequestHandled(request)</code></a></li><li><a href="#requestqueuereclaimrequestrequest-options" class="table-of-contents__link toc-highlight"><code>requestQueue.reclaimRequest(request, [options])</code></a></li><li><a href="#requestqueueisempty" class="table-of-contents__link toc-highlight"><code>requestQueue.isEmpty()</code></a></li><li><a href="#requestqueueisfinished" class="table-of-contents__link toc-highlight"><code>requestQueue.isFinished()</code></a></li><li><a href="#requestqueue_reset" class="table-of-contents__link toc-highlight"><code>requestQueue._reset()</code></a></li><li><a href="#requestqueuedrop" class="table-of-contents__link toc-highlight"><code>requestQueue.drop()</code></a></li><li><a href="#requestqueuehandledcount" class="table-of-contents__link toc-highlight"><code>requestQueue.handledCount()</code></a></li><li><a href="#requestqueuegetinfo" class="table-of-contents__link toc-highlight"><code>requestQueue.getInfo()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +function, which in turn calls the <a href="https://apify.com/docs/api/v2#/reference/request-queues/queue/get-request-queue" target="_blank" rel="noopener">Get request queue</a> API endpoint.</p><p><strong>Example:</strong></p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"WkzbQMuFYuamGv3YF"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"my-queue"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> userId</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"wRsJZtadYvn4mBZmm"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> createdAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-12T07:34:14.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> modifiedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-13T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> accessedAt</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Date</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"2015-12-14T08:36:13.202Z"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> totalRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">25</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handledRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pendingRequestCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">20</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-queue-info"><code>Promise<RequestQueueInfo></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/RequestQueue.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/request-list"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestList</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/pseudo-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PseudoUrl</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestqueueaddrequestrequestlike-options" class="table-of-contents__link toc-highlight"><code>requestQueue.addRequest(requestLike, [options])</code></a></li><li><a href="#requestqueuegetrequestid" class="table-of-contents__link toc-highlight"><code>requestQueue.getRequest(id)</code></a></li><li><a href="#requestqueuefetchnextrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.fetchNextRequest()</code></a></li><li><a href="#requestqueuemarkrequesthandledrequest" class="table-of-contents__link toc-highlight"><code>requestQueue.markRequestHandled(request)</code></a></li><li><a href="#requestqueuereclaimrequestrequest-options" class="table-of-contents__link toc-highlight"><code>requestQueue.reclaimRequest(request, [options])</code></a></li><li><a href="#requestqueueisempty" class="table-of-contents__link toc-highlight"><code>requestQueue.isEmpty()</code></a></li><li><a href="#requestqueueisfinished" class="table-of-contents__link toc-highlight"><code>requestQueue.isFinished()</code></a></li><li><a href="#requestqueue_reset" class="table-of-contents__link toc-highlight"><code>requestQueue._reset()</code></a></li><li><a href="#requestqueuedrop" class="table-of-contents__link toc-highlight"><code>requestQueue.drop()</code></a></li><li><a href="#requestqueuehandledcount" class="table-of-contents__link toc-highlight"><code>requestQueue.handledCount()</code></a></li><li><a href="#requestqueuegetinfo" class="table-of-contents__link toc-highlight"><code>requestQueue.getInfo()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/request.html b/docs/2.3/api/request.html index af0e2e2b68..cda035b30c 100644 --- a/docs/2.3/api/request.html +++ b/docs/2.3/api/request.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ or may not be included, depending on their nature. This generally means that redirects, which happen immediately will most likely be included, but delayed redirects will not.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="uniquekey"><code>uniqueKey</code><a href="#uniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>A unique key identifying the request. Two requests with the same <code>uniqueKey</code> are considered as pointing to the same URL.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="method"><code>method</code><a href="#method" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>HTTP method, e.g. <code>GET</code> or <code>POST</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Buffer</code></p><p>HTTP request payload, e.g. for POST requests.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="noretry"><code>noRetry</code><a href="#noretry" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>The <code>true</code> value indicates that the request will not be automatically retried on error.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="retrycount"><code>retryCount</code><a href="#retrycount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Indicates the number of times the crawling of the request has been retried on error.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errormessages"><code>errorMessages</code><a href="#errormessages" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><p>An array of error messages from request processing.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="headers"><code>headers</code><a href="#headers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, string></code></p><p>Object with HTTP headers. Key is header name, value is the value.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Custom user data assigned to the request.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="handledat"><code>handledAt</code><a href="#handledat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Indicates the time when the request has been processed. Is <code>null</code> if the request has not been crawled yet.</p><hr><a name="request"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-requestoptions"><code>new Request(options)</code><a href="#new-requestoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>options</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/request-options"><code>RequestOptions</code></a> - <code>Request</code> parameters including the URL, HTTP method and headers, and others.</li></ul><hr><a name="headers"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestheaders"><code>request.headers</code><a href="#requestheaders" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="userdata"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestuserdata"><code>request.userData</code><a href="#requestuserdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><hr><a name="pusherrormessage"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestpusherrormessageerrorormessage-options"><code>request.pushErrorMessage(errorOrMessage, [options])</code><a href="#requestpusherrormessageerrorormessage-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stores information about an error that occurred during processing of this request.</p><p>You should always use Error instances when throwing errors in JavaScript.</p><p>Nevertheless, to improve the debugging experience when using third party libraries that may not always throw an Error instance, the function performs a type inspection of the passed argument and attempts to extract as much information as possible, since just throwing a bad type error makes any -debugging rather difficult.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>errorOrMessage</code></strong>: <code>Error</code> | <code>string</code> - Error object or error message to be stored in the request.</li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[omitStack]</code></strong>: <code>boolean</code> <code> = false</code> - Only push the error message without stack trace when true.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Request.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/system-status"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatus</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/request-list"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestList</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#loadedurl" class="table-of-contents__link toc-highlight"><code>loadedUrl</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#noretry" class="table-of-contents__link toc-highlight"><code>noRetry</code></a></li><li><a href="#retrycount" class="table-of-contents__link toc-highlight"><code>retryCount</code></a></li><li><a href="#errormessages" class="table-of-contents__link toc-highlight"><code>errorMessages</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#handledat" class="table-of-contents__link toc-highlight"><code>handledAt</code></a></li></ul></li><li><a href="#new-requestoptions" class="table-of-contents__link toc-highlight"><code>new Request(options)</code></a></li><li><a href="#requestheaders" class="table-of-contents__link toc-highlight"><code>request.headers</code></a></li><li><a href="#requestuserdata" class="table-of-contents__link toc-highlight"><code>request.userData</code></a></li><li><a href="#requestpusherrormessageerrorormessage-options" class="table-of-contents__link toc-highlight"><code>request.pushErrorMessage(errorOrMessage, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +debugging rather difficult.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>errorOrMessage</code></strong>: <code>Error</code> | <code>string</code> - Error object or error message to be stored in the request.</li><li><strong><code>[options]</code></strong>: <code>object</code><ul><li><strong><code>[omitStack]</code></strong>: <code>boolean</code> <code> = false</code> - Only push the error message without stack trace when true.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Request.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/system-status"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatus</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/request-list"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestList</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#loadedurl" class="table-of-contents__link toc-highlight"><code>loadedUrl</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#noretry" class="table-of-contents__link toc-highlight"><code>noRetry</code></a></li><li><a href="#retrycount" class="table-of-contents__link toc-highlight"><code>retryCount</code></a></li><li><a href="#errormessages" class="table-of-contents__link toc-highlight"><code>errorMessages</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#handledat" class="table-of-contents__link toc-highlight"><code>handledAt</code></a></li></ul></li><li><a href="#new-requestoptions" class="table-of-contents__link toc-highlight"><code>new Request(options)</code></a></li><li><a href="#requestheaders" class="table-of-contents__link toc-highlight"><code>request.headers</code></a></li><li><a href="#requestuserdata" class="table-of-contents__link toc-highlight"><code>request.userData</code></a></li><li><a href="#requestpusherrormessageerrorormessage-options" class="table-of-contents__link toc-highlight"><code>request.pushErrorMessage(errorOrMessage, [options])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/session-pool.html b/docs/2.3/api/session-pool.html index 530a14058b..e4b438e26b 100644 --- a/docs/2.3/api/session-pool.html +++ b/docs/2.3/api/session-pool.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ sessions once the max pool size is reached. This also allows you to add session with overridden session options (e.g. with specific session id).</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a> | <a href="/sdk/js/docs/2.3/typedefs/session-options"><code>SessionOptions</code></a> - The configuration options for the session being added to the session pool.</li></ul><hr><a name="getsession"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolgetsessionsessionid"><code>sessionPool.getSession([sessionId])</code><a href="#sessionpoolgetsessionsessionid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Gets session. If there is space for new session, it creates and returns new session. If the session pool is full, it picks a session from the pool, If the picked session is usable it is returned, otherwise it creates and returns a new one.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sessionId]</code></strong>: <code>String</code> - If provided, it returns the usable session with this id, <code>undefined</code> otherwise.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/session"><code>Promise<Session></code></a></p><hr><a name="getstate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolgetstate"><code>sessionPool.getState()</code><a href="#sessionpoolgetstate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an object representing the internal state of the <code>SessionPool</code> instance. Note that the object's fields can change in future releases.</p><hr><a name="persiststate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolpersiststate"><code>sessionPool.persistState()</code><a href="#sessionpoolpersiststate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Persists the current state of the <code>SessionPool</code> into the default <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a>. The state is persisted automatically in -regular intervals.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="teardown"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolteardown"><code>sessionPool.teardown()</code><a href="#sessionpoolteardown" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes listener from <code>persistState</code> event. This function should be called after you are done with using the <code>SessionPool</code> instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SessionPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sessionpoolsessions" class="table-of-contents__link toc-highlight"><code>sessionPool.sessions</code></a></li><li><a href="#sessionpoolforcecloud" class="table-of-contents__link toc-highlight"><code>sessionPool.forceCloud</code></a></li><li><a href="#sessionpoolusablesessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.usableSessionsCount</code></a></li><li><a href="#sessionpoolretiredsessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.retiredSessionsCount</code></a></li><li><a href="#sessionpoolinitialize" class="table-of-contents__link toc-highlight"><code>sessionPool.initialize()</code></a></li><li><a href="#sessionpooladdsessionoptions" class="table-of-contents__link toc-highlight"><code>sessionPool.addSession([options])</code></a></li><li><a href="#sessionpoolgetsessionsessionid" class="table-of-contents__link toc-highlight"><code>sessionPool.getSession([sessionId])</code></a></li><li><a href="#sessionpoolgetstate" class="table-of-contents__link toc-highlight"><code>sessionPool.getState()</code></a></li><li><a href="#sessionpoolpersiststate" class="table-of-contents__link toc-highlight"><code>sessionPool.persistState()</code></a></li><li><a href="#sessionpoolteardown" class="table-of-contents__link toc-highlight"><code>sessionPool.teardown()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +regular intervals.</p><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr><a name="teardown"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpoolteardown"><code>sessionPool.teardown()</code><a href="#sessionpoolteardown" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Removes listener from <code>persistState</code> event. This function should be called after you are done with using the <code>SessionPool</code> instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SessionPool.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sessionpoolsessions" class="table-of-contents__link toc-highlight"><code>sessionPool.sessions</code></a></li><li><a href="#sessionpoolforcecloud" class="table-of-contents__link toc-highlight"><code>sessionPool.forceCloud</code></a></li><li><a href="#sessionpoolusablesessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.usableSessionsCount</code></a></li><li><a href="#sessionpoolretiredsessionscount" class="table-of-contents__link toc-highlight"><code>sessionPool.retiredSessionsCount</code></a></li><li><a href="#sessionpoolinitialize" class="table-of-contents__link toc-highlight"><code>sessionPool.initialize()</code></a></li><li><a href="#sessionpooladdsessionoptions" class="table-of-contents__link toc-highlight"><code>sessionPool.addSession([options])</code></a></li><li><a href="#sessionpoolgetsessionsessionid" class="table-of-contents__link toc-highlight"><code>sessionPool.getSession([sessionId])</code></a></li><li><a href="#sessionpoolgetstate" class="table-of-contents__link toc-highlight"><code>sessionPool.getState()</code></a></li><li><a href="#sessionpoolpersiststate" class="table-of-contents__link toc-highlight"><code>sessionPool.persistState()</code></a></li><li><a href="#sessionpoolteardown" class="table-of-contents__link toc-highlight"><code>sessionPool.teardown()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/session.html b/docs/2.3/api/session.html index 17abf45f3b..3d15fd62e5 100644 --- a/docs/2.3/api/session.html +++ b/docs/2.3/api/session.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ by retiring the session when such code is received. Optionally the default status codes can be extended in the second parameter.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>statusCode</code></strong>: <code>number</code> - HTTP status code</li><li><strong><code>[blockedStatusCodes]</code></strong>: <code>Array<number></code> - Custom HTTP status codes that means blocking on particular website.</li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code> - whether the session was retired.</p><hr><a name="setcookiesfromresponse"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionsetcookiesfromresponseresponse"><code>session.setCookiesFromResponse(response)</code><a href="#sessionsetcookiesfromresponseresponse" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Saves cookies from an HTTP response to be used with the session. It expects an object with a <code>headers</code> property that's either an <code>Object</code> (typical Node.js responses) or a <code>Function</code> (Puppeteer Response).</p><p>It then parses and saves the cookies from the <code>set-cookie</code> header, if available.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>response</code></strong>: <code>PuppeteerResponse</code> | <code>IncomingMessage</code></li></ul><hr><a name="setpuppeteercookies"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessionsetpuppeteercookiescookies-url"><code>session.setPuppeteerCookies(cookies, url)</code><a href="#sessionsetpuppeteercookiescookies-url" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Saves an array with cookie objects to be used with the session. The objects should be in the format that <a href="https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-pagecookiesurls" target="_blank" rel="noopener">Puppeteer uses</a>, but you can also use this function to set cookies -manually:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'your-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>cookies</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/puppeteer-cookie"><code>Array<PuppeteerCookie></code></a></li><li><strong><code>url</code></strong>: <code>string</code></li></ul><hr><a name="getpuppeteercookies"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetpuppeteercookiesurl"><code>session.getPuppeteerCookies(url)</code><a href="#sessiongetpuppeteercookiesurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies in a format compatible with puppeteer and ready to be used with <code>page.setCookie</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code> - website url. Only cookies stored for this url will be returned</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/puppeteer-cookie"><code>Array<PuppeteerCookie></code></a></p><hr><a name="getcookiestring"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetcookiestringurl"><code>session.getCookieString(url)</code><a href="#sessiongetcookiestringurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - represents <code>Cookie</code> header.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Session.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/session-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-sessionoptions" class="table-of-contents__link toc-highlight"><code>new Session(options)</code></a></li><li><a href="#sessionuserdata" class="table-of-contents__link toc-highlight"><code>session.userData</code></a></li><li><a href="#sessionisblocked" class="table-of-contents__link toc-highlight"><code>session.isBlocked()</code></a></li><li><a href="#sessionisexpired" class="table-of-contents__link toc-highlight"><code>session.isExpired()</code></a></li><li><a href="#sessionismaxusagecountreached" class="table-of-contents__link toc-highlight"><code>session.isMaxUsageCountReached()</code></a></li><li><a href="#sessionisusable" class="table-of-contents__link toc-highlight"><code>session.isUsable()</code></a></li><li><a href="#sessionmarkgood" class="table-of-contents__link toc-highlight"><code>session.markGood()</code></a></li><li><a href="#sessiongetstate" class="table-of-contents__link toc-highlight"><code>session.getState()</code></a></li><li><a href="#sessionretire" class="table-of-contents__link toc-highlight"><code>session.retire()</code></a></li><li><a href="#sessionmarkbad" class="table-of-contents__link toc-highlight"><code>session.markBad()</code></a></li><li><a href="#sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes" class="table-of-contents__link toc-highlight"><code>session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])</code></a></li><li><a href="#sessionsetcookiesfromresponseresponse" class="table-of-contents__link toc-highlight"><code>session.setCookiesFromResponse(response)</code></a></li><li><a href="#sessionsetpuppeteercookiescookies-url" class="table-of-contents__link toc-highlight"><code>session.setPuppeteerCookies(cookies, url)</code></a></li><li><a href="#sessiongetpuppeteercookiesurl" class="table-of-contents__link toc-highlight"><code>session.getPuppeteerCookies(url)</code></a></li><li><a href="#sessiongetcookiestringurl" class="table-of-contents__link toc-highlight"><code>session.getCookieString(url)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +manually:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'cookie2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'your-cookie'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>cookies</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/puppeteer-cookie"><code>Array<PuppeteerCookie></code></a></li><li><strong><code>url</code></strong>: <code>string</code></li></ul><hr><a name="getpuppeteercookies"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetpuppeteercookiesurl"><code>session.getPuppeteerCookies(url)</code><a href="#sessiongetpuppeteercookiesurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies in a format compatible with puppeteer and ready to be used with <code>page.setCookie</code>.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code> - website url. Only cookies stored for this url will be returned</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/puppeteer-cookie"><code>Array<PuppeteerCookie></code></a></p><hr><a name="getcookiestring"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="sessiongetcookiestringurl"><code>session.getCookieString(url)</code><a href="#sessiongetcookiestringurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns cookies saved with the session in the typical key1=value1; key2=value2 format, ready to be used in a cookie header or elsewhere.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>url</code></strong>: <code>string</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - represents <code>Cookie</code> header.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Session.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/autoscaled-pool"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPool</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/session-pool"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPool</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-sessionoptions" class="table-of-contents__link toc-highlight"><code>new Session(options)</code></a></li><li><a href="#sessionuserdata" class="table-of-contents__link toc-highlight"><code>session.userData</code></a></li><li><a href="#sessionisblocked" class="table-of-contents__link toc-highlight"><code>session.isBlocked()</code></a></li><li><a href="#sessionisexpired" class="table-of-contents__link toc-highlight"><code>session.isExpired()</code></a></li><li><a href="#sessionismaxusagecountreached" class="table-of-contents__link toc-highlight"><code>session.isMaxUsageCountReached()</code></a></li><li><a href="#sessionisusable" class="table-of-contents__link toc-highlight"><code>session.isUsable()</code></a></li><li><a href="#sessionmarkgood" class="table-of-contents__link toc-highlight"><code>session.markGood()</code></a></li><li><a href="#sessiongetstate" class="table-of-contents__link toc-highlight"><code>session.getState()</code></a></li><li><a href="#sessionretire" class="table-of-contents__link toc-highlight"><code>session.retire()</code></a></li><li><a href="#sessionmarkbad" class="table-of-contents__link toc-highlight"><code>session.markBad()</code></a></li><li><a href="#sessionretireonblockedstatuscodesstatuscode-blockedstatuscodes" class="table-of-contents__link toc-highlight"><code>session.retireOnBlockedStatusCodes(statusCode, [blockedStatusCodes])</code></a></li><li><a href="#sessionsetcookiesfromresponseresponse" class="table-of-contents__link toc-highlight"><code>session.setCookiesFromResponse(response)</code></a></li><li><a href="#sessionsetpuppeteercookiescookies-url" class="table-of-contents__link toc-highlight"><code>session.setPuppeteerCookies(cookies, url)</code></a></li><li><a href="#sessiongetpuppeteercookiesurl" class="table-of-contents__link toc-highlight"><code>session.getPuppeteerCookies(url)</code></a></li><li><a href="#sessiongetcookiestringurl" class="table-of-contents__link toc-highlight"><code>session.getCookieString(url)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/snapshotter.html b/docs/2.3/api/snapshotter.html index 09f67c237a..4e0feedf2c 100644 --- a/docs/2.3/api/snapshotter.html +++ b/docs/2.3/api/snapshotter.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sampleDurationMillis]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr><a name="geteventloopsample"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="snapshottergeteventloopsamplesampledurationmillis"><code>snapshotter.getEventLoopSample([sampleDurationMillis])</code><a href="#snapshottergeteventloopsamplesampledurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a sample of latest event loop snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sampleDurationMillis]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr><a name="getcpusample"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="snapshottergetcpusamplesampledurationmillis"><code>snapshotter.getCpuSample([sampleDurationMillis])</code><a href="#snapshottergetcpusamplesampledurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a sample of latest CPU snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[sampleDurationMillis]</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr><a name="getclientsample"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="snapshottergetclientsamplesampledurationmillis"><code>snapshotter.getClientSample(sampleDurationMillis)</code><a href="#snapshottergetclientsamplesampledurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns a sample of latest Client snapshots, with the size of the sample defined by the sampleDurationMillis parameter. If omitted, it returns a full -snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sampleDurationMillis</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Snapshotter.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/system-status"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatus</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-snapshotteroptions" class="table-of-contents__link toc-highlight"><code>new Snapshotter([options])</code></a></li><li><a href="#snapshotterlog" class="table-of-contents__link toc-highlight"><code>snapshotter.log</code></a></li><li><a href="#snapshotterstart" class="table-of-contents__link toc-highlight"><code>snapshotter.start()</code></a></li><li><a href="#snapshotterstop" class="table-of-contents__link toc-highlight"><code>snapshotter.stop()</code></a></li><li><a href="#snapshottergetmemorysamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getMemorySample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergeteventloopsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getEventLoopSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetcpusamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getCpuSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetclientsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getClientSample(sampleDurationMillis)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +snapshot history.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sampleDurationMillis</code></strong>: <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>Array<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Snapshotter.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/proxy-configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/system-status"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatus</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-snapshotteroptions" class="table-of-contents__link toc-highlight"><code>new Snapshotter([options])</code></a></li><li><a href="#snapshotterlog" class="table-of-contents__link toc-highlight"><code>snapshotter.log</code></a></li><li><a href="#snapshotterstart" class="table-of-contents__link toc-highlight"><code>snapshotter.start()</code></a></li><li><a href="#snapshotterstop" class="table-of-contents__link toc-highlight"><code>snapshotter.stop()</code></a></li><li><a href="#snapshottergetmemorysamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getMemorySample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergeteventloopsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getEventLoopSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetcpusamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getCpuSample([sampleDurationMillis])</code></a></li><li><a href="#snapshottergetclientsamplesampledurationmillis" class="table-of-contents__link toc-highlight"><code>snapshotter.getClientSample(sampleDurationMillis)</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/social.html b/docs/2.3/api/social.html index c441d20cee..949450a56c 100644 --- a/docs/2.3/api/social.html +++ b/docs/2.3/api/social.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,8 +26,8 @@ Facebook profile URLs. The function removes duplicates from the resulting arrays and sorts the items alphabetically.</p><p>Note that the <code>phones</code> field contains phone numbers extracted from the special phone links such as <code>[call us](tel:+1234556789)</code> (see <a href="/sdk/js/docs/2.3/api/social#phonesfromurls"><code>social.phonesFromUrls()</code></a>) and potentially other sources with high certainty, while <code>phonesUncertain</code> contains phone numbers extracted from the plain text, which might be very inaccurate.</p><p><strong>Example usage:</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'http://www.example.com'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">content</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">social</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">parseHandlesFromHtml</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Social handles:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">dir</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">result</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>html</code></strong>: <code>string</code> - HTML text</li><li><strong><code>[data]</code></strong>: <code>*</code> | <code>null</code> <code> = </code> - Optional object which will receive the <code>text</code> and <code>$</code> properties that contain text content of the -HTML and <code>cheerio</code> object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/social-handles"><code>SocialHandles</code></a> - An object with the social handles.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/social.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/puppeteer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sociallinkedin_regex" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX</code></a></li><li><a href="#sociallinkedin_regex_global" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX_GLOBAL</code></a></li><li><a href="#socialinstagram_regex" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX</code></a></li><li><a href="#socialinstagram_regex_global" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX_GLOBAL</code></a></li><li><a href="#socialtwitter_regex" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX</code></a></li><li><a href="#socialtwitter_regex_global" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX_GLOBAL</code></a></li><li><a href="#socialfacebook_regex" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX</code></a></li><li><a href="#socialfacebook_regex_global" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX_GLOBAL</code></a></li><li><a href="#socialyoutube_regex" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX</code></a></li><li><a href="#socialyoutube_regex_global" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX_GLOBAL</code></a></li><li><a href="#socialemail_regex" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX</code></a></li><li><a href="#socialemail_regex_global" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX_GLOBAL</code></a></li><li><a href="#socialemailsfromtexttext" class="table-of-contents__link toc-highlight"><code>social.emailsFromText(text)</code></a></li><li><a href="#socialemailsfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.emailsFromUrls(urls)</code></a></li><li><a href="#socialphonesfromtexttext" class="table-of-contents__link toc-highlight"><code>social.phonesFromText(text)</code></a></li><li><a href="#socialphonesfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.phonesFromUrls(urls)</code></a></li><li><a href="#socialparsehandlesfromhtmlhtml-data" class="table-of-contents__link toc-highlight"><code>social.parseHandlesFromHtml(html, [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +HTML and <code>cheerio</code> object, respectively. This is an optimization so that the caller doesn't need to parse the HTML document again, if needed.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/social-handles"><code>SocialHandles</code></a> - An object with the social handles.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/social.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/puppeteer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#sociallinkedin_regex" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX</code></a></li><li><a href="#sociallinkedin_regex_global" class="table-of-contents__link toc-highlight"><code>social.LINKEDIN_REGEX_GLOBAL</code></a></li><li><a href="#socialinstagram_regex" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX</code></a></li><li><a href="#socialinstagram_regex_global" class="table-of-contents__link toc-highlight"><code>social.INSTAGRAM_REGEX_GLOBAL</code></a></li><li><a href="#socialtwitter_regex" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX</code></a></li><li><a href="#socialtwitter_regex_global" class="table-of-contents__link toc-highlight"><code>social.TWITTER_REGEX_GLOBAL</code></a></li><li><a href="#socialfacebook_regex" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX</code></a></li><li><a href="#socialfacebook_regex_global" class="table-of-contents__link toc-highlight"><code>social.FACEBOOK_REGEX_GLOBAL</code></a></li><li><a href="#socialyoutube_regex" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX</code></a></li><li><a href="#socialyoutube_regex_global" class="table-of-contents__link toc-highlight"><code>social.YOUTUBE_REGEX_GLOBAL</code></a></li><li><a href="#socialemail_regex" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX</code></a></li><li><a href="#socialemail_regex_global" class="table-of-contents__link toc-highlight"><code>social.EMAIL_REGEX_GLOBAL</code></a></li><li><a href="#socialemailsfromtexttext" class="table-of-contents__link toc-highlight"><code>social.emailsFromText(text)</code></a></li><li><a href="#socialemailsfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.emailsFromUrls(urls)</code></a></li><li><a href="#socialphonesfromtexttext" class="table-of-contents__link toc-highlight"><code>social.phonesFromText(text)</code></a></li><li><a href="#socialphonesfromurlsurls" class="table-of-contents__link toc-highlight"><code>social.phonesFromUrls(urls)</code></a></li><li><a href="#socialparsehandlesfromhtmlhtml-data" class="table-of-contents__link toc-highlight"><code>social.parseHandlesFromHtml(html, [data])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/statistics.html b/docs/2.3/api/statistics.html index 5265976d63..1ec6550c97 100644 --- a/docs/2.3/api/statistics.html +++ b/docs/2.3/api/statistics.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/api/statistics">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/api/statistics">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify">Apify</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/configuration">Configuration</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/api/basic-crawler">Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/basic-crawler">BasicCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/cheerio-crawler">CheerioCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/playwright-crawler">PlaywrightCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/puppeteer-crawler">PuppeteerCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/api/statistics">Statistics</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/dataset">Result Stores</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/autoscaled-pool">Scaling</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/request">Sources</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/utils">Utilities</a></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">API Reference</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Statistics</h1></header><a name="statistics"></a><p>The statistics class provides an interface to collecting and logging run statistics for requests.</p><p>All statistic information is saved on key value store under the key SDK<em>CRAWLER_STATISTICS</em>*<!-- -->, persists between migrations and abort/resurrect</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="state"><code>state</code><a href="#state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/statistic-state"><code>StatisticState</code></a></p><p>Current statistic state used for doing calculations on <a href="/sdk/js/docs/2.3/api/statistics#calculate"><code>Statistics.calculate()</code></a> calls</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Statistic instance id</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><p>Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on</p><hr><a name="reset"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsreset"><code>statistics.reset()</code><a href="#statisticsreset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Set the current statistic instance to pristine values</p><hr><a name="calculate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticscalculate"><code>statistics.calculate()</code><a href="#statisticscalculate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Calculate the current statistics</p><hr><a name="startcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstartcapturing"><code>statistics.startCapturing()</code><a href="#statisticsstartcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals</p><hr><a name="stopcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstopcapturing"><code>statistics.stopCapturing()</code><a href="#statisticsstopcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stops logging and remove event listeners, then persist</p><hr><a name="persiststate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticspersiststate"><code>statistics.persistState()</code><a href="#statisticspersiststate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Persist internal state to the key value store</p><hr><a name="tojson"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticstojson"><code>statistics.toJSON()</code><a href="#statisticstojson" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Make this class serializable when called with <code>JSON.stringify(statsInstance)</code> directly or through <code>keyValueStore.setValue('KEY', statsInstance)</code></p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/statistic-persisted-state"><code>StatisticPersistedState</code></a> <!-- -->|<!-- --> <a href="/sdk/js/docs/2.3/typedefs/statistic-state"><code>StatisticState</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Statistics.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li></ul></li><li><a href="#statisticsreset" class="table-of-contents__link toc-highlight"><code>statistics.reset()</code></a></li><li><a href="#statisticscalculate" class="table-of-contents__link toc-highlight"><code>statistics.calculate()</code></a></li><li><a href="#statisticsstartcapturing" class="table-of-contents__link toc-highlight"><code>statistics.startCapturing()</code></a></li><li><a href="#statisticsstopcapturing" class="table-of-contents__link toc-highlight"><code>statistics.stopCapturing()</code></a></li><li><a href="#statisticspersiststate" class="table-of-contents__link toc-highlight"><code>statistics.persistState()</code></a></li><li><a href="#statisticstojson" class="table-of-contents__link toc-highlight"><code>statistics.toJSON()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/api/statistics">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/api/statistics">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify">Apify</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/configuration">Configuration</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/api/basic-crawler">Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/basic-crawler">BasicCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/cheerio-crawler">CheerioCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/playwright-crawler">PlaywrightCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/puppeteer-crawler">PuppeteerCrawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/api/statistics">Statistics</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/dataset">Result Stores</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/autoscaled-pool">Scaling</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/request">Sources</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/api/utils">Utilities</a></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">API Reference</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Statistics</h1></header><a name="statistics"></a><p>The statistics class provides an interface to collecting and logging run statistics for requests.</p><p>All statistic information is saved on key value store under the key SDK<em>CRAWLER_STATISTICS</em>*<!-- -->, persists between migrations and abort/resurrect</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="state"><code>state</code><a href="#state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/statistic-state"><code>StatisticState</code></a></p><p>Current statistic state used for doing calculations on <a href="/sdk/js/docs/2.3/api/statistics#calculate"><code>Statistics.calculate()</code></a> calls</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Statistic instance id</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><p>Contains the current retries histogram. Index 0 means 0 retries, index 2, 2 retries, and so on</p><hr><a name="reset"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsreset"><code>statistics.reset()</code><a href="#statisticsreset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Set the current statistic instance to pristine values</p><hr><a name="calculate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticscalculate"><code>statistics.calculate()</code><a href="#statisticscalculate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Calculate the current statistics</p><hr><a name="startcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstartcapturing"><code>statistics.startCapturing()</code><a href="#statisticsstartcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Initializes the key value store for persisting the statistics, displaying the current state in predefined intervals</p><hr><a name="stopcapturing"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticsstopcapturing"><code>statistics.stopCapturing()</code><a href="#statisticsstopcapturing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Stops logging and remove event listeners, then persist</p><hr><a name="persiststate"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticspersiststate"><code>statistics.persistState()</code><a href="#statisticspersiststate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Persist internal state to the key value store</p><hr><a name="tojson"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="statisticstojson"><code>statistics.toJSON()</code><a href="#statisticstojson" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Make this class serializable when called with <code>JSON.stringify(statsInstance)</code> directly or through <code>keyValueStore.setValue('KEY', statsInstance)</code></p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/statistic-persisted-state"><code>StatisticPersistedState</code></a> <!-- -->|<!-- --> <a href="/sdk/js/docs/2.3/typedefs/statistic-state"><code>StatisticState</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/Statistics.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li></ul></li><li><a href="#statisticsreset" class="table-of-contents__link toc-highlight"><code>statistics.reset()</code></a></li><li><a href="#statisticscalculate" class="table-of-contents__link toc-highlight"><code>statistics.calculate()</code></a></li><li><a href="#statisticsstartcapturing" class="table-of-contents__link toc-highlight"><code>statistics.startCapturing()</code></a></li><li><a href="#statisticsstopcapturing" class="table-of-contents__link toc-highlight"><code>statistics.stopCapturing()</code></a></li><li><a href="#statisticspersiststate" class="table-of-contents__link toc-highlight"><code>statistics.persistState()</code></a></li><li><a href="#statisticstojson" class="table-of-contents__link toc-highlight"><code>statistics.toJSON()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/system-status.html b/docs/2.3/api/system-status.html index 83f8807c48..e9bf5ba17c 100644 --- a/docs/2.3/api/system-status.html +++ b/docs/2.3/api/system-status.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ for the calculation.</p><p><a href="/sdk/js/docs/2.3/api/system-status#gethistoricalstatus"><code>SystemStatus.getHistoricalStatus()</code></a> returns a boolean that represents the long-term status of the system. It considers the full snapshot history available in the <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a> instance.</p><hr><a name="systemstatus"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="new-systemstatusoptions"><code>new SystemStatus([options])</code><a href="#new-systemstatusoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><strong>Parameters</strong>:</p><ul><li><strong><code>[options]</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/system-status-options"><code>SystemStatusOptions</code></a> - All <code>SystemStatus</code> configuration options.</li></ul><hr><a name="getcurrentstatus"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="systemstatusgetcurrentstatus"><code>systemStatus.getCurrentStatus()</code><a href="#systemstatusgetcurrentstatus" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an <a href="/sdk/js/docs/2.3/typedefs/system-info"><code>SystemInfo</code></a> object with the following structure:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">isSystemIdle</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Boolean</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">memInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">eventLoopInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">cpuInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Where the <code>isSystemIdle</code> property is set to <code>false</code> if the system has been overloaded in the last <code>options.currentHistorySecs</code> seconds, and <code>true</code> otherwise.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/system-info"><code>SystemInfo</code></a></p><hr><a name="gethistoricalstatus"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="systemstatusgethistoricalstatus"><code>systemStatus.getHistoricalStatus()</code><a href="#systemstatusgethistoricalstatus" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Returns an <a href="/sdk/js/docs/2.3/typedefs/system-info"><code>SystemInfo</code></a> object with the following structure:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">isSystemIdle</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Boolean</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">memInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">eventLoopInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">cpuInfo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token known-class-name class-name">Object</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Where the <code>isSystemIdle</code> property is set to <code>false</code> if the system has been overloaded in the full history of the <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a> -(which is configurable in the <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a>) and <code>true</code> otherwise.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/system-info"><code>SystemInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SystemStatus.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/snapshotter"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Snapshotter</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-systemstatusoptions" class="table-of-contents__link toc-highlight"><code>new SystemStatus([options])</code></a></li><li><a href="#systemstatusgetcurrentstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getCurrentStatus()</code></a></li><li><a href="#systemstatusgethistoricalstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getHistoricalStatus()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +(which is configurable in the <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a>) and <code>true</code> otherwise.</p><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/system-info"><code>SystemInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/SystemStatus.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/snapshotter"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Snapshotter</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#new-systemstatusoptions" class="table-of-contents__link toc-highlight"><code>new SystemStatus([options])</code></a></li><li><a href="#systemstatusgetcurrentstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getCurrentStatus()</code></a></li><li><a href="#systemstatusgethistoricalstatus" class="table-of-contents__link toc-highlight"><code>systemStatus.getHistoricalStatus()</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/api/utils.html b/docs/2.3/api/utils.html index 39a932e07b..cef65a1648 100644 --- a/docs/2.3/api/utils.html +++ b/docs/2.3/api/utils.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -47,8 +47,8 @@ newlines and whitespaces in and around HTML elements to avoid merging distinct parts of text and thus enable extraction of data from the text (e.g. phone numbers).</p><p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">htmlToText</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'<html><body>Some text</body></html>'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">text</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that the function uses <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">cheerio</a> to parse the HTML. Optionally, to avoid duplicate parsing of HTML and thus improve performance, you can pass an existing Cheerio object to the function instead of the HTML text. The HTML should be parsed with the -<code>decodeEntities</code> option set to <code>true</code>. For example:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> cheerio </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'cheerio'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'<html><body>Some text</body></html>'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">htmlToText</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cheerio</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">load</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">decodeEntities</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>html</code></strong>: <code>string</code> | <code>CheerioAPI</code> - HTML text or parsed HTML represented using a <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">cheerio</a> function.</li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - Plain text</p><hr><a name="purgelocalstorage"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="utilspurgelocalstoragefolder"><code>utils.purgeLocalStorage([folder])</code><a href="#utilspurgelocalstoragefolder" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Cleans up the local storage folder created when testing locally. This is useful in the event you are debugging your code locally.</p><p>Be careful as this will remove the folder you provide and everything in it!</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[folder]</code></strong>: <code>string</code> - The folder to clean up</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/utils.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/pseudo-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PseudoUrl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#utilsurl_no_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_NO_COMMAS_REGEX</code></a></li><li><a href="#utilsurl_with_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_WITH_COMMAS_REGEX</code></a></li><li><a href="#utilsenqueuelinksoptions" class="table-of-contents__link toc-highlight"><code>utils.enqueueLinks(options)</code></a></li><li><a href="#utilsrequestasbrowseroptions" class="table-of-contents__link toc-highlight"><code>utils.requestAsBrowser(options)</code></a></li><li><a href="#utilsisdockerforcereset" class="table-of-contents__link toc-highlight"><code>utils.isDocker(forceReset)</code></a></li><li><a href="#utilssleepmillis" class="table-of-contents__link toc-highlight"><code>utils.sleep(millis)</code></a></li><li><a href="#utilsdownloadlistofurlsoptions" class="table-of-contents__link toc-highlight"><code>utils.downloadListOfUrls(options)</code></a></li><li><a href="#utilsextracturlsoptions" class="table-of-contents__link toc-highlight"><code>utils.extractUrls(options)</code></a></li><li><a href="#utilshtmltotexthtml" class="table-of-contents__link toc-highlight"><code>utils.htmlToText(html)</code></a></li><li><a href="#utilspurgelocalstoragefolder" class="table-of-contents__link toc-highlight"><code>utils.purgeLocalStorage([folder])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>decodeEntities</code> option set to <code>true</code>. For example:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> cheerio </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'cheerio'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'<html><body>Some text</body></html>'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> text </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">htmlToText</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">cheerio</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">load</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">decodeEntities</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Parameters</strong>:</p><ul><li><strong><code>html</code></strong>: <code>string</code> | <code>CheerioAPI</code> - HTML text or parsed HTML represented using a <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">cheerio</a> function.</li></ul><p><strong>Returns</strong>:</p><p><code>string</code> - Plain text</p><hr><a name="purgelocalstorage"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="utilspurgelocalstoragefolder"><code>utils.purgeLocalStorage([folder])</code><a href="#utilspurgelocalstoragefolder" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Cleans up the local storage folder created when testing locally. This is useful in the event you are debugging your code locally.</p><p>Be careful as this will remove the folder you provide and everything in it!</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>[folder]</code></strong>: <code>string</code> - The folder to clean up</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/api/utils.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/pseudo-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PseudoUrl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">utils.log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#utilsurl_no_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_NO_COMMAS_REGEX</code></a></li><li><a href="#utilsurl_with_commas_regex" class="table-of-contents__link toc-highlight"><code>utils.URL_WITH_COMMAS_REGEX</code></a></li><li><a href="#utilsenqueuelinksoptions" class="table-of-contents__link toc-highlight"><code>utils.enqueueLinks(options)</code></a></li><li><a href="#utilsrequestasbrowseroptions" class="table-of-contents__link toc-highlight"><code>utils.requestAsBrowser(options)</code></a></li><li><a href="#utilsisdockerforcereset" class="table-of-contents__link toc-highlight"><code>utils.isDocker(forceReset)</code></a></li><li><a href="#utilssleepmillis" class="table-of-contents__link toc-highlight"><code>utils.sleep(millis)</code></a></li><li><a href="#utilsdownloadlistofurlsoptions" class="table-of-contents__link toc-highlight"><code>utils.downloadListOfUrls(options)</code></a></li><li><a href="#utilsextracturlsoptions" class="table-of-contents__link toc-highlight"><code>utils.extractUrls(options)</code></a></li><li><a href="#utilshtmltotexthtml" class="table-of-contents__link toc-highlight"><code>utils.htmlToText(html)</code></a></li><li><a href="#utilspurgelocalstoragefolder" class="table-of-contents__link toc-highlight"><code>utils.purgeLocalStorage([folder])</code></a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/changelog.html b/docs/2.3/changelog.html index 81b8fedeb0..46a67d8768 100644 --- a/docs/2.3/changelog.html +++ b/docs/2.3/changelog.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/changelog">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/changelog">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/changelog">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/changelog">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/changelog">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/changelog">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Changelog</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.12" target="_blank" rel="noopener">apify@3.1.12</a><a href="#apify3112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3112-2023-10-05"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.11...apify@3.1.12" target="_blank" rel="noopener">3.1.12</a> (2023-10-05)<a href="#3112-2023-10-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add more logging to <code>Actor.init</code> and <code>Actor.exit</code> (<a href="https://github.com/apify/apify-sdk-js/issues/236" target="_blank" rel="noopener">#236</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/b7e01fc649de84d6f1391bf95e0f349f7ca32536" target="_blank" rel="noopener">b7e01fc</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3111"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.11" target="_blank" rel="noopener">apify@3.1.11</a><a href="#apify3111" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3111-2023-10-04"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.10...apify@3.1.11" target="_blank" rel="noopener">3.1.11</a> (2023-10-04)<a href="#3111-2023-10-04" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-1">Bug Fixes<a href="#bug-fixes-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>run the whole <code>Actor.exit()</code> code inside a timeout handler (<a href="https://github.com/apify/apify-sdk-js/issues/235" target="_blank" rel="noopener">#235</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c8aabaee5f2de1ab40947f47f95f54ccff37cad0" target="_blank" rel="noopener">c8aabae</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features">Features<a href="#features" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use <code>.reboot()</code> instead of <code>.metamorph()</code> for reboot (<a href="https://github.com/apify/apify-sdk-js/issues/227" target="_blank" rel="noopener">#227</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/8c0bff5a8d3ea65e532b3700b34b9c563856158a" target="_blank" rel="noopener">8c0bff5</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.10" target="_blank" rel="noopener">apify@3.1.10</a><a href="#apify3110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3110-2023-09-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.9...apify@3.1.10" target="_blank" rel="noopener">3.1.10</a> (2023-09-07)<a href="#3110-2023-09-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-2">Bug Fixes<a href="#bug-fixes-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of crawlee to fix possible issues with <code>purgeDefaultStorages</code> (<a href="https://github.com/apify/apify-sdk-js/issues/226" target="_blank" rel="noopener">#226</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/95cf31f3d1d054a1c8e3daac89f41bbb0aaddbba" target="_blank" rel="noopener">95cf31f</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify319"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.9" target="_blank" rel="noopener">apify@3.1.9</a><a href="#apify319" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="319-2023-09-06"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.8...apify@3.1.9" target="_blank" rel="noopener">3.1.9</a> (2023-09-06)<a href="#319-2023-09-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">@apify/scraper-tools@1.1.2</a><a href="#apifyscraper-tools112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="112-2023-07-28"><a href="https://github.com/apify/apify-sdk-js/compare/@apify/scraper-tools@1.1.1...@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">1.1.2</a> (2023-07-28)<a href="#112-2023-07-28" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-3">Bug Fixes<a href="#bug-fixes-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-1">Features<a href="#features-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify318"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.8" target="_blank" rel="noopener">apify@3.1.8</a><a href="#apify318" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="318-2023-07-20"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.7...apify@3.1.8" target="_blank" rel="noopener">3.1.8</a> (2023-07-20)<a href="#318-2023-07-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-4">Bug Fixes<a href="#bug-fixes-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of apify-client and other packages (<a href="https://github.com/apify/apify-sdk-js/commit/24a3a4b5bf2f61e690348727e7f24c06c45a0999" target="_blank" rel="noopener">24a3a4b</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-2">Features<a href="#features-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use Actor env vars (<a href="https://github.com/apify/apify-sdk-js/issues/216" target="_blank" rel="noopener">#216</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/11ff740ad3d2bdd37fce011d94b64ea01413b0d9" target="_blank" rel="noopener">11ff740</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify317"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.7" target="_blank" rel="noopener">apify@3.1.7</a><a href="#apify317" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="317-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.6...apify@3.1.7" target="_blank" rel="noopener">3.1.7</a> (2023-06-09)<a href="#317-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify316"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.6" target="_blank" rel="noopener">apify@3.1.6</a><a href="#apify316" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="316-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.5...apify@3.1.6" target="_blank" rel="noopener">3.1.6</a> (2023-06-09)<a href="#316-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-5">Bug Fixes<a href="#bug-fixes-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>only print status message when explicitly provided in <code>Actor.exit()</code> (<a href="https://github.com/apify/apify-sdk-js/issues/203" target="_blank" rel="noopener">#203</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/85159e499984c78eee90b6d92332ea63b9f46c8c" target="_blank" rel="noopener">85159e4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify315"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.5" target="_blank" rel="noopener">apify@3.1.5</a><a href="#apify315" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="315-2023-05-31"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.4...apify@3.1.5" target="_blank" rel="noopener">3.1.5</a> (2023-05-31)<a href="#315-2023-05-31" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-6">Bug Fixes<a href="#bug-fixes-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add missing <code>options</code> parameter to <code>Actor.setStatusMessage()</code> (<a href="https://github.com/apify/apify-sdk-js/commit/712e8c66755ac8baeb35fcc1ad000487da8b2c48" target="_blank" rel="noopener">712e8c6</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-3">Features<a href="#features-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.getInputOrThrow()</code> method (<a href="https://github.com/apify/apify-sdk-js/issues/198" target="_blank" rel="noopener">#198</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/5fbbfe4960a79fbbd23f4fdd7d07a1a5063820f4" target="_blank" rel="noopener">5fbbfe4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify314"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.4" target="_blank" rel="noopener">apify@3.1.4</a><a href="#apify314" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="314-2023-03-23"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.3...apify@3.1.4" target="_blank" rel="noopener">3.1.4</a> (2023-03-23)<a href="#314-2023-03-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-7">Bug Fixes<a href="#bug-fixes-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>log status message only once and without prefix (<a href="https://github.com/apify/apify-sdk-js/issues/179" target="_blank" rel="noopener">#179</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1f11a6ad8ebc8a0cfaef58be47ba8b12c75018f1" target="_blank" rel="noopener">1f11a6a</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify313"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.3" target="_blank" rel="noopener">apify@3.1.3</a><a href="#apify313" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="313-2023-03-22"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.2...apify@3.1.3" target="_blank" rel="noopener">3.1.3</a> (2023-03-22)<a href="#313-2023-03-22" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-8">Bug Fixes<a href="#bug-fixes-8" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><code>call/callTask</code> accept <code>waitSecs</code> instead of <code>waitForFinish</code> (<a href="https://github.com/apify/apify-sdk-js/issues/176" target="_blank" rel="noopener">#176</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/f0c73d8765091212f2abb4b4faaf109f9447d90a" target="_blank" rel="noopener">f0c73d8</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-4">Features<a href="#features-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify312"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.2" target="_blank" rel="noopener">apify@3.1.2</a><a href="#apify312" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="312-2023-02-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.1...apify@3.1.2" target="_blank" rel="noopener">3.1.2</a> (2023-02-07)<a href="#312-2023-02-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-9">Bug Fixes<a href="#bug-fixes-9" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li><li>remove unused export of <code>QueueOperationInfoOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/b29fe4853d637ab527a7f7e3e53c7a5b0fe27a32" target="_blank" rel="noopener">b29fe48</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify311"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.1" target="_blank" rel="noopener">apify@3.1.1</a><a href="#apify311" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="311-2022-11-13"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.0...apify@3.1.1" target="_blank" rel="noopener">3.1.1</a> (2022-11-13)<a href="#311-2022-11-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-5">Features<a href="#features-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>statusMessage</code> to <code>AbortOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/fb10bb60c12c0af97e41ae88adcf0b2000286235" target="_blank" rel="noopener">fb10bb6</a>)</li><li>warn about actor not being initialized before using storage methods (<a href="https://github.com/apify/apify-sdk-js/issues/126" target="_blank" rel="noopener">#126</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/91cd2467d111de19490a6bf47b4a9138f26a37d4" target="_blank" rel="noopener">91cd246</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify310"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.0" target="_blank" rel="noopener">apify@3.1.0</a><a href="#apify310" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="310-2022-10-13">3.1.0 (2022-10-13)<a href="#310-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-10">Bug Fixes<a href="#bug-fixes-10" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><strong>apify:</strong> add <code>@apify/timeout</code> to dependencies (<a href="https://github.com/apify/apify-sdk-js/issues/76" target="_blank" rel="noopener">#76</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1d64a1fa8f0e88a96eb82c2669e85b09dd4f372d" target="_blank" rel="noopener">1d64a1f</a>)</li><li>use correct event manager for actor methods (<a href="https://github.com/apify/apify-sdk-js/issues/49" target="_blank" rel="noopener">#49</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/ef3a0c54359be64c89e76b0cac600cd780281321" target="_blank" rel="noopener">ef3a0c5</a>)</li><li>wait for memory storage to write changes before <code>Actor.exit</code> exists the process (<a href="https://github.com/apify/apify-sdk-js/commit/c721d988141cf5b7aa170fddeffb792ded769622" target="_blank" rel="noopener">c721d98</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-6">Features<a href="#features-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li><strong>apify:</strong> add decryption for input secrets (<a href="https://github.com/apify/apify-sdk-js/issues/83" target="_blank" rel="noopener">#83</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/78bb990817c01254de19c828937181c1263e21eb" target="_blank" rel="noopener">78bb990</a>)</li><li>re-export the logger in actor sdk (<a href="https://github.com/apify/apify-sdk-js/issues/54" target="_blank" rel="noopener">#54</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c78d8a44d7af5de7fda7bf2e436fefda752a4b1a" target="_blank" rel="noopener">c78d8a4</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.0" target="_blank" rel="noopener">@apify/scraper-tools@1.1.0</a><a href="#apifyscraper-tools110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="110-2022-10-13">1.1.0 (2022-10-13)<a href="#110-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-7">Features<a href="#features-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li>add playwright scraper (<a href="https://github.com/apify/apify-sdk-js/issues/26" target="_blank" rel="noopener">#26</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/2dcd50ded777ae13bc7b75e6e0bc21a6a11315b7" target="_blank" rel="noopener">2dcd50d</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/changelog.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/system-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify3112" class="table-of-contents__link toc-highlight">apify@3.1.12</a></li><li><a href="#apify3111" class="table-of-contents__link toc-highlight">apify@3.1.11</a></li><li><a href="#apify3110" class="table-of-contents__link toc-highlight">apify@3.1.10</a></li><li><a href="#apify319" class="table-of-contents__link toc-highlight">apify@3.1.9</a></li><li><a href="#apifyscraper-tools112" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.2</a></li><li><a href="#apify318" class="table-of-contents__link toc-highlight">apify@3.1.8</a></li><li><a href="#apify317" class="table-of-contents__link toc-highlight">apify@3.1.7</a></li><li><a href="#apify316" class="table-of-contents__link toc-highlight">apify@3.1.6</a></li><li><a href="#apify315" class="table-of-contents__link toc-highlight">apify@3.1.5</a></li><li><a href="#apify314" class="table-of-contents__link toc-highlight">apify@3.1.4</a></li><li><a href="#apify313" class="table-of-contents__link toc-highlight">apify@3.1.3</a></li><li><a href="#apify312" class="table-of-contents__link toc-highlight">apify@3.1.2</a></li><li><a href="#apify311" class="table-of-contents__link toc-highlight">apify@3.1.1</a></li><li><a href="#apify310" class="table-of-contents__link toc-highlight">apify@3.1.0</a></li><li><a href="#apifyscraper-tools110" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.0</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples.html b/docs/2.3/examples.html index f119a0062c..b8c8116b70 100644 --- a/docs/2.3/examples.html +++ b/docs/2.3/examples.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><header><h1 class="title_kItE">Examples</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/accept-user-input"><h2 class="text--truncate cardTitle_rnsV" title="Accept user input">📄️<!-- --> <!-- -->Accept user input</h2><p class="text--truncate cardDescription_PWke" title="This example accepts and logs user input:">This example accepts and logs user input:</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/add-data-to-dataset"><h2 class="text--truncate cardTitle_rnsV" title="Add data to dataset">📄️<!-- --> <!-- -->Add data to dataset</h2><p class="text--truncate cardDescription_PWke" title="This example saves data to the default dataset. If the dataset doesn't exist, it will be created.">This example saves data to the default dataset. If the dataset doesn't exist, it will be created.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/basic-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Basic crawler">📄️<!-- --> <!-- -->Basic crawler</h2><p class="text--truncate cardDescription_PWke" title="This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the">This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/call-actor"><h2 class="text--truncate cardTitle_rnsV" title="Call actor">📄️<!-- --> <!-- -->Call actor</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to start an Apify actor using">This example demonstrates how to start an Apify actor using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/capture-screenshot"><h2 class="text--truncate cardTitle_rnsV" title="Capture a screenshot">📄️<!-- --> <!-- -->Capture a screenshot</h2><p class="text--truncate cardDescription_PWke" title="To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.">To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/cheerio-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Cheerio crawler">📄️<!-- --> <!-- -->Cheerio crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use CheerioCrawler">This example demonstrates how to use CheerioCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/crawl-all-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl all links on a website">📄️<!-- --> <!-- -->Crawl all links on a website</h2><p class="text--truncate cardDescription_PWke" title="This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates">This example uses the Apify.enqueueLinks() method to add new links to the RequestQueue as the crawler navigates</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls"><h2 class="text--truncate cardTitle_rnsV" title="Crawl multiple URLs">📄️<!-- --> <!-- -->Crawl multiple URLs</h2><p class="text--truncate cardDescription_PWke" title="This example crawls the specified list of URLs.">This example crawls the specified list of URLs.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/crawl-relative-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a website with relative links">📄️<!-- --> <!-- -->Crawl a website with relative links</h2><p class="text--truncate cardDescription_PWke" title="If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may">If a website uses relative links, CheerioCrawler and Apify.enqueueLinks() may</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/crawl-single-url"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a single URL">📄️<!-- --> <!-- -->Crawl a single URL</h2><p class="text--truncate cardDescription_PWke" title="This example uses the Apify.utils.requestAsBrowser() function to grab the">This example uses the Apify.utils.requestAsBrowser() function to grab the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/crawl-sitemap"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a sitemap">📄️<!-- --> <!-- -->Crawl a sitemap</h2><p class="text--truncate cardDescription_PWke" title="This example downloads and crawls the URLs from a sitemap.">This example downloads and crawls the URLs from a sitemap.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/crawl-some-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl some links on a website">📄️<!-- --> <!-- -->Crawl some links on a website</h2><p class="text--truncate cardDescription_PWke" title="This CheerioCrawler example uses the pseudoUrls property">This CheerioCrawler example uses the pseudoUrls property</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/forms"><h2 class="text--truncate cardTitle_rnsV" title="Forms">📄️<!-- --> <!-- -->Forms</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler">This example demonstrates how to use PuppeteerCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/map-and-reduce"><h2 class="text--truncate cardTitle_rnsV" title="Dataset Map and Reduce methods">📄️<!-- --> <!-- -->Dataset Map and Reduce methods</h2><p class="text--truncate cardDescription_PWke" title="This example shows an easy use-case of the Apify dataset">This example shows an easy use-case of the Apify dataset</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/playwright-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Playwright crawler">📄️<!-- --> <!-- -->Playwright crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PlaywrightCrawler">This example demonstrates how to use PlaywrightCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/puppeteer-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer crawler">📄️<!-- --> <!-- -->Puppeteer crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler">This example demonstrates how to use PuppeteerCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer recursive crawl">📄️<!-- --> <!-- -->Puppeteer recursive crawl</h2><p class="text--truncate cardDescription_PWke" title="Run the following example to perform a recursive crawl">Run the following example to perform a recursive crawl</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer with proxy">📄️<!-- --> <!-- -->Puppeteer with proxy</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to load pages in headless Chrome / Puppeteer">This example demonstrates how to load pages in headless Chrome / Puppeteer</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/synchronous-run"><h2 class="text--truncate cardTitle_rnsV" title="Synchronous run">📄️<!-- --> <!-- -->Synchronous run</h2><p class="text--truncate cardDescription_PWke" title="This example shows a quick actor that has a run time of just a few seconds.">This example shows a quick actor that has a run time of just a few seconds.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/2.3/examples/use-stealth-mode"><h2 class="text--truncate cardTitle_rnsV" title="Use stealth mode">📄️<!-- --> <!-- -->Use stealth mode</h2><p class="text--truncate cardDescription_PWke" title="Deprecated: This example is deprecated. Checkout the Avoid getting blocked guide.">Deprecated: This example is deprecated. Checkout the Avoid getting blocked guide.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/avoid-blocking"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Avoid getting blocked</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/accept-user-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Accept user input</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/accept-user-input.html b/docs/2.3/examples/accept-user-input.html index 271b8d7298..eab81e15d1 100644 --- a/docs/2.3/examples/accept-user-input.html +++ b/docs/2.3/examples/accept-user-input.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to -the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/accept_user_input.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/accept_user_input.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/add-data-to-dataset.html b/docs/2.3/examples/add-data-to-dataset.html index cb5ea6fc5c..95d3afad8e 100644 --- a/docs/2.3/examples/add-data-to-dataset.html +++ b/docs/2.3/examples/add-data-to-dataset.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/add-data-to-dataset">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/add-data-to-dataset">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/add-data-to-dataset">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Add data to dataset</h1></header><p>This example saves data to the default dataset. If the dataset doesn't exist, it will be created. -You can save data to custom datasets by using <a href="/sdk/js/docs/2.3/api/apify#opendataset"><code>Apify.openDataset()</code></a></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">CheerioCrawler</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">requestHandler</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> body </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestHandler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/add_data_to_dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +You can save data to custom datasets by using <a href="/sdk/js/docs/2.3/api/apify#opendataset"><code>Apify.openDataset()</code></a></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">CheerioCrawler</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">requestHandler</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> body </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestHandler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/apify_storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/add_data_to_dataset.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/basic-crawler.html b/docs/2.3/examples/basic-crawler.html index 008b4003c1..bcf86186f0 100644 --- a/docs/2.3/examples/basic-crawler.html +++ b/docs/2.3/examples/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ featured crawlers like <a href="https://sdk.apify.com/docs/examples/cheerio-crawler"><code>CheerioCrawler</code></a> or <a href="https://sdk.apify.com/docs/examples/playwright-crawler"><code>PlaywrightCrawler</code></a>.</p><p>The script simply downloads several web pages with plain HTTP requests using the <a href="/sdk/js/docs/api/utils#requestasbrowser"><code>Apify.utils.requestAsBrowser()</code></a> convenience function and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in -<code>./apify_storage/datasets/default</code>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and initialize an instance of the RequestList class that contains</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// a list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils requestAsBrowser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/basic_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>./apify_storage/datasets/default</code>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and initialize an instance of the RequestList class that contains</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// a list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils requestAsBrowser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/basic_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/call-actor.html b/docs/2.3/examples/call-actor.html index f10978b90b..c86577baf2 100644 --- a/docs/2.3/examples/call-actor.html +++ b/docs/2.3/examples/call-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ and set it to the <a href="/sdk/js/docs/guides/environment-variables#APIFY_TOKEN"><code>APIFY_TOKEN</code></a> environment variable, or run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>Node.js 12 + Chrome on Debian (apify/actor-node-chrome)</code> -base image on the <strong>Source</strong> tab when configuring the actor.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> user </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Apify.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> user</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/call_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +base image on the <strong>Source</strong> tab when configuring the actor.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> user </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Apify.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> user</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/call_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/capture-screenshot.html b/docs/2.3/examples/capture-screenshot.html index 67dd0bb97c..c87dd175ab 100644 --- a/docs/2.3/examples/capture-screenshot.html +++ b/docs/2.3/examples/capture-screenshot.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ Using <code>Apify.utils.puppeteer.saveSnapshot()</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">key</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This example captures a screenshot of multiple web pages when using <code>PuppeteerCrawler</code>:</p><p>\ Using <code>page.screenshot()</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot with Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>Apify.utils.puppeteer.saveSnapshot()</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>In both examples using <code>page.screenshot()</code>, a <code>key</code> variable is created based on the URL of the web page. -This variable is used as the key when saving each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/capture_screenshot.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +This variable is used as the key when saving each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/capture_screenshot.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/cheerio-crawler.html b/docs/2.3/examples/cheerio-crawler.html index 8e60ec7c29..0315f8513d 100644 --- a/docs/2.3/examples/cheerio-crawler.html +++ b/docs/2.3/examples/cheerio-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/cheerio-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="/sdk/js/docs/api/cheerio-crawler"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> -and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.utils contains various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">LEVELS</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the RequestList class that contains a list of URLs to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">handlePageTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./apify_storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/cheerio_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.utils contains various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">LEVELS</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Apify.main() function wraps the crawler logic (it is optional).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the RequestList class that contains a list of URLs to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Let the crawler fetch URLs from our list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">handlePageTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./apify_storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/cheerio_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/crawl-all-links.html b/docs/2.3/examples/crawl-all-links.html index e8fb0a7e26..4f69506748 100644 --- a/docs/2.3/examples/crawl-all-links.html +++ b/docs/2.3/examples/crawl-all-links.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ from page to page. If only the required parameters are defined, all links will be crawled.</p><p>\ Using <code>CheerioCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>PuppeteerCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ -Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_all_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_all_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/crawl-multiple-urls.html b/docs/2.3/examples/crawl-multiple-urls.html index b38b57b35a..c5e450d0eb 100644 --- a/docs/2.3/examples/crawl-multiple-urls.html +++ b/docs/2.3/examples/crawl-multiple-urls.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-multiple-urls">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><p>\ Using <code>CheerioCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>PuppeteerCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ -Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_multiple_urls.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Using <code>PlaywrightCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestList</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_multiple_urls.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/crawl-relative-links.html b/docs/2.3/examples/crawl-relative-links.html index 6472882e48..5e34fe101e 100644 --- a/docs/2.3/examples/crawl-relative-links.html +++ b/docs/2.3/examples/crawl-relative-links.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-relative-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-relative-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-relative-links">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/crawl-relative-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-relative-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-relative-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a website with relative links</h1></header><p>If a website uses relative links, <a href="/sdk/js/docs/api/cheerio-crawler"><code>CheerioCrawler</code></a> and <code>Apify.enqueueLinks()</code> may have trouble following them. -This is why it is important to set the <code>baseUrl</code> property within <code>Apify.enqueueLinks()</code> to <code>request.loadedUrl</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <-------------- important to set the base url here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_relative_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +This is why it is important to set the <code>baseUrl</code> property within <code>Apify.enqueueLinks()</code> to <code>request.loadedUrl</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// <-------------- important to set the base url here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_relative_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/crawl-single-url.html b/docs/2.3/examples/crawl-single-url.html index 456e0ff968..8bc133d528 100644 --- a/docs/2.3/examples/crawl-single-url.html +++ b/docs/2.3/examples/crawl-single-url.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-single-url">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-single-url">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-single-url">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/crawl-single-url">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-single-url">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-single-url">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a single URL</h1></header><p>This example uses the <a href="/sdk/js/docs/api/utils#utilsrequestasbrowseroptions"><code>Apify.utils.requestAsBrowser()</code></a> function to grab the -HTML of a web page.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/2.3/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_single_url.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +HTML of a web page.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/2.3/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_single_url.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/crawl-sitemap.html b/docs/2.3/examples/crawl-sitemap.html index a1954ef890..bf8df58e00 100644 --- a/docs/2.3/examples/crawl-sitemap.html +++ b/docs/2.3/examples/crawl-sitemap.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-sitemap">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><p>\ Using <code>CheerioCrawler</code>:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that uses Cheerio</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ Using <code>PuppeteerCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that runs Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>\ -Using <code>PlaywrightCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that runs Playwright</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_sitemap.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Using <code>PlaywrightCrawler</code>:</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add URLs to a RequestList from a sitemap</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestsFromUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a crawler that runs Playwright</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_sitemap.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/crawl-some-links.html b/docs/2.3/examples/crawl-some-links.html index fa1f21b7e2..e911b597cb 100644 --- a/docs/2.3/examples/crawl-some-links.html +++ b/docs/2.3/examples/crawl-some-links.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-some-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="/sdk/js/docs/api/cheerio-crawler"><code>CheerioCrawler</code></a> example uses the <a href="/sdk/js/docs/api/pseudo-url"><code>pseudoUrls</code></a> property in the <code>Apify.enqueueLinks()</code> method to only add links to the <code>RequestList</code> queue if -they match the specified regular expression.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_some_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +they match the specified regular expression.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">baseUrl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> handlePageFunction</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/crawl_some_links.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/forms.html b/docs/2.3/examples/forms.html index f357482505..81de6b299d 100644 --- a/docs/2.3/examples/forms.html +++ b/docs/2.3/examples/forms.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the default <a href="/sdk/js/docs/api/dataset"><code>dataset</code></a> -or on the local machine as JSON files in <code>./apify_storage/datasets/default</code>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/forms.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +or on the local machine as JSON files in <code>./apify_storage/datasets/default</code>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/forms.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/map-and-reduce.html b/docs/2.3/examples/map-and-reduce.html index 8eff237040..c84d0f50e6 100644 --- a/docs/2.3/examples/map-and-reduce.html +++ b/docs/2.3/examples/map-and-reduce.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -30,8 +30,8 @@ <a href="/sdk/js/docs/api/dataset#datasetreduceiteratee-memo-options"><code>memo</code> argument</a>. After performing the necessary calculation, the <code>memo</code> is sent to the next iteration, while the item just processed is reduced (removed).</p><p>Using the <code>reduce</code> method to get the total number of headers scraped (all items in the dataset):</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// open default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataSet </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// calling reduce function and using memo to calculate number of headers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> pagesHeadingCount </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataSet</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">memo</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> memo </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headingCount</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> memo</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// saving result of reduce to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_heading_count'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pagesHeadingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The original dataset will be reduced to a single value, <code>pagesHeadingCount</code>, which contains -the count of all headers for all scraped pages (all dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/docs/api/key-value-store">key-value store</a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/map_and_reduce.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +the count of all headers for all scraped pages (all dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/docs/api/key-value-store">key-value store</a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/map_and_reduce.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/playwright-crawler.html b/docs/2.3/examples/playwright-crawler.html index e62fe0834b..822bdb7ac1 100644 --- a/docs/2.3/examples/playwright-crawler.html +++ b/docs/2.3/examples/playwright-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Playwright.</p><p> The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results are stored to the default dataset. In local configuration, the results are stored as -JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/playwright_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/playwright_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/puppeteer-crawler.html b/docs/2.3/examples/puppeteer-crawler.html index 6d29a11622..2d15dd77cf 100644 --- a/docs/2.3/examples/puppeteer-crawler.html +++ b/docs/2.3/examples/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results are stored to the default dataset. In local configuration, the results are stored as -JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the Apify.launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +JSON files in <code>./apify_storage/datasets/default</code></p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Apify.openRequestQueue() creates a preconfigured RequestQueue instance.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We add our first request to it - the initial page the crawler will visit.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the Apify.launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleFailedRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_crawler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/puppeteer-recursive-crawl.html b/docs/2.3/examples/puppeteer-recursive-crawl.html index fe5fbdab81..9b27b0305f 100644 --- a/docs/2.3/examples/puppeteer-recursive-crawl.html +++ b/docs/2.3/examples/puppeteer-recursive-crawl.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl -of a website using <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_recursive_crawl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +of a website using <a href="/sdk/js/docs/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a>.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_recursive_crawl.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/puppeteer-with-proxy.html b/docs/2.3/examples/puppeteer-with-proxy.html index 0d53af71d4..4c279afcb7 100644 --- a/docs/2.3/examples/puppeteer-with-proxy.html +++ b/docs/2.3/examples/puppeteer-with-proxy.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>. To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find -how to log into your account from the SDK.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_with_proxy.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Synchronous run</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +how to log into your account from the SDK.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/puppeteer_with_proxy.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Synchronous run</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/synchronous-run.html b/docs/2.3/examples/synchronous-run.html index 38390de0a7..8cd1ec4275 100644 --- a/docs/2.3/examples/synchronous-run.html +++ b/docs/2.3/examples/synchronous-run.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ texts that change daily. The actor scrapes all the "Did you know" items and saves them to the default dataset.</p><p> This actor can be invoked synchronously using a single HTTP request to directly obtain its output as a response, using the <a href="https://apify.com/docs/api/v2#/reference/actors/run-actor-synchronously/without-input" target="_blank" rel="noopener">Run actor synchronously</a> -Apify API endpoint.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load https://en.wikipedia.org and get all "Did you know" texts.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Opening web page...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://en.wikipedia.org'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get all "Did you know" items from the page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Getting "Did you know" items from the page.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'div#mp-dyk > ul li'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Did you know'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save all the items to the Apify dataSet.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Actor finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/synchronous_run.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Use stealth mode</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Apify API endpoint.</p><blockquote><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Launch web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Load https://en.wikipedia.org and get all "Did you know" texts.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Opening web page...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://en.wikipedia.org'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get all "Did you know" items from the page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Getting "Did you know" items from the page.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'div#mp-dyk > ul li'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Did you know'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save all the items to the Apify dataSet.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Actor finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/synchronous_run.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples/use-stealth-mode"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Use stealth mode</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/examples/use-stealth-mode.html b/docs/2.3/examples/use-stealth-mode.html index 50ca9059c7..9fd4b58871 100644 --- a/docs/2.3/examples/use-stealth-mode.html +++ b/docs/2.3/examples/use-stealth-mode.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/use-stealth-mode">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/use-stealth-mode">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Use stealth mode</h1></header><blockquote><p><strong>Deprecated</strong>: This example is deprecated. Checkout the <a href="/sdk/js/docs/2.3/guides/avoid-blocking">Avoid getting blocked guide</a>.</p></blockquote><p>Stealth mode allows you to bypass anti-scraping techniques that use <a href="https://pixelprivacy.com/resources/browser-fingerprinting/" target="_blank" rel="noopener">browser fingerprinting</a>. It overrides the attributes specified for <a href="https://developers.google.com/web/updates/2017/04/headless-chrome" target="_blank" rel="noopener">headless</a> browser mode, making your headless browser harder to distinguish from the full Chrome browser.</p><p>To activate stealth mode, you need to <code>useChrome</code>, run <code>headless</code> and turn <code>stealth</code> on in your <a href="https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext"><code>launchContext</code></a>.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> launchContext </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">stealth</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">stealth</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You can override default stealth options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// stealthOptions: {</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// addLanguage: false,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// },</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the title of each post on Hacker News</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">The title is: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the data array to the Apify dataSet</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You can then specify the <a href="https://sdk.apify.com/docs/typedefs/stealth-options"><code>stealthOptions</code></a>, which allow you to adapt to different anti-scraping techniques. All the options are set to <code>true</code> by default. The number of options does not affect performance.</p><p>While the default configuration will be fine in many cases, you can adapt the options to your use case.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="single-browser-instances">Single-browser instances<a href="#single-browser-instances" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>You can also use stealth mode in single-browser instances when using <a href="https://sdk.apify.com/docs/api/apify#launchpuppeteer"><code>Apify.launchPuppeteer</code></a>. The <code>launchContext</code> is the same.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/use_stealth_mode.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Synchronous run</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/apify"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#single-browser-instances" class="table-of-contents__link toc-highlight">Single-browser instances</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/examples/use-stealth-mode">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/use-stealth-mode">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/capture-screenshot">Capture a screenshot</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/examples/synchronous-run">Synchronous run</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/examples/use-stealth-mode">Use stealth mode</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/2.3/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Use stealth mode</h1></header><blockquote><p><strong>Deprecated</strong>: This example is deprecated. Checkout the <a href="/sdk/js/docs/2.3/guides/avoid-blocking">Avoid getting blocked guide</a>.</p></blockquote><p>Stealth mode allows you to bypass anti-scraping techniques that use <a href="https://pixelprivacy.com/resources/browser-fingerprinting/" target="_blank" rel="noopener">browser fingerprinting</a>. It overrides the attributes specified for <a href="https://developers.google.com/web/updates/2017/04/headless-chrome" target="_blank" rel="noopener">headless</a> browser mode, making your headless browser harder to distinguish from the full Chrome browser.</p><p>To activate stealth mode, you need to <code>useChrome</code>, run <code>headless</code> and turn <code>stealth</code> on in your <a href="https://sdk.apify.com/docs/typedefs/puppeteer-crawler-options#launchcontext"><code>launchContext</code></a>.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> launchContext </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">stealth</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'start-urls'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">stealth</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You can override default stealth options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// stealthOptions: {</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// addLanguage: false,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// },</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get the title of each post on Hacker News</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">The title is: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the data array to the Apify dataSet</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You can then specify the <a href="https://sdk.apify.com/docs/typedefs/stealth-options"><code>stealthOptions</code></a>, which allow you to adapt to different anti-scraping techniques. All the options are set to <code>true</code> by default. The number of options does not affect performance.</p><p>While the default configuration will be fine in many cases, you can adapt the options to your use case.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="single-browser-instances">Single-browser instances<a href="#single-browser-instances" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>You can also use stealth mode in single-browser instances when using <a href="https://sdk.apify.com/docs/api/apify#launchpuppeteer"><code>Apify.launchPuppeteer</code></a>. The <code>launchContext</code> is the same.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/examples/use_stealth_mode.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/examples/synchronous-run"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Synchronous run</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/apify"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#single-browser-instances" class="table-of-contents__link toc-highlight">Single-browser instances</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/apify-platform.html b/docs/2.3/guides/apify-platform.html index 7bc74b17d4..5411c24a34 100644 --- a/docs/2.3/guides/apify-platform.html +++ b/docs/2.3/guides/apify-platform.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -38,8 +38,8 @@ as filling out a web form or sending an email, to complex operations such as crawling an entire website and removing duplicates from a large dataset.</p><p>Actors can be shared in the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a> so that other people can use them. But don't worry, if you share your actor in the store and somebody uses it, it runs under their account, -not yours.</p><p><strong>Related links</strong></p><ul><li><a href="https://apify.com/store" target="_blank" rel="noopener">Store of existing actors</a></li><li><a href="https://docs.apify.com/actor" target="_blank" rel="noopener">Documentation</a></li><li><a href="https://console.apify.com/actors" target="_blank" rel="noopener">View actors in Apify Console</a></li><li><a href="https://apify.com/docs/api/v2#/reference/actors" target="_blank" rel="noopener">API reference</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/apify_platform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/quick-start"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Quick Start</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/getting-started"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Getting Started</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-apify-sdk" class="table-of-contents__link toc-highlight">Logging into Apify platform from Apify SDK</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +not yours.</p><p><strong>Related links</strong></p><ul><li><a href="https://apify.com/store" target="_blank" rel="noopener">Store of existing actors</a></li><li><a href="https://docs.apify.com/actor" target="_blank" rel="noopener">Documentation</a></li><li><a href="https://console.apify.com/actors" target="_blank" rel="noopener">View actors in Apify Console</a></li><li><a href="https://apify.com/docs/api/v2#/reference/actors" target="_blank" rel="noopener">API reference</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/apify_platform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/quick-start"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Quick Start</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/getting-started"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Getting Started</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-apify-sdk" class="table-of-contents__link toc-highlight">Logging into Apify platform from Apify SDK</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/avoid-blocking.html b/docs/2.3/guides/avoid-blocking.html index 50d0b7f894..4a9e71e9d3 100644 --- a/docs/2.3/guides/avoid-blocking.html +++ b/docs/2.3/guides/avoid-blocking.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/guides/avoid-blocking">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/motivation">Motivation</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/quick-start">Quick Start</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/getting-started">Getting Started</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/docker-images">Running in Docker</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/guides/migration-to-v1">Migration to version 1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/guides/avoid-blocking">Avoid getting blocked</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Guide</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Avoid getting blocked</h1></header><p>A Scraper might get blocked for numerous reasons. Let's narrow it down to two main reasons. The first one is a bad or blocked IP address. This topic is covered in the <a href="/sdk/js/docs/2.3/guides/proxy-management">proxy management guide</a>. The second reason we will explore more is <a href="https://pixelprivacy.com/resources/browser-fingerprinting/" target="_blank" rel="noopener">browser fingerprints</a> or signatures. -Browser fingerprint is a collection of browser attributes and significant features that can show if your browser is a bot or a real user. Moreover, even most browsers have these unique features that allow the website to track the browser even within different IP addresses. This is the main reason why scrapers should change browser fingerprints while doing browser-based scraping. In addition, it should reduce blocking significantly.</p><p>Changing browser fingerprints can be a tedious job. Luckily, Apify SDK provides this feature out of the box with zero configuration necessary. Let's take a look at how it is done.</p><p> Changing browser fingerprints is available in <code>PuppeteerCrawler</code> and <code>PlaywrightCrawler</code>. You have to pass the <code>useFingerprints</code> option to the <code>browserPoolOptions</code>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now, it is all set. The fingerprints are going to be generated for the default browser and the operating system. The Crawler can have the generation alghoritm customized to reflect particular browser version and many more. Let's take a look at the example bellow:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">fingerprintOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">fingerprintGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">browsers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'firefox'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">80</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'chrome'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">87</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'safari'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'desktop'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">operatingSystems</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'windows'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p> Fingerprint generator has more options available check out the <a href="https://github.com/apify/fingerprint-generator#HeaderGeneratorOptions" target="_blank" rel="noopener">Fingerprint generator docs</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/avoid_blocking.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Migration to version 1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +Browser fingerprint is a collection of browser attributes and significant features that can show if your browser is a bot or a real user. Moreover, even most browsers have these unique features that allow the website to track the browser even within different IP addresses. This is the main reason why scrapers should change browser fingerprints while doing browser-based scraping. In addition, it should reduce blocking significantly.</p><p>Changing browser fingerprints can be a tedious job. Luckily, Apify SDK provides this feature out of the box with zero configuration necessary. Let's take a look at how it is done.</p><p> Changing browser fingerprints is available in <code>PuppeteerCrawler</code> and <code>PlaywrightCrawler</code>. You have to pass the <code>useFingerprints</code> option to the <code>browserPoolOptions</code>.</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now, it is all set. The fingerprints are going to be generated for the default browser and the operating system. The Crawler can have the generation alghoritm customized to reflect particular browser version and many more. Let's take a look at the example bellow:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">fingerprintOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">fingerprintGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">browsers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'firefox'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">80</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'chrome'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">87</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'safari'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'desktop'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">operatingSystems</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'windows'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p> Fingerprint generator has more options available check out the <a href="https://github.com/apify/fingerprint-generator#HeaderGeneratorOptions" target="_blank" rel="noopener">Fingerprint generator docs</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/avoid_blocking.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Migration to version 1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/docker-images.html b/docs/2.3/guides/docker-images.html index ef42a77262..a0af39c958 100644 --- a/docs/2.3/guides/docker-images.html +++ b/docs/2.3/guides/docker-images.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -27,8 +27,8 @@ If you want more browsers, either choose the <a href="#actor-node-playwright"><code>actor-node-playwright</code></a> image or override this env var.</p><p>The image supports XVFB by default, so you can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-firefox">actor-node-playwright-firefox<a href="#actor-node-playwright-firefox" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with Firefox pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-firefox:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-webkit">actor-node-playwright-webkit<a href="#actor-node-playwright-webkit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with WebKit -pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/docker_images.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Migration to version 1</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/docker_images.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/migration-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Migration to version 1</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/environment-variables.html b/docs/2.3/guides/environment-variables.html index 647ad27042..d27cab9023 100644 --- a/docs/2.3/guides/environment-variables.html +++ b/docs/2.3/guides/environment-variables.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -43,8 +43,8 @@ in the Apify app. The password is automatically inferred using the <code>APIFY_TOKEN</code> env var, so in most cases, you don't need to touch it. You should use it when, for some reason, you need access to Apify Proxy, but no access to Apify API, or when you need access to -proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/environment_variables.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars:</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars:</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/environment_variables.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars:</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars:</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/getting-started.html b/docs/2.3/guides/getting-started.html index 49c4ef8e10..ef736cc2eb 100644 --- a/docs/2.3/guides/getting-started.html +++ b/docs/2.3/guides/getting-started.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -276,8 +276,8 @@ spans tens or hundreds of lines of code.</p><p>It's good practice in any programming to split your logic into bite-sized chunks that are easy to read and reason about. Scrolling through a thousand line long <code>handlePageFunction()</code> where everything interacts with everything and variables can be used everywhere is not a beautiful thing to do and a pain to debug. That's why we prefer the separation of routes into a special file and with large routes, we would even suggest having one file -per route.</p><blockquote><p>TO BE CONTINUED with details on <code>PuppeteerCrawler</code> and other features...</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/getting_started.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#intro" class="table-of-contents__link toc-highlight">Intro</a></li><li><a href="#setting-up-locally" class="table-of-contents__link toc-highlight">Setting up locally</a><ul><li><a href="#creating-a-new-project" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#setting-up-on-the-apify-platform" class="table-of-contents__link toc-highlight">Setting up on the Apify Platform</a><ul><li><a href="#creating-a-new-project-1" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#first-crawler" class="table-of-contents__link toc-highlight">First crawler</a><ul><li><a href="#the-general-idea" class="table-of-contents__link toc-highlight">The general idea</a></li><li><a href="#the-where---request-requestlist-and-requestqueue" class="table-of-contents__link toc-highlight">The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code></a></li><li><a href="#the-what---handlepagefunction" class="table-of-contents__link toc-highlight">The What - <code>handlePageFunction</code></a></li><li><a href="#putting-it-all-together" class="table-of-contents__link toc-highlight">Putting it all together</a></li></ul></li><li><a href="#cheeriocrawler-aka-jquery-crawler" class="table-of-contents__link toc-highlight">CheerioCrawler aka jQuery crawler</a><ul><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#when-to-use-cheeriocrawler" class="table-of-contents__link toc-highlight">When to use <code>CheerioCrawler</code></a></li><li><a href="#basic-use-of-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>CheerioCrawler</code></a></li></ul></li><li><a href="#using-apify-sdk-to-enqueue-links-like-a-boss" class="table-of-contents__link toc-highlight">Using Apify SDK to enqueue links like a boss</a><ul><li><a href="#meet-apifyutils" class="table-of-contents__link toc-highlight">Meet <code>Apify.utils</code></a></li><li><a href="#introduction-to-apifyutilsenqueuelinks" class="table-of-contents__link toc-highlight">Introduction to <code>Apify.utils.enqueueLinks()</code></a></li><li><a href="#basic-use-of-enqueuelinks-with-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code></a></li></ul></li><li><a href="#getting-some-real-world-data" class="table-of-contents__link toc-highlight">Getting some real-world data</a><ul><li><a href="#the-importance-of-having-a-plan" class="table-of-contents__link toc-highlight">The importance of having a plan</a></li><li><a href="#the-crawling-strategy" class="table-of-contents__link toc-highlight">The crawling strategy</a></li><li><a href="#scraping-data" class="table-of-contents__link toc-highlight">Scraping data</a></li><li><a href="#saving-the-scraped-data" class="table-of-contents__link toc-highlight">Saving the scraped data</a></li><li><a href="#final-touch" class="table-of-contents__link toc-highlight">Final touch</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +per route.</p><blockquote><p>TO BE CONTINUED with details on <code>PuppeteerCrawler</code> and other features...</p></blockquote></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/getting_started.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#intro" class="table-of-contents__link toc-highlight">Intro</a></li><li><a href="#setting-up-locally" class="table-of-contents__link toc-highlight">Setting up locally</a><ul><li><a href="#creating-a-new-project" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#setting-up-on-the-apify-platform" class="table-of-contents__link toc-highlight">Setting up on the Apify Platform</a><ul><li><a href="#creating-a-new-project-1" class="table-of-contents__link toc-highlight">Creating a new project</a></li></ul></li><li><a href="#first-crawler" class="table-of-contents__link toc-highlight">First crawler</a><ul><li><a href="#the-general-idea" class="table-of-contents__link toc-highlight">The general idea</a></li><li><a href="#the-where---request-requestlist-and-requestqueue" class="table-of-contents__link toc-highlight">The Where - <code>Request</code>, <code>RequestList</code> and <code>RequestQueue</code></a></li><li><a href="#the-what---handlepagefunction" class="table-of-contents__link toc-highlight">The What - <code>handlePageFunction</code></a></li><li><a href="#putting-it-all-together" class="table-of-contents__link toc-highlight">Putting it all together</a></li></ul></li><li><a href="#cheeriocrawler-aka-jquery-crawler" class="table-of-contents__link toc-highlight">CheerioCrawler aka jQuery crawler</a><ul><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#when-to-use-cheeriocrawler" class="table-of-contents__link toc-highlight">When to use <code>CheerioCrawler</code></a></li><li><a href="#basic-use-of-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>CheerioCrawler</code></a></li></ul></li><li><a href="#using-apify-sdk-to-enqueue-links-like-a-boss" class="table-of-contents__link toc-highlight">Using Apify SDK to enqueue links like a boss</a><ul><li><a href="#meet-apifyutils" class="table-of-contents__link toc-highlight">Meet <code>Apify.utils</code></a></li><li><a href="#introduction-to-apifyutilsenqueuelinks" class="table-of-contents__link toc-highlight">Introduction to <code>Apify.utils.enqueueLinks()</code></a></li><li><a href="#basic-use-of-enqueuelinks-with-cheeriocrawler" class="table-of-contents__link toc-highlight">Basic use of <code>enqueueLinks()</code> with <code>CheerioCrawler</code></a></li></ul></li><li><a href="#getting-some-real-world-data" class="table-of-contents__link toc-highlight">Getting some real-world data</a><ul><li><a href="#the-importance-of-having-a-plan" class="table-of-contents__link toc-highlight">The importance of having a plan</a></li><li><a href="#the-crawling-strategy" class="table-of-contents__link toc-highlight">The crawling strategy</a></li><li><a href="#scraping-data" class="table-of-contents__link toc-highlight">Scraping data</a></li><li><a href="#saving-the-scraped-data" class="table-of-contents__link toc-highlight">Saving the scraped data</a></li><li><a href="#final-touch" class="table-of-contents__link toc-highlight">Final touch</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/migration-to-v1.html b/docs/2.3/guides/migration-to-v1.html index 0c00b10121..bd5c2fa364 100644 --- a/docs/2.3/guides/migration-to-v1.html +++ b/docs/2.3/guides/migration-to-v1.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -81,8 +81,8 @@ the functions also have access to the <code>crawlingContext</code> of the <code>request</code> that triggered the launch.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> preLaunchHooks </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">maybeLaunchChrome</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">pageId</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> launchContext</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">crawlingContexts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">pageId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">userData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">useHeadful</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">launchOptions</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headless</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="launch-functions">Launch functions<a href="#launch-functions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In addition to <code>Apify.launchPuppeteer()</code> we now also have <code>Apify.launchPlaywright()</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="updated-arguments">Updated arguments<a href="#updated-arguments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We <a href="#launchpuppeteeroptions--launchcontext">updated the launch options object</a> because it was a frequent source of confusion.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// OLD</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// NEW</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-modules">Custom modules<a href="#custom-modules" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><code>Apify.launchPuppeteer</code> already supported the <code>puppeteerModule</code> option. With Playwright, we normalized the name to <code>launcher</code> because the <code>playwright</code> module itself does not -launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/migration_to_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/avoid-blocking"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Avoid getting blocked</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/migration_to_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/avoid-blocking"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Avoid getting blocked</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/motivation.html b/docs/2.3/guides/motivation.html index 1f726b5498..1c2812c5ce 100644 --- a/docs/2.3/guides/motivation.html +++ b/docs/2.3/guides/motivation.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ the web</strong>. The use of JavaScript is natural, since the same language is used to write the scripts as well as the data extraction code running in a browser.</p><p>The goal of the Apify SDK is to fill this gap and provide a toolbox for generic web scraping, crawling and automation tasks in JavaScript. So don't reinvent the wheel every time you need data from the web, and focus on writing code specific to the target website, rather than developing -commonalities.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/motivation.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/quick-start"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Quick Start</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +commonalities.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/motivation.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/quick-start"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Quick Start</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/proxy-management.html b/docs/2.3/guides/proxy-management.html index 798edbe367..7fbc26bfdc 100644 --- a/docs/2.3/guides/proxy-management.html +++ b/docs/2.3/guides/proxy-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -47,8 +47,8 @@ in the <a href="https://console.apify.com/proxy" target="_blank" rel="noopener">proxy dashboard</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="inspecting-current-proxy-in-crawlers">Inspecting current proxy in Crawlers<a href="#inspecting-current-proxy-in-crawlers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><code>CheerioCrawler</code> and <code>PuppeteerCrawler</code> grant access to information about the currently used proxy in their <code>handlePageFunction</code> using a <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>proxyInfo</code></a> object. With the object, you can easily access the proxy URL. If you're using Apify Proxy, the other -configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/proxy_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/proxy_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/quick-start.html b/docs/2.3/guides/quick-start.html index 41eb1a1df5..793b9a94c6 100644 --- a/docs/2.3/guides/quick-start.html +++ b/docs/2.3/guides/quick-start.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,8 +26,8 @@ be in the default key-value store in <code>./apify_storage/key_value_stores/default/INPUT.json</code>.</p><p>Now you can easily deploy your code to the Apify platform by running:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">apify login</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">apify push</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Your script will be uploaded to the Apify platform and built there so that it can be run. For more information, view the <a href="https://docs.apify.com/cli" target="_blank" rel="noopener">Apify Actor</a> documentation.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="usage-on-the-apify-platform">Usage on the Apify platform<a href="#usage-on-the-apify-platform" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>You can also develop your web scraping project in an online code editor directly on the <a href="/sdk/js/docs/2.3/guides/apify-platform">Apify platform</a>. You'll need to have an Apify Account. Go to the <a href="https://console.apify.com/actors" target="_blank" rel="noopener">Actors</a> page in the app, click <i>Create new</i> -and then go to the <i>Source</i> tab and start writing your code or paste one of the examples from the Examples section.</p><p>For more information, view the <a href="https://docs.apify.com/actor/quick-start" target="_blank" rel="noopener">Apify actors quick start guide</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/quick_start.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/motivation"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Motivation</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#local-stand-alone-usage" class="table-of-contents__link toc-highlight">Local stand-alone usage</a></li><li><a href="#local-usage-with-apify-command-line-interface-cli" class="table-of-contents__link toc-highlight">Local usage with Apify command-line interface (CLI)</a></li><li><a href="#usage-on-the-apify-platform" class="table-of-contents__link toc-highlight">Usage on the Apify platform</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +and then go to the <i>Source</i> tab and start writing your code or paste one of the examples from the Examples section.</p><p>For more information, view the <a href="https://docs.apify.com/actor/quick-start" target="_blank" rel="noopener">Apify actors quick start guide</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/quick_start.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/motivation"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Motivation</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#local-stand-alone-usage" class="table-of-contents__link toc-highlight">Local stand-alone usage</a></li><li><a href="#local-usage-with-apify-command-line-interface-cli" class="table-of-contents__link toc-highlight">Local usage with Apify command-line interface (CLI)</a></li><li><a href="#usage-on-the-apify-platform" class="table-of-contents__link toc-highlight">Usage on the Apify platform</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/request-storage.html b/docs/2.3/guides/request-storage.html index 8a8173d8a1..7554ea06c6 100644 --- a/docs/2.3/guides/request-storage.html +++ b/docs/2.3/guides/request-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable, or on the <a href="/sdk/js/docs/guides/apify-platform">Apify platform</a> under the user account identified by the API token defined by the <code>APIFY_TOKEN</code> environment variable. If neither of these variables is defined, by default Apify SDK sets <code>APIFY_LOCAL_STORAGE_DIR</code> to <code>./apify_storage</code> in the current working directory and prints a warning.</p><p>Typically, you will be developing the code on your local computer and thus set the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the <code>APIFY_TOKEN</code> environment variable and thus use cloud storage. No code changes are needed.</p><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/storage" target="_blank" rel="noopener">Apify platform storage documentation</a></li><li><a href="https://console.apify.com/storage" target="_blank" rel="noopener">View storage in Apify app</a></li><li><a href="https://docs.apify.com/api/v2#/reference/request-queues" target="_blank" rel="noopener">Request queues API reference</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-queue">Request queue<a href="#request-queue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.</p><p>Each actor run is associated with a <strong>default request queue</strong>, which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional.</p><p>In Apify SDK, the request queue is represented by the <a href="/sdk/js/docs/api/request-queue"><code>RequestQueue</code></a> class.</p><p>In local configuration, the request queue is emulated by <a href="https://github.com/apify/apify-storage-local-js" target="_blank" rel="noopener">@apify/storage-local</a> NPM package and its data is stored in SQLite database in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">request_queues</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">QUEUE_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">db</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sqlite</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{QUEUE_ID}</code> is the name or ID of the request queue. The default queue has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code> environment variable.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue the initial request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request queue with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-list">Request list<a href="#request-list" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default <a href="/sdk/js/docs/2.3/guides/results-storage#key-value-store">Key-Value Store</a> associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web.</p><p>Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional.</p><p>In Apify SDK, the request list is represented by the <a href="/sdk/js/docs/api/request-list"><code>RequestList</code></a> class.</p><p>The following code demonstrates basic operations of the request list:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// List name is used to persist the sources and the list state in the key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Process the page (extract data, take page screenshot, etc).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the request list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request list with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="which-one-to-choose">Which one to choose?<a href="#which-one-to-choose" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either.</p><p>On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue.</p><p>Note that Request queue and Request list can be used together by the same crawler. In such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue). -In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/request_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/getting-started"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Getting Started</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestList</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openRequestQueue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/request_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/getting-started"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Getting Started</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/result-storage.html b/docs/2.3/guides/result-storage.html index 03dc17a709..5a7f34079c 100644 --- a/docs/2.3/guides/result-storage.html +++ b/docs/2.3/guides/result-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -36,8 +36,8 @@ results specific for the actor run. Its usage is optional.</p><p>In the Apify SDK, the dataset is represented by the <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> class. In order to simplify writes to the default dataset, the SDK also provides the <a href="/sdk/js/docs/2.3/api/apify#pushdata"><code>Apify.pushData()</code></a> function.</p><p>In local configuration, the data is stored in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">datasets</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">DATASET_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">INDEX</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{DATASET_ID}</code> is the name or ID of the dataset. The default dataset has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_DATASET_ID</code> environment variable. Each dataset item is stored as a separate JSON file, where <code>{INDEX}</code> is a zero-based index of the -item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/result_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/2.3/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/result_storage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/session-management.html b/docs/2.3/guides/session-management.html index d757d3fd29..1cc150ccc5 100644 --- a/docs/2.3/guides/session-management.html +++ b/docs/2.3/guides/session-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ Last but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly, which should prevent burning out a small pool of available IPs.</p><p>Now let's take a look at how to use a Session pool.</p><p><strong>Example usage in <a href="/sdk/js/docs/2.3/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookies to page before navigation automatically.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in puppeteer pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookie header to request automatically...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"title"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in BasicCrawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="/sdk/js/docs/2.3/api/basic-crawler"><code>BasicCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Apify</span><span class="token class-name punctuation" style="color:#393A34">.</span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Allows access to proxyInfo object in handleRequestFunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">throwHttpErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the cookieJar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This way you get the Cookie headers string from session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">Cookie</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getCookieString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> response</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">requestOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"SomeNetworkError"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If a network error happens, such as timeout, socket hangup etc...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// There is usually a chance that it was just bad luck and the proxy works.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to throw it away.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Automatically retires the session based on response HTTP status code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retireOnBlockedStatusCodes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">statusCode</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">body</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">blocked</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You are sure it is blocked.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This will throw away the session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Everything is ok, you can get the data.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to call session.markGood -> BasicCrawler calls it for you.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the CookieJar in session you need.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setCookiesFromResponse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example solo usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPoolOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openSessionPool</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">sessionPoolOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> session </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> sessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getSession</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the errorScore.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Throw away the session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Lower the errorScore and marks the session good.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markGood</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These are the basics of configuring SessionPool. Please, bear in mind that a Session pool needs time to find working IPs and build up the pool, -so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/session_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/session_management.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/guides/type-script-actor.html b/docs/2.3/guides/type-script-actor.html index 09cd5439f5..e35bbdf573 100644 --- a/docs/2.3/guides/type-script-actor.html +++ b/docs/2.3/guides/type-script-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -30,8 +30,8 @@ return types, in the Apify SDK.</p><h1>Caveats</h1><p>As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties and parameters annotated with <code>any</code> type, therefore the settings <code>noImplicitAny</code> and <code>strictNullChecks</code>, set to <code>true</code>, may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary.</p><p>Besides the <em>implicit any</em> errors that might occur in the code when writing in TypeScript, the current typings doesn't offer generics that make outputs type-safe, so you need to declare your -types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/typescript_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/guides/typescript_actor.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/readme/introduction.html b/docs/2.3/readme/introduction.html index 918f8e906d..e532efd1df 100644 --- a/docs/2.3/readme/introduction.html +++ b/docs/2.3/readme/introduction.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ The SDK is available as the <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> NPM package. It can be used either stand-alone in your own applications or in <a href="https://docs.apify.com/actor" target="_blank" rel="noopener">actors</a> -running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/readme/overview.html b/docs/2.3/readme/overview.html index 1d36c8c5cc..4e8ac16689 100644 --- a/docs/2.3/readme/overview.html +++ b/docs/2.3/readme/overview.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -36,8 +36,8 @@ web scraping tasks at the maximum capacity of the system.</p></li><li><p><a href="https://sdk.apify.com/docs/api/puppeteer"><code>Browser Utils</code></a> - Provides several helper functions useful for web scraping. For example, to inject jQuery into web pages or to hide browser origin.</p></li></ul><p>Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus take advantage of its pool of proxies, job scheduler, data storage, etc. -For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/readme/support.html b/docs/2.3/readme/support.html index ed38ded8cd..23a6f7a903 100644 --- a/docs/2.3/readme/support.html +++ b/docs/2.3/readme/support.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ For contribution guidelines and the code of conduct, see <a href="https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-js/blob/master/LICENSE.md" target="_blank" rel="noopener">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener">Chema Balsas</a> for giving up the <code>apify</code> package name -on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/abort-function.html b/docs/2.3/typedefs/abort-function.html index 1c56120eed..53099ed778 100644 --- a/docs/2.3/typedefs/abort-function.html +++ b/docs/2.3/typedefs/abort-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/abort-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/abort-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>AbortFunction</h1></header><a name="abortfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>response</code></strong>: <code>IncomingMessage</code></li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AbortFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/abort-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/abort-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>AbortFunction</h1></header><a name="abortfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>response</code></strong>: <code>IncomingMessage</code></li></ul><p><strong>Returns</strong>:</p><p><code>boolean</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AbortFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/actor-run.html b/docs/2.3/typedefs/actor-run.html index 4c25a6cd05..cb0ca4f63d 100644 --- a/docs/2.3/typedefs/actor-run.html +++ b/docs/2.3/typedefs/actor-run.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,8 +19,8 @@ <a href="https://apify.com/docs/api/v2#/reference/actors/run-collection/run-actor" target="_blank" rel="noopener">Actor run</a> Apify API endpoint and extended with certain fields. For more details, see <a href="https://docs.apify.com/actor/run" target="_blank" rel="noopener">Runs.</a></p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Actor run ID</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actid"><code>actId</code><a href="#actid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Actor ID</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="startedat"><code>startedAt</code><a href="#startedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Time when the actor run started</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="finishedat"><code>finishedAt</code><a href="#finishedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Time when the actor run finished. Contains <code>null</code> for running actors.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="status"><code>status</code><a href="#status" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Status of the run. For possible values, see <a href="https://docs.apify.com/actors/running#lifecycle" target="_blank" rel="noopener">Run lifecycle</a> in Apify actor documentation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meta"><code>meta</code><a href="#meta" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, string></code></p><p>Actor run meta-data. For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"origin"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"API"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"clientIp"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"1.2.3.4"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"userAgent"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ApifyClient/0.2.13 (Linux; Node/v8.11.3)"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stats"><code>stats</code><a href="#stats" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, number></code></p><p>An object containing various actor run statistics. For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"inputBodyLen"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">22</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"restartCount"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"workersUsed"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Beware that object fields might change in future releases.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="options"><code>options</code><a href="#options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Actor run options. For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"build"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"latest"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"waitSecs"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"memoryMbytes"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">256</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"diskMbytes"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">512</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="buildid"><code>buildId</code><a href="#buildid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the actor build used for the run. For details, see <a href="https://docs.apify.com/actor/build" target="_blank" rel="noopener">Builds</a> in Apify actor documentation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="buildnumber"><code>buildNumber</code><a href="#buildnumber" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Number of the actor build used for the run. For example, <code>0.0.10</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="exitcode"><code>exitCode</code><a href="#exitcode" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Exit code of the actor run process. It's <code>null</code> if actor is still running.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultkeyvaluestoreid"><code>defaultKeyValueStoreId</code><a href="#defaultkeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the default key-value store associated with the actor run. See <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a> for details.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultdatasetid"><code>defaultDatasetId</code><a href="#defaultdatasetid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the default dataset associated with the actor run. See <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> for details.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultrequestqueueid"><code>defaultRequestQueueId</code><a href="#defaultrequestqueueid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>ID of the default request queue associated with the actor run. See <a href="/sdk/js/docs/2.3/api/request-queue"><code>RequestQueue</code></a> for details.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="containerurl"><code>containerUrl</code><a href="#containerurl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>URL on which the web server running inside actor run's Docker container can be accessed. For more details, see <a href="https://docs.apify.com/actor/run#container-web-server" target="_blank" rel="noopener">Container web server</a> in Apify actor documentation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="output"><code>output</code><a href="#output" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code> | <code>null</code> | <code>undefined</code></p><p>Contains output of the actor run. The value is <code>null</code> or <code>undefined</code> in case the actor is still running, or if you pass <code>false</code> to the <code>fetchOutput</code> -option of <a href="/sdk/js/docs/2.3/api/apify#call"><code>Apify.call()</code></a>.</p><p>For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"contentType"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"application/json; charset=utf-8"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"body"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"message"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Hello world!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ActorRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestTransform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/apify-call-error"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyCallError</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#actid" class="table-of-contents__link toc-highlight"><code>actId</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#finishedat" class="table-of-contents__link toc-highlight"><code>finishedAt</code></a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><code>status</code></a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><code>meta</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><code>options</code></a></li><li><a href="#buildid" class="table-of-contents__link toc-highlight"><code>buildId</code></a></li><li><a href="#buildnumber" class="table-of-contents__link toc-highlight"><code>buildNumber</code></a></li><li><a href="#exitcode" class="table-of-contents__link toc-highlight"><code>exitCode</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#defaultrequestqueueid" class="table-of-contents__link toc-highlight"><code>defaultRequestQueueId</code></a></li><li><a href="#containerurl" class="table-of-contents__link toc-highlight"><code>containerUrl</code></a></li><li><a href="#output" class="table-of-contents__link toc-highlight"><code>output</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +option of <a href="/sdk/js/docs/2.3/api/apify#call"><code>Apify.call()</code></a>.</p><p>For example:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"contentType"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"application/json; charset=utf-8"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"body"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">"message"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Hello world!"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ActorRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestTransform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/api/apify-call-error"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyCallError</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#actid" class="table-of-contents__link toc-highlight"><code>actId</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#finishedat" class="table-of-contents__link toc-highlight"><code>finishedAt</code></a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><code>status</code></a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><code>meta</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><code>options</code></a></li><li><a href="#buildid" class="table-of-contents__link toc-highlight"><code>buildId</code></a></li><li><a href="#buildnumber" class="table-of-contents__link toc-highlight"><code>buildNumber</code></a></li><li><a href="#exitcode" class="table-of-contents__link toc-highlight"><code>exitCode</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#defaultrequestqueueid" class="table-of-contents__link toc-highlight"><code>defaultRequestQueueId</code></a></li><li><a href="#containerurl" class="table-of-contents__link toc-highlight"><code>containerUrl</code></a></li><li><a href="#output" class="table-of-contents__link toc-highlight"><code>output</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/adhoc-webhook.html b/docs/2.3/typedefs/adhoc-webhook.html index 752b29b249..95b079ae3f 100644 --- a/docs/2.3/typedefs/adhoc-webhook.html +++ b/docs/2.3/typedefs/adhoc-webhook.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/adhoc-webhook">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/adhoc-webhook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>AdhocWebhook</h1></header><a name="adhocwebhook"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="idempotencykey"><code>idempotencyKey</code><a href="#idempotencykey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AdhocWebhook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#idempotencykey" class="table-of-contents__link toc-highlight"><code>idempotencyKey</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/adhoc-webhook">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/adhoc-webhook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>AdhocWebhook</h1></header><a name="adhocwebhook"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="idempotencykey"><code>idempotencyKey</code><a href="#idempotencykey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AdhocWebhook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#idempotencykey" class="table-of-contents__link toc-highlight"><code>idempotencyKey</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/apify-env.html b/docs/2.3/typedefs/apify-env.html index 4aa953ab6e..d53cbc57d3 100644 --- a/docs/2.3/typedefs/apify-env.html +++ b/docs/2.3/typedefs/apify-env.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/apify-env">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/apify-env">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyEnv</h1></header><a name="apifyenv"></a><p>Parsed representation of the <code>APIFY_XXX</code> environmental variables. This object is returned by the <a href="/sdk/js/docs/2.3/api/apify#getenv"><code>Apify.getEnv()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorid"><code>actorId</code><a href="#actorid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor (APIFY_ACTOR_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorrunid"><code>actorRunId</code><a href="#actorrunid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor run (APIFY_ACTOR_RUN_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actortaskid"><code>actorTaskId</code><a href="#actortaskid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor task (APIFY_ACTOR_TASK_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="token"><code>token</code><a href="#token" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="startedat"><code>startedAt</code><a href="#startedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor was started (APIFY_STARTED_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutat"><code>timeoutAt</code><a href="#timeoutat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor will time out (APIFY_TIMEOUT_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultkeyvaluestoreid"><code>defaultKeyValueStoreId</code><a href="#defaultkeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultdatasetid"><code>defaultDatasetId</code><a href="#defaultdatasetid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="memorymbytes"><code>memoryMbytes</code><a href="#memorymbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> | <code>null</code></p><p>Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ApifyEnv.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/apify-call-error"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyCallError</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#actorid" class="table-of-contents__link toc-highlight"><code>actorId</code></a></li><li><a href="#actorrunid" class="table-of-contents__link toc-highlight"><code>actorRunId</code></a></li><li><a href="#actortaskid" class="table-of-contents__link toc-highlight"><code>actorTaskId</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><code>token</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#timeoutat" class="table-of-contents__link toc-highlight"><code>timeoutAt</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#memorymbytes" class="table-of-contents__link toc-highlight"><code>memoryMbytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/apify-env">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/apify-env">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>ApifyEnv</h1></header><a name="apifyenv"></a><p>Parsed representation of the <code>APIFY_XXX</code> environmental variables. This object is returned by the <a href="/sdk/js/docs/2.3/api/apify#getenv"><code>Apify.getEnv()</code></a> function.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorid"><code>actorId</code><a href="#actorid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor (APIFY_ACTOR_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actorrunid"><code>actorRunId</code><a href="#actorrunid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor run (APIFY_ACTOR_RUN_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actortaskid"><code>actorTaskId</code><a href="#actortaskid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the actor task (APIFY_ACTOR_TASK_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="token"><code>token</code><a href="#token" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="startedat"><code>startedAt</code><a href="#startedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor was started (APIFY_STARTED_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutat"><code>timeoutAt</code><a href="#timeoutat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>null</code></p><p>Date when the actor will time out (APIFY_TIMEOUT_AT)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultkeyvaluestoreid"><code>defaultKeyValueStoreId</code><a href="#defaultkeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the key-value store where input and output data of this actor is stored (APIFY_DEFAULT_KEY_VALUE_STORE_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="defaultdatasetid"><code>defaultDatasetId</code><a href="#defaultdatasetid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>null</code></p><p>ID of the dataset where input and output data of this actor is stored (APIFY_DEFAULT_DATASET_ID)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="memorymbytes"><code>memoryMbytes</code><a href="#memorymbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> | <code>null</code></p><p>Amount of memory allocated for the actor, in megabytes (APIFY_MEMORY_MBYTES)</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ApifyEnv.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/apify-call-error"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyCallError</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#actorid" class="table-of-contents__link toc-highlight"><code>actorId</code></a></li><li><a href="#actorrunid" class="table-of-contents__link toc-highlight"><code>actorRunId</code></a></li><li><a href="#actortaskid" class="table-of-contents__link toc-highlight"><code>actorTaskId</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><code>token</code></a></li><li><a href="#startedat" class="table-of-contents__link toc-highlight"><code>startedAt</code></a></li><li><a href="#timeoutat" class="table-of-contents__link toc-highlight"><code>timeoutAt</code></a></li><li><a href="#defaultkeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>defaultKeyValueStoreId</code></a></li><li><a href="#defaultdatasetid" class="table-of-contents__link toc-highlight"><code>defaultDatasetId</code></a></li><li><a href="#memorymbytes" class="table-of-contents__link toc-highlight"><code>memoryMbytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/autoscaled-pool-options.html b/docs/2.3/typedefs/autoscaled-pool-options.html index d9ff7b94b5..836d5d68cf 100644 --- a/docs/2.3/typedefs/autoscaled-pool-options.html +++ b/docs/2.3/typedefs/autoscaled-pool-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ <code>minConcurrency</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="desiredconcurrencyratio"><code>desiredConcurrencyRatio</code><a href="#desiredconcurrencyratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.95</code></p><p>Minimum level of desired concurrency to reach before more scaling up is allowed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="scaleupstepratio"><code>scaleUpStepRatio</code><a href="#scaleupstepratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.05</code></p><p>Defines the fractional amount of desired concurrency to be added with each scaling up. The minimum scaling step is one.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="scaledownstepratio"><code>scaleDownStepRatio</code><a href="#scaledownstepratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.05</code></p><p>Defines the amount of desired concurrency to be subtracted with each scaling down. The minimum scaling step is one.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mayberunintervalsecs"><code>maybeRunIntervalSecs</code><a href="#mayberunintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.5</code></p><p>Indicates how often the pool should call the <code>runTaskFunction()</code> to start a new task, in seconds. This has no effect on starting new tasks immediately after a task completes.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="loggingintervalsecs"><code>loggingIntervalSecs</code><a href="#loggingintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 60</code></p><p>Specifies a period in which the instance logs its state, in seconds. Set to <code>null</code> to disable periodic logging.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="autoscaleintervalsecs"><code>autoscaleIntervalSecs</code><a href="#autoscaleintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 10</code></p><p>Defines in seconds how often the pool should attempt to adjust the desired concurrency based on the latest system status. Setting it lower than 1 might have a severe impact on performance. We suggest using a value from 5 to 20.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="tasktimeoutsecs"><code>taskTimeoutSecs</code><a href="#tasktimeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Timeout in which the <code>runTaskFunction</code> needs to finish, given in seconds.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshotteroptions"><code>snapshotterOptions</code><a href="#snapshotteroptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/snapshotter-options"><code>SnapshotterOptions</code></a></p><p>Options to be passed down to the <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a> constructor. This is useful for fine-tuning the snapshot intervals and history.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="systemstatusoptions"><code>systemStatusOptions</code><a href="#systemstatusoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/system-status-options"><code>SystemStatusOptions</code></a></p><p>Options to be passed down to the <a href="/sdk/js/docs/2.3/api/system-status"><code>SystemStatus</code></a> constructor. This is useful for fine-tuning the system status reports. If a -custom snapshotter is set in the options, it will be used by the pool.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AutoscaledPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/social"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.social</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#runtaskfunction" class="table-of-contents__link toc-highlight"><code>runTaskFunction</code></a></li><li><a href="#istaskreadyfunction" class="table-of-contents__link toc-highlight"><code>isTaskReadyFunction</code></a></li><li><a href="#isfinishedfunction" class="table-of-contents__link toc-highlight"><code>isFinishedFunction</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#desiredconcurrency" class="table-of-contents__link toc-highlight"><code>desiredConcurrency</code></a></li><li><a href="#desiredconcurrencyratio" class="table-of-contents__link toc-highlight"><code>desiredConcurrencyRatio</code></a></li><li><a href="#scaleupstepratio" class="table-of-contents__link toc-highlight"><code>scaleUpStepRatio</code></a></li><li><a href="#scaledownstepratio" class="table-of-contents__link toc-highlight"><code>scaleDownStepRatio</code></a></li><li><a href="#mayberunintervalsecs" class="table-of-contents__link toc-highlight"><code>maybeRunIntervalSecs</code></a></li><li><a href="#loggingintervalsecs" class="table-of-contents__link toc-highlight"><code>loggingIntervalSecs</code></a></li><li><a href="#autoscaleintervalsecs" class="table-of-contents__link toc-highlight"><code>autoscaleIntervalSecs</code></a></li><li><a href="#tasktimeoutsecs" class="table-of-contents__link toc-highlight"><code>taskTimeoutSecs</code></a></li><li><a href="#snapshotteroptions" class="table-of-contents__link toc-highlight"><code>snapshotterOptions</code></a></li><li><a href="#systemstatusoptions" class="table-of-contents__link toc-highlight"><code>systemStatusOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +custom snapshotter is set in the options, it will be used by the pool.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/AutoscaledPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/api/social"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">utils.social</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#runtaskfunction" class="table-of-contents__link toc-highlight"><code>runTaskFunction</code></a></li><li><a href="#istaskreadyfunction" class="table-of-contents__link toc-highlight"><code>isTaskReadyFunction</code></a></li><li><a href="#isfinishedfunction" class="table-of-contents__link toc-highlight"><code>isFinishedFunction</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#desiredconcurrency" class="table-of-contents__link toc-highlight"><code>desiredConcurrency</code></a></li><li><a href="#desiredconcurrencyratio" class="table-of-contents__link toc-highlight"><code>desiredConcurrencyRatio</code></a></li><li><a href="#scaleupstepratio" class="table-of-contents__link toc-highlight"><code>scaleUpStepRatio</code></a></li><li><a href="#scaledownstepratio" class="table-of-contents__link toc-highlight"><code>scaleDownStepRatio</code></a></li><li><a href="#mayberunintervalsecs" class="table-of-contents__link toc-highlight"><code>maybeRunIntervalSecs</code></a></li><li><a href="#loggingintervalsecs" class="table-of-contents__link toc-highlight"><code>loggingIntervalSecs</code></a></li><li><a href="#autoscaleintervalsecs" class="table-of-contents__link toc-highlight"><code>autoscaleIntervalSecs</code></a></li><li><a href="#tasktimeoutsecs" class="table-of-contents__link toc-highlight"><code>taskTimeoutSecs</code></a></li><li><a href="#snapshotteroptions" class="table-of-contents__link toc-highlight"><code>snapshotterOptions</code></a></li><li><a href="#systemstatusoptions" class="table-of-contents__link toc-highlight"><code>systemStatusOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/basic-crawler-options.html b/docs/2.3/typedefs/basic-crawler-options.html index f3fbee2842..49a7f916bc 100644 --- a/docs/2.3/typedefs/basic-crawler-options.html +++ b/docs/2.3/typedefs/basic-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ <code>isTaskReadyFunction</code> options are provided by <code>BasicCrawler</code> and cannot be overridden. However, you can provide a custom implementation of <code>isFinishedFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Basic crawler will initialize the <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> with the corresponding <code>sessionPoolOptions</code>. The session instance will be than -available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BasicCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlerequestfunction" class="table-of-contents__link toc-highlight"><code>handleRequestFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#handlerequesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>handleRequestTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BasicCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AutoscaledPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlerequestfunction" class="table-of-contents__link toc-highlight"><code>handleRequestFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#handlerequesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>handleRequestTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/browser-crawling-context.html b/docs/2.3/typedefs/browser-crawling-context.html index 760c423923..6e5bc772be 100644 --- a/docs/2.3/typedefs/browser-crawling-context.html +++ b/docs/2.3/typedefs/browser-crawling-context.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/browser-crawling-context">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/browser-crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserCrawlingContext</h1></header><a name="browsercrawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="browsercontroller"><code>browserController</code><a href="#browsercontroller" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>BrowserController</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserCrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#browsercontroller" class="table-of-contents__link toc-highlight"><code>browserController</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/browser-crawling-context">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/browser-crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>BrowserCrawlingContext</h1></header><a name="browsercrawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="browsercontroller"><code>browserController</code><a href="#browsercontroller" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>BrowserController</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserCrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#browsercontroller" class="table-of-contents__link toc-highlight"><code>browserController</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/browser-handle-page-function.html b/docs/2.3/typedefs/browser-handle-page-function.html index 575e401f70..42c81f1466 100644 --- a/docs/2.3/typedefs/browser-handle-page-function.html +++ b/docs/2.3/typedefs/browser-handle-page-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/browser-handle-page-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/browser-handle-page-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>BrowserHandlePageFunction</h1></header><a name="browserhandlepagefunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/browser-handle-page-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/browser-handle-page-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>BrowserHandlePageFunction</h1></header><a name="browserhandlepagefunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/browser-launch-context.html b/docs/2.3/typedefs/browser-launch-context.html index 9ed98c8e64..156ed366f7 100644 --- a/docs/2.3/typedefs/browser-launch-context.html +++ b/docs/2.3/typedefs/browser-launch-context.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ resources will not be throttled by one another.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdatadir"><code>userDataDir</code><a href="#userdatadir" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Sets the <a href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md" target="_blank" rel="noopener">User Data Directory</a> path. The user data directory contains profile data such as history, bookmarks, and cookies, as well as other per-installation local state. If not specified, a temporary directory is used instead.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launcher"><code>launcher</code><a href="#launcher" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>By default this function uses -require("playwright").chromium<code>. If you want to use a different browser you can pass it by this property as</code>require("playwright").firefox</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#userdatadir" class="table-of-contents__link toc-highlight"><code>userDataDir</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +require("playwright").chromium<code>. If you want to use a different browser you can pass it by this property as</code>require("playwright").firefox</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/BrowserLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#userdatadir" class="table-of-contents__link toc-highlight"><code>userDataDir</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/cheerio-crawler-options.html b/docs/2.3/typedefs/cheerio-crawler-options.html index 200529c95f..526eb03904 100644 --- a/docs/2.3/typedefs/cheerio-crawler-options.html +++ b/docs/2.3/typedefs/cheerio-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -41,8 +41,8 @@ event loop.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If set to true Crawler will automatically use Session Pool. It will automatically retire sessions on 403, 401 and 429 status codes. It also marks Session as bad after a request timeout.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>Custom options passed to the underlying <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> constructor.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="persistcookiespersession"><code>persistCookiesPerSession</code><a href="#persistcookiespersession" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Automatically saves cookies to Session. Works only if Session Pool is used.</p><p>It parses cookie from response "set-cookie" header saves or updates cookies for session and once the session is used for next request. It passes the -"Cookie" header to the request with the session cookies.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#preparerequestfunction" class="table-of-contents__link toc-highlight"><code>prepareRequestFunction</code></a></li><li><a href="#postresponsefunction" class="table-of-contents__link toc-highlight"><code>postResponseFunction</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#requesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>requestTimeoutSecs</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#additionalmimetypes" class="table-of-contents__link toc-highlight"><code>additionalMimeTypes</code></a></li><li><a href="#suggestresponseencoding" class="table-of-contents__link toc-highlight"><code>suggestResponseEncoding</code></a></li><li><a href="#forceresponseencoding" class="table-of-contents__link toc-highlight"><code>forceResponseEncoding</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +"Cookie" header to the request with the session cookies.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">BasicCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#preparerequestfunction" class="table-of-contents__link toc-highlight"><code>prepareRequestFunction</code></a></li><li><a href="#postresponsefunction" class="table-of-contents__link toc-highlight"><code>postResponseFunction</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#requesttimeoutsecs" class="table-of-contents__link toc-highlight"><code>requestTimeoutSecs</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#additionalmimetypes" class="table-of-contents__link toc-highlight"><code>additionalMimeTypes</code></a></li><li><a href="#suggestresponseencoding" class="table-of-contents__link toc-highlight"><code>suggestResponseEncoding</code></a></li><li><a href="#forceresponseencoding" class="table-of-contents__link toc-highlight"><code>forceResponseEncoding</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/cheerio-handle-page-inputs.html b/docs/2.3/typedefs/cheerio-handle-page-inputs.html index 82815b064f..a8a7674dae 100644 --- a/docs/2.3/typedefs/cheerio-handle-page-inputs.html +++ b/docs/2.3/typedefs/cheerio-handle-page-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePageInputs</h1></header><a name="cheeriohandlepageinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3><code>$</code></h3><p><strong>Type</strong>: <code>CheerioAPI</code></p><p>The <a href="https://cheerio.js.org/" target="_blank" rel="noopener">Cheerio</a> object with parsed HTML.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="body"><code>body</code><a href="#body" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Buffer</code></p><p>The request body of the web page.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="json"><code>json</code><a href="#json" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>The parsed object from JSON string if the response contains the content type application/json.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="contenttype"><code>contentType</code><a href="#contenttype" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object</code></p><p>Parsed <code>Content-Type header: { type, encoding }</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code></p><p>An instance of Node's <a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage" target="_blank" rel="noopener">http.IncomingMessage</a> object,</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/2.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePageInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#" class="table-of-contents__link toc-highlight"><code>$</code></a></li><li><a href="#body" class="table-of-contents__link toc-highlight"><code>body</code></a></li><li><a href="#json" class="table-of-contents__link toc-highlight"><code>json</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#contenttype" class="table-of-contents__link toc-highlight"><code>contentType</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePageInputs</h1></header><a name="cheeriohandlepageinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3><code>$</code></h3><p><strong>Type</strong>: <code>CheerioAPI</code></p><p>The <a href="https://cheerio.js.org/" target="_blank" rel="noopener">Cheerio</a> object with parsed HTML.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="body"><code>body</code><a href="#body" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> | <code>Buffer</code></p><p>The request body of the web page.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="json"><code>json</code><a href="#json" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>The parsed object from JSON string if the response contains the content type application/json.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="contenttype"><code>contentType</code><a href="#contenttype" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object</code></p><p>Parsed <code>Content-Type header: { type, encoding }</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code></p><p>An instance of Node's <a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage" target="_blank" rel="noopener">http.IncomingMessage</a> object,</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/2.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePageInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#" class="table-of-contents__link toc-highlight"><code>$</code></a></li><li><a href="#body" class="table-of-contents__link toc-highlight"><code>body</code></a></li><li><a href="#json" class="table-of-contents__link toc-highlight"><code>json</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#contenttype" class="table-of-contents__link toc-highlight"><code>contentType</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/cheerio-handle-page.html b/docs/2.3/typedefs/cheerio-handle-page.html index 3496573c23..aff4e1c441 100644 --- a/docs/2.3/typedefs/cheerio-handle-page.html +++ b/docs/2.3/typedefs/cheerio-handle-page.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePage</h1></header><a name="cheeriohandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"><code>CheerioHandlePageInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatusOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/cheerio-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>CheerioHandlePage</h1></header><a name="cheeriohandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"><code>CheerioHandlePageInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CheerioHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SystemStatusOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/compiled-script-function.html b/docs/2.3/typedefs/compiled-script-function.html index 525bbda932..e43c3e6f6c 100644 --- a/docs/2.3/typedefs/compiled-script-function.html +++ b/docs/2.3/typedefs/compiled-script-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/compiled-script-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/compiled-script-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptFunction</h1></header><a name="compiledscriptfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>params</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/compiled-script-params"><code>CompiledScriptParams</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/compiled-script-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/compiled-script-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptFunction</h1></header><a name="compiledscriptfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>params</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/compiled-script-params"><code>CompiledScriptParams</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/compiled-script-params.html b/docs/2.3/typedefs/compiled-script-params.html index 30f13a02ef..0126fc257c 100644 --- a/docs/2.3/typedefs/compiled-script-params.html +++ b/docs/2.3/typedefs/compiled-script-params.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/compiled-script-params">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/compiled-script-params">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptParams</h1></header><a name="compiledscriptparams"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramspage"><code>params.page</code><a href="#paramspage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramsrequest"><code>params.request</code><a href="#paramsrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptParams.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#paramspage" class="table-of-contents__link toc-highlight"><code>params.page</code></a></li><li><a href="#paramsrequest" class="table-of-contents__link toc-highlight"><code>params.request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/compiled-script-params">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/compiled-script-params">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CompiledScriptParams</h1></header><a name="compiledscriptparams"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramspage"><code>params.page</code><a href="#paramspage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="paramsrequest"><code>params.request</code><a href="#paramsrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CompiledScriptParams.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#paramspage" class="table-of-contents__link toc-highlight"><code>params.page</code></a></li><li><a href="#paramsrequest" class="table-of-contents__link toc-highlight"><code>params.request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/crawling-context.html b/docs/2.3/typedefs/crawling-context.html index 28e94052ee..df65b38eb4 100644 --- a/docs/2.3/typedefs/crawling-context.html +++ b/docs/2.3/typedefs/crawling-context.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/crawling-context">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CrawlingContext</h1></header><a name="crawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/crawling-context">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/crawling-context">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CrawlingContext</h1></header><a name="crawlingcontext"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CrawlingContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/create-session.html b/docs/2.3/typedefs/create-session.html index ffe0d9b146..493ff8a890 100644 --- a/docs/2.3/typedefs/create-session.html +++ b/docs/2.3/typedefs/create-session.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/create-session">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/create-session">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">CreateSession</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Sessions</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>CreateSession</h1></header><a name="createsession"></a><p>Factory user-function which creates customized <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a> instances.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionPool</code></strong>: <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> - Pool requesting the new session.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/session"><code>Promise<Session></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CreateSession.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestTransform</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/create-session">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/create-session">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">CreateSession</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Sessions</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>CreateSession</h1></header><a name="createsession"></a><p>Factory user-function which creates customized <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a> instances.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionPool</code></strong>: <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> - Pool requesting the new session.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/api/session"><code>Promise<Session></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/CreateSession.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-transform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestTransform</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/dataset-consumer.html b/docs/2.3/typedefs/dataset-consumer.html index 4eec61625c..44bb240ba9 100644 --- a/docs/2.3/typedefs/dataset-consumer.html +++ b/docs/2.3/typedefs/dataset-consumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetConsumer</h1></header><a name="datasetconsumer"></a><p>User-function used in the <code>Dataset.forEach()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Current <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePageFunctionParam</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetConsumer</h1></header><a name="datasetconsumer"></a><p>User-function used in the <code>Dataset.forEach()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Current <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePageFunctionParam</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/dataset-content.html b/docs/2.3/typedefs/dataset-content.html index fbbb4e5096..bbeae8f1e4 100644 --- a/docs/2.3/typedefs/dataset-content.html +++ b/docs/2.3/typedefs/dataset-content.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-content">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-content">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>DatasetContent</h1></header><a name="datasetcontent"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="items"><code>items</code><a href="#items" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<object></code></p><p>Dataset entries based on chosen format parameter.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="total"><code>total</code><a href="#total" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total count of entries in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="offset"><code>offset</code><a href="#offset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the first returned entry in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="count"><code>count</code><a href="#count" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Count of dataset entries returned in this set.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="limit"><code>limit</code><a href="#limit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Maximum number of dataset entries requested.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetContent.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MemoryInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#items" class="table-of-contents__link toc-highlight"><code>items</code></a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><code>total</code></a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><code>offset</code></a></li><li><a href="#count" class="table-of-contents__link toc-highlight"><code>count</code></a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><code>limit</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-content">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-content">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>DatasetContent</h1></header><a name="datasetcontent"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="items"><code>items</code><a href="#items" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<object></code></p><p>Dataset entries based on chosen format parameter.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="total"><code>total</code><a href="#total" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total count of entries in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="offset"><code>offset</code><a href="#offset" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the first returned entry in the dataset.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="count"><code>count</code><a href="#count" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Count of dataset entries returned in this set.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="limit"><code>limit</code><a href="#limit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Maximum number of dataset entries requested.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetContent.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/apify-env"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MemoryInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#items" class="table-of-contents__link toc-highlight"><code>items</code></a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><code>total</code></a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><code>offset</code></a></li><li><a href="#count" class="table-of-contents__link toc-highlight"><code>count</code></a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><code>limit</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/dataset-mapper.html b/docs/2.3/typedefs/dataset-mapper.html index 913ebdf6a0..b143007813 100644 --- a/docs/2.3/typedefs/dataset-mapper.html +++ b/docs/2.3/typedefs/dataset-mapper.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetMapper</h1></header><a name="datasetmapper"></a><p>User-function used in the <code>Dataset.map()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetMapper.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-mapper">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetMapper</h1></header><a name="datasetmapper"></a><p>User-function used in the <code>Dataset.map()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetMapper.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/dataset-reducer.html b/docs/2.3/typedefs/dataset-reducer.html index 77c9ad8a39..e5bb9f09f4 100644 --- a/docs/2.3/typedefs/dataset-reducer.html +++ b/docs/2.3/typedefs/dataset-reducer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetReducer</h1></header><a name="datasetreducer"></a><p>User-function used in the <code>Dataset.reduce()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>memo</code></strong>: <code>object</code> - Previous state of the reduction.</li><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetReducer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/dataset-reducer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-mapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-reducer">DatasetReducer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Dataset</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>DatasetReducer</h1></header><a name="datasetreducer"></a><p>User-function used in the <code>Dataset.reduce()</code> API.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>memo</code></strong>: <code>object</code> - Previous state of the reduction.</li><li><strong><code>item</code></strong>: <code>object</code> - Currect <a href="/sdk/js/docs/2.3/api/dataset"><code>Dataset</code></a> entry being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of current {Dataset} entry.</li></ul><p><strong>Returns</strong>:</p><p><code>object</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DatasetReducer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-mapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/key-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/direct-navigation-options.html b/docs/2.3/typedefs/direct-navigation-options.html index bf96af59e5..28c30e286c 100644 --- a/docs/2.3/typedefs/direct-navigation-options.html +++ b/docs/2.3/typedefs/direct-navigation-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ browserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="waituntil"><code>waitUntil</code><a href="#waituntil" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>&quot;domcontentloaded&quot;</code> | <code>&quot;load&quot;</code> | <code>&quot;networkidle&quot;</code></p><p>When to consider operation succeeded, defaults to <code>load</code>. Events can be either: - <code>'domcontentloaded'</code> - consider operation to be finished when the <code>DOMContentLoaded</code> event is fired. - <code>'load'</code> - consider operation to be finished when the <code>load</code> event is fired. - <code>'networkidle'</code> - consider -operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DirectNavigationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/DirectNavigationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/event-types.html b/docs/2.3/typedefs/event-types.html index 16d8bf3e41..8df4f2f9c1 100644 --- a/docs/2.3/typedefs/event-types.html +++ b/docs/2.3/typedefs/event-types.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/event-types">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/event-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>EventTypes</h1></header><a name="eventtypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/EventTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/event-types">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/event-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>EventTypes</h1></header><a name="eventtypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/EventTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/goto-function.html b/docs/2.3/typedefs/goto-function.html index da0548be5b..4a53d417a3 100644 --- a/docs/2.3/typedefs/goto-function.html +++ b/docs/2.3/typedefs/goto-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/goto-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/goto-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>GotoFunction</h1></header><a name="gotofunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/GotoFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/goto-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/goto-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>GotoFunction</h1></header><a name="gotofunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<*></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/GotoFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/handle-failed-request-input.html b/docs/2.3/typedefs/handle-failed-request-input.html index 5ec16fb7cb..2a3622eede 100644 --- a/docs/2.3/typedefs/handle-failed-request-input.html +++ b/docs/2.3/typedefs/handle-failed-request-input.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequestInput</h1></header><a name="handlefailedrequestinput"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="error"><code>error</code><a href="#error" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Error</code></p><p>The Error thrown by <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original {Request} object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequestInput.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#error" class="table-of-contents__link toc-highlight"><code>error</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-failed-request-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequestInput</h1></header><a name="handlefailedrequestinput"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="error"><code>error</code><a href="#error" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Error</code></p><p>The Error thrown by <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original {Request} object.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequestInput.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-failed-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#error" class="table-of-contents__link toc-highlight"><code>error</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/handle-failed-request.html b/docs/2.3/typedefs/handle-failed-request.html index 18542c3b9a..b823dee256 100644 --- a/docs/2.3/typedefs/handle-failed-request.html +++ b/docs/2.3/typedefs/handle-failed-request.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequest</h1></header><a name="handlefailedrequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input"><code>HandleFailedRequestInput</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-failed-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleFailedRequest</h1></header><a name="handlefailedrequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input"><code>HandleFailedRequestInput</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleFailedRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioHandlePageInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/handle-request-inputs.html b/docs/2.3/typedefs/handle-request-inputs.html index 0cb816067b..65893b89d9 100644 --- a/docs/2.3/typedefs/handle-request-inputs.html +++ b/docs/2.3/typedefs/handle-request-inputs.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-request-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>HandleRequestInputs</h1></header><a name="handlerequestinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original {Request} object. A reference to the underlying <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> class that manages the concurrency of the crawler. Note that this property is only initialized after calling the <a href="/sdk/js/docs/2.3/api/basic-crawler#run"><code>BasicCrawler.run()</code></a> function. You can use it to change the concurrency settings on the fly, to pause the crawler by calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#pause"><code>AutoscaledPool.pause()</code></a> or to abort it by -calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/basic-crawler"><code>BasicCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +calling <a href="/sdk/js/docs/2.3/api/autoscaled-pool#abort"><code>AutoscaledPool.abort()</code></a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/basic-crawler"><code>BasicCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequest</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/handle-request.html b/docs/2.3/typedefs/handle-request.html index 01ba4019c6..9a26e2fc82 100644 --- a/docs/2.3/typedefs/handle-request.html +++ b/docs/2.3/typedefs/handle-request.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-request">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleRequest</h1></header><a name="handlerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/handle-request-inputs"><code>HandleRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/handle-request">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/handle-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>HandleRequest</h1></header><a name="handlerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/handle-request-inputs"><code>HandleRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/HandleRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleFailedRequestInput</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">HandleRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/hook.html b/docs/2.3/typedefs/hook.html index 66350033d5..e742387c67 100644 --- a/docs/2.3/typedefs/hook.html +++ b/docs/2.3/typedefs/hook.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/hook">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Hook</h1></header><a name="hook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/Hook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/hook">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>Hook</h1></header><a name="hook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>Object<string, *></code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/Hook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/intercept-handler.html b/docs/2.3/typedefs/intercept-handler.html index 4c7f619ddf..1d4776eafe 100644 --- a/docs/2.3/typedefs/intercept-handler.html +++ b/docs/2.3/typedefs/intercept-handler.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/intercept-handler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/intercept-handler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>InterceptHandler</h1></header><a name="intercepthandler"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/2.3/api/request"><code>PuppeteerRequest</code></a></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/InterceptHandler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/intercept-handler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/intercept-handler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>InterceptHandler</h1></header><a name="intercepthandler"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>request</code></strong>: <a href="/sdk/js/docs/2.3/api/request"><code>PuppeteerRequest</code></a></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/InterceptHandler.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/key-consumer.html b/docs/2.3/typedefs/key-consumer.html index 276c48c0b8..24c3a16635 100644 --- a/docs/2.3/typedefs/key-consumer.html +++ b/docs/2.3/typedefs/key-consumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/key-consumer">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/key-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">KeyConsumer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - KeyValueStore</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyConsumer</h1></header><a name="keyconsumer"></a><p>User-function used in the <a href="/sdk/js/docs/2.3/api/key-value-store#foreachkey"><code>KeyValueStore.forEachKey()</code></a> method.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code> - Current {KeyValue} key being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of the current key in <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a>.</li><li><strong><code>info</code></strong>: <code>*</code> - Information about the current <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a> entry.<ul><li><strong><code>size</code></strong>: <code>number</code> - Size of the value associated with the current key in bytes.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/create-session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CreateSession</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/key-consumer">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/key-consumer">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">KeyConsumer</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - KeyValueStore</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyConsumer</h1></header><a name="keyconsumer"></a><p>User-function used in the <a href="/sdk/js/docs/2.3/api/key-value-store#foreachkey"><code>KeyValueStore.forEachKey()</code></a> method.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>key</code></strong>: <code>string</code> - Current {KeyValue} key being processed.</li><li><strong><code>index</code></strong>: <code>number</code> - Position of the current key in <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a>.</li><li><strong><code>info</code></strong>: <code>*</code> - Information about the current <a href="/sdk/js/docs/2.3/api/key-value-store"><code>KeyValueStore</code></a> entry.<ul><li><strong><code>size</code></strong>: <code>number</code> - Size of the value associated with the current key in bytes.</li></ul></li></ul><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyConsumer.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-reducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/create-session"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CreateSession</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/key-value-store-value-types.html b/docs/2.3/typedefs/key-value-store-value-types.html index 31b290a3cd..faa4d90dba 100644 --- a/docs/2.3/typedefs/key-value-store-value-types.html +++ b/docs/2.3/typedefs/key-value-store-value-types.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/key-value-store-value-types">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/key-value-store-value-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyValueStoreValueTypes</h1></header><a name="keyvaluestorevaluetypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyValueStoreValueTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/key-value-store-value-types">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/key-value-store-value-types">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>KeyValueStoreValueTypes</h1></header><a name="keyvaluestorevaluetypes"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/KeyValueStoreValueTypes.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/logger-options.html b/docs/2.3/typedefs/logger-options.html index 695231bad8..e61241767c 100644 --- a/docs/2.3/typedefs/logger-options.html +++ b/docs/2.3/typedefs/logger-options.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/logger-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/logger-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>LoggerOptions</h1></header><a name="loggeroptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="level"><code>level</code><a href="#level" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 4</code></p><p>Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with the <code>log.LEVELS</code> constants.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxdepth"><code>maxDepth</code><a href="#maxdepth" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 4</code></p><p>Max depth of data object that will be logged. Anything deeper than the limit will be stripped off.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxstringlength"><code>maxStringLength</code><a href="#maxstringlength" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 2000</code></p><p>Max length of the string to be logged. Longer strings will be truncated.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="prefix"><code>prefix</code><a href="#prefix" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Prefix to be prepended the each logged line.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="suffix"><code>suffix</code><a href="#suffix" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Suffix that will be appended the each logged line.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="logger"><code>logger</code><a href="#logger" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Logger</code></p><p>Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use <code>log.LoggerJson</code> -that formats each log line as a JSON.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="data"><code>data</code><a href="#data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Record<string, unknown></code></p><p>Additional data to be added to each log line.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/LoggerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#level" class="table-of-contents__link toc-highlight"><code>level</code></a></li><li><a href="#maxdepth" class="table-of-contents__link toc-highlight"><code>maxDepth</code></a></li><li><a href="#maxstringlength" class="table-of-contents__link toc-highlight"><code>maxStringLength</code></a></li><li><a href="#prefix" class="table-of-contents__link toc-highlight"><code>prefix</code></a></li><li><a href="#suffix" class="table-of-contents__link toc-highlight"><code>suffix</code></a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><code>logger</code></a></li><li><a href="#data" class="table-of-contents__link toc-highlight"><code>data</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +that formats each log line as a JSON.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="data"><code>data</code><a href="#data" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Record<string, unknown></code></p><p>Additional data to be added to each log line.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/LoggerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#level" class="table-of-contents__link toc-highlight"><code>level</code></a></li><li><a href="#maxdepth" class="table-of-contents__link toc-highlight"><code>maxDepth</code></a></li><li><a href="#maxstringlength" class="table-of-contents__link toc-highlight"><code>maxStringLength</code></a></li><li><a href="#prefix" class="table-of-contents__link toc-highlight"><code>prefix</code></a></li><li><a href="#suffix" class="table-of-contents__link toc-highlight"><code>suffix</code></a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><code>logger</code></a></li><li><a href="#data" class="table-of-contents__link toc-highlight"><code>data</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/memory-info.html b/docs/2.3/typedefs/memory-info.html index 2e1b29572f..5779e59745 100644 --- a/docs/2.3/typedefs/memory-info.html +++ b/docs/2.3/typedefs/memory-info.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/memory-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/memory-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>MemoryInfo</h1></header><a name="memoryinfo"></a><p>Describes memory usage of an Actor.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalbytes"><code>totalBytes</code><a href="#totalbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total memory available in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="freebytes"><code>freeBytes</code><a href="#freebytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of free memory in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usedbytes"><code>usedBytes</code><a href="#usedbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used (= totalBytes - freeBytes)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mainprocessbytes"><code>mainProcessBytes</code><a href="#mainprocessbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used the current Node.js process</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="childprocessesbytes"><code>childProcessesBytes</code><a href="#childprocessesbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used by child processes of the current Node.js process</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/MemoryInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#totalbytes" class="table-of-contents__link toc-highlight"><code>totalBytes</code></a></li><li><a href="#freebytes" class="table-of-contents__link toc-highlight"><code>freeBytes</code></a></li><li><a href="#usedbytes" class="table-of-contents__link toc-highlight"><code>usedBytes</code></a></li><li><a href="#mainprocessbytes" class="table-of-contents__link toc-highlight"><code>mainProcessBytes</code></a></li><li><a href="#childprocessesbytes" class="table-of-contents__link toc-highlight"><code>childProcessesBytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/memory-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/memory-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>MemoryInfo</h1></header><a name="memoryinfo"></a><p>Describes memory usage of an Actor.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalbytes"><code>totalBytes</code><a href="#totalbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Total memory available in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="freebytes"><code>freeBytes</code><a href="#freebytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of free memory in the system or container</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usedbytes"><code>usedBytes</code><a href="#usedbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used (= totalBytes - freeBytes)</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mainprocessbytes"><code>mainProcessBytes</code><a href="#mainprocessbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used the current Node.js process</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="childprocessesbytes"><code>childProcessesBytes</code><a href="#childprocessesbytes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Amount of memory used by child processes of the current Node.js process</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/MemoryInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/dataset-content"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#totalbytes" class="table-of-contents__link toc-highlight"><code>totalBytes</code></a></li><li><a href="#freebytes" class="table-of-contents__link toc-highlight"><code>freeBytes</code></a></li><li><a href="#usedbytes" class="table-of-contents__link toc-highlight"><code>usedBytes</code></a></li><li><a href="#mainprocessbytes" class="table-of-contents__link toc-highlight"><code>mainProcessBytes</code></a></li><li><a href="#childprocessesbytes" class="table-of-contents__link toc-highlight"><code>childProcessesBytes</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/playwright-crawler-options.html b/docs/2.3/typedefs/playwright-crawler-options.html index 729cbd65f0..585211eeff 100644 --- a/docs/2.3/typedefs/playwright-crawler-options.html +++ b/docs/2.3/typedefs/playwright-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -34,8 +34,8 @@ <code>isTaskReadyFunction</code> options are provided by <code>BasicCrawler</code> and cannot be overridden. However, you can provide a custom implementation of <code>isFinishedFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Playwright crawler will initialize the <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> with the corresponding <code>sessionPoolOptions</code>. The session instance will be -than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CheerioCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/playwright-goto-options.html b/docs/2.3/typedefs/playwright-goto-options.html index d0e4a34641..0e109aad32 100644 --- a/docs/2.3/typedefs/playwright-goto-options.html +++ b/docs/2.3/typedefs/playwright-goto-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ browserContext.setDefaultNavigationTimeout(timeout), browserContext.setDefaultTimeout(timeout), page.setDefaultNavigationTimeout(timeout) or page.setDefaultTimeout(timeout) methods.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="waituntil"><code>waitUntil</code><a href="#waituntil" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>&quot;domcontentloaded&quot;</code> | <code>&quot;load&quot;</code> | <code>&quot;networkidle&quot;</code></p><p>When to consider operation succeeded, defaults to <code>load</code>. Events can be either: - <code>'domcontentloaded'</code> - consider operation to be finished when the <code>DOMContentLoaded</code> event is fired. - <code>'load'</code> - consider operation to be finished when the <code>load</code> event is fired. - <code>'networkidle'</code> - consider -operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightGotoOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +operation to be finished when there are no network connections for at least <code>500</code> ms.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="referer"><code>referer</code><a href="#referer" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Referer header value. If provided it will take preference over the referer header value set by page.setExtraHTTPHeaders(headers).</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightGotoOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#timeout" class="table-of-contents__link toc-highlight"><code>timeout</code></a></li><li><a href="#waituntil" class="table-of-contents__link toc-highlight"><code>waitUntil</code></a></li><li><a href="#referer" class="table-of-contents__link toc-highlight"><code>referer</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/playwright-handle-page-function-param.html b/docs/2.3/typedefs/playwright-handle-page-function-param.html index 46504b5ee6..7063f9a475 100644 --- a/docs/2.3/typedefs/playwright-handle-page-function-param.html +++ b/docs/2.3/typedefs/playwright-handle-page-function-param.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHandlePageFunctionParam</h1></header><a name="playwrighthandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/playwright-crawler"><code>PlaywrightCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHandlePageFunctionParam</h1></header><a name="playwrighthandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/playwright-crawler"><code>PlaywrightCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/playwright-handle-page-function.html b/docs/2.3/typedefs/playwright-handle-page-function.html index a6a5349ef6..bff0594409 100644 --- a/docs/2.3/typedefs/playwright-handle-page-function.html +++ b/docs/2.3/typedefs/playwright-handle-page-function.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/playwright-handle-page-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHandlePageFunction</h1></header><a name="playwrighthandlepagefunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"><code>PlaywrightHandlePageFunctionParam</code></a> | -<a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHandlePageFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/playwright-hook.html b/docs/2.3/typedefs/playwright-hook.html index bc68fe8fa1..ed0a77e135 100644 --- a/docs/2.3/typedefs/playwright-hook.html +++ b/docs/2.3/typedefs/playwright-hook.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/playwright-hook">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/playwright-hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PlaywrightHook</h1></header><a name="playwrighthook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <code>Object</code> | <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | -<a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/playwright-goto-options"><code>PlaywrightGotoOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/playwright-goto-options"><code>PlaywrightGotoOptions</code></a></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/playwright-launch-context.html b/docs/2.3/typedefs/playwright-launch-context.html index dcf945177a..b2affa1144 100644 --- a/docs/2.3/typedefs/playwright-launch-context.html +++ b/docs/2.3/typedefs/playwright-launch-context.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ resources will not be throttled by one another.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdatadir"><code>userDataDir</code><a href="#userdatadir" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Sets the <a href="https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md" target="_blank" rel="noopener">User Data Directory</a> path. The user data directory contains profile data such as history, bookmarks, and cookies, as well as other per-installation local state. If not specified, a temporary directory is used instead.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launcher"><code>launcher</code><a href="#launcher" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>By default this function uses <code>require("playwright").chromium</code>. If you want to use a different browser you can pass it by this property as e.g. -<code>require("playwright").firefox</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#userdatadir" class="table-of-contents__link toc-highlight"><code>userDataDir</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>require("playwright").firefox</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PlaywrightLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#userdatadir" class="table-of-contents__link toc-highlight"><code>userDataDir</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/post-response-inputs.html b/docs/2.3/typedefs/post-response-inputs.html index 92b4d515f6..193ddc1176 100644 --- a/docs/2.3/typedefs/post-response-inputs.html +++ b/docs/2.3/typedefs/post-response-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/post-response-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/post-response-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PostResponseInputs</h1></header><a name="postresponseinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code> | <code>Readable</code></p><p>stream</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/2.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponseInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/post-response-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/post-response-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PostResponseInputs</h1></header><a name="postresponseinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="response"><code>response</code><a href="#response" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>IncomingMessage</code> | <code>Readable</code></p><p>stream</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/2.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponseInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#response" class="table-of-contents__link toc-highlight"><code>response</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/post-response.html b/docs/2.3/typedefs/post-response.html index a1e4501d84..f39faf352b 100644 --- a/docs/2.3/typedefs/post-response.html +++ b/docs/2.3/typedefs/post-response.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/post-response">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/post-response">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PostResponse</h1></header><a name="postresponse"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/post-response-inputs"><code>PostResponseInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponse.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/post-response">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/post-response">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PostResponse</h1></header><a name="postresponse"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/post-response-inputs"><code>PostResponseInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PostResponse.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/prepare-request-inputs.html b/docs/2.3/typedefs/prepare-request-inputs.html index ef52c906f5..7a839aeffa 100644 --- a/docs/2.3/typedefs/prepare-request-inputs.html +++ b/docs/2.3/typedefs/prepare-request-inputs.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PrepareRequestInputs</h1></header><a name="preparerequestinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/2.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/prepare-request-inputs">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PrepareRequestInputs</h1></header><a name="preparerequestinputs"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>Original instance fo the {Request} object. Must be modified in-place.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="session"><code>session</code><a href="#session" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a></p><p>The current session</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyinfo"><code>proxyInfo</code><a href="#proxyinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-info"><code>ProxyInfo</code></a></p><p>An object with information about currently used proxy by the crawler and configured by the <a href="/sdk/js/docs/2.3/api/proxy-configuration"><code>ProxyConfiguration</code></a> class.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/cheerio-crawler"><code>CheerioCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequestInputs.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/prepare-request"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PrepareRequest</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlaywrightHandlePageFunction</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li><li><a href="#session" class="table-of-contents__link toc-highlight"><code>session</code></a></li><li><a href="#proxyinfo" class="table-of-contents__link toc-highlight"><code>proxyInfo</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/prepare-request.html b/docs/2.3/typedefs/prepare-request.html index 8ca7f579a0..ea0419fef7 100644 --- a/docs/2.3/typedefs/prepare-request.html +++ b/docs/2.3/typedefs/prepare-request.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/prepare-request">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/prepare-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PrepareRequest</h1></header><a name="preparerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs"><code>PrepareRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/prepare-request">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/prepare-request">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PrepareRequest</h1></header><a name="preparerequest"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>inputs</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs"><code>PrepareRequestInputs</code></a> - Arguments passed to this callback.</li></ul><p><strong>Returns</strong>:</p><p><code>void</code> <!-- -->|<!-- --> <code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PrepareRequest.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">HandleRequestInputs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PrepareRequestInputs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/proxy-configuration-function.html b/docs/2.3/typedefs/proxy-configuration-function.html index e0418e7a28..f64c1a9761 100644 --- a/docs/2.3/typedefs/proxy-configuration-function.html +++ b/docs/2.3/typedefs/proxy-configuration-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>ProxyConfigurationFunction</h1></header><a name="proxyconfigurationfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionId</code></strong>: <code>string</code> | <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/proxy-configuration-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>ProxyConfigurationFunction</h1></header><a name="proxyconfigurationfunction"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>sessionId</code></strong>: <code>string</code> | <code>number</code></li></ul><p><strong>Returns</strong>:</p><p><code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/proxy-configuration-options.html b/docs/2.3/typedefs/proxy-configuration-options.html index 4fead33343..75a277aff1 100644 --- a/docs/2.3/typedefs/proxy-configuration-options.html +++ b/docs/2.3/typedefs/proxy-configuration-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,8 +26,8 @@ code.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="proxyurls"><code>proxyUrls</code><a href="#proxyurls" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><p>An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will cause an error to be thrown on initialize.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="newurlfunction"><code>newUrlFunction</code><a href="#newurlfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/proxy-configuration-function"><code>ProxyConfigurationFunction</code></a></p><p>Custom function that allows you to generate the new proxy URL dynamically. It gets the <code>sessionId</code> as a parameter and should always return stringified proxy URL. This function is used to generate the URL when <a href="/sdk/js/docs/2.3/api/proxy-configuration#newurl"><code>ProxyConfiguration.newUrl</code></a> or -<a href="/sdk/js/docs/2.3/api/proxy-configuration#newproxyinfo"><code>ProxyConfiguration.newProxyInfo</code></a> is called.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#apifyproxygroups" class="table-of-contents__link toc-highlight"><code>apifyProxyGroups</code></a></li><li><a href="#apifyproxycountry" class="table-of-contents__link toc-highlight"><code>apifyProxyCountry</code></a></li><li><a href="#proxyurls" class="table-of-contents__link toc-highlight"><code>proxyUrls</code></a></li><li><a href="#newurlfunction" class="table-of-contents__link toc-highlight"><code>newUrlFunction</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/proxy-configuration#newproxyinfo"><code>ProxyConfiguration.newProxyInfo</code></a> is called.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyConfigurationOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/proxy-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#apifyproxygroups" class="table-of-contents__link toc-highlight"><code>apifyProxyGroups</code></a></li><li><a href="#apifyproxycountry" class="table-of-contents__link toc-highlight"><code>apifyProxyCountry</code></a></li><li><a href="#proxyurls" class="table-of-contents__link toc-highlight"><code>proxyUrls</code></a></li><li><a href="#newurlfunction" class="table-of-contents__link toc-highlight"><code>newUrlFunction</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/proxy-info.html b/docs/2.3/typedefs/proxy-info.html index 6e5b301069..19f935e366 100644 --- a/docs/2.3/typedefs/proxy-info.html +++ b/docs/2.3/typedefs/proxy-info.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ assigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" target="_blank" rel="noopener">full list of available country codes</a>. This parameter is optional, by default, the proxy uses all available proxy servers from all countries.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="password"><code>password</code><a href="#password" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>User's password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> environment variable, which is automatically set by the system -when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener">Apify CLI</a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hostname"><code>hostname</code><a href="#hostname" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Hostname of your proxy.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="port"><code>port</code><a href="#port" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Proxy port.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sessionid" class="table-of-contents__link toc-highlight"><code>sessionId</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><code>hostname</code></a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><code>port</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener">Apify CLI</a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hostname"><code>hostname</code><a href="#hostname" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Hostname of your proxy.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="port"><code>port</code><a href="#port" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Proxy port.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/ProxyInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sessionid" class="table-of-contents__link toc-highlight"><code>sessionId</code></a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><code>groups</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><code>password</code></a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><code>hostname</code></a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><code>port</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/puppeteer-cookie.html b/docs/2.3/typedefs/puppeteer-cookie.html index a594fb90d5..1ab992050a 100644 --- a/docs/2.3/typedefs/puppeteer-cookie.html +++ b/docs/2.3/typedefs/puppeteer-cookie.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-cookie">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerCookie</h1></header><a name="puppeteercookie"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCookie.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-cookie">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerCookie</h1></header><a name="puppeteercookie"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCookie.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/puppeteer-crawler-options.html b/docs/2.3/typedefs/puppeteer-crawler-options.html index 58b70597bf..14cbc8c5cb 100644 --- a/docs/2.3/typedefs/puppeteer-crawler-options.html +++ b/docs/2.3/typedefs/puppeteer-crawler-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ <code>isTaskReadyFunction</code> options are provided by the crawler and cannot be overridden. However, you can provide a custom implementation of <code>isFinishedFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="minconcurrency"><code>minConcurrency</code><a href="#minconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Sets the minimum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><p><em>WARNING:</em> If you set this value too high with respect to the available system memory and CPU, your crawler will run extremely slow or crash. If you're not sure, just keep the default value and the concurrency will scale up automatically.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxconcurrency"><code>maxConcurrency</code><a href="#maxconcurrency" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Sets the maximum concurrency (parallelism) for the crawl. Shortcut to the corresponding <a href="/sdk/js/docs/2.3/api/autoscaled-pool"><code>AutoscaledPool</code></a> option.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usesessionpool"><code>useSessionPool</code><a href="#usesessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Puppeteer crawler will initialize the <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> with the corresponding <code>sessionPoolOptions</code>. The session instance will be -than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +than available in the <code>handleRequestFunction</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpooloptions"><code>sessionPoolOptions</code><a href="#sessionpooloptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-pool-options"><code>SessionPoolOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a> to use.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerCrawlerOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightLaunchContext</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerLaunchContext</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#handlepagefunction" class="table-of-contents__link toc-highlight"><code>handlePageFunction</code></a></li><li><a href="#navigationtimeoutsecs" class="table-of-contents__link toc-highlight"><code>navigationTimeoutSecs</code></a></li><li><a href="#handlefailedrequestfunction" class="table-of-contents__link toc-highlight"><code>handleFailedRequestFunction</code></a></li><li><a href="#launchcontext" class="table-of-contents__link toc-highlight"><code>launchContext</code></a></li><li><a href="#handlepagetimeoutsecs" class="table-of-contents__link toc-highlight"><code>handlePageTimeoutSecs</code></a></li><li><a href="#browserpooloptions" class="table-of-contents__link toc-highlight"><code>browserPoolOptions</code></a></li><li><a href="#persistcookiespersession" class="table-of-contents__link toc-highlight"><code>persistCookiesPerSession</code></a></li><li><a href="#proxyconfiguration" class="table-of-contents__link toc-highlight"><code>proxyConfiguration</code></a></li><li><a href="#prenavigationhooks" class="table-of-contents__link toc-highlight"><code>preNavigationHooks</code></a></li><li><a href="#postnavigationhooks" class="table-of-contents__link toc-highlight"><code>postNavigationHooks</code></a></li><li><a href="#requestlist" class="table-of-contents__link toc-highlight"><code>requestList</code></a></li><li><a href="#requestqueue" class="table-of-contents__link toc-highlight"><code>requestQueue</code></a></li><li><a href="#maxrequestretries" class="table-of-contents__link toc-highlight"><code>maxRequestRetries</code></a></li><li><a href="#maxrequestspercrawl" class="table-of-contents__link toc-highlight"><code>maxRequestsPerCrawl</code></a></li><li><a href="#autoscaledpooloptions" class="table-of-contents__link toc-highlight"><code>autoscaledPoolOptions</code></a></li><li><a href="#minconcurrency" class="table-of-contents__link toc-highlight"><code>minConcurrency</code></a></li><li><a href="#maxconcurrency" class="table-of-contents__link toc-highlight"><code>maxConcurrency</code></a></li><li><a href="#usesessionpool" class="table-of-contents__link toc-highlight"><code>useSessionPool</code></a></li><li><a href="#sessionpooloptions" class="table-of-contents__link toc-highlight"><code>sessionPoolOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/puppeteer-handle-page-function-param.html b/docs/2.3/typedefs/puppeteer-handle-page-function-param.html index fd50b492c6..b1b12dc762 100644 --- a/docs/2.3/typedefs/puppeteer-handle-page-function-param.html +++ b/docs/2.3/typedefs/puppeteer-handle-page-function-param.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePageFunctionParam</h1></header><a name="puppeteerhandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page-function-param">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePageFunctionParam</h1></header><a name="puppeteerhandlepagefunctionparam"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="page"><code>page</code><a href="#page" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Page</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawler"><code>crawler</code><a href="#crawler" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/puppeteer-crawler"><code>PuppeteerCrawler</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePageFunctionParam.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerHandlePage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/dataset-consumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#page" class="table-of-contents__link toc-highlight"><code>page</code></a></li><li><a href="#crawler" class="table-of-contents__link toc-highlight"><code>crawler</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/puppeteer-handle-page.html b/docs/2.3/typedefs/puppeteer-handle-page.html index 0ed9df7d49..f8f889835d 100644 --- a/docs/2.3/typedefs/puppeteer-handle-page.html +++ b/docs/2.3/typedefs/puppeteer-handle-page.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePage</h1></header><a name="puppeteerhandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <code>Object</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePageFunctionParam</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/puppeteer-handle-page">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">CheerioHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page-inputs">CheerioHandlePageInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request">HandleFailedRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-failed-request-input">HandleFailedRequestInput</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request">HandleRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/handle-request-inputs">HandleRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request">PrepareRequest</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/prepare-request-inputs">PrepareRequestInputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function">PlaywrightHandlePageFunction</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param">PlaywrightHandlePageFunctionParam</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page">PuppeteerHandlePage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param">PuppeteerHandlePageFunctionParam</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Crawlers</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHandlePage</h1></header><a name="puppeteerhandlepage"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>context</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a> | <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | <code>Object</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHandlePage.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/playwright-handle-page-function-param"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlaywrightHandlePageFunctionParam</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/puppeteer-handle-page-function-param"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PuppeteerHandlePageFunctionParam</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/puppeteer-hook.html b/docs/2.3/typedefs/puppeteer-hook.html index 6affd6b299..44fb2e0d55 100644 --- a/docs/2.3/typedefs/puppeteer-hook.html +++ b/docs/2.3/typedefs/puppeteer-hook.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/puppeteer-hook">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/puppeteer-hook">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>PuppeteerHook</h1></header><a name="puppeteerhook"></a><p><strong>Parameters</strong>:</p><ul><li><strong><code>crawlingContext</code></strong>: <code>Object</code> | <a href="/sdk/js/docs/2.3/typedefs/browser-crawling-context"><code>BrowserCrawlingContext</code></a> | -<a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>any</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/typedefs/crawling-context"><code>CrawlingContext</code></a></li><li><strong><code>gotoOptions</code></strong>: <code>any</code></li></ul><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerHook.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/puppeteer-launch-context.html b/docs/2.3/typedefs/puppeteer-launch-context.html index f2b1388113..f595ff3cf1 100644 --- a/docs/2.3/typedefs/puppeteer-launch-context.html +++ b/docs/2.3/typedefs/puppeteer-launch-context.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ The path to Chrome executable is taken from the <code>APIFY_CHROME_EXECUTABLE_PATH</code> environment variable if provided, or defaults to the typical Google Chrome executable location specific for the operating system. By default, this option is <code>false</code>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="launcher"><code>launcher</code><a href="#launcher" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><p>Already required module (<code>Object</code>). This enables usage of various Puppeteer wrappers such as <code>puppeteer-extra</code>.</p><p>Take caution, because it can cause all kinds of unexpected errors and weird behavior. Apify SDK is not tested with any other library besides <code>puppeteer</code> itself.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="useincognitopages"><code>useIncognitoPages</code><a href="#useincognitopages" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>With this option selected, all pages will be opened in a new incognito browser context. This means they will not share cookies nor cache and their -resources will not be throttled by one another.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealth"><code>stealth</code><a href="#stealth" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealthoptions"><code>stealthOptions</code><a href="#stealthoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/stealth-options"><code>StealthOptions</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#stealth" class="table-of-contents__link toc-highlight"><code>stealth</code></a></li><li><a href="#stealthoptions" class="table-of-contents__link toc-highlight"><code>stealthOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +resources will not be throttled by one another.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealth"><code>stealth</code><a href="#stealth" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stealthoptions"><code>stealthOptions</code><a href="#stealthoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/stealth-options"><code>StealthOptions</code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/PuppeteerLaunchContext.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PuppeteerCrawlerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#launchoptions" class="table-of-contents__link toc-highlight"><code>launchOptions</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#useragent" class="table-of-contents__link toc-highlight"><code>userAgent</code></a></li><li><a href="#usechrome" class="table-of-contents__link toc-highlight"><code>useChrome</code></a></li><li><a href="#launcher" class="table-of-contents__link toc-highlight"><code>launcher</code></a></li><li><a href="#useincognitopages" class="table-of-contents__link toc-highlight"><code>useIncognitoPages</code></a></li><li><a href="#stealth" class="table-of-contents__link toc-highlight"><code>stealth</code></a></li><li><a href="#stealthoptions" class="table-of-contents__link toc-highlight"><code>stealthOptions</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/queue-operation-info.html b/docs/2.3/typedefs/queue-operation-info.html index b6c2bfb438..211f26e67b 100644 --- a/docs/2.3/typedefs/queue-operation-info.html +++ b/docs/2.3/typedefs/queue-operation-info.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/queue-operation-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>QueueOperationInfo</h1></header><a name="queueoperationinfo"></a><p>A helper class that is used to report results from various <a href="/sdk/js/docs/2.3/api/request-queue"><code>RequestQueue</code></a> functions as well as -<a href="/sdk/js/docs/2.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadypresent"><code>wasAlreadyPresent</code><a href="#wasalreadypresent" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already present in the queue.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadyhandled"><code>wasAlreadyHandled</code><a href="#wasalreadyhandled" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already marked as handled.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestid"><code>requestId</code><a href="#requestid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>The ID of the added request</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> object passed to the <code>RequestQueue</code> function.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/QueueOperationInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MemoryInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#wasalreadypresent" class="table-of-contents__link toc-highlight"><code>wasAlreadyPresent</code></a></li><li><a href="#wasalreadyhandled" class="table-of-contents__link toc-highlight"><code>wasAlreadyHandled</code></a></li><li><a href="#requestid" class="table-of-contents__link toc-highlight"><code>requestId</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadypresent"><code>wasAlreadyPresent</code><a href="#wasalreadypresent" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already present in the queue.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="wasalreadyhandled"><code>wasAlreadyHandled</code><a href="#wasalreadyhandled" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>Indicates if request was already marked as handled.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestid"><code>requestId</code><a href="#requestid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>The ID of the added request</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="request"><code>request</code><a href="#request" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a></p><p>The original <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> object passed to the <code>RequestQueue</code> function.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/QueueOperationInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/memory-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MemoryInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#wasalreadypresent" class="table-of-contents__link toc-highlight"><code>wasAlreadyPresent</code></a></li><li><a href="#wasalreadyhandled" class="table-of-contents__link toc-highlight"><code>wasAlreadyHandled</code></a></li><li><a href="#requestid" class="table-of-contents__link toc-highlight"><code>requestId</code></a></li><li><a href="#request" class="table-of-contents__link toc-highlight"><code>request</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-as-browser-options.html b/docs/2.3/typedefs/request-as-browser-options.html index 995a7a3cf1..22df1aa698 100644 --- a/docs/2.3/typedefs/request-as-browser-options.html +++ b/docs/2.3/typedefs/request-as-browser-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ vulnerabilities, although the risk should be negligible as these vulnerabilities mainly relate to server applications, not clients. Learn more in this <a href="https://snyk.io/blog/node-js-release-fixes-a-critical-http-security-vulnerability/" target="_blank" rel="noopener">blog post</a>.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/abort-function"><code>AbortFunction</code></a></p><p>Function accepts <code>response</code> object as a single parameter and should return <code>true</code> or <code>false</code>. If function returns true, request gets aborted.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usehttp2"><code>useHttp2</code><a href="#usehttp2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If set to false, it will prevent use of HTTP2 requests. This is strongly discouraged. Websites expect HTTP2 connections, because browsers use HTTP2 by default. It will automatically downgrade to HTTP/1.1 for websites that do not support HTTP2.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessiontoken"><code>sessionToken</code><a href="#sessiontoken" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>object</code></p><p>A unique object used to generate browser headers. By default, new headers are generated on every call. Set this option to make these headers -persistent.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/session-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#headergeneratoroptions" class="table-of-contents__link toc-highlight"><code>headerGeneratorOptions</code></a></li><li><a href="#languagecode" class="table-of-contents__link toc-highlight"><code>languageCode</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#usemobileversion" class="table-of-contents__link toc-highlight"><code>useMobileVersion</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#useinsecurehttpparser" class="table-of-contents__link toc-highlight"><code>useInsecureHttpParser</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li><li><a href="#usehttp2" class="table-of-contents__link toc-highlight"><code>useHttp2</code></a></li><li><a href="#sessiontoken" class="table-of-contents__link toc-highlight"><code>sessionToken</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +persistent.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/session-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#proxyurl" class="table-of-contents__link toc-highlight"><code>proxyUrl</code></a></li><li><a href="#headergeneratoroptions" class="table-of-contents__link toc-highlight"><code>headerGeneratorOptions</code></a></li><li><a href="#languagecode" class="table-of-contents__link toc-highlight"><code>languageCode</code></a></li><li><a href="#countrycode" class="table-of-contents__link toc-highlight"><code>countryCode</code></a></li><li><a href="#usemobileversion" class="table-of-contents__link toc-highlight"><code>useMobileVersion</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#useinsecurehttpparser" class="table-of-contents__link toc-highlight"><code>useInsecureHttpParser</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li><li><a href="#usehttp2" class="table-of-contents__link toc-highlight"><code>useHttp2</code></a></li><li><a href="#sessiontoken" class="table-of-contents__link toc-highlight"><code>sessionToken</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-as-browser-result.html b/docs/2.3/typedefs/request-as-browser-result.html index d4bfb2a32d..aa242239c0 100644 --- a/docs/2.3/typedefs/request-as-browser-result.html +++ b/docs/2.3/typedefs/request-as-browser-result.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-as-browser-result">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-as-browser-result">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestAsBrowserResult</h1></header><a name="requestasbrowserresult"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserResult.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-as-browser-result">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-as-browser-result">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestAsBrowserResult</h1></header><a name="requestasbrowserresult"></a><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestAsBrowserResult.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-list-options.html b/docs/2.3/typedefs/request-list-options.html index 823c359375..282cab8b14 100644 --- a/docs/2.3/typedefs/request-list-options.html +++ b/docs/2.3/typedefs/request-list-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -31,8 +31,8 @@ <a href="/sdk/js/docs/2.3/api/request"><code>Request</code></a> objects.</p><p>If the property is not present, it is generated by normalizing the URL. If present, it is kept intact. In any case, only one request per <code>uniqueKey</code> is added to the <code>RequestList</code> resulting in removal of duplicate URLs / unique keys.</p><p>Setting <code>keepDuplicateUrls</code> to <code>true</code> will append an additional identifier to the <code>uniqueKey</code> of each request that does not already include a <code>uniqueKey</code>. Therefore, duplicate URLs will be kept in the list. It does not protect the user from having duplicates in user set <code>uniqueKey</code>s however. -It is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the <code>RequestList</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sources" class="table-of-contents__link toc-highlight"><code>sources</code></a></li><li><a href="#sourcesfunction" class="table-of-contents__link toc-highlight"><code>sourcesFunction</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#persistrequestskey" class="table-of-contents__link toc-highlight"><code>persistRequestsKey</code></a></li><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#keepduplicateurls" class="table-of-contents__link toc-highlight"><code>keepDuplicateUrls</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +It is the user's responsibility to ensure uniqueness of their unique keys if they wish to keep more than just a single copy in the <code>RequestList</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#sources" class="table-of-contents__link toc-highlight"><code>sources</code></a></li><li><a href="#sourcesfunction" class="table-of-contents__link toc-highlight"><code>sourcesFunction</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#persistrequestskey" class="table-of-contents__link toc-highlight"><code>persistRequestsKey</code></a></li><li><a href="#state" class="table-of-contents__link toc-highlight"><code>state</code></a></li><li><a href="#keepduplicateurls" class="table-of-contents__link toc-highlight"><code>keepDuplicateUrls</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-list-sources-function.html b/docs/2.3/typedefs/request-list-sources-function.html index ad1104ad44..0422b6c260 100644 --- a/docs/2.3/typedefs/request-list-sources-function.html +++ b/docs/2.3/typedefs/request-list-sources-function.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-list-sources-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-list-sources-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestListSourcesFunction</h1></header><a name="requestlistsourcesfunction"></a><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-options"><code>Promise<Array<(RequestOptions|Request|string)>></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListSourcesFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-list-sources-function">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-list-sources-function">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestListSourcesFunction</h1></header><a name="requestlistsourcesfunction"></a><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-options"><code>Promise<Array<(RequestOptions|Request|string)>></code></a></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListSourcesFunction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-list-state.html b/docs/2.3/typedefs/request-list-state.html index f06818ec8c..9a3442344d 100644 --- a/docs/2.3/typedefs/request-list-state.html +++ b/docs/2.3/typedefs/request-list-state.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-list-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-list-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>RequestListState</h1></header><a name="requestliststate"></a><p>Represents state of a <a href="/sdk/js/docs/2.3/api/request-list"><code>RequestList</code></a>. It can be used to resume a <a href="/sdk/js/docs/2.3/api/request-list"><code>RequestList</code></a> which has been previously processed. You can obtain the state by calling <a href="/sdk/js/docs/2.3/api/request-list#getstate"><code>RequestList.getState()</code></a> and receive an object with the following -structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextIndex</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextUniqueKey</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'unique-key-5'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> inProgress</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-1'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-4'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextindex"><code>nextIndex</code><a href="#nextindex" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextuniquekey"><code>nextUniqueKey</code><a href="#nextuniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Key of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="inprogress"><code>inProgress</code><a href="#inprogress" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, boolean></code></p><p>An object mapping request keys to a boolean value respresenting whether they are being processed at the moment.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/session-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#nextindex" class="table-of-contents__link toc-highlight"><code>nextIndex</code></a></li><li><a href="#nextuniquekey" class="table-of-contents__link toc-highlight"><code>nextUniqueKey</code></a></li><li><a href="#inprogress" class="table-of-contents__link toc-highlight"><code>inProgress</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextIndex</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> nextUniqueKey</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'unique-key-5'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> inProgress</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-1'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string-property property" style="color:#36acaa">'unique-key-4'</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextindex"><code>nextIndex</code><a href="#nextindex" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><p>Position of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nextuniquekey"><code>nextUniqueKey</code><a href="#nextuniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Key of the next request to be processed.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="inprogress"><code>inProgress</code><a href="#inprogress" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, boolean></code></p><p>An object mapping request keys to a boolean value respresenting whether they are being processed at the moment.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestListState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/queue-operation-info"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/session-state"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionState</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#nextindex" class="table-of-contents__link toc-highlight"><code>nextIndex</code></a></li><li><a href="#nextuniquekey" class="table-of-contents__link toc-highlight"><code>nextUniqueKey</code></a></li><li><a href="#inprogress" class="table-of-contents__link toc-highlight"><code>inProgress</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-options.html b/docs/2.3/typedefs/request-options.html index 622b900fa6..f4e8ca16ee 100644 --- a/docs/2.3/typedefs/request-options.html +++ b/docs/2.3/typedefs/request-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ failures etc.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="keepurlfragment"><code>keepUrlFragment</code><a href="#keepurlfragment" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If <code>false</code> then the hash part of a URL is removed when computing the <code>uniqueKey</code> property. For example, this causes the <code>http://www.example.com#foo</code> and <code>http://www.example.com#bar</code> URLs to have the same <code>uniqueKey</code> of <code>http://www.example.com</code> and thus the URLs are considered equal. Note that this option only has an effect if <code>uniqueKey</code> is not set.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="useextendeduniquekey"><code>useExtendedUniqueKey</code><a href="#useextendeduniquekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If <code>true</code> then the <code>uniqueKey</code> is computed not only from the URL, but also from the method and payload properties. This is useful when making requests -to the same URL that are differentiated by method or payload, such as form submit navigations in browsers.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#keepurlfragment" class="table-of-contents__link toc-highlight"><code>keepUrlFragment</code></a></li><li><a href="#useextendeduniquekey" class="table-of-contents__link toc-highlight"><code>useExtendedUniqueKey</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +to the same URL that are differentiated by method or payload, such as form submit navigations in browsers.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/logger-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/request-list-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestListOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#url" class="table-of-contents__link toc-highlight"><code>url</code></a></li><li><a href="#uniquekey" class="table-of-contents__link toc-highlight"><code>uniqueKey</code></a></li><li><a href="#method" class="table-of-contents__link toc-highlight"><code>method</code></a></li><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#headers" class="table-of-contents__link toc-highlight"><code>headers</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#keepurlfragment" class="table-of-contents__link toc-highlight"><code>keepUrlFragment</code></a></li><li><a href="#useextendeduniquekey" class="table-of-contents__link toc-highlight"><code>useExtendedUniqueKey</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-queue-info.html b/docs/2.3/typedefs/request-queue-info.html index 4e06c29845..20d9b58e19 100644 --- a/docs/2.3/typedefs/request-queue-info.html +++ b/docs/2.3/typedefs/request-queue-info.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-queue-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-queue-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>RequestQueueInfo</h1></header><a name="requestqueueinfo"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="accessedat"><code>accessedAt</code><a href="#accessedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalrequestcount"><code>totalRequestCount</code><a href="#totalrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="handledrequestcount"><code>handledRequestCount</code><a href="#handledrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pendingrequestcount"><code>pendingRequestCount</code><a href="#pendingrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestQueueInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#accessedat" class="table-of-contents__link toc-highlight"><code>accessedAt</code></a></li><li><a href="#totalrequestcount" class="table-of-contents__link toc-highlight"><code>totalRequestCount</code></a></li><li><a href="#handledrequestcount" class="table-of-contents__link toc-highlight"><code>handledRequestCount</code></a></li><li><a href="#pendingrequestcount" class="table-of-contents__link toc-highlight"><code>pendingRequestCount</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-queue-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-queue-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>RequestQueueInfo</h1></header><a name="requestqueueinfo"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="name"><code>name</code><a href="#name" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="accessedat"><code>accessedAt</code><a href="#accessedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="totalrequestcount"><code>totalRequestCount</code><a href="#totalrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="handledrequestcount"><code>handledRequestCount</code><a href="#handledrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pendingrequestcount"><code>pendingRequestCount</code><a href="#pendingrequestcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestQueueInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><code>name</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#accessedat" class="table-of-contents__link toc-highlight"><code>accessedAt</code></a></li><li><a href="#totalrequestcount" class="table-of-contents__link toc-highlight"><code>totalRequestCount</code></a></li><li><a href="#handledrequestcount" class="table-of-contents__link toc-highlight"><code>handledRequestCount</code></a></li><li><a href="#pendingrequestcount" class="table-of-contents__link toc-highlight"><code>pendingRequestCount</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/request-transform.html b/docs/2.3/typedefs/request-transform.html index 99ceb9c55a..1eea411462 100644 --- a/docs/2.3/typedefs/request-transform.html +++ b/docs/2.3/typedefs/request-transform.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/request-transform">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/request-transform">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">RequestTransform</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Functions - Utilities</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>RequestTransform</h1></header><a name="requesttransform"></a><p>Takes an Apify {RequestOptions} object and changes it's attributes in a desired way. This user-function is used -<a href="/sdk/js/docs/2.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a> to modify requests before enqueuing them.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>original</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/request-options"><code>RequestOptions</code></a> - Request options to be modified.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-options"><code>RequestOptions</code></a> <!-- -->|<!-- --> <code>null</code> <!-- -->|<!-- --> <code>undefined</code> <!-- -->|<!-- --> <code>false</code> - The modified request options to enqueue.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestTransform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/create-session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CreateSession</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<a href="/sdk/js/docs/2.3/api/utils#enqueuelinks"><code>utils.enqueueLinks()</code></a> to modify requests before enqueuing them.</p><p><strong>Parameters</strong>:</p><ul><li><strong><code>original</code></strong>: <a href="/sdk/js/docs/2.3/typedefs/request-options"><code>RequestOptions</code></a> - Request options to be modified.</li></ul><p><strong>Returns</strong>:</p><p><a href="/sdk/js/docs/2.3/typedefs/request-options"><code>RequestOptions</code></a> <!-- -->|<!-- --> <code>null</code> <!-- -->|<!-- --> <code>undefined</code> <!-- -->|<!-- --> <code>false</code> - The modified request options to enqueue.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/RequestTransform.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/create-session"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CreateSession</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/actor-run"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/session-options.html b/docs/2.3/typedefs/session-options.html index a1ccc96754..4165fe1a09 100644 --- a/docs/2.3/typedefs/session-options.html +++ b/docs/2.3/typedefs/session-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/session-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/session-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionOptions</h1></header><a name="sessionoptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Id of session used for generating fingerprints. It is used as proxy session name.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxagesecs"><code>maxAgeSecs</code><a href="#maxagesecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 3000</code></p><p>Number of seconds after which the session is considered as expired.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Object where custom user data can be stored. For example custom headers.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxerrorscore"><code>maxErrorScore</code><a href="#maxerrorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 3</code></p><p>Maximum number of marking session as blocked usage. If the <code>errorScore</code> reaches the <code>maxErrorScore</code> session is marked as block and it is thrown away. It starts at 0. Calling the <code>markBad</code> function increases the <code>errorScore</code> by 1. Calling the <code>markGood</code> will decrease the <code>errorScore</code> by <code>errorScoreDecrement</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscoredecrement"><code>errorScoreDecrement</code><a href="#errorscoredecrement" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.5</code></p><p>It is used for healing the session. For example: if your session is marked bad two times, but it is successful on the third attempt it's errorScore is -decremented by this number.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of creation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of expiration.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session has been used.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorcount"><code>errorCount</code><a href="#errorcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session is marked bad.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusagecount"><code>maxUsageCount</code><a href="#maxusagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 50</code></p><p>Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpool"><code>sessionPool</code><a href="#sessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a></p><p>SessionPool instance. Session will emit the <code>sessionRetired</code> event on this instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#maxagesecs" class="table-of-contents__link toc-highlight"><code>maxAgeSecs</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#errorcount" class="table-of-contents__link toc-highlight"><code>errorCount</code></a></li><li><a href="#maxusagecount" class="table-of-contents__link toc-highlight"><code>maxUsageCount</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +decremented by this number.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of creation.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code></p><p>Date of expiration.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session has been used.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorcount"><code>errorCount</code><a href="#errorcount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0</code></p><p>Indicates how many times the session is marked bad.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusagecount"><code>maxUsageCount</code><a href="#maxusagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 50</code></p><p>Session should be used only a limited amount of times. This number indicates how many times the session is going to be used, before it is thrown away.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionpool"><code>sessionPool</code><a href="#sessionpool" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/session-pool"><code>SessionPool</code></a></p><p>SessionPool instance. Session will emit the <code>sessionRetired</code> event on this instance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestAsBrowserOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SessionPoolOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#maxagesecs" class="table-of-contents__link toc-highlight"><code>maxAgeSecs</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#errorcount" class="table-of-contents__link toc-highlight"><code>errorCount</code></a></li><li><a href="#maxusagecount" class="table-of-contents__link toc-highlight"><code>maxUsageCount</code></a></li><li><a href="#sessionpool" class="table-of-contents__link toc-highlight"><code>sessionPool</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/session-pool-options.html b/docs/2.3/typedefs/session-pool-options.html index beaa6bc909..1940ee3f13 100644 --- a/docs/2.3/typedefs/session-pool-options.html +++ b/docs/2.3/typedefs/session-pool-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/session-pool-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/session-pool-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionPoolOptions</h1></header><a name="sessionpooloptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxpoolsize"><code>maxPoolSize</code><a href="#maxpoolsize" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1000</code></p><p>Maximum size of the pool. Indicates how many sessions are rotated.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="sessionoptions"><code>sessionOptions</code><a href="#sessionoptions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/session-options"><code>SessionOptions</code></a></p><p>The configuration options for <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a> instances.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="persiststatekeyvaluestoreid"><code>persistStateKeyValueStoreId</code><a href="#persiststatekeyvaluestoreid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><p>Name or Id of <code>KeyValueStore</code> where is the <code>SessionPool</code> state stored.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="persiststatekey"><code>persistStateKey</code><a href="#persiststatekey" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code> <code> = <!-- -->"<!-- -->\<!-- -->"<!-- -->SESSION_POOL_STATE\<!-- -->"<!-- -->"</code></p><p>Session pool persists it's state under this key in Key value store.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createsessionfunction"><code>createSessionFunction</code><a href="#createsessionfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/create-session"><code>CreateSession</code></a></p><p>Custom function that should return <code>Session</code> instance. Any error thrown from this function will terminate the process. Function receives <code>SessionPool</code> instance as a parameter</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="forcecloud"><code>forceCloud</code><a href="#forcecloud" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = false</code></p><p>If set to <code>true</code> then the function uses cloud storage usage even if the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable is set. This way it is possible to combine local and cloud storage.</p><p><strong>Note:</strong> If you use <code>forceCloud</code>, it is recommended to also set the <code>persistStateKeyValueStoreId</code> option, as otherwise the <code>KeyValueStore</code> will be -unnamed!</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/session-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SnapshotterOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#maxpoolsize" class="table-of-contents__link toc-highlight"><code>maxPoolSize</code></a></li><li><a href="#sessionoptions" class="table-of-contents__link toc-highlight"><code>sessionOptions</code></a></li><li><a href="#persiststatekeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>persistStateKeyValueStoreId</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#createsessionfunction" class="table-of-contents__link toc-highlight"><code>createSessionFunction</code></a></li><li><a href="#forcecloud" class="table-of-contents__link toc-highlight"><code>forceCloud</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +unnamed!</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionPoolOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/session-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SnapshotterOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#maxpoolsize" class="table-of-contents__link toc-highlight"><code>maxPoolSize</code></a></li><li><a href="#sessionoptions" class="table-of-contents__link toc-highlight"><code>sessionOptions</code></a></li><li><a href="#persiststatekeyvaluestoreid" class="table-of-contents__link toc-highlight"><code>persistStateKeyValueStoreId</code></a></li><li><a href="#persiststatekey" class="table-of-contents__link toc-highlight"><code>persistStateKey</code></a></li><li><a href="#createsessionfunction" class="table-of-contents__link toc-highlight"><code>createSessionFunction</code></a></li><li><a href="#forcecloud" class="table-of-contents__link toc-highlight"><code>forceCloud</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/session-state.html b/docs/2.3/typedefs/session-state.html index 4b1dbda723..7efa2e45f5 100644 --- a/docs/2.3/typedefs/session-state.html +++ b/docs/2.3/typedefs/session-state.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/session-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/session-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionState</h1></header><a name="sessionstate"></a><p>Persistable <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a> state.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cookiejar"><code>cookieJar</code><a href="#cookiejar" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>CookieJar</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>object</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscore"><code>errorScore</code><a href="#errorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxerrorscore"><code>maxErrorScore</code><a href="#maxerrorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscoredecrement"><code>errorScoreDecrement</code><a href="#errorscoredecrement" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SocialHandles</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#cookiejar" class="table-of-contents__link toc-highlight"><code>cookieJar</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#errorscore" class="table-of-contents__link toc-highlight"><code>errorScore</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/session-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/session-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SessionState</h1></header><a name="sessionstate"></a><p>Persistable <a href="/sdk/js/docs/2.3/api/session"><code>Session</code></a> state.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cookiejar"><code>cookieJar</code><a href="#cookiejar" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>CookieJar</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userdata"><code>userData</code><a href="#userdata" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>object</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscore"><code>errorScore</code><a href="#errorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxerrorscore"><code>maxErrorScore</code><a href="#maxerrorscore" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="errorscoredecrement"><code>errorScoreDecrement</code><a href="#errorscoredecrement" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="usagecount"><code>usageCount</code><a href="#usagecount" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="expiresat"><code>expiresAt</code><a href="#expiresat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SessionState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/request-list-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestListState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SocialHandles</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#cookiejar" class="table-of-contents__link toc-highlight"><code>cookieJar</code></a></li><li><a href="#userdata" class="table-of-contents__link toc-highlight"><code>userData</code></a></li><li><a href="#errorscore" class="table-of-contents__link toc-highlight"><code>errorScore</code></a></li><li><a href="#maxerrorscore" class="table-of-contents__link toc-highlight"><code>maxErrorScore</code></a></li><li><a href="#errorscoredecrement" class="table-of-contents__link toc-highlight"><code>errorScoreDecrement</code></a></li><li><a href="#usagecount" class="table-of-contents__link toc-highlight"><code>usageCount</code></a></li><li><a href="#expiresat" class="table-of-contents__link toc-highlight"><code>expiresAt</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/snapshotter-options.html b/docs/2.3/typedefs/snapshotter-options.html index 15299ff59d..a553ff33e2 100644 --- a/docs/2.3/typedefs/snapshotter-options.html +++ b/docs/2.3/typedefs/snapshotter-options.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/snapshotter-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SnapshotterOptions</h1></header><a name="snapshotteroptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventloopsnapshotintervalsecs"><code>eventLoopSnapshotIntervalSecs</code><a href="#eventloopsnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.5</code></p><p>Defines the interval of measuring the event loop response time.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="clientsnapshotintervalsecs"><code>clientSnapshotIntervalSecs</code><a href="#clientsnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the interval of checking the current state of the remote API client.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxblockedmillis"><code>maxBlockedMillis</code><a href="#maxblockedmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 50</code></p><p>Maximum allowed delay of the event loop in milliseconds. Exceeding this limit overloads the event loop.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cpusnapshotintervalsecs"><code>cpuSnapshotIntervalSecs</code><a href="#cpusnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the interval of measuring CPU usage. This is only used when running locally. On the Apify platform, the statistics are provided externally at a fixed interval.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusedcpuratio"><code>maxUsedCpuRatio</code><a href="#maxusedcpuratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.95</code></p><p>Defines the maximum usage of CPU. Exceeding this limit overloads the CPU.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="memorysnapshotintervalsecs"><code>memorySnapshotIntervalSecs</code><a href="#memorysnapshotintervalsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the interval of measuring memory consumption. This is only used when running locally. On the Apify platform, the statistics are provided externally at a fixed interval. The measurement itself is resource intensive (25 - 50ms async). Therefore, setting this interval below 1 second is not -recommended.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusedmemoryratio"><code>maxUsedMemoryRatio</code><a href="#maxusedmemoryratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.7</code></p><p>Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclienterrors"><code>maxClientErrors</code><a href="#maxclienterrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the maximum number of new rate limit errors within the given interval.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshothistorysecs"><code>snapshotHistorySecs</code><a href="#snapshothistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 60</code></p><p>Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SnapshotterOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">StealthOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventloopsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>eventLoopSnapshotIntervalSecs</code></a></li><li><a href="#clientsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>clientSnapshotIntervalSecs</code></a></li><li><a href="#maxblockedmillis" class="table-of-contents__link toc-highlight"><code>maxBlockedMillis</code></a></li><li><a href="#cpusnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>cpuSnapshotIntervalSecs</code></a></li><li><a href="#maxusedcpuratio" class="table-of-contents__link toc-highlight"><code>maxUsedCpuRatio</code></a></li><li><a href="#memorysnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>memorySnapshotIntervalSecs</code></a></li><li><a href="#maxusedmemoryratio" class="table-of-contents__link toc-highlight"><code>maxUsedMemoryRatio</code></a></li><li><a href="#maxclienterrors" class="table-of-contents__link toc-highlight"><code>maxClientErrors</code></a></li><li><a href="#snapshothistorysecs" class="table-of-contents__link toc-highlight"><code>snapshotHistorySecs</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +recommended.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxusedmemoryratio"><code>maxUsedMemoryRatio</code><a href="#maxusedmemoryratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.7</code></p><p>Defines the maximum ratio of total memory that can be used. Exceeding this limit overloads the memory.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclienterrors"><code>maxClientErrors</code><a href="#maxclienterrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 1</code></p><p>Defines the maximum number of new rate limit errors within the given interval.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshothistorysecs"><code>snapshotHistorySecs</code><a href="#snapshothistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 60</code></p><p>Sets the interval in seconds for which a history of resource snapshots will be kept. Increasing this to very high numbers will affect performance.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SnapshotterOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/session-pool-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionPoolOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">StealthOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#eventloopsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>eventLoopSnapshotIntervalSecs</code></a></li><li><a href="#clientsnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>clientSnapshotIntervalSecs</code></a></li><li><a href="#maxblockedmillis" class="table-of-contents__link toc-highlight"><code>maxBlockedMillis</code></a></li><li><a href="#cpusnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>cpuSnapshotIntervalSecs</code></a></li><li><a href="#maxusedcpuratio" class="table-of-contents__link toc-highlight"><code>maxUsedCpuRatio</code></a></li><li><a href="#memorysnapshotintervalsecs" class="table-of-contents__link toc-highlight"><code>memorySnapshotIntervalSecs</code></a></li><li><a href="#maxusedmemoryratio" class="table-of-contents__link toc-highlight"><code>maxUsedMemoryRatio</code></a></li><li><a href="#maxclienterrors" class="table-of-contents__link toc-highlight"><code>maxClientErrors</code></a></li><li><a href="#snapshothistorysecs" class="table-of-contents__link toc-highlight"><code>snapshotHistorySecs</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/social-handles.html b/docs/2.3/typedefs/social-handles.html index 31543e56b3..a2077c9a31 100644 --- a/docs/2.3/typedefs/social-handles.html +++ b/docs/2.3/typedefs/social-handles.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/social-handles">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/social-handles">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SocialHandles</h1></header><a name="socialhandles"></a><p>Representation of social handles parsed from a HTML page.</p><p>The object has the following structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> emails</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phones</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phonesUncertain</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> linkedIns</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> twitters</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> instagrams</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> facebooks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> youtubes</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> tiktoks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pinterests</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> discords</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emails"><code>emails</code><a href="#emails" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phones"><code>phones</code><a href="#phones" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phonesuncertain"><code>phonesUncertain</code><a href="#phonesuncertain" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="linkedins"><code>linkedIns</code><a href="#linkedins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="twitters"><code>twitters</code><a href="#twitters" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="instagrams"><code>instagrams</code><a href="#instagrams" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="facebooks"><code>facebooks</code><a href="#facebooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="youtubes"><code>youtubes</code><a href="#youtubes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="tiktoks"><code>tiktoks</code><a href="#tiktoks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pinterests"><code>pinterests</code><a href="#pinterests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="discords"><code>discords</code><a href="#discords" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SocialHandles.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/session-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/system-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#emails" class="table-of-contents__link toc-highlight"><code>emails</code></a></li><li><a href="#phones" class="table-of-contents__link toc-highlight"><code>phones</code></a></li><li><a href="#phonesuncertain" class="table-of-contents__link toc-highlight"><code>phonesUncertain</code></a></li><li><a href="#linkedins" class="table-of-contents__link toc-highlight"><code>linkedIns</code></a></li><li><a href="#twitters" class="table-of-contents__link toc-highlight"><code>twitters</code></a></li><li><a href="#instagrams" class="table-of-contents__link toc-highlight"><code>instagrams</code></a></li><li><a href="#facebooks" class="table-of-contents__link toc-highlight"><code>facebooks</code></a></li><li><a href="#youtubes" class="table-of-contents__link toc-highlight"><code>youtubes</code></a></li><li><a href="#tiktoks" class="table-of-contents__link toc-highlight"><code>tiktoks</code></a></li><li><a href="#pinterests" class="table-of-contents__link toc-highlight"><code>pinterests</code></a></li><li><a href="#discords" class="table-of-contents__link toc-highlight"><code>discords</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/social-handles">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/social-handles">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SocialHandles</h1></header><a name="socialhandles"></a><p>Representation of social handles parsed from a HTML page.</p><p>The object has the following structure:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> emails</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phones</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> phonesUncertain</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> linkedIns</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> twitters</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> instagrams</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> facebooks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> youtubes</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> tiktoks</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pinterests</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> discords</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> String</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emails"><code>emails</code><a href="#emails" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phones"><code>phones</code><a href="#phones" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="phonesuncertain"><code>phonesUncertain</code><a href="#phonesuncertain" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="linkedins"><code>linkedIns</code><a href="#linkedins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="twitters"><code>twitters</code><a href="#twitters" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="instagrams"><code>instagrams</code><a href="#instagrams" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="facebooks"><code>facebooks</code><a href="#facebooks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="youtubes"><code>youtubes</code><a href="#youtubes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="tiktoks"><code>tiktoks</code><a href="#tiktoks" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pinterests"><code>pinterests</code><a href="#pinterests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="discords"><code>discords</code><a href="#discords" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<string></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SocialHandles.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/session-state"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SessionState</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/system-info"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#emails" class="table-of-contents__link toc-highlight"><code>emails</code></a></li><li><a href="#phones" class="table-of-contents__link toc-highlight"><code>phones</code></a></li><li><a href="#phonesuncertain" class="table-of-contents__link toc-highlight"><code>phonesUncertain</code></a></li><li><a href="#linkedins" class="table-of-contents__link toc-highlight"><code>linkedIns</code></a></li><li><a href="#twitters" class="table-of-contents__link toc-highlight"><code>twitters</code></a></li><li><a href="#instagrams" class="table-of-contents__link toc-highlight"><code>instagrams</code></a></li><li><a href="#facebooks" class="table-of-contents__link toc-highlight"><code>facebooks</code></a></li><li><a href="#youtubes" class="table-of-contents__link toc-highlight"><code>youtubes</code></a></li><li><a href="#tiktoks" class="table-of-contents__link toc-highlight"><code>tiktoks</code></a></li><li><a href="#pinterests" class="table-of-contents__link toc-highlight"><code>pinterests</code></a></li><li><a href="#discords" class="table-of-contents__link toc-highlight"><code>discords</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/statistic-persisted-state.html b/docs/2.3/typedefs/statistic-persisted-state.html index ab4a9d74ff..2e7986bf87 100644 --- a/docs/2.3/typedefs/statistic-persisted-state.html +++ b/docs/2.3/typedefs/statistic-persisted-state.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/statistic-persisted-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/statistic-persisted-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticPersistedState</h1></header><a name="statisticpersistedstate"></a><p>Format of the persisted stats</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statsid"><code>statsId</code><a href="#statsid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfaileddurationmillis"><code>requestAvgFailedDurationMillis</code><a href="#requestavgfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfinisheddurationmillis"><code>requestAvgFinishedDurationMillis</code><a href="#requestavgfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotaldurationmillis"><code>requestTotalDurationMillis</code><a href="#requesttotaldurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requeststotal"><code>requestsTotal</code><a href="#requeststotal" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerlaststarttimestamp"><code>crawlerLastStartTimestamp</code><a href="#crawlerlaststarttimestamp" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticPersistedState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li><li><a href="#statsid" class="table-of-contents__link toc-highlight"><code>statsId</code></a></li><li><a href="#requestavgfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFailedDurationMillis</code></a></li><li><a href="#requestavgfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFinishedDurationMillis</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requesttotaldurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalDurationMillis</code></a></li><li><a href="#requeststotal" class="table-of-contents__link toc-highlight"><code>requestsTotal</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#crawlerlaststarttimestamp" class="table-of-contents__link toc-highlight"><code>crawlerLastStartTimestamp</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/statistic-persisted-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/statistic-persisted-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticPersistedState</h1></header><a name="statisticpersistedstate"></a><p>Format of the persisted stats</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestretryhistogram"><code>requestRetryHistogram</code><a href="#requestretryhistogram" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Array<number></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statsid"><code>statsId</code><a href="#statsid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfaileddurationmillis"><code>requestAvgFailedDurationMillis</code><a href="#requestavgfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestavgfinisheddurationmillis"><code>requestAvgFinishedDurationMillis</code><a href="#requestavgfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotaldurationmillis"><code>requestTotalDurationMillis</code><a href="#requesttotaldurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requeststotal"><code>requestsTotal</code><a href="#requeststotal" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerlaststarttimestamp"><code>crawlerLastStartTimestamp</code><a href="#crawlerlaststarttimestamp" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticPersistedState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestretryhistogram" class="table-of-contents__link toc-highlight"><code>requestRetryHistogram</code></a></li><li><a href="#statsid" class="table-of-contents__link toc-highlight"><code>statsId</code></a></li><li><a href="#requestavgfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFailedDurationMillis</code></a></li><li><a href="#requestavgfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestAvgFinishedDurationMillis</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requesttotaldurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalDurationMillis</code></a></li><li><a href="#requeststotal" class="table-of-contents__link toc-highlight"><code>requestsTotal</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#crawlerlaststarttimestamp" class="table-of-contents__link toc-highlight"><code>crawlerLastStartTimestamp</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/statistic-state.html b/docs/2.3/typedefs/statistic-state.html index 4a9284381e..c91f56330b 100644 --- a/docs/2.3/typedefs/statistic-state.html +++ b/docs/2.3/typedefs/statistic-state.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/statistic-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/statistic-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticState</h1></header><a name="statisticstate"></a><p>Contains the statistics state</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinished"><code>requestsFinished</code><a href="#requestsfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailed"><code>requestsFailed</code><a href="#requestsfailed" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsretries"><code>requestsRetries</code><a href="#requestsretries" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmindurationmillis"><code>requestMinDurationMillis</code><a href="#requestmindurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmaxdurationmillis"><code>requestMaxDurationMillis</code><a href="#requestmaxdurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfaileddurationmillis"><code>requestTotalFailedDurationMillis</code><a href="#requesttotalfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfinisheddurationmillis"><code>requestTotalFinishedDurationMillis</code><a href="#requesttotalfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerstartedat"><code>crawlerStartedAt</code><a href="#crawlerstartedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerfinishedat"><code>crawlerFinishedAt</code><a href="#crawlerfinishedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestsfinished" class="table-of-contents__link toc-highlight"><code>requestsFinished</code></a></li><li><a href="#requestsfailed" class="table-of-contents__link toc-highlight"><code>requestsFailed</code></a></li><li><a href="#requestsretries" class="table-of-contents__link toc-highlight"><code>requestsRetries</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestmindurationmillis" class="table-of-contents__link toc-highlight"><code>requestMinDurationMillis</code></a></li><li><a href="#requestmaxdurationmillis" class="table-of-contents__link toc-highlight"><code>requestMaxDurationMillis</code></a></li><li><a href="#requesttotalfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFailedDurationMillis</code></a></li><li><a href="#requesttotalfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFinishedDurationMillis</code></a></li><li><a href="#crawlerstartedat" class="table-of-contents__link toc-highlight"><code>crawlerStartedAt</code></a></li><li><a href="#crawlerfinishedat" class="table-of-contents__link toc-highlight"><code>crawlerFinishedAt</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/statistic-state">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/statistic-state">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StatisticState</h1></header><a name="statisticstate"></a><p>Contains the statistics state</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinished"><code>requestsFinished</code><a href="#requestsfinished" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailed"><code>requestsFailed</code><a href="#requestsfailed" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsretries"><code>requestsRetries</code><a href="#requestsretries" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfailedperminute"><code>requestsFailedPerMinute</code><a href="#requestsfailedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestsfinishedperminute"><code>requestsFinishedPerMinute</code><a href="#requestsfinishedperminute" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmindurationmillis"><code>requestMinDurationMillis</code><a href="#requestmindurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requestmaxdurationmillis"><code>requestMaxDurationMillis</code><a href="#requestmaxdurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfaileddurationmillis"><code>requestTotalFailedDurationMillis</code><a href="#requesttotalfaileddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesttotalfinisheddurationmillis"><code>requestTotalFinishedDurationMillis</code><a href="#requesttotalfinisheddurationmillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerstartedat"><code>crawlerStartedAt</code><a href="#crawlerstartedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerfinishedat"><code>crawlerFinishedAt</code><a href="#crawlerfinishedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="crawlerruntimemillis"><code>crawlerRuntimeMillis</code><a href="#crawlerruntimemillis" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="statspersistedat"><code>statsPersistedAt</code><a href="#statspersistedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Date</code> | <code>string</code> | <code>null</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StatisticState.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#requestsfinished" class="table-of-contents__link toc-highlight"><code>requestsFinished</code></a></li><li><a href="#requestsfailed" class="table-of-contents__link toc-highlight"><code>requestsFailed</code></a></li><li><a href="#requestsretries" class="table-of-contents__link toc-highlight"><code>requestsRetries</code></a></li><li><a href="#requestsfailedperminute" class="table-of-contents__link toc-highlight"><code>requestsFailedPerMinute</code></a></li><li><a href="#requestsfinishedperminute" class="table-of-contents__link toc-highlight"><code>requestsFinishedPerMinute</code></a></li><li><a href="#requestmindurationmillis" class="table-of-contents__link toc-highlight"><code>requestMinDurationMillis</code></a></li><li><a href="#requestmaxdurationmillis" class="table-of-contents__link toc-highlight"><code>requestMaxDurationMillis</code></a></li><li><a href="#requesttotalfaileddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFailedDurationMillis</code></a></li><li><a href="#requesttotalfinisheddurationmillis" class="table-of-contents__link toc-highlight"><code>requestTotalFinishedDurationMillis</code></a></li><li><a href="#crawlerstartedat" class="table-of-contents__link toc-highlight"><code>crawlerStartedAt</code></a></li><li><a href="#crawlerfinishedat" class="table-of-contents__link toc-highlight"><code>crawlerFinishedAt</code></a></li><li><a href="#crawlerruntimemillis" class="table-of-contents__link toc-highlight"><code>crawlerRuntimeMillis</code></a></li><li><a href="#statspersistedat" class="table-of-contents__link toc-highlight"><code>statsPersistedAt</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/stealth-options.html b/docs/2.3/typedefs/stealth-options.html index 3eec89fd2f..0192241e9f 100644 --- a/docs/2.3/typedefs/stealth-options.html +++ b/docs/2.3/typedefs/stealth-options.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/stealth-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/stealth-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>StealthOptions</h1></header><a name="stealthoptions"></a><p>Configuration of stealth tricks for a proper hiding effect all of them should be set to true. These tricks are applied only when the <code>stealth</code> option -is set to <code>true</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addplugins"><code>addPlugins</code><a href="#addplugins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If plugins should be added to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewindowframe"><code>emulateWindowFrame</code><a href="#emulatewindowframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates window Iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewebgl"><code>emulateWebGL</code><a href="#emulatewebgl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates graphic card.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulateconsoledebug"><code>emulateConsoleDebug</code><a href="#emulateconsoledebug" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates console.debug to return null.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addlanguage"><code>addLanguage</code><a href="#addlanguage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds languages to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hidewebdriver"><code>hideWebDriver</code><a href="#hidewebdriver" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Hides the webdriver by changing the navigator proto.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hackpermissions"><code>hackPermissions</code><a href="#hackpermissions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Fakes interaction with permissions.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchrome"><code>mockChrome</code><a href="#mockchrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchromeiniframe"><code>mockChromeInIframe</code><a href="#mockchromeiniframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties inside the every newly created iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockdevicememory"><code>mockDeviceMemory</code><a href="#mockdevicememory" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Sets device memory to other value than 0.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StealthOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SnapshotterOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatusOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#addplugins" class="table-of-contents__link toc-highlight"><code>addPlugins</code></a></li><li><a href="#emulatewindowframe" class="table-of-contents__link toc-highlight"><code>emulateWindowFrame</code></a></li><li><a href="#emulatewebgl" class="table-of-contents__link toc-highlight"><code>emulateWebGL</code></a></li><li><a href="#emulateconsoledebug" class="table-of-contents__link toc-highlight"><code>emulateConsoleDebug</code></a></li><li><a href="#addlanguage" class="table-of-contents__link toc-highlight"><code>addLanguage</code></a></li><li><a href="#hidewebdriver" class="table-of-contents__link toc-highlight"><code>hideWebDriver</code></a></li><li><a href="#hackpermissions" class="table-of-contents__link toc-highlight"><code>hackPermissions</code></a></li><li><a href="#mockchrome" class="table-of-contents__link toc-highlight"><code>mockChrome</code></a></li><li><a href="#mockchromeiniframe" class="table-of-contents__link toc-highlight"><code>mockChromeInIframe</code></a></li><li><a href="#mockdevicememory" class="table-of-contents__link toc-highlight"><code>mockDeviceMemory</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +is set to <code>true</code>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addplugins"><code>addPlugins</code><a href="#addplugins" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>If plugins should be added to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewindowframe"><code>emulateWindowFrame</code><a href="#emulatewindowframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates window Iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulatewebgl"><code>emulateWebGL</code><a href="#emulatewebgl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates graphic card.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="emulateconsoledebug"><code>emulateConsoleDebug</code><a href="#emulateconsoledebug" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Emulates console.debug to return null.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="addlanguage"><code>addLanguage</code><a href="#addlanguage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds languages to the navigator.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hidewebdriver"><code>hideWebDriver</code><a href="#hidewebdriver" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Hides the webdriver by changing the navigator proto.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="hackpermissions"><code>hackPermissions</code><a href="#hackpermissions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Fakes interaction with permissions.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchrome"><code>mockChrome</code><a href="#mockchrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockchromeiniframe"><code>mockChromeInIframe</code><a href="#mockchromeiniframe" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Adds the chrome runtime properties inside the every newly created iframe.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mockdevicememory"><code>mockDeviceMemory</code><a href="#mockdevicememory" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code> <code> = true</code></p><p>Sets device memory to other value than 0.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/StealthOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/snapshotter-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SnapshotterOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/system-status-options"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">SystemStatusOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#addplugins" class="table-of-contents__link toc-highlight"><code>addPlugins</code></a></li><li><a href="#emulatewindowframe" class="table-of-contents__link toc-highlight"><code>emulateWindowFrame</code></a></li><li><a href="#emulatewebgl" class="table-of-contents__link toc-highlight"><code>emulateWebGL</code></a></li><li><a href="#emulateconsoledebug" class="table-of-contents__link toc-highlight"><code>emulateConsoleDebug</code></a></li><li><a href="#addlanguage" class="table-of-contents__link toc-highlight"><code>addLanguage</code></a></li><li><a href="#hidewebdriver" class="table-of-contents__link toc-highlight"><code>hideWebDriver</code></a></li><li><a href="#hackpermissions" class="table-of-contents__link toc-highlight"><code>hackPermissions</code></a></li><li><a href="#mockchrome" class="table-of-contents__link toc-highlight"><code>mockChrome</code></a></li><li><a href="#mockchromeiniframe" class="table-of-contents__link toc-highlight"><code>mockChromeInIframe</code></a></li><li><a href="#mockdevicememory" class="table-of-contents__link toc-highlight"><code>mockDeviceMemory</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/system-info.html b/docs/2.3/typedefs/system-info.html index 676a6a8614..bfda85b13d 100644 --- a/docs/2.3/typedefs/system-info.html +++ b/docs/2.3/typedefs/system-info.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/system-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/system-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemInfo</h1></header><a name="systeminfo"></a><p>Represents the current status of the system.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="issystemidle"><code>isSystemIdle</code><a href="#issystemidle" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>If true, system is being overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meminfo"><code>memInfo</code><a href="#meminfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Memory</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventloopinfo"><code>eventLoopInfo</code><a href="#eventloopinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cpuinfo"><code>cpuInfo</code><a href="#cpuinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SocialHandles</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#issystemidle" class="table-of-contents__link toc-highlight"><code>isSystemIdle</code></a></li><li><a href="#meminfo" class="table-of-contents__link toc-highlight"><code>memInfo</code></a></li><li><a href="#eventloopinfo" class="table-of-contents__link toc-highlight"><code>eventLoopInfo</code></a></li><li><a href="#cpuinfo" class="table-of-contents__link toc-highlight"><code>cpuInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/system-info">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/system-info">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/api/apify-call-error">ApifyCallError</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/apify-env">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-content">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/memory-info">MemoryInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/queue-operation-info">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-state">RequestListState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-state">SessionState</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/social-handles">SocialHandles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-info">SystemInfo</a></li></ul></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Return Types</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemInfo</h1></header><a name="systeminfo"></a><p>Represents the current status of the system.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="issystemidle"><code>isSystemIdle</code><a href="#issystemidle" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><p>If true, system is being overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="meminfo"><code>memInfo</code><a href="#meminfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><p>Memory</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventloopinfo"><code>eventLoopInfo</code><a href="#eventloopinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="cpuinfo"><code>cpuInfo</code><a href="#cpuinfo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>Object<string, *></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemInfo.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/social-handles"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">SocialHandles</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#issystemidle" class="table-of-contents__link toc-highlight"><code>isSystemIdle</code></a></li><li><a href="#meminfo" class="table-of-contents__link toc-highlight"><code>memInfo</code></a></li><li><a href="#eventloopinfo" class="table-of-contents__link toc-highlight"><code>eventLoopInfo</code></a></li><li><a href="#cpuinfo" class="table-of-contents__link toc-highlight"><code>cpuInfo</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/system-status-options.html b/docs/2.3/typedefs/system-status-options.html index 2fa39610e8..8cff9b42af 100644 --- a/docs/2.3/typedefs/system-status-options.html +++ b/docs/2.3/typedefs/system-status-options.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/system-status-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/system-status-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemStatusOptions</h1></header><a name="systemstatusoptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="currenthistorysecs"><code>currentHistorySecs</code><a href="#currenthistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 5</code></p><p>Defines max age of snapshots used in the <a href="/sdk/js/docs/2.3/api/system-status#getcurrentstatus"><code>SystemStatus.getCurrentStatus()</code></a> measurement.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxmemoryoverloadedratio"><code>maxMemoryOverloadedRatio</code><a href="#maxmemoryoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.2</code></p><p>Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxeventloopoverloadedratio"><code>maxEventLoopOverloadedRatio</code><a href="#maxeventloopoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.6</code></p><p>Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxcpuoverloadedratio"><code>maxCpuOverloadedRatio</code><a href="#maxcpuoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.4</code></p><p>Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclientoverloadedratio"><code>maxClientOverloadedRatio</code><a href="#maxclientoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.3</code></p><p>Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshotter"><code>snapshotter</code><a href="#snapshotter" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a></p><p>The <code>Snapshotter</code> instance to be queried for <code>SystemStatus</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemStatusOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">StealthOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#currenthistorysecs" class="table-of-contents__link toc-highlight"><code>currentHistorySecs</code></a></li><li><a href="#maxmemoryoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxMemoryOverloadedRatio</code></a></li><li><a href="#maxeventloopoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxEventLoopOverloadedRatio</code></a></li><li><a href="#maxcpuoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxCpuOverloadedRatio</code></a></li><li><a href="#maxclientoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxClientOverloadedRatio</code></a></li><li><a href="#snapshotter" class="table-of-contents__link toc-highlight"><code>snapshotter</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/system-status-options">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/system-status-options">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/guides/motivation">Guide</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/2.3/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/docs/2.3/api/apify">API Reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Type Definitions</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">Constructor Options</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/autoscaled-pool-options">AutoscaledPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/basic-crawler-options">BasicCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-crawler-options">CheerioCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-crawler-options">PlaywrightCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/playwright-launch-context">PlaywrightLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-crawler-options">PuppeteerCrawlerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/puppeteer-launch-context">PuppeteerLaunchContext</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-configuration-options">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/proxy-info">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/logger-options">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-options">RequestOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-list-options">RequestListOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-as-browser-options">RequestAsBrowserOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-options">SessionOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/session-pool-options">SessionPoolOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/snapshotter-options">SnapshotterOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/2.3/typedefs/stealth-options">StealthOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/2.3/typedefs/system-status-options">SystemStatusOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page">Functions - Crawlers</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/dataset-consumer">Functions - Dataset</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/key-consumer">Functions - KeyValueStore</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/create-session">Functions - Sessions</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/request-transform">Functions - Utilities</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" tabindex="0" href="/sdk/js/docs/2.3/typedefs/actor-run">Return Types</a></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/2.3/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Type Definitions</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Constructor Options</span><meta itemprop="position" content="2"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>SystemStatusOptions</h1></header><a name="systemstatusoptions"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="currenthistorysecs"><code>currentHistorySecs</code><a href="#currenthistorysecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 5</code></p><p>Defines max age of snapshots used in the <a href="/sdk/js/docs/2.3/api/system-status#getcurrentstatus"><code>SystemStatus.getCurrentStatus()</code></a> measurement.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxmemoryoverloadedratio"><code>maxMemoryOverloadedRatio</code><a href="#maxmemoryoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.2</code></p><p>Sets the maximum ratio of overloaded snapshots in a memory sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxeventloopoverloadedratio"><code>maxEventLoopOverloadedRatio</code><a href="#maxeventloopoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.6</code></p><p>Sets the maximum ratio of overloaded snapshots in an event loop sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxcpuoverloadedratio"><code>maxCpuOverloadedRatio</code><a href="#maxcpuoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.4</code></p><p>Sets the maximum ratio of overloaded snapshots in a CPU sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="maxclientoverloadedratio"><code>maxClientOverloadedRatio</code><a href="#maxclientoverloadedratio" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>number</code> <code> = 0.3</code></p><p>Sets the maximum ratio of overloaded snapshots in a Client sample. If the sample exceeds this ratio, the system will be overloaded.</p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="snapshotter"><code>snapshotter</code><a href="#snapshotter" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/api/snapshotter"><code>Snapshotter</code></a></p><p>The <code>Snapshotter</code> instance to be queried for <code>SystemStatus</code>.</p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/SystemStatusOptions.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/2.3/typedefs/stealth-options"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">StealthOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/2.3/typedefs/cheerio-handle-page"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CheerioHandlePage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#currenthistorysecs" class="table-of-contents__link toc-highlight"><code>currentHistorySecs</code></a></li><li><a href="#maxmemoryoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxMemoryOverloadedRatio</code></a></li><li><a href="#maxeventloopoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxEventLoopOverloadedRatio</code></a></li><li><a href="#maxcpuoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxCpuOverloadedRatio</code></a></li><li><a href="#maxclientoverloadedratio" class="table-of-contents__link toc-highlight"><code>maxClientOverloadedRatio</code></a></li><li><a href="#snapshotter" class="table-of-contents__link toc-highlight"><code>snapshotter</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/user-func.html b/docs/2.3/typedefs/user-func.html index e75699e918..f199b004bc 100644 --- a/docs/2.3/typedefs/user-func.html +++ b/docs/2.3/typedefs/user-func.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/user-func">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/user-func">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>UserFunc</h1></header><a name="userfunc"></a><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/UserFunc.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/user-func">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/user-func">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="theme-doc-markdown markdown"><header><h1>UserFunc</h1></header><a name="userfunc"></a><p><strong>Returns</strong>:</p><p><code>Promise<void></code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/UserFunc.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/2.3/typedefs/webhook-run.html b/docs/2.3/typedefs/webhook-run.html index f02c3a1543..d995bd992a 100644 --- a/docs/2.3/typedefs/webhook-run.html +++ b/docs/2.3/typedefs/webhook-run.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/webhook-run">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/webhook-run">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>WebhookRun</h1></header><a name="webhookrun"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="isadhoc"><code>isAdHoc</code><a href="#isadhoc" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="condition"><code>condition</code><a href="#condition" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="donotretry"><code>doNotRetry</code><a href="#donotretry" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="lastdispatch"><code>lastDispatch</code><a href="#lastdispatch" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stats"><code>stats</code><a href="#stats" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/WebhookRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#isadhoc" class="table-of-contents__link toc-highlight"><code>isAdHoc</code></a></li><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#condition" class="table-of-contents__link toc-highlight"><code>condition</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#donotretry" class="table-of-contents__link toc-highlight"><code>doNotRetry</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li><li><a href="#lastdispatch" class="table-of-contents__link toc-highlight"><code>lastDispatch</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/2.3/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/2.3/guides/motivation">2.3</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/2.3/typedefs/webhook-run">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/typedefs/webhook-run">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>2.3</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/apify-platform">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 2.3</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>WebhookRun</h1></header><a name="webhookrun"></a><h2 class="anchor anchorWithStickyNavbar_LWe7" id="properties">Properties<a href="#properties" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="id"><code>id</code><a href="#id" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="createdat"><code>createdAt</code><a href="#createdat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="modifiedat"><code>modifiedAt</code><a href="#modifiedat" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="userid"><code>userId</code><a href="#userid" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="isadhoc"><code>isAdHoc</code><a href="#isadhoc" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="eventtypes"><code>eventTypes</code><a href="#eventtypes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <a href="/sdk/js/docs/2.3/typedefs/event-types"><code>EventTypes</code></a></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="condition"><code>condition</code><a href="#condition" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="donotretry"><code>doNotRetry</code><a href="#donotretry" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>boolean</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="requesturl"><code>requestUrl</code><a href="#requesturl" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="payloadtemplate"><code>payloadTemplate</code><a href="#payloadtemplate" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>string</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="lastdispatch"><code>lastDispatch</code><a href="#lastdispatch" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr><h3 class="anchor anchorWithStickyNavbar_LWe7" id="stats"><code>stats</code><a href="#stats" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><strong>Type</strong>: <code>*</code></p><hr></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-2.3/typedefs/WebhookRun.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#properties" class="table-of-contents__link toc-highlight">Properties</a><ul><li><a href="#id" class="table-of-contents__link toc-highlight"><code>id</code></a></li><li><a href="#createdat" class="table-of-contents__link toc-highlight"><code>createdAt</code></a></li><li><a href="#modifiedat" class="table-of-contents__link toc-highlight"><code>modifiedAt</code></a></li><li><a href="#userid" class="table-of-contents__link toc-highlight"><code>userId</code></a></li><li><a href="#isadhoc" class="table-of-contents__link toc-highlight"><code>isAdHoc</code></a></li><li><a href="#eventtypes" class="table-of-contents__link toc-highlight"><code>eventTypes</code></a></li><li><a href="#condition" class="table-of-contents__link toc-highlight"><code>condition</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#donotretry" class="table-of-contents__link toc-highlight"><code>doNotRetry</code></a></li><li><a href="#requesturl" class="table-of-contents__link toc-highlight"><code>requestUrl</code></a></li><li><a href="#payloadtemplate" class="table-of-contents__link toc-highlight"><code>payloadTemplate</code></a></li><li><a href="#lastdispatch" class="table-of-contents__link toc-highlight"><code>lastDispatch</code></a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><code>stats</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/changelog.html b/docs/3.0/changelog.html index 53ac373bc5..594a5f0115 100644 --- a/docs/3.0/changelog.html +++ b/docs/3.0/changelog.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/changelog">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/changelog">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/changelog">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/changelog">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/changelog">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/changelog">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Changelog</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.12" target="_blank" rel="noopener">apify@3.1.12</a><a href="#apify3112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3112-2023-10-05"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.11...apify@3.1.12" target="_blank" rel="noopener">3.1.12</a> (2023-10-05)<a href="#3112-2023-10-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add more logging to <code>Actor.init</code> and <code>Actor.exit</code> (<a href="https://github.com/apify/apify-sdk-js/issues/236" target="_blank" rel="noopener">#236</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/b7e01fc649de84d6f1391bf95e0f349f7ca32536" target="_blank" rel="noopener">b7e01fc</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3111"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.11" target="_blank" rel="noopener">apify@3.1.11</a><a href="#apify3111" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3111-2023-10-04"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.10...apify@3.1.11" target="_blank" rel="noopener">3.1.11</a> (2023-10-04)<a href="#3111-2023-10-04" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-1">Bug Fixes<a href="#bug-fixes-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>run the whole <code>Actor.exit()</code> code inside a timeout handler (<a href="https://github.com/apify/apify-sdk-js/issues/235" target="_blank" rel="noopener">#235</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c8aabaee5f2de1ab40947f47f95f54ccff37cad0" target="_blank" rel="noopener">c8aabae</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features">Features<a href="#features" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use <code>.reboot()</code> instead of <code>.metamorph()</code> for reboot (<a href="https://github.com/apify/apify-sdk-js/issues/227" target="_blank" rel="noopener">#227</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/8c0bff5a8d3ea65e532b3700b34b9c563856158a" target="_blank" rel="noopener">8c0bff5</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.10" target="_blank" rel="noopener">apify@3.1.10</a><a href="#apify3110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3110-2023-09-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.9...apify@3.1.10" target="_blank" rel="noopener">3.1.10</a> (2023-09-07)<a href="#3110-2023-09-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-2">Bug Fixes<a href="#bug-fixes-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of crawlee to fix possible issues with <code>purgeDefaultStorages</code> (<a href="https://github.com/apify/apify-sdk-js/issues/226" target="_blank" rel="noopener">#226</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/95cf31f3d1d054a1c8e3daac89f41bbb0aaddbba" target="_blank" rel="noopener">95cf31f</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify319"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.9" target="_blank" rel="noopener">apify@3.1.9</a><a href="#apify319" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="319-2023-09-06"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.8...apify@3.1.9" target="_blank" rel="noopener">3.1.9</a> (2023-09-06)<a href="#319-2023-09-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">@apify/scraper-tools@1.1.2</a><a href="#apifyscraper-tools112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="112-2023-07-28"><a href="https://github.com/apify/apify-sdk-js/compare/@apify/scraper-tools@1.1.1...@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">1.1.2</a> (2023-07-28)<a href="#112-2023-07-28" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-3">Bug Fixes<a href="#bug-fixes-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-1">Features<a href="#features-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify318"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.8" target="_blank" rel="noopener">apify@3.1.8</a><a href="#apify318" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="318-2023-07-20"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.7...apify@3.1.8" target="_blank" rel="noopener">3.1.8</a> (2023-07-20)<a href="#318-2023-07-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-4">Bug Fixes<a href="#bug-fixes-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of apify-client and other packages (<a href="https://github.com/apify/apify-sdk-js/commit/24a3a4b5bf2f61e690348727e7f24c06c45a0999" target="_blank" rel="noopener">24a3a4b</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-2">Features<a href="#features-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use Actor env vars (<a href="https://github.com/apify/apify-sdk-js/issues/216" target="_blank" rel="noopener">#216</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/11ff740ad3d2bdd37fce011d94b64ea01413b0d9" target="_blank" rel="noopener">11ff740</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify317"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.7" target="_blank" rel="noopener">apify@3.1.7</a><a href="#apify317" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="317-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.6...apify@3.1.7" target="_blank" rel="noopener">3.1.7</a> (2023-06-09)<a href="#317-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify316"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.6" target="_blank" rel="noopener">apify@3.1.6</a><a href="#apify316" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="316-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.5...apify@3.1.6" target="_blank" rel="noopener">3.1.6</a> (2023-06-09)<a href="#316-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-5">Bug Fixes<a href="#bug-fixes-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>only print status message when explicitly provided in <code>Actor.exit()</code> (<a href="https://github.com/apify/apify-sdk-js/issues/203" target="_blank" rel="noopener">#203</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/85159e499984c78eee90b6d92332ea63b9f46c8c" target="_blank" rel="noopener">85159e4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify315"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.5" target="_blank" rel="noopener">apify@3.1.5</a><a href="#apify315" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="315-2023-05-31"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.4...apify@3.1.5" target="_blank" rel="noopener">3.1.5</a> (2023-05-31)<a href="#315-2023-05-31" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-6">Bug Fixes<a href="#bug-fixes-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add missing <code>options</code> parameter to <code>Actor.setStatusMessage()</code> (<a href="https://github.com/apify/apify-sdk-js/commit/712e8c66755ac8baeb35fcc1ad000487da8b2c48" target="_blank" rel="noopener">712e8c6</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-3">Features<a href="#features-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.getInputOrThrow()</code> method (<a href="https://github.com/apify/apify-sdk-js/issues/198" target="_blank" rel="noopener">#198</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/5fbbfe4960a79fbbd23f4fdd7d07a1a5063820f4" target="_blank" rel="noopener">5fbbfe4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify314"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.4" target="_blank" rel="noopener">apify@3.1.4</a><a href="#apify314" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="314-2023-03-23"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.3...apify@3.1.4" target="_blank" rel="noopener">3.1.4</a> (2023-03-23)<a href="#314-2023-03-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-7">Bug Fixes<a href="#bug-fixes-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>log status message only once and without prefix (<a href="https://github.com/apify/apify-sdk-js/issues/179" target="_blank" rel="noopener">#179</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1f11a6ad8ebc8a0cfaef58be47ba8b12c75018f1" target="_blank" rel="noopener">1f11a6a</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify313"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.3" target="_blank" rel="noopener">apify@3.1.3</a><a href="#apify313" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="313-2023-03-22"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.2...apify@3.1.3" target="_blank" rel="noopener">3.1.3</a> (2023-03-22)<a href="#313-2023-03-22" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-8">Bug Fixes<a href="#bug-fixes-8" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><code>call/callTask</code> accept <code>waitSecs</code> instead of <code>waitForFinish</code> (<a href="https://github.com/apify/apify-sdk-js/issues/176" target="_blank" rel="noopener">#176</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/f0c73d8765091212f2abb4b4faaf109f9447d90a" target="_blank" rel="noopener">f0c73d8</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-4">Features<a href="#features-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify312"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.2" target="_blank" rel="noopener">apify@3.1.2</a><a href="#apify312" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="312-2023-02-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.1...apify@3.1.2" target="_blank" rel="noopener">3.1.2</a> (2023-02-07)<a href="#312-2023-02-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-9">Bug Fixes<a href="#bug-fixes-9" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li><li>remove unused export of <code>QueueOperationInfoOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/b29fe4853d637ab527a7f7e3e53c7a5b0fe27a32" target="_blank" rel="noopener">b29fe48</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify311"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.1" target="_blank" rel="noopener">apify@3.1.1</a><a href="#apify311" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="311-2022-11-13"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.0...apify@3.1.1" target="_blank" rel="noopener">3.1.1</a> (2022-11-13)<a href="#311-2022-11-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-5">Features<a href="#features-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>statusMessage</code> to <code>AbortOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/fb10bb60c12c0af97e41ae88adcf0b2000286235" target="_blank" rel="noopener">fb10bb6</a>)</li><li>warn about actor not being initialized before using storage methods (<a href="https://github.com/apify/apify-sdk-js/issues/126" target="_blank" rel="noopener">#126</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/91cd2467d111de19490a6bf47b4a9138f26a37d4" target="_blank" rel="noopener">91cd246</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify310"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.0" target="_blank" rel="noopener">apify@3.1.0</a><a href="#apify310" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="310-2022-10-13">3.1.0 (2022-10-13)<a href="#310-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-10">Bug Fixes<a href="#bug-fixes-10" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><strong>apify:</strong> add <code>@apify/timeout</code> to dependencies (<a href="https://github.com/apify/apify-sdk-js/issues/76" target="_blank" rel="noopener">#76</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1d64a1fa8f0e88a96eb82c2669e85b09dd4f372d" target="_blank" rel="noopener">1d64a1f</a>)</li><li>use correct event manager for actor methods (<a href="https://github.com/apify/apify-sdk-js/issues/49" target="_blank" rel="noopener">#49</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/ef3a0c54359be64c89e76b0cac600cd780281321" target="_blank" rel="noopener">ef3a0c5</a>)</li><li>wait for memory storage to write changes before <code>Actor.exit</code> exists the process (<a href="https://github.com/apify/apify-sdk-js/commit/c721d988141cf5b7aa170fddeffb792ded769622" target="_blank" rel="noopener">c721d98</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-6">Features<a href="#features-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li><strong>apify:</strong> add decryption for input secrets (<a href="https://github.com/apify/apify-sdk-js/issues/83" target="_blank" rel="noopener">#83</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/78bb990817c01254de19c828937181c1263e21eb" target="_blank" rel="noopener">78bb990</a>)</li><li>re-export the logger in actor sdk (<a href="https://github.com/apify/apify-sdk-js/issues/54" target="_blank" rel="noopener">#54</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c78d8a44d7af5de7fda7bf2e436fefda752a4b1a" target="_blank" rel="noopener">c78d8a4</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.0" target="_blank" rel="noopener">@apify/scraper-tools@1.1.0</a><a href="#apifyscraper-tools110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="110-2022-10-13">1.1.0 (2022-10-13)<a href="#110-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-7">Features<a href="#features-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li>add playwright scraper (<a href="https://github.com/apify/apify-sdk-js/issues/26" target="_blank" rel="noopener">#26</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/2dcd50ded777ae13bc7b75e6e0bc21a6a11315b7" target="_blank" rel="noopener">2dcd50d</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/changelog.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify3112" class="table-of-contents__link toc-highlight">apify@3.1.12</a></li><li><a href="#apify3111" class="table-of-contents__link toc-highlight">apify@3.1.11</a></li><li><a href="#apify3110" class="table-of-contents__link toc-highlight">apify@3.1.10</a></li><li><a href="#apify319" class="table-of-contents__link toc-highlight">apify@3.1.9</a></li><li><a href="#apifyscraper-tools112" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.2</a></li><li><a href="#apify318" class="table-of-contents__link toc-highlight">apify@3.1.8</a></li><li><a href="#apify317" class="table-of-contents__link toc-highlight">apify@3.1.7</a></li><li><a href="#apify316" class="table-of-contents__link toc-highlight">apify@3.1.6</a></li><li><a href="#apify315" class="table-of-contents__link toc-highlight">apify@3.1.5</a></li><li><a href="#apify314" class="table-of-contents__link toc-highlight">apify@3.1.4</a></li><li><a href="#apify313" class="table-of-contents__link toc-highlight">apify@3.1.3</a></li><li><a href="#apify312" class="table-of-contents__link toc-highlight">apify@3.1.2</a></li><li><a href="#apify311" class="table-of-contents__link toc-highlight">apify@3.1.1</a></li><li><a href="#apify310" class="table-of-contents__link toc-highlight">apify@3.1.0</a></li><li><a href="#apifyscraper-tools110" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.0</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples.html b/docs/3.0/examples.html index a86179431b..eece6312c3 100644 --- a/docs/3.0/examples.html +++ b/docs/3.0/examples.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><header><h1 class="title_kItE">Examples</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/accept-user-input"><h2 class="text--truncate cardTitle_rnsV" title="Accept user input">📄️<!-- --> <!-- -->Accept user input</h2><p class="text--truncate cardDescription_PWke" title="This example accepts and logs user input:">This example accepts and logs user input:</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/add-data-to-dataset"><h2 class="text--truncate cardTitle_rnsV" title="Add data to dataset">📄️<!-- --> <!-- -->Add data to dataset</h2><p class="text--truncate cardDescription_PWke" title="This example saves data to the default dataset. If the dataset doesn't exist, it will be created.">This example saves data to the default dataset. If the dataset doesn't exist, it will be created.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/basic-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Basic crawler">📄️<!-- --> <!-- -->Basic crawler</h2><p class="text--truncate cardDescription_PWke" title="This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers">This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/call-actor"><h2 class="text--truncate cardTitle_rnsV" title="Call actor">📄️<!-- --> <!-- -->Call actor</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to start an Apify actor using">This example demonstrates how to start an Apify actor using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/cheerio-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Cheerio crawler">📄️<!-- --> <!-- -->Cheerio crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.">This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/crawl-all-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl all links on a website">📄️<!-- --> <!-- -->Crawl all links on a website</h2><p class="text--truncate cardDescription_PWke" title="This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the">This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls"><h2 class="text--truncate cardTitle_rnsV" title="Crawl multiple URLs">📄️<!-- --> <!-- -->Crawl multiple URLs</h2><p class="text--truncate cardDescription_PWke" title="This example crawls the specified list of URLs.">This example crawls the specified list of URLs.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/crawl-relative-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a website with relative links">📄️<!-- --> <!-- -->Crawl a website with relative links</h2><p class="text--truncate cardDescription_PWke" title="When crawling a website, you may encounter different types of links present that you may want to crawl.">When crawling a website, you may encounter different types of links present that you may want to crawl.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/crawl-single-url"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a single URL">📄️<!-- --> <!-- -->Crawl a single URL</h2><p class="text--truncate cardDescription_PWke" title="This example uses the got-scraping npm package">This example uses the got-scraping npm package</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/crawl-sitemap"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a sitemap">📄️<!-- --> <!-- -->Crawl a sitemap</h2><p class="text--truncate cardDescription_PWke" title="This example downloads and crawls the URLs from a sitemap.">This example downloads and crawls the URLs from a sitemap.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/crawl-some-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl some links on a website">📄️<!-- --> <!-- -->Crawl some links on a website</h2><p class="text--truncate cardDescription_PWke" title="This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.">This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/forms"><h2 class="text--truncate cardTitle_rnsV" title="Forms">📄️<!-- --> <!-- -->Forms</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler to">This example demonstrates how to use PuppeteerCrawler to</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/map-and-reduce"><h2 class="text--truncate cardTitle_rnsV" title="Dataset Map and Reduce methods">📄️<!-- --> <!-- -->Dataset Map and Reduce methods</h2><p class="text--truncate cardDescription_PWke" title="This example shows an easy use-case of the Dataset map">This example shows an easy use-case of the Dataset map</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/playwright-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Playwright crawler">📄️<!-- --> <!-- -->Playwright crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PlaywrightCrawler">This example demonstrates how to use PlaywrightCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/capture-screenshot"><h2 class="text--truncate cardTitle_rnsV" title="Capture a screenshot using Puppeteer">📄️<!-- --> <!-- -->Capture a screenshot using Puppeteer</h2><p class="text--truncate cardDescription_PWke" title="To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.">To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/puppeteer-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer crawler">📄️<!-- --> <!-- -->Puppeteer crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler in combination">This example demonstrates how to use PuppeteerCrawler in combination</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer recursive crawl">📄️<!-- --> <!-- -->Puppeteer recursive crawl</h2><p class="text--truncate cardDescription_PWke" title="Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.">Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer with proxy">📄️<!-- --> <!-- -->Puppeteer with proxy</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.">This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/accept-user-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Accept user input</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/accept-user-input.html b/docs/3.0/examples/accept-user-input.html index 9b5bbc1a9c..2150fba1b1 100644 --- a/docs/3.0/examples/accept-user-input.html +++ b/docs/3.0/examples/accept-user-input.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/accept_user_input.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/accept_user_input.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/add-data-to-dataset.html b/docs/3.0/examples/add-data-to-dataset.html index 3462dd8086..621c7230b0 100644 --- a/docs/3.0/examples/add-data-to-dataset.html +++ b/docs/3.0/examples/add-data-to-dataset.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/add-data-to-dataset">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/add-data-to-dataset">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/add-data-to-dataset">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Add data to dataset</h1></header><p>This example saves data to the default dataset. If the dataset doesn't exist, it will be created. -You can save data to custom datasets by using <a href="/sdk/js/api/3.0/apify/class/Dataset#open"><code>Actor.openDataset()</code></a></p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> body </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/add_data_to_dataset.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +You can save data to custom datasets by using <a href="/sdk/js/api/3.0/apify/class/Dataset#open"><code>Actor.openDataset()</code></a></p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> body </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/add_data_to_dataset.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/basic-crawler.html b/docs/3.0/examples/basic-crawler.html index e770e10edd..52793e5817 100644 --- a/docs/3.0/examples/basic-crawler.html +++ b/docs/3.0/examples/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/basic-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/basic-crawler">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/basic-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/basic-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/basic-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/basic-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Basic crawler</h1></header><p>This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the <a href="https://crawlee.dev/api/basic-crawler/class/BasicCrawler" target="_blank" rel="noopener noreferrer"><code>BasicCrawler</code></a>. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers like <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> or <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>.</p><p>The script simply downloads several web pages with plain HTTP requests using the <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> npm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in -<code>./storage/datasets/default</code>.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">BasicCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> gotScraping </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils gotScraping</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/basic_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>./storage/datasets/default</code>.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">BasicCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> gotScraping </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils gotScraping</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/basic_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/call-actor.html b/docs/3.0/examples/call-actor.html index c69a0900ce..7cffd13b68 100644 --- a/docs/3.0/examples/call-actor.html +++ b/docs/3.0/examples/call-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ Go to the <a href="https://console.apify.com/account?tab=integrations" target="_blank" rel="noopener">Settings - Integrations</a> page to obtain your API token and set it to the <a href="/sdk/js/docs/guides/environment-variables#APIFY_TOKEN"><code>APIFY_TOKEN</code></a> environment variable, or run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set -up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on Apify Platform, use the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> email </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Actor.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/call_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on Apify Platform, use the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> email </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Actor.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/call_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/capture-screenshot.html b/docs/3.0/examples/capture-screenshot.html index c98505ba9b..f60ec0da23 100644 --- a/docs/3.0/examples/capture-screenshot.html +++ b/docs/3.0/examples/capture-screenshot.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/capture-screenshot">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/capture-screenshot">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/capture-screenshot">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/capture-screenshot">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/capture-screenshot">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/capture-screenshot">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Capture a screenshot using Puppeteer</h1></header><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><p>This example captures a screenshot of a web page using <code>Puppeteer</code>. It would look almost exactly the same with <code>Playwright</code>.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Page Screenshot</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Crawler Utils Screenshot</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>page.screenshot()</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>puppeteerUtils.saveSnapshot()</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> utils </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">key</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><p>This example captures a screenshot of multiple web pages when using <code>PuppeteerCrawler</code>:</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Page Screenshot</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Crawler Utils Screenshot</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>page.screenshot()</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot with Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>puppeteerUtils.saveSnapshot()</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> puppeteerUtils </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> puppeteerUtils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><p>In both examples using <code>page.screenshot()</code>, a <code>key</code> variable is created based on the URL of the web page. This variable is used as the key when saving -each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_capture_screenshot.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_capture_screenshot.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/cheerio-crawler.html b/docs/3.0/examples/cheerio-crawler.html index dc9a3f9aae..2a3856e60d 100644 --- a/docs/3.0/examples/cheerio-crawler.html +++ b/docs/3.0/examples/cheerio-crawler.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/cheerio-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> log</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">LogLevel</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Crawlers come with various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token maybe-class-name">LogLevel</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestHandlerTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/cheerio_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/cheerio-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> log</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">LogLevel</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Crawlers come with various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token maybe-class-name">LogLevel</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">requestHandlerTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/cheerio_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/crawl-all-links.html b/docs/3.0/examples/crawl-all-links.html index cfb43bc56f..f33e56b4fb 100644 --- a/docs/3.0/examples/crawl-all-links.html +++ b/docs/3.0/examples/crawl-all-links.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-all-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-all-links">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-all-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-all-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-all-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-all-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl all links on a website</h1></header><p>This example uses the <code>enqueueLinks()</code> method to add new links to the <code>RequestQueue</code> as the crawler navigates from page to page. If only the -required parameters are defined, all links will be crawled.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_all_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +required parameters are defined, all links will be crawled.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_all_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/crawl-multiple-urls.html b/docs/3.0/examples/crawl-multiple-urls.html index b218cbae00..c43504d343 100644 --- a/docs/3.0/examples/crawl-multiple-urls.html +++ b/docs/3.0/examples/crawl-multiple-urls.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-multiple-urls">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_multiple_urls.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-multiple-urls">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $ </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_multiple_urls.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/crawl-relative-links.html b/docs/3.0/examples/crawl-relative-links.html index ba0ca99bf3..d76d48b3ae 100644 --- a/docs/3.0/examples/crawl-relative-links.html +++ b/docs/3.0/examples/crawl-relative-links.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ full domain or urls that point to any subdomain of the provided domain.</p><p>For instance, hyperlinks like <code>https://subdomain.example.com/some/path</code>, <code>https://example.com/some/path</code>, <code>/absolute/example</code> or <code>./relative/example</code> will all be matched by this strategy.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EnqueueStrategy</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token maybe-class-name">EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access maybe-class-name">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-hostname'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-hostname',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>This is the default strategy when calling <code>enqueueLinks()</code>, so you don't have to specify it.</p></div></div><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>Example domains</div><div class="admonitionContent_S0QG"><p>For a url of <code>https://subdomain.example.com</code>, <code>enqueueLinks()</code> will only match relative urls or urls that point to the same full domain.</p><p>For instance, hyperlinks like <code>https://subdomain.example.com/some/path</code>, <code>/absolute/example</code> or <code>./relative/example</code> -will all be matched by this strategy, while <code>https://other-subdomain.example.com</code> or <code>https://otherexample.com</code> will not.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EnqueueStrategy</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token maybe-class-name">EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access maybe-class-name">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-subdomain'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-subdomain',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_relative_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +will all be matched by this strategy, while <code>https://other-subdomain.example.com</code> or <code>https://otherexample.com</code> will not.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EnqueueStrategy</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token maybe-class-name">EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access maybe-class-name">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-subdomain'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-subdomain',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_relative_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/crawl-single-url.html b/docs/3.0/examples/crawl-single-url.html index 389bc41f75..45e739822c 100644 --- a/docs/3.0/examples/crawl-single-url.html +++ b/docs/3.0/examples/crawl-single-url.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-single-url">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-single-url">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-single-url">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-single-url">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-single-url">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-single-url">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a single URL</h1></header><p>This example uses the <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> npm package -to grab the HTML of a web page.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> gotScraping </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/3.0/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_single_url.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +to grab the HTML of a web page.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> gotScraping </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/3.0/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_single_url.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/crawl-sitemap.html b/docs/3.0/examples/crawl-sitemap.html index 833ca289db..317fd06d52 100644 --- a/docs/3.0/examples/crawl-sitemap.html +++ b/docs/3.0/examples/crawl-sitemap.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-sitemap">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> downloadListOfUrls </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> downloadListOfUrls </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> downloadListOfUrls </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify/src'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_sitemap.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-sitemap">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> downloadListOfUrls </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> downloadListOfUrls </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> downloadListOfUrls </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify/src'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_sitemap.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/crawl-some-links.html b/docs/3.0/examples/crawl-some-links.html index c1eef2a117..8f56ce82cf 100644 --- a/docs/3.0/examples/crawl-some-links.html +++ b/docs/3.0/examples/crawl-some-links.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-some-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> example uses the <a href="https://crawlee.dev/api/core/class/PseudoUrl" target="_blank" rel="noopener noreferrer"><code>pseudoUrls</code></a> property in the <a href="https://crawlee.dev/api/cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks" target="_blank" rel="noopener noreferrer"><code>enqueueLinks()</code></a> method to only add links to the <a href="/sdk/js/api/3.0/apify/class/RequestQueue"><code>RequestQueue</code></a> queue if they match the specified regular expression.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limits the crawler to only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to the crawler's RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL and run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_some_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-some-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> example uses the <a href="https://crawlee.dev/api/core/class/PseudoUrl" target="_blank" rel="noopener noreferrer"><code>pseudoUrls</code></a> property in the <a href="https://crawlee.dev/api/cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks" target="_blank" rel="noopener noreferrer"><code>enqueueLinks()</code></a> method to only add links to the <a href="/sdk/js/api/3.0/apify/class/RequestQueue"><code>RequestQueue</code></a> queue if they match the specified regular expression.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">CheerioCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limits the crawler to only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to the crawler's RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL and run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/crawl_some_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/forms.html b/docs/3.0/examples/forms.html index bf3fa7b6a5..940fb89524 100644 --- a/docs/3.0/examples/forms.html +++ b/docs/3.0/examples/forms.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ automatically fill and submit a search form to look up repositories on <a href="https://github.com" target="_blank" rel="noopener">GitHub</a> using headless Chrome / Puppeteer. The actor first fills in the search term, repository owner, start date and language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the -default <a href="/sdk/js/api/3.0/apify/class/Dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./storage/datasets/default</code>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/forms.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +default <a href="/sdk/js/api/3.0/apify/class/Dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./storage/datasets/default</code>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token known-class-name class-name">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/forms.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/map-and-reduce.html b/docs/3.0/examples/map-and-reduce.html index 42f7aaa2f5..05f2ef1246 100644 --- a/docs/3.0/examples/map-and-reduce.html +++ b/docs/3.0/examples/map-and-reduce.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ array through a transformation function and an options parameter.</p><p>The <code>map</code> method used to check if are there more than 5 header elements on each page:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">openDataset</span><span class="token operator" style="color:#393A34"><</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headingCount</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> number </span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// calling map function and filtering through mapped items</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> moreThan5headers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">item</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_with_more_than_5_headers'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> moreThan5headers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The <code>moreThan5headers</code> variable is an array of <code>headingCount</code> attributes where the number of headers is greater than 5.</p><p>The <code>map</code> method's result value saved to the <a href="/sdk/js/api/3.0/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="reduce">Reduce<a href="#reduce" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The dataset <code>reduce</code> method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through the items in the dataset using the <a href="/sdk/js/api/3.0/apify/class/Dataset#reduce"><code>memo</code> argument</a>. After performing the necessary calculation, the <code>memo</code> is sent to the next iteration, while the item just processed is reduced (removed).</p><p>Using the <code>reduce</code> method to get the total number of headers scraped (all items in the dataset):</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// calling reduce function and using memo to calculate number of headers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> pagesHeadingCount </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">memo</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> memo </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headingCount</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_heading_count'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pagesHeadingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>The original dataset will be reduced to a single value, <code>pagesHeadingCount</code>, which contains the count of all headers for all scraped pages (all -dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/api/3.0/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/map_and_reduce.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/api/3.0/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/map_and_reduce.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/playwright-crawler.html b/docs/3.0/examples/playwright-crawler.html index 8518e2d0f1..adc7c86744 100644 --- a/docs/3.0/examples/playwright-crawler.html +++ b/docs/3.0/examples/playwright-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/playwright-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/playwright-crawler">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/playwright-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/playwright-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/playwright-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/playwright-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Playwright crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a> in combination with <a href="/sdk/js/api/3.0/apify/class/RequestQueue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Playwright.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">processedRequests</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/playwright_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">processedRequests</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/playwright_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/puppeteer-crawler.html b/docs/3.0/examples/puppeteer-crawler.html index 96fd60c5be..2a244d3344 100644 --- a/docs/3.0/examples/puppeteer-crawler.html +++ b/docs/3.0/examples/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-crawler">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a> in combination with <a href="/sdk/js/api/3.0/apify/class/RequestQueue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Puppeteer.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">length</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/puppeteer-recursive-crawl.html b/docs/3.0/examples/puppeteer-recursive-crawl.html index 7c5efdc506..590fc346df 100644 --- a/docs/3.0/examples/puppeteer-recursive-crawl.html +++ b/docs/3.0/examples/puppeteer-recursive-crawl.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_recursive_crawl.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_recursive_crawl.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/examples/puppeteer-with-proxy.html b/docs/3.0/examples/puppeteer-with-proxy.html index 9ce184c3e4..8237165005 100644 --- a/docs/3.0/examples/puppeteer-with-proxy.html +++ b/docs/3.0/examples/puppeteer-with-proxy.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-with-proxy">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>.</p><p>To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your account from the SDK.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_with_proxy.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-with-proxy">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>.</p><p>To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your account from the SDK.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PuppeteerCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/examples/puppeteer_with_proxy.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides.html b/docs/3.0/guides.html index cab2fb75a8..ac1629511f 100644 --- a/docs/3.0/guides.html +++ b/docs/3.0/guides.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/guides">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/docker-images">Running in Docker</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><header><h1 class="title_kItE">Guides</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/apify-platform"><h2 class="text--truncate cardTitle_rnsV" title="Apify Platform">📄️<!-- --> <!-- -->Apify Platform</h2><p class="text--truncate cardDescription_PWke" title="Apify is a platform built to serve large-scale and high-performance web scraping">Apify is a platform built to serve large-scale and high-performance web scraping</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/request-storage"><h2 class="text--truncate cardTitle_rnsV" title="Request Storage">📄️<!-- --> <!-- -->Request Storage</h2><p class="text--truncate cardDescription_PWke" title="The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the">The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/result-storage"><h2 class="text--truncate cardTitle_rnsV" title="Result Storage">📄️<!-- --> <!-- -->Result Storage</h2><p class="text--truncate cardDescription_PWke" title="The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the">The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/environment-variables"><h2 class="text--truncate cardTitle_rnsV" title="Environment Variables">📄️<!-- --> <!-- -->Environment Variables</h2><p class="text--truncate cardDescription_PWke" title="The following is a list of the environment variables used by Apify SDK that are available to the user.">The following is a list of the environment variables used by Apify SDK that are available to the user.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/proxy-management"><h2 class="text--truncate cardTitle_rnsV" title="Proxy Management">📄️<!-- --> <!-- -->Proxy Management</h2><p class="text--truncate cardDescription_PWke" title="IP address blocking is one of the oldest">IP address blocking is one of the oldest</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/session-management"><h2 class="text--truncate cardTitle_rnsV" title="Session Management">📄️<!-- --> <!-- -->Session Management</h2><p class="text--truncate cardDescription_PWke" title="&#8203;SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.">&#8203;SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/type-script-actor"><h2 class="text--truncate cardTitle_rnsV" title="TypeScript Actors">📄️<!-- --> <!-- -->TypeScript Actors</h2><p class="text--truncate cardDescription_PWke" title="Apify SDK supports TypeScript by covering public APIs with type declarations. This">Apify SDK supports TypeScript by covering public APIs with type declarations. This</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/guides/docker-images"><h2 class="text--truncate cardTitle_rnsV" title="Running in Docker">📄️<!-- --> <!-- -->Running in Docker</h2><p class="text--truncate cardDescription_PWke" title="Example Docker images to run your crawlers">Example Docker images to run your crawlers</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/apify-platform.html b/docs/3.0/guides/apify-platform.html index a298251403..f10ae6b74f 100644 --- a/docs/3.0/guides/apify-platform.html +++ b/docs/3.0/guides/apify-platform.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -38,8 +38,8 @@ as filling out a web form or sending an email, to complex operations such as crawling an entire website and removing duplicates from a large dataset.</p><p>Actors can be shared in the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a> so that other people can use them. But don't worry, if you share your actor in the store and somebody uses it, it runs under their account, -not yours.</p><p><strong>Related links</strong></p><ul><li><a href="https://apify.com/store" target="_blank" rel="noopener">Store of existing actors</a></li><li><a href="https://docs.apify.com/actor" target="_blank" rel="noopener">Documentation</a></li><li><a href="https://console.apify.com/actors" target="_blank" rel="noopener">View actors in Apify Console</a></li><li><a href="https://apify.com/docs/api/v2#/reference/actors" target="_blank" rel="noopener">API reference</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/apify_platform.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guides</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-apify-sdk" class="table-of-contents__link toc-highlight">Logging into Apify platform from Apify SDK</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +not yours.</p><p><strong>Related links</strong></p><ul><li><a href="https://apify.com/store" target="_blank" rel="noopener">Store of existing actors</a></li><li><a href="https://docs.apify.com/actor" target="_blank" rel="noopener">Documentation</a></li><li><a href="https://console.apify.com/actors" target="_blank" rel="noopener">View actors in Apify Console</a></li><li><a href="https://apify.com/docs/api/v2#/reference/actors" target="_blank" rel="noopener">API reference</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/apify_platform.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guides</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-apify-sdk" class="table-of-contents__link toc-highlight">Logging into Apify platform from Apify SDK</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/docker-images.html b/docs/3.0/guides/docker-images.html index cc9ab557cb..51cc420276 100644 --- a/docs/3.0/guides/docker-images.html +++ b/docs/3.0/guides/docker-images.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/docker-images">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/docker-images">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/guides/docker-images">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/docker-images">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/docker-images">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/guides/docker-images">Running in Docker</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/docker-images">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/guides"><span itemprop="name">Guides</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Running in Docker</h1></header><p>Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the <a href="/sdk/js/docs/3.0/guides/apify-platform">Apify Platform</a>.</p><p>All images can be found in their <a href="https://github.com/apify/apify-actor-docker" target="_blank" rel="noopener">GitHub repo</a> and in our <a href="https://hub.docker.com/orgs/apify" target="_blank" rel="noopener">DockerHub</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="overview">Overview<a href="#overview" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images.</p><ul><li><a href="#actor-node"><code>apify/actor-node</code></a></li><li><a href="#actor-node-puppeteer-chrome"><code>apify/actor-node-puppeteer-chrome</code></a></li><li><a href="#actor-node-playwright"><code>apify/actor-node-playwright</code></a></li><li><a href="#actor-node-playwright-chrome"><code>apify/actor-node-playwright-chrome</code></a></li><li><a href="#actor-node-playwright-firefox"><code>apify/actor-node-playwright-firefox</code></a></li><li><a href="#actor-node-playwright-webkit"><code>apify/actor-node-playwright-webkit</code></a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="versioning">Versioning<a href="#versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version.</p><blockquote><p>We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nodejs-versioning">Node.js versioning<a href="#nodejs-versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js <strong>versions 16 and 18 are supported</strong> (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Use Node.js 16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="automation-library-versioning">Automation library versioning<a href="#automation-library-versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Images that include a pre-installed automation library, which means all images that include <code>puppeteer</code> or <code>playwright</code> in their name, are also tagged with the pre-installed version of the library. For example, <code>apify/actor-node-puppeteer-chrome:16-13.7.0</code> comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with <code>puppeteer</code> will not match the version of Chromium that's pre-installed.</p><p>Similarly <code>apify/actor-node-playwright-firefox:14-1.21.1</code> runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1.</p><p>Installing <code>apify/actor-node-puppeteer-chrome</code> (without a tag) will install the latest available version of Node.js and <code>puppeteer</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pre-release-tags">Pre-release tags<a href="#pre-release-tags" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a <code>beta</code> suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Without library version.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16-beta</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># With library version.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16-1.10.0-beta</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="best-practices">Best practices<a href="#best-practices" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Node.js version tag should <strong>always</strong> be used.</li><li>The automation library version tag should be used for <strong>added security</strong>.</li><li>Asterisk <code>*</code> should be used as the automation library version in our <code>package.json</code> files.</li></ul><p>It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"dependencies"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"crawlee"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"^3.0.0"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"playwright"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="warning-about-image-size">Warning about image size<a href="#warning-about-image-size" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need.</p><p>You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the<code>actor-node-puppeteer-chrome</code> image, but the resulting image will be about 3 times larger and extremely slow to download and build.</p><p>When you use only what you need, you'll be rewarded with reasonable build and start times.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-docker-images">Apify Docker Images<a href="#apify-docker-images" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node">actor-node<a href="#actor-node" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a>. It benefits from lightning fast builds and container startups.</p><p>​<a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>, <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a> and other browser based features will <strong>NOT</strong> work with this image.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-puppeteer-chrome">actor-node-puppeteer-chrome<a href="#actor-node-puppeteer-chrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> and <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>, but <strong>NOT</strong> with <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>.</p><p>The image supports XVFB by default, so you can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-puppeteer-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright">actor-node-playwright<a href="#actor-node-playwright" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-chrome">actor-node-playwright-chrome<a href="#actor-node-playwright-chrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Similar to <a href="#actor-node-puppeteer-chrome"><code>actor-node-puppeteer-chrome</code></a>, but for Playwright. You can run <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> and <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>, but <strong>NOT</strong> <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><p>It uses the <a href="https://playwright.dev/docs/api/environment-variables/" target="_blank" rel="noopener"><code>PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD</code></a> environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the <a href="#actor-node-playwright"><code>actor-node-playwright</code></a> image override this env var.</p><p>The image supports XVFB by default, so we can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-firefox">actor-node-playwright-firefox<a href="#actor-node-playwright-firefox" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with Firefox pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-firefox:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-webkit">actor-node-playwright-webkit<a href="#actor-node-playwright-webkit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with WebKit -pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example-dockerfile">Example Dockerfile<a href="#example-dockerfile" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>To use the above images, it's necessary to have a <a href="https://docs.docker.com/engine/reference/builder/" target="_blank" rel="noopener"><code>Dockerfile</code></a>. You can either use this example, or bootstrap your projects with the <a href="https://crawlee.dev/docs/introduction/setting-up" target="_blank" rel="noopener noreferrer">Crawlee CLI</a> which automatically adds the correct Dockerfile into our project folder.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Node+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Node+TypeScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+TypeScript</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in the <code>FROM</code> declaration.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in both <code>FROM</code> declarations.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction options"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> /home/myuser/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image. If you know you won't need headful browsers,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># you can remove the XVFB start script for a micro perf gain.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/docker_images.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#apify-docker-images" class="table-of-contents__link toc-highlight">Apify Docker Images</a><ul><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example-dockerfile">Example Dockerfile<a href="#example-dockerfile" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>To use the above images, it's necessary to have a <a href="https://docs.docker.com/engine/reference/builder/" target="_blank" rel="noopener"><code>Dockerfile</code></a>. You can either use this example, or bootstrap your projects with the <a href="https://crawlee.dev/docs/introduction/setting-up" target="_blank" rel="noopener noreferrer">Crawlee CLI</a> which automatically adds the correct Dockerfile into our project folder.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Node+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Node+TypeScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+TypeScript</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in the <code>FROM</code> declaration.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in both <code>FROM</code> declarations.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction options"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> /home/myuser/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image. If you know you won't need headful browsers,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># you can remove the XVFB start script for a micro perf gain.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/docker_images.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#apify-docker-images" class="table-of-contents__link toc-highlight">Apify Docker Images</a><ul><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/environment-variables.html b/docs/3.0/guides/environment-variables.html index cfded80796..80a1554498 100644 --- a/docs/3.0/guides/environment-variables.html +++ b/docs/3.0/guides/environment-variables.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -36,8 +36,8 @@ in the Apify Console. The password is automatically inferred using the <code>APIFY_TOKEN</code> env var, so in most cases, you don't need to touch it. You should use it when, for some reason, you need access to Apify Proxy, but no access to Apify API, or when you need access to -proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/environment_variables.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/environment_variables.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/proxy-management.html b/docs/3.0/guides/proxy-management.html index e67b71775d..f1ac83a980 100644 --- a/docs/3.0/guides/proxy-management.html +++ b/docs/3.0/guides/proxy-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -32,8 +32,8 @@ in the <a href="https://console.apify.com/proxy" target="_blank" rel="noopener">proxy dashboard</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="inspecting-current-proxy-in-crawlers">Inspecting current proxy in Crawlers<a href="#inspecting-current-proxy-in-crawlers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><code>CheerioCrawler</code> and <code>PuppeteerCrawler</code> grant access to information about the currently used proxy in their <code>handlePageFunction</code> using a <a href="/sdk/js/api/3.0/apify/interface/ProxyInfo"><code>proxyInfo</code></a> object. With the object, you can easily access the proxy URL. If you're using Apify Proxy, the other -configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/proxy_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/proxy_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/request-storage.html b/docs/3.0/guides/request-storage.html index dffe6c5200..0f445bed77 100644 --- a/docs/3.0/guides/request-storage.html +++ b/docs/3.0/guides/request-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable, or on the <a href="/sdk/js/docs/guides/apify-platform">Apify platform</a> under the user account identified by the API token defined by the <code>APIFY_TOKEN</code> environment variable. If neither of these variables is defined, by default Apify SDK sets <code>APIFY_LOCAL_STORAGE_DIR</code> to <code>./storage</code> in the current working directory and prints a warning.</p><p>Typically, you will be developing the code on your local computer and thus set the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the <code>APIFY_TOKEN</code> environment variable and thus use cloud storage. No code changes are needed.</p><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/storage" target="_blank" rel="noopener">Apify platform storage documentation</a></li><li><a href="https://console.apify.com/storage" target="_blank" rel="noopener">View storage in Apify Console</a></li><li><a href="https://docs.apify.com/api/v2#/reference/request-queues" target="_blank" rel="noopener">Request queues API reference</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-queue">Request queue<a href="#request-queue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.</p><p>Each actor run is associated with a <strong>default request queue</strong>, which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional.</p><p>In Apify SDK, the request queue is represented by the <a href="/sdk/js/api/3.0/apify/class/RequestQueue"><code>RequestQueue</code></a> class.</p><p>In local configuration, the request queue is emulated by <a href="https://github.com/apify/apify-storage-local-js" target="_blank" rel="noopener">@apify/storage-local</a> NPM package and its data is stored in SQLite database in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">request_queues</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">QUEUE_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">db</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sqlite</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{QUEUE_ID}</code> is the name or ID of the request queue. The default queue has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code> environment variable.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue the initial request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request queue with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-list">Request list<a href="#request-list" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default <a href="/sdk/js/docs/3.0/guides/result-storage#key-value-store">Key-Value Store</a> associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web.</p><p>Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional.</p><p>In Apify SDK, the request list is represented by the </p><div to="core/class/RequestList"><code>RequestList</code></div> class.<p></p><p>The following code demonstrates basic operations of the request list:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// List name is used to persist the sources and the list state in the key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Process the page (extract data, take page screenshot, etc).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the request list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request list with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="which-one-to-choose">Which one to choose?<a href="#which-one-to-choose" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either.</p><p>On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue.</p><p>Note that Request queue and Request list can be used together by the same crawler. In such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue). -In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/request_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/request_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/result-storage.html b/docs/3.0/guides/result-storage.html index 1ce13d6304..bb869a9294 100644 --- a/docs/3.0/guides/result-storage.html +++ b/docs/3.0/guides/result-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ results specific for the actor run. Its usage is optional.</p><p>In the Apify SDK, the dataset is represented by the <a href="/sdk/js/api/3.0/apify/class/Dataset"><code>Dataset</code></a> class. In order to simplify writes to the default dataset, the SDK also provides the <a href="/sdk/js/api/3.0/apify/class/Actor#pushData"><code>Actor.pushData()</code></a> function.</p><p>In local configuration, the data is stored in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">datasets</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">DATASET_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">INDEX</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{DATASET_ID}</code> is the name or ID of the dataset. The default dataset has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_DATASET_ID</code> environment variable. Each dataset item is stored as a separate JSON file, where <code>{INDEX}</code> is a zero-based index of the -item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/result_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/3.0/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/result_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/session-management.html b/docs/3.0/guides/session-management.html index 9d928092fe..ebb898b676 100644 --- a/docs/3.0/guides/session-management.html +++ b/docs/3.0/guides/session-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ Last but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly, which should prevent burning out a small pool of available IPs.</p><p>Now let's take a look at how to use a Session pool.</p><p><strong>Example usage in <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookies to page before navigation automatically.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in puppeteer pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookie header to request automatically...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"title"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in BasicCrawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="https://crawlee.dev/api/basic-crawler/class/BasicCrawler" target="_blank" rel="noopener noreferrer"><code>BasicCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Allows access to proxyInfo object in handleRequestFunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">throwHttpErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the cookieJar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This way you get the Cookie headers string from session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">Cookie</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getCookieString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> response</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">requestOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"SomeNetworkError"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If a network error happens, such as timeout, socket hangup etc...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// There is usually a chance that it was just bad luck and the proxy works.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to throw it away.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Automatically retires the session based on response HTTP status code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retireOnBlockedStatusCodes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">statusCode</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">body</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">blocked</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You are sure it is blocked.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This will throw away the session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Everything is ok, you can get the data.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to call session.markGood -> BasicCrawler calls it for you.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the CookieJar in session you need.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setCookiesFromResponse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example solo usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPoolOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">SessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">sessionPoolOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> session </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> sessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getSession</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the errorScore.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Throw away the session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Lower the errorScore and marks the session good.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markGood</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These are the basics of configuring SessionPool. Please, bear in mind that a Session pool needs time to find working IPs and build up the pool, -so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/session_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/session_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/guides/type-script-actor.html b/docs/3.0/guides/type-script-actor.html index 93bc62e5e1..b02da66cd1 100644 --- a/docs/3.0/guides/type-script-actor.html +++ b/docs/3.0/guides/type-script-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -30,8 +30,8 @@ return types, in the Apify SDK.</p><h1>Caveats</h1><p>As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties and parameters annotated with <code>any</code> type, therefore the settings <code>noImplicitAny</code> and <code>strictNullChecks</code>, set to <code>true</code>, may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary.</p><p>Besides the <em>implicit any</em> errors that might occur in the code when writing in TypeScript, the current typings doesn't offer generics that make outputs type-safe, so you need to declare your -types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/typescript_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/guides/typescript_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/readme/introduction.html b/docs/3.0/readme/introduction.html index cb3905304d..7a18d97409 100644 --- a/docs/3.0/readme/introduction.html +++ b/docs/3.0/readme/introduction.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ The SDK is available as the <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> NPM package. It can be used either stand-alone in your own applications or in <a href="https://docs.apify.com/actor" target="_blank" rel="noopener">actors</a> -running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/readme/overview.html b/docs/3.0/readme/overview.html index eb32760a93..180ca13f60 100644 --- a/docs/3.0/readme/overview.html +++ b/docs/3.0/readme/overview.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ records or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs or to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.</p></li></ul><p>Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus take advantage of its pool of proxies, job scheduler, data storage, etc. -For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/readme/support.html b/docs/3.0/readme/support.html index bb7e72fde1..5aca88046a 100644 --- a/docs/3.0/readme/support.html +++ b/docs/3.0/readme/support.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ For contribution guidelines and the code of conduct, see <a href="https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-js/blob/master/LICENSE.md" target="_blank" rel="noopener">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener">Chema Balsas</a> for giving up the <code>apify</code> package name -on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/upgrading.html b/docs/3.0/upgrading.html index cd4106155a..396c7fb41c 100644 --- a/docs/3.0/upgrading.html +++ b/docs/3.0/upgrading.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/upgrading">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><header><h1 class="title_kItE">Upgrading</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v1">📄️<!-- --> <!-- -->Upgrading to v1</h2><p class="text--truncate cardDescription_PWke" title="Summary">Summary</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v2">📄️<!-- --> <!-- -->Upgrading to v2</h2><p class="text--truncate cardDescription_PWke" title="- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.">- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v3">📄️<!-- --> <!-- -->Upgrading to v3</h2><p class="text--truncate cardDescription_PWke" title="This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.">This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v1</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/upgrading/upgrading-to-v1.html b/docs/3.0/upgrading/upgrading-to-v1.html index 0996369c03..0064e03e90 100644 --- a/docs/3.0/upgrading/upgrading-to-v1.html +++ b/docs/3.0/upgrading/upgrading-to-v1.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -81,8 +81,8 @@ the functions also have access to the <code>crawlingContext</code> of the <code>request</code> that triggered the launch.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> preLaunchHooks </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">maybeLaunchChrome</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">pageId</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> launchContext</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">crawlingContexts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">pageId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">userData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">useHeadful</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">launchOptions</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headless</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="launch-functions">Launch functions<a href="#launch-functions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In addition to <code>Apify.launchPuppeteer()</code> we now also have <code>Apify.launchPlaywright()</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="updated-arguments">Updated arguments<a href="#updated-arguments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We <a href="#launchpuppeteeroptions--launchcontext">updated the launch options object</a> because it was a frequent source of confusion.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// OLD</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// NEW</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-modules">Custom modules<a href="#custom-modules" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><code>Apify.launchPuppeteer</code> already supported the <code>puppeteerModule</code> option. With Playwright, we normalized the name to <code>launcher</code> because the <code>playwright</code> module itself does not -launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v2</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v2</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/upgrading/upgrading-to-v2.html b/docs/3.0/upgrading/upgrading-to-v2.html index cfd3e4b7e5..463119633d 100644 --- a/docs/3.0/upgrading/upgrading-to-v2.html +++ b/docs/3.0/upgrading/upgrading-to-v2.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v2">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v2">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v2</h1></header><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v2.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v2">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v2">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v2</h1></header><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v2.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/3.0/upgrading/upgrading-to-v3.html b/docs/3.0/upgrading/upgrading-to-v3.html index 3172907467..7ce23acfa0 100644 --- a/docs/3.0/upgrading/upgrading-to-v3.html +++ b/docs/3.0/upgrading/upgrading-to-v3.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v3">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v3">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v3</h1></header><p>This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Crawlee vs Apify SDK v2</div><div class="admonitionContent_S0QG"><p>Up until version 3 of <code>apify</code>, the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:</p><ul><li><a href="https://github.com/apify/crawlee" target="_blank" rel="noopener">Crawlee</a>, the new web-scraping library, available as <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package on NPM</li><li><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener">Apify SDK</a>, helpers for the Apify platform, available as <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> package on NPM</li></ul></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawlee-monorepo">Crawlee monorepo<a href="#crawlee-monorepo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package consists of several smaller packages, released separately under <code>@crawlee</code> namespace:</p><ul><li><code>@crawlee/core</code>: the base for all the crawler implementations, also contains things like <code>Request</code>, <code>RequestQueue</code>, <code>RequestList</code> or <code>Dataset</code> classes</li><li><code>@crawlee/basic</code>: exports <code>BasicCrawler</code></li><li><code>@crawlee/http</code>: exports <code>HttpCrawler</code> (which is used for creating <code>@crawlee/dom</code> and <code>@crawlee/cheerio</code>)</li><li><code>@crawlee/dom</code>: exports <code>DOMCrawler</code></li><li><code>@crawlee/cheerio</code>: exports <code>CheerioCrawler</code></li><li><code>@crawlee/browser</code>: exports <code>BrowserCrawler</code> (which is used for creating <code>@crawlee/playwright</code> and <code>@crawlee/puppeteer</code>)</li><li><code>@crawlee/playwright</code>: exports <code>PlaywrightCrawler</code></li><li><code>@crawlee/puppeteer</code>: exports <code>PuppeteerCrawler</code></li><li><code>@crawlee/memory-storage</code>: <code>@apify/storage-local</code> alternative</li><li><code>@crawlee/browser-pool</code>: previously <code>browser-pool</code> package</li><li><code>@crawlee/utils</code>: utility methods</li><li><code>@crawlee/types</code>: holds TS interfaces mainly about the <code>StorageClient</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installing-crawlee">Installing Crawlee<a href="#installing-crawlee" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. <code>@crawlee/playwright</code> if you plan on using <code>playwright</code> - it already contains everything from the <code>@crawlee/browser</code> package, which includes everything from <code>@crawlee/basic</code>, which includes everything from <code>@crawlee/core</code>.</p><p>If we don't care much about additional code being pulled in, we can just use the <code>crawlee</code> meta-package, which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Or if all we need is cheerio support, we can install only <code>@crawlee/cheerio</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> @crawlee/cheerio</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When using <code>playwright</code> or <code>puppeteer</code>, we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee playwright</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or npm install @crawlee/playwright playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Alternatively we can also use the <code>crawlee</code> meta-package which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><blockquote><p>Sometimes you might want to use some utility methods from <code>@crawlee/utils</code>, so you might want to install that as well. This package contains some utilities that were previously available under <code>Apify.utils</code>. Browser related utilities can be also found in the crawler packages (e.g. <code>@crawlee/playwright</code>).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="full-typescript-support">Full TypeScript support<a href="#full-typescript-support" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from <code>@apify/tsconfig</code> package. Don't forget to set the <code>module</code> and <code>target</code> to <code>ES2022</code> or above to be able to use top level await.</p><blockquote><p>The <code>@apify/tsconfig</code> config has <a href="https://www.typescriptlang.org/tsconfig#noImplicitAny" target="_blank" rel="noopener"><code>noImplicitAny</code></a> enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.</p></blockquote><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">tsconfig.json</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"extends"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"@apify/tsconfig"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"compilerOptions"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"module"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"target"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"outDir"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"dist"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"lib"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"DOM"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"include"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./src/**/*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="docker-build">Docker build<a href="#docker-build" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>For <code>Dockerfile</code> we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Dockerfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># using multistage build, as we need dev deps to build the TS source code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy all files, install all dependencies (including dev deps) and build the project</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy only necessary files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/README.md ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/apify.json ./apify.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># install only prod deps</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --only=prod --no-optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --only=prod --no-optional --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># run compiled code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="browser-fingerprints">Browser fingerprints<a href="#browser-fingerprints" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously we had a magical <code>stealth</code> option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints.</p><p>In case we don't want to have dynamic fingerprints, we can disable this behaviour via <code>useFingerprints</code> in <code>browserPoolOptions</code>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="session-cookie-method-renames">Session cookie method renames<a href="#session-cookie-method-renames" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call <code>session.getPuppeteerCookies()</code> or <code>session.setPuppeteerCookies()</code>. Since this method could be used for any of our crawlers, not just <code>PuppeteerCrawler</code>, the methods have been renamed to <code>session.getCookies()</code> and <code>session.setCookies()</code> respectively. Otherwise, their usage is exactly the same!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="memory-storage">Memory storage<a href="#memory-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When we store some data or intermediate state (like the one <code>RequestQueue</code> holds), we now use <code>@crawlee/memory-storage</code> by default. It is an alternative to the <code>@apify/storage-local</code>, that stores the state inside memory (as opposed to SQLite database used by <code>@apify/storage-local</code>). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the <code>INPUT.json</code> file).</p><p>When we want to run the crawler on Apify platform, we need to use <code>Actor.init</code> or <code>Actor.main</code>, which will automatically switch the storage client to <code>ApifyClient</code> when on the Apify platform.</p><p>We can still use the <code>@apify/storage-local</code>, to do it, first install it pass it to the <code>Actor.init</code> or <code>Actor.main</code> options:</p><blockquote><p><code>@apify/storage-local</code> v2.1.0+ is required for Crawlee</p></blockquote><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> ApifyStorageLocal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@apify/storage-local'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> storage </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">ApifyStorageLocal</span><span class="token punctuation" style="color:#393A34">(</span><span class="token comment" style="color:#999988;font-style:italic">/* options like `enableWalMode` belong here */</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> storage </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="purging-of-the-default-storage">Purging of the default storage<a href="#purging-of-the-default-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously the state was preserved between local runs, and we had to use <code>--purge</code> argument of the <code>apify-cli</code>. With Crawlee, this is now the default behaviour, we purge the storage automatically on <code>Actor.init/main</code> call. We can opt out of it via <code>purge: false</code> in the <code>Actor.init</code> options.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-crawler-options-and-interfaces">Renamed crawler options and interfaces<a href="#renamed-crawler-options-and-interfaces" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level.</p><ul><li><code>handleRequestFunction</code> -> <code>requestHandler</code></li><li><code>handlePageFunction</code> -> <code>requestHandler</code></li><li><code>handleRequestTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>handlePageTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>requestTimeoutSecs</code> -> <code>navigationTimeoutSecs</code></li><li><code>handleFailedRequestFunction</code> -> <code>failedRequestHandler</code></li></ul><p>We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:</p><ul><li><code>CheerioHandlePageInputs</code> -> <code>CheerioCrawlingContext</code></li><li><code>PlaywrightHandlePageFunction</code> -> <code>PlaywrightCrawlingContext</code></li><li><code>PuppeteerHandlePageFunction</code> -> <code>PuppeteerCrawlingContext</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="context-aware-helpers">Context aware helpers<a href="#context-aware-helpers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some utilities previously available under <code>Apify.utils</code> namespace are now moved to the crawling context and are <em>context aware</em>. This means they have some parameters automatically filled in from the context, like the current <code>Request</code> instance or current <code>Page</code> object, or the <code>RequestQueue</code> bound to the crawler.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enqueuing-links">Enqueuing links<a href="#enqueuing-links" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>One common helper that received more attention is the <code>enqueueLinks</code>. As mentioned above, it is context aware - we no longer need pass in the <code>requestQueue</code> or <code>page</code> arguments (or the cheerio handle <code>$</code>). In addition to that, it now offers 3 enqueuing strategies:</p><ul><li><code>EnqueueStrategy.All</code> (<code>'all'</code>): Matches any URLs found</li><li><code>EnqueueStrategy.SameHostname</code> (<code>'same-hostname'</code>) Matches any URLs that have the same subdomain as the base URL (default)</li><li><code>EnqueueStrategy.SameDomain</code> (<code>'same-domain'</code>) Matches any URLs that have the same domain name. For example, <code>https://wow.an.example.com</code> and <code>https://example.com</code> will both be matched for a base url of <code>https://example.com</code>.</li></ul><p>This means we can even call <code>enqueueLinks()</code> without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain.</p><p>Moreover, we can specify patterns the URL should match via globs:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev/*/*'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can also use `regexps` and `pseudoUrls` keys here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="implicit-requestqueue-instance">Implicit <code>RequestQueue</code> instance<a href="#implicit-requestqueue-instance" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>All crawlers now have the <code>RequestQueue</code> instance automatically available via <code>crawler.getRequestQueue()</code> method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the <code>RequestQueue</code> instance manually, and we can just use <code>crawler.addRequests()</code> method described underneath.</p><blockquote><p>We can still create the <code>RequestQueue</code> explicitly, the <code>crawler.getRequestQueue()</code> method will respect that and return the instance provided via crawler options.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawleraddrequests"><code>crawler.addRequests()</code><a href="#crawleraddrequests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>We can now add multiple requests in batches. The newly added <code>addRequests</code> method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of <code>RequestQueue</code> and <code>RequestList</code>.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// will resolve right after the initial batch of 1000 requests is added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addRequests</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token comment" style="color:#999988;font-style:italic">/* many requests, can be even millions */</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">waitForAllRequestsToBeAdded</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="less-verbose-error-logging">Less verbose error logging<a href="#less-verbose-error-logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the <code>CRAWLEE_VERBOSE_LOG</code> env var.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlabel-shortcut"><code>Request.label</code> shortcut<a href="#requestlabel-shortcut" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Labeling requests used to work via the <code>Request.userData</code> object. With Crawlee, we can also use the <code>Request.label</code> shortcut. It is implemented as a <code>get/set</code> pair, using the value from <code>Request.userData</code>. The support for this shortcut is also added to the <code>enqueueLinks</code> options interface.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">label </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> label</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-requestasbrowser">Removal of <code>requestAsBrowser</code><a href="#removal-of-requestasbrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In v1 we replaced the underlying implementation of <code>requestAsBrowser</code> to be just a proxy over calling <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> - our custom extension to <code>got</code> that tries to mimic the real browsers as much as possible. With v3, we are removing the <code>requestAsBrowser</code>, encouraging the use of <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> directly.</p><p>For easier migration, we also added <code>context.sendRequest()</code> helper that allows processing the context bound <code>Request</code> object through <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sendRequest</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can use the options parameter to override gotScraping options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sendRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> responseType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'json'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'received body'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-sendrequest">How to use <code>sendRequest()</code>?<a href="#how-to-use-sendrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>See <a href="https://crawlee.dev/docs/guides/got-scraping" target="_blank" rel="noopener">the Got Scraping guide</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="removed-options">Removed options<a href="#removed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The <code>useInsecureHttpParser</code> option has been removed. It's permanently set to <code>true</code> in order to better mimic browsers' behavior.</p><p>Got Scraping automatically performs protocol negotiation, hence we removed the <code>useHttp2</code> option. It's set to <code>true</code> - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-options">Renamed options<a href="#renamed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>In the <code>requestAsBrowser</code> approach, some of the options were named differently. Here's a list of renamed options:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This options represents the body to send. It could be a <code>string</code> or a <code>Buffer</code>. However, there is no <code>payload</code> option anymore. You need to use <code>body</code> instead. Or, if you wish to send JSON, <code>json</code>. Here's an example:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>It has been renamed to <code>https.rejectUnauthorized</code>. By default, it's set to <code>false</code> for convenience. However, if you want to make sure the connection is secure, you can do the following:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ignoreSslErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> https</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> rejectUnauthorized</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Please note: the meanings are opposite! So we needed to invert the values as well.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="header-generator-options"><code>header-generator</code> options<a href="#header-generator-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>useMobileVersion</code>, <code>languageCode</code> and <code>countryCode</code> no longer exist. Instead, you need to use <code>headerGeneratorOptions</code> directly:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useMobileVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> languageCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'en'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headerGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'mobile'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// or ['desktop']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> locales</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'en-US'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutsecs"><code>timeoutSecs</code><a href="#timeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>In order to set a timeout, use <code>timeout.request</code> (which is <strong>milliseconds</strong> now).</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeout</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> request</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="throwonhttperrors"><code>throwOnHttpErrors</code><a href="#throwonhttperrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>throwOnHttpErrors</code> → <code>throwHttpErrors</code>. This options throws on unsuccessful HTTP status codes, for example <code>404</code>. By default, it's set to <code>false</code>.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="decodebody"><code>decodeBody</code><a href="#decodebody" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>decodeBody</code> → <code>decompress</code>. This options decompresses the body. Defaults to <code>true</code> - please do not change this or websites will break (unless you know what you're doing!).</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This function used to make the promise throw on specific responses, if it returned <code>true</code>. However, it wasn't that useful.</p><p>You probably want to cancel the request instead, which you can do in the following way:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> promise </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">…</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'request'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Please note this is not a Got Request instance, but a ClientRequest one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://nodejs.org/api/http.html#class-httpclientrequest</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">protocol </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Unsecure request, abort.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cancel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you set `isStream` to `true`, please use `stream.destroy()` instead.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-browser-pool-plugin-mixing">Removal of browser pool plugin mixing<a href="#removal-of-browser-pool-plugin-mixing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type).</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Confused?</div><div class="admonitionContent_S0QG"><p>As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="handling-requests-outside-of-browser">Handling requests outside of browser<a href="#handling-requests-outside-of-browser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of <code>Request.skipNavigation</code> and <code>context.sendRequest()</code>.</p><p>Take a look at how to achieve this by checking out the <a href="https://crawlee.dev/docs/examples/skip-navigation" target="_blank" rel="noopener">Skipping navigation for certain requests</a> example!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logging">Logging<a href="#logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Crawlee exports the default <code>log</code> instance directly as a named export. We also have a scoped <code>log</code> instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Opened </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="auto-saved-crawler-state">Auto-saved crawler state<a href="#auto-saved-crawler-state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Every crawler instance now has <code>useState()</code> method that will return a state object we can use. It will be automatically saved when <code>persistState</code> event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> crawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> state </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">useState</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// just change the value, no need to care about saving it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> state</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-sdk">Apify SDK<a href="#apify-sdk" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The Apify platform helpers can be now found in the Apify SDK (<code>apify</code> NPM package). It exports the <code>Actor</code> class that offers following static helpers:</p><ul><li><code>ApifyClient</code> shortcuts: <code>addWebhook()</code>, <code>call()</code>, <code>callTask()</code>, <code>metamorph()</code></li><li>helpers for running on Apify platform: <code>init()</code>, <code>exit()</code>, <code>fail()</code>, <code>main()</code>, <code>isAtHome()</code>, <code>createProxyConfiguration()</code></li><li>storage support: <code>getInput()</code>, <code>getValue()</code>, <code>openDataset()</code>, <code>openKeyValueStore()</code>, <code>openRequestQueue()</code>, <code>pushData()</code>, <code>setValue()</code></li><li>events support: <code>on()</code>, <code>off()</code></li><li>other utilities: <code>getEnv()</code>, <code>newClient()</code>, <code>reboot()</code></li></ul><p><code>Actor.main</code> is now just a syntax sugar around calling <code>Actor.init()</code> at the beginning and <code>Actor.exit()</code> at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> statusMessage</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>Actor.init()</code> will conditionally set the storage implementation of Crawlee to the <code>ApifyClient</code> when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). <code>Actor.exit()</code> will handle the tear down and calls <code>process.exit()</code> to ensure our process won't hang indefinitely for some reason.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="events">Events<a href="#events" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Apify SDK (v2) exports <code>Apify.events</code>, which is an <code>EventEmitter</code> instance. With Crawlee, the events are managed by <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> class instead. We can either access it via <code>Actor.eventManager</code> getter, or use <code>Actor.on</code> and <code>Actor.off</code> shortcuts instead.</p><div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">Apify.events.on(...);</span><br></span><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">Actor.on(...);</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>We can also get the <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> instance via <code>Configuration.getEventManager()</code>.</p></blockquote><p>In addition to the existing events, we now have an <code>exit</code> event fired when calling <code>Actor.exit()</code> (which is called at the end of <code>Actor.main()</code>). This event allows you to gracefully shut down any resources when <code>Actor.exit</code> is called.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="smallerinternal-breaking-changes">Smaller/internal breaking changes<a href="#smallerinternal-breaking-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><code>Apify.call()</code> is now just a shortcut for running <code>ApifyClient.actor(actorId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.callTask()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.metamorph()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).metamorph(input, options)</code>, while also taking the ACTOR_RUN_ID inside env vars into account</li><li><code>Apify.waitForRunToFinish()</code> has been removed, use <code>ApifyClient.waitForFinish()</code> instead</li><li><code>Actor.main/init</code> purges the storage by default</li><li>remove <code>purgeLocalStorage</code> helper, move purging to the storage class directly<ul><li><code>StorageClient</code> interface now has optional <code>purge</code> method</li><li>purging happens automatically via <code>Actor.init()</code> (you can opt out via <code>purge: false</code> in the options of <code>init/main</code> methods)</li></ul></li><li><code>QueueOperationInfo.request</code> is no longer available</li><li><code>Request.handledAt</code> is now string date in ISO format</li><li><code>Request.inProgress</code> and <code>Request.reclaimed</code> are now <code>Set</code>s instead of POJOs</li><li><code>injectUnderscore</code> from puppeteer utils has been removed</li><li><code>APIFY_MEMORY_MBYTES</code> is no longer taken into account, use <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> instead</li><li>some <code>AutoscaledPool</code> options are no longer available:<ul><li><code>cpuSnapshotIntervalSecs</code> and <code>memorySnapshotIntervalSecs</code> has been replaced with top level <code>systemInfoIntervalMillis</code> configuration</li><li><code>maxUsedCpuRatio</code> has been moved to the top level configuration</li></ul></li><li><code>ProxyConfiguration.newUrlFunction</code> can be async. <code>.newUrl()</code> and <code>.newProxyInfo()</code> now return promises.</li><li><code>prepareRequestFunction</code> and <code>postResponseFunction</code> options are removed, use navigation hooks instead</li><li><code>gotoFunction</code> and <code>gotoTimeoutSecs</code> are removed</li><li>removed compatibility fix for old/broken request queues with null <code>Request</code> props</li><li><code>fingerprintsOptions</code> renamed to <code>fingerprintOptions</code> (<code>fingerprints</code> -> <code>fingerprint</code>).</li><li><code>fingerprintOptions</code> now accept <code>useFingerprintCache</code> and <code>fingerprintCacheSize</code> (instead of <code>useFingerprintPerProxyCache</code> and <code>fingerprintPerProxyCacheSize</code>, which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v3.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v2</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#crawlee-monorepo" class="table-of-contents__link toc-highlight">Crawlee monorepo</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#requestlabel-shortcut" class="table-of-contents__link toc-highlight"><code>Request.label</code> shortcut</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/3.0/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v3">3.1</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/3.0/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/3.0/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>3.0</b>, which is no longer actively maintained.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v3">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/3.0/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v3</h1></header><p>This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Crawlee vs Apify SDK v2</div><div class="admonitionContent_S0QG"><p>Up until version 3 of <code>apify</code>, the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:</p><ul><li><a href="https://github.com/apify/crawlee" target="_blank" rel="noopener">Crawlee</a>, the new web-scraping library, available as <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package on NPM</li><li><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener">Apify SDK</a>, helpers for the Apify platform, available as <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> package on NPM</li></ul></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawlee-monorepo">Crawlee monorepo<a href="#crawlee-monorepo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package consists of several smaller packages, released separately under <code>@crawlee</code> namespace:</p><ul><li><code>@crawlee/core</code>: the base for all the crawler implementations, also contains things like <code>Request</code>, <code>RequestQueue</code>, <code>RequestList</code> or <code>Dataset</code> classes</li><li><code>@crawlee/basic</code>: exports <code>BasicCrawler</code></li><li><code>@crawlee/http</code>: exports <code>HttpCrawler</code> (which is used for creating <code>@crawlee/dom</code> and <code>@crawlee/cheerio</code>)</li><li><code>@crawlee/dom</code>: exports <code>DOMCrawler</code></li><li><code>@crawlee/cheerio</code>: exports <code>CheerioCrawler</code></li><li><code>@crawlee/browser</code>: exports <code>BrowserCrawler</code> (which is used for creating <code>@crawlee/playwright</code> and <code>@crawlee/puppeteer</code>)</li><li><code>@crawlee/playwright</code>: exports <code>PlaywrightCrawler</code></li><li><code>@crawlee/puppeteer</code>: exports <code>PuppeteerCrawler</code></li><li><code>@crawlee/memory-storage</code>: <code>@apify/storage-local</code> alternative</li><li><code>@crawlee/browser-pool</code>: previously <code>browser-pool</code> package</li><li><code>@crawlee/utils</code>: utility methods</li><li><code>@crawlee/types</code>: holds TS interfaces mainly about the <code>StorageClient</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installing-crawlee">Installing Crawlee<a href="#installing-crawlee" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. <code>@crawlee/playwright</code> if you plan on using <code>playwright</code> - it already contains everything from the <code>@crawlee/browser</code> package, which includes everything from <code>@crawlee/basic</code>, which includes everything from <code>@crawlee/core</code>.</p><p>If we don't care much about additional code being pulled in, we can just use the <code>crawlee</code> meta-package, which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Or if all we need is cheerio support, we can install only <code>@crawlee/cheerio</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> @crawlee/cheerio</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When using <code>playwright</code> or <code>puppeteer</code>, we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee playwright</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or npm install @crawlee/playwright playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Alternatively we can also use the <code>crawlee</code> meta-package which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><blockquote><p>Sometimes you might want to use some utility methods from <code>@crawlee/utils</code>, so you might want to install that as well. This package contains some utilities that were previously available under <code>Apify.utils</code>. Browser related utilities can be also found in the crawler packages (e.g. <code>@crawlee/playwright</code>).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="full-typescript-support">Full TypeScript support<a href="#full-typescript-support" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from <code>@apify/tsconfig</code> package. Don't forget to set the <code>module</code> and <code>target</code> to <code>ES2022</code> or above to be able to use top level await.</p><blockquote><p>The <code>@apify/tsconfig</code> config has <a href="https://www.typescriptlang.org/tsconfig#noImplicitAny" target="_blank" rel="noopener"><code>noImplicitAny</code></a> enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.</p></blockquote><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">tsconfig.json</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"extends"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"@apify/tsconfig"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"compilerOptions"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"module"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"target"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"outDir"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"dist"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"lib"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"DOM"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"include"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./src/**/*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="docker-build">Docker build<a href="#docker-build" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>For <code>Dockerfile</code> we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Dockerfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># using multistage build, as we need dev deps to build the TS source code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy all files, install all dependencies (including dev deps) and build the project</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy only necessary files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/README.md ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/apify.json ./apify.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># install only prod deps</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --only=prod --no-optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --only=prod --no-optional --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># run compiled code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="browser-fingerprints">Browser fingerprints<a href="#browser-fingerprints" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously we had a magical <code>stealth</code> option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints.</p><p>In case we don't want to have dynamic fingerprints, we can disable this behaviour via <code>useFingerprints</code> in <code>browserPoolOptions</code>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="session-cookie-method-renames">Session cookie method renames<a href="#session-cookie-method-renames" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call <code>session.getPuppeteerCookies()</code> or <code>session.setPuppeteerCookies()</code>. Since this method could be used for any of our crawlers, not just <code>PuppeteerCrawler</code>, the methods have been renamed to <code>session.getCookies()</code> and <code>session.setCookies()</code> respectively. Otherwise, their usage is exactly the same!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="memory-storage">Memory storage<a href="#memory-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When we store some data or intermediate state (like the one <code>RequestQueue</code> holds), we now use <code>@crawlee/memory-storage</code> by default. It is an alternative to the <code>@apify/storage-local</code>, that stores the state inside memory (as opposed to SQLite database used by <code>@apify/storage-local</code>). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the <code>INPUT.json</code> file).</p><p>When we want to run the crawler on Apify platform, we need to use <code>Actor.init</code> or <code>Actor.main</code>, which will automatically switch the storage client to <code>ApifyClient</code> when on the Apify platform.</p><p>We can still use the <code>@apify/storage-local</code>, to do it, first install it pass it to the <code>Actor.init</code> or <code>Actor.main</code> options:</p><blockquote><p><code>@apify/storage-local</code> v2.1.0+ is required for Crawlee</p></blockquote><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> ApifyStorageLocal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@apify/storage-local'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> storage </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">ApifyStorageLocal</span><span class="token punctuation" style="color:#393A34">(</span><span class="token comment" style="color:#999988;font-style:italic">/* options like `enableWalMode` belong here */</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> storage </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="purging-of-the-default-storage">Purging of the default storage<a href="#purging-of-the-default-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously the state was preserved between local runs, and we had to use <code>--purge</code> argument of the <code>apify-cli</code>. With Crawlee, this is now the default behaviour, we purge the storage automatically on <code>Actor.init/main</code> call. We can opt out of it via <code>purge: false</code> in the <code>Actor.init</code> options.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-crawler-options-and-interfaces">Renamed crawler options and interfaces<a href="#renamed-crawler-options-and-interfaces" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level.</p><ul><li><code>handleRequestFunction</code> -> <code>requestHandler</code></li><li><code>handlePageFunction</code> -> <code>requestHandler</code></li><li><code>handleRequestTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>handlePageTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>requestTimeoutSecs</code> -> <code>navigationTimeoutSecs</code></li><li><code>handleFailedRequestFunction</code> -> <code>failedRequestHandler</code></li></ul><p>We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:</p><ul><li><code>CheerioHandlePageInputs</code> -> <code>CheerioCrawlingContext</code></li><li><code>PlaywrightHandlePageFunction</code> -> <code>PlaywrightCrawlingContext</code></li><li><code>PuppeteerHandlePageFunction</code> -> <code>PuppeteerCrawlingContext</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="context-aware-helpers">Context aware helpers<a href="#context-aware-helpers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some utilities previously available under <code>Apify.utils</code> namespace are now moved to the crawling context and are <em>context aware</em>. This means they have some parameters automatically filled in from the context, like the current <code>Request</code> instance or current <code>Page</code> object, or the <code>RequestQueue</code> bound to the crawler.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enqueuing-links">Enqueuing links<a href="#enqueuing-links" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>One common helper that received more attention is the <code>enqueueLinks</code>. As mentioned above, it is context aware - we no longer need pass in the <code>requestQueue</code> or <code>page</code> arguments (or the cheerio handle <code>$</code>). In addition to that, it now offers 3 enqueuing strategies:</p><ul><li><code>EnqueueStrategy.All</code> (<code>'all'</code>): Matches any URLs found</li><li><code>EnqueueStrategy.SameHostname</code> (<code>'same-hostname'</code>) Matches any URLs that have the same subdomain as the base URL (default)</li><li><code>EnqueueStrategy.SameDomain</code> (<code>'same-domain'</code>) Matches any URLs that have the same domain name. For example, <code>https://wow.an.example.com</code> and <code>https://example.com</code> will both be matched for a base url of <code>https://example.com</code>.</li></ul><p>This means we can even call <code>enqueueLinks()</code> without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain.</p><p>Moreover, we can specify patterns the URL should match via globs:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev/*/*'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can also use `regexps` and `pseudoUrls` keys here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="implicit-requestqueue-instance">Implicit <code>RequestQueue</code> instance<a href="#implicit-requestqueue-instance" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>All crawlers now have the <code>RequestQueue</code> instance automatically available via <code>crawler.getRequestQueue()</code> method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the <code>RequestQueue</code> instance manually, and we can just use <code>crawler.addRequests()</code> method described underneath.</p><blockquote><p>We can still create the <code>RequestQueue</code> explicitly, the <code>crawler.getRequestQueue()</code> method will respect that and return the instance provided via crawler options.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawleraddrequests"><code>crawler.addRequests()</code><a href="#crawleraddrequests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>We can now add multiple requests in batches. The newly added <code>addRequests</code> method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of <code>RequestQueue</code> and <code>RequestList</code>.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// will resolve right after the initial batch of 1000 requests is added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addRequests</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token comment" style="color:#999988;font-style:italic">/* many requests, can be even millions */</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">waitForAllRequestsToBeAdded</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="less-verbose-error-logging">Less verbose error logging<a href="#less-verbose-error-logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the <code>CRAWLEE_VERBOSE_LOG</code> env var.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlabel-shortcut"><code>Request.label</code> shortcut<a href="#requestlabel-shortcut" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Labeling requests used to work via the <code>Request.userData</code> object. With Crawlee, we can also use the <code>Request.label</code> shortcut. It is implemented as a <code>get/set</code> pair, using the value from <code>Request.userData</code>. The support for this shortcut is also added to the <code>enqueueLinks</code> options interface.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">label </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> label</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-requestasbrowser">Removal of <code>requestAsBrowser</code><a href="#removal-of-requestasbrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In v1 we replaced the underlying implementation of <code>requestAsBrowser</code> to be just a proxy over calling <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> - our custom extension to <code>got</code> that tries to mimic the real browsers as much as possible. With v3, we are removing the <code>requestAsBrowser</code>, encouraging the use of <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> directly.</p><p>For easier migration, we also added <code>context.sendRequest()</code> helper that allows processing the context bound <code>Request</code> object through <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sendRequest</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can use the options parameter to override gotScraping options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sendRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> responseType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'json'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'received body'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-sendrequest">How to use <code>sendRequest()</code>?<a href="#how-to-use-sendrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>See <a href="https://crawlee.dev/docs/guides/got-scraping" target="_blank" rel="noopener">the Got Scraping guide</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="removed-options">Removed options<a href="#removed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The <code>useInsecureHttpParser</code> option has been removed. It's permanently set to <code>true</code> in order to better mimic browsers' behavior.</p><p>Got Scraping automatically performs protocol negotiation, hence we removed the <code>useHttp2</code> option. It's set to <code>true</code> - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-options">Renamed options<a href="#renamed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>In the <code>requestAsBrowser</code> approach, some of the options were named differently. Here's a list of renamed options:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This options represents the body to send. It could be a <code>string</code> or a <code>Buffer</code>. However, there is no <code>payload</code> option anymore. You need to use <code>body</code> instead. Or, if you wish to send JSON, <code>json</code>. Here's an example:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>It has been renamed to <code>https.rejectUnauthorized</code>. By default, it's set to <code>false</code> for convenience. However, if you want to make sure the connection is secure, you can do the following:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ignoreSslErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> https</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> rejectUnauthorized</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Please note: the meanings are opposite! So we needed to invert the values as well.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="header-generator-options"><code>header-generator</code> options<a href="#header-generator-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>useMobileVersion</code>, <code>languageCode</code> and <code>countryCode</code> no longer exist. Instead, you need to use <code>headerGeneratorOptions</code> directly:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useMobileVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> languageCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'en'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headerGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'mobile'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// or ['desktop']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> locales</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'en-US'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutsecs"><code>timeoutSecs</code><a href="#timeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>In order to set a timeout, use <code>timeout.request</code> (which is <strong>milliseconds</strong> now).</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeout</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> request</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="throwonhttperrors"><code>throwOnHttpErrors</code><a href="#throwonhttperrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>throwOnHttpErrors</code> → <code>throwHttpErrors</code>. This options throws on unsuccessful HTTP status codes, for example <code>404</code>. By default, it's set to <code>false</code>.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="decodebody"><code>decodeBody</code><a href="#decodebody" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>decodeBody</code> → <code>decompress</code>. This options decompresses the body. Defaults to <code>true</code> - please do not change this or websites will break (unless you know what you're doing!).</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This function used to make the promise throw on specific responses, if it returned <code>true</code>. However, it wasn't that useful.</p><p>You probably want to cancel the request instead, which you can do in the following way:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> promise </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">…</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'request'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Please note this is not a Got Request instance, but a ClientRequest one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://nodejs.org/api/http.html#class-httpclientrequest</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">protocol </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Unsecure request, abort.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cancel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you set `isStream` to `true`, please use `stream.destroy()` instead.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-browser-pool-plugin-mixing">Removal of browser pool plugin mixing<a href="#removal-of-browser-pool-plugin-mixing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type).</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Confused?</div><div class="admonitionContent_S0QG"><p>As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="handling-requests-outside-of-browser">Handling requests outside of browser<a href="#handling-requests-outside-of-browser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of <code>Request.skipNavigation</code> and <code>context.sendRequest()</code>.</p><p>Take a look at how to achieve this by checking out the <a href="https://crawlee.dev/docs/examples/skip-navigation" target="_blank" rel="noopener">Skipping navigation for certain requests</a> example!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logging">Logging<a href="#logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Crawlee exports the default <code>log</code> instance directly as a named export. We also have a scoped <code>log</code> instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Opened </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="auto-saved-crawler-state">Auto-saved crawler state<a href="#auto-saved-crawler-state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Every crawler instance now has <code>useState()</code> method that will return a state object we can use. It will be automatically saved when <code>persistState</code> event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> crawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> state </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">useState</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// just change the value, no need to care about saving it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> state</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-sdk">Apify SDK<a href="#apify-sdk" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The Apify platform helpers can be now found in the Apify SDK (<code>apify</code> NPM package). It exports the <code>Actor</code> class that offers following static helpers:</p><ul><li><code>ApifyClient</code> shortcuts: <code>addWebhook()</code>, <code>call()</code>, <code>callTask()</code>, <code>metamorph()</code></li><li>helpers for running on Apify platform: <code>init()</code>, <code>exit()</code>, <code>fail()</code>, <code>main()</code>, <code>isAtHome()</code>, <code>createProxyConfiguration()</code></li><li>storage support: <code>getInput()</code>, <code>getValue()</code>, <code>openDataset()</code>, <code>openKeyValueStore()</code>, <code>openRequestQueue()</code>, <code>pushData()</code>, <code>setValue()</code></li><li>events support: <code>on()</code>, <code>off()</code></li><li>other utilities: <code>getEnv()</code>, <code>newClient()</code>, <code>reboot()</code></li></ul><p><code>Actor.main</code> is now just a syntax sugar around calling <code>Actor.init()</code> at the beginning and <code>Actor.exit()</code> at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> statusMessage</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>Actor.init()</code> will conditionally set the storage implementation of Crawlee to the <code>ApifyClient</code> when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). <code>Actor.exit()</code> will handle the tear down and calls <code>process.exit()</code> to ensure our process won't hang indefinitely for some reason.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="events">Events<a href="#events" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Apify SDK (v2) exports <code>Apify.events</code>, which is an <code>EventEmitter</code> instance. With Crawlee, the events are managed by <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> class instead. We can either access it via <code>Actor.eventManager</code> getter, or use <code>Actor.on</code> and <code>Actor.off</code> shortcuts instead.</p><div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">Apify.events.on(...);</span><br></span><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">Actor.on(...);</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>We can also get the <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> instance via <code>Configuration.getEventManager()</code>.</p></blockquote><p>In addition to the existing events, we now have an <code>exit</code> event fired when calling <code>Actor.exit()</code> (which is called at the end of <code>Actor.main()</code>). This event allows you to gracefully shut down any resources when <code>Actor.exit</code> is called.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="smallerinternal-breaking-changes">Smaller/internal breaking changes<a href="#smallerinternal-breaking-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><code>Apify.call()</code> is now just a shortcut for running <code>ApifyClient.actor(actorId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.callTask()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.metamorph()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).metamorph(input, options)</code>, while also taking the ACTOR_RUN_ID inside env vars into account</li><li><code>Apify.waitForRunToFinish()</code> has been removed, use <code>ApifyClient.waitForFinish()</code> instead</li><li><code>Actor.main/init</code> purges the storage by default</li><li>remove <code>purgeLocalStorage</code> helper, move purging to the storage class directly<ul><li><code>StorageClient</code> interface now has optional <code>purge</code> method</li><li>purging happens automatically via <code>Actor.init()</code> (you can opt out via <code>purge: false</code> in the options of <code>init/main</code> methods)</li></ul></li><li><code>QueueOperationInfo.request</code> is no longer available</li><li><code>Request.handledAt</code> is now string date in ISO format</li><li><code>Request.inProgress</code> and <code>Request.reclaimed</code> are now <code>Set</code>s instead of POJOs</li><li><code>injectUnderscore</code> from puppeteer utils has been removed</li><li><code>APIFY_MEMORY_MBYTES</code> is no longer taken into account, use <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> instead</li><li>some <code>AutoscaledPool</code> options are no longer available:<ul><li><code>cpuSnapshotIntervalSecs</code> and <code>memorySnapshotIntervalSecs</code> has been replaced with top level <code>systemInfoIntervalMillis</code> configuration</li><li><code>maxUsedCpuRatio</code> has been moved to the top level configuration</li></ul></li><li><code>ProxyConfiguration.newUrlFunction</code> can be async. <code>.newUrl()</code> and <code>.newProxyInfo()</code> now return promises.</li><li><code>prepareRequestFunction</code> and <code>postResponseFunction</code> options are removed, use navigation hooks instead</li><li><code>gotoFunction</code> and <code>gotoTimeoutSecs</code> are removed</li><li>removed compatibility fix for old/broken request queues with null <code>Request</code> props</li><li><code>fingerprintsOptions</code> renamed to <code>fingerprintOptions</code> (<code>fingerprints</code> -> <code>fingerprint</code>).</li><li><code>fingerprintOptions</code> now accept <code>useFingerprintCache</code> and <code>fingerprintCacheSize</code> (instead of <code>useFingerprintPerProxyCache</code> and <code>fingerprintPerProxyCacheSize</code>, which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.0/upgrading/upgrading_v3.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v2</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/3.0/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#crawlee-monorepo" class="table-of-contents__link toc-highlight">Crawlee monorepo</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#requestlabel-shortcut" class="table-of-contents__link toc-highlight"><code>Request.label</code> shortcut</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/changelog.html b/docs/changelog.html index 40e6a9013f..d7acac407d 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/changelog">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/changelog">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/changelog">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/changelog">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/changelog">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Changelog</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.12" target="_blank" rel="noopener">apify@3.1.12</a><a href="#apify3112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3112-2023-10-05"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.11...apify@3.1.12" target="_blank" rel="noopener">3.1.12</a> (2023-10-05)<a href="#3112-2023-10-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add more logging to <code>Actor.init</code> and <code>Actor.exit</code> (<a href="https://github.com/apify/apify-sdk-js/issues/236" target="_blank" rel="noopener">#236</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/b7e01fc649de84d6f1391bf95e0f349f7ca32536" target="_blank" rel="noopener">b7e01fc</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3111"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.11" target="_blank" rel="noopener">apify@3.1.11</a><a href="#apify3111" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3111-2023-10-04"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.10...apify@3.1.11" target="_blank" rel="noopener">3.1.11</a> (2023-10-04)<a href="#3111-2023-10-04" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-1">Bug Fixes<a href="#bug-fixes-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>run the whole <code>Actor.exit()</code> code inside a timeout handler (<a href="https://github.com/apify/apify-sdk-js/issues/235" target="_blank" rel="noopener">#235</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c8aabaee5f2de1ab40947f47f95f54ccff37cad0" target="_blank" rel="noopener">c8aabae</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features">Features<a href="#features" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use <code>.reboot()</code> instead of <code>.metamorph()</code> for reboot (<a href="https://github.com/apify/apify-sdk-js/issues/227" target="_blank" rel="noopener">#227</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/8c0bff5a8d3ea65e532b3700b34b9c563856158a" target="_blank" rel="noopener">8c0bff5</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.10" target="_blank" rel="noopener">apify@3.1.10</a><a href="#apify3110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3110-2023-09-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.9...apify@3.1.10" target="_blank" rel="noopener">3.1.10</a> (2023-09-07)<a href="#3110-2023-09-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-2">Bug Fixes<a href="#bug-fixes-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of crawlee to fix possible issues with <code>purgeDefaultStorages</code> (<a href="https://github.com/apify/apify-sdk-js/issues/226" target="_blank" rel="noopener">#226</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/95cf31f3d1d054a1c8e3daac89f41bbb0aaddbba" target="_blank" rel="noopener">95cf31f</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify319"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.9" target="_blank" rel="noopener">apify@3.1.9</a><a href="#apify319" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="319-2023-09-06"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.8...apify@3.1.9" target="_blank" rel="noopener">3.1.9</a> (2023-09-06)<a href="#319-2023-09-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">@apify/scraper-tools@1.1.2</a><a href="#apifyscraper-tools112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="112-2023-07-28"><a href="https://github.com/apify/apify-sdk-js/compare/@apify/scraper-tools@1.1.1...@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">1.1.2</a> (2023-07-28)<a href="#112-2023-07-28" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-3">Bug Fixes<a href="#bug-fixes-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-1">Features<a href="#features-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify318"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.8" target="_blank" rel="noopener">apify@3.1.8</a><a href="#apify318" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="318-2023-07-20"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.7...apify@3.1.8" target="_blank" rel="noopener">3.1.8</a> (2023-07-20)<a href="#318-2023-07-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-4">Bug Fixes<a href="#bug-fixes-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of apify-client and other packages (<a href="https://github.com/apify/apify-sdk-js/commit/24a3a4b5bf2f61e690348727e7f24c06c45a0999" target="_blank" rel="noopener">24a3a4b</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-2">Features<a href="#features-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use Actor env vars (<a href="https://github.com/apify/apify-sdk-js/issues/216" target="_blank" rel="noopener">#216</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/11ff740ad3d2bdd37fce011d94b64ea01413b0d9" target="_blank" rel="noopener">11ff740</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify317"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.7" target="_blank" rel="noopener">apify@3.1.7</a><a href="#apify317" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="317-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.6...apify@3.1.7" target="_blank" rel="noopener">3.1.7</a> (2023-06-09)<a href="#317-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify316"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.6" target="_blank" rel="noopener">apify@3.1.6</a><a href="#apify316" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="316-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.5...apify@3.1.6" target="_blank" rel="noopener">3.1.6</a> (2023-06-09)<a href="#316-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-5">Bug Fixes<a href="#bug-fixes-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>only print status message when explicitly provided in <code>Actor.exit()</code> (<a href="https://github.com/apify/apify-sdk-js/issues/203" target="_blank" rel="noopener">#203</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/85159e499984c78eee90b6d92332ea63b9f46c8c" target="_blank" rel="noopener">85159e4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify315"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.5" target="_blank" rel="noopener">apify@3.1.5</a><a href="#apify315" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="315-2023-05-31"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.4...apify@3.1.5" target="_blank" rel="noopener">3.1.5</a> (2023-05-31)<a href="#315-2023-05-31" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-6">Bug Fixes<a href="#bug-fixes-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add missing <code>options</code> parameter to <code>Actor.setStatusMessage()</code> (<a href="https://github.com/apify/apify-sdk-js/commit/712e8c66755ac8baeb35fcc1ad000487da8b2c48" target="_blank" rel="noopener">712e8c6</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-3">Features<a href="#features-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.getInputOrThrow()</code> method (<a href="https://github.com/apify/apify-sdk-js/issues/198" target="_blank" rel="noopener">#198</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/5fbbfe4960a79fbbd23f4fdd7d07a1a5063820f4" target="_blank" rel="noopener">5fbbfe4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify314"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.4" target="_blank" rel="noopener">apify@3.1.4</a><a href="#apify314" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="314-2023-03-23"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.3...apify@3.1.4" target="_blank" rel="noopener">3.1.4</a> (2023-03-23)<a href="#314-2023-03-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-7">Bug Fixes<a href="#bug-fixes-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>log status message only once and without prefix (<a href="https://github.com/apify/apify-sdk-js/issues/179" target="_blank" rel="noopener">#179</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1f11a6ad8ebc8a0cfaef58be47ba8b12c75018f1" target="_blank" rel="noopener">1f11a6a</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify313"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.3" target="_blank" rel="noopener">apify@3.1.3</a><a href="#apify313" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="313-2023-03-22"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.2...apify@3.1.3" target="_blank" rel="noopener">3.1.3</a> (2023-03-22)<a href="#313-2023-03-22" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-8">Bug Fixes<a href="#bug-fixes-8" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><code>call/callTask</code> accept <code>waitSecs</code> instead of <code>waitForFinish</code> (<a href="https://github.com/apify/apify-sdk-js/issues/176" target="_blank" rel="noopener">#176</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/f0c73d8765091212f2abb4b4faaf109f9447d90a" target="_blank" rel="noopener">f0c73d8</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-4">Features<a href="#features-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify312"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.2" target="_blank" rel="noopener">apify@3.1.2</a><a href="#apify312" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="312-2023-02-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.1...apify@3.1.2" target="_blank" rel="noopener">3.1.2</a> (2023-02-07)<a href="#312-2023-02-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-9">Bug Fixes<a href="#bug-fixes-9" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li><li>remove unused export of <code>QueueOperationInfoOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/b29fe4853d637ab527a7f7e3e53c7a5b0fe27a32" target="_blank" rel="noopener">b29fe48</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify311"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.1" target="_blank" rel="noopener">apify@3.1.1</a><a href="#apify311" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="311-2022-11-13"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.0...apify@3.1.1" target="_blank" rel="noopener">3.1.1</a> (2022-11-13)<a href="#311-2022-11-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-5">Features<a href="#features-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>statusMessage</code> to <code>AbortOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/fb10bb60c12c0af97e41ae88adcf0b2000286235" target="_blank" rel="noopener">fb10bb6</a>)</li><li>warn about actor not being initialized before using storage methods (<a href="https://github.com/apify/apify-sdk-js/issues/126" target="_blank" rel="noopener">#126</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/91cd2467d111de19490a6bf47b4a9138f26a37d4" target="_blank" rel="noopener">91cd246</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify310"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.0" target="_blank" rel="noopener">apify@3.1.0</a><a href="#apify310" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="310-2022-10-13">3.1.0 (2022-10-13)<a href="#310-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-10">Bug Fixes<a href="#bug-fixes-10" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><strong>apify:</strong> add <code>@apify/timeout</code> to dependencies (<a href="https://github.com/apify/apify-sdk-js/issues/76" target="_blank" rel="noopener">#76</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1d64a1fa8f0e88a96eb82c2669e85b09dd4f372d" target="_blank" rel="noopener">1d64a1f</a>)</li><li>use correct event manager for actor methods (<a href="https://github.com/apify/apify-sdk-js/issues/49" target="_blank" rel="noopener">#49</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/ef3a0c54359be64c89e76b0cac600cd780281321" target="_blank" rel="noopener">ef3a0c5</a>)</li><li>wait for memory storage to write changes before <code>Actor.exit</code> exists the process (<a href="https://github.com/apify/apify-sdk-js/commit/c721d988141cf5b7aa170fddeffb792ded769622" target="_blank" rel="noopener">c721d98</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-6">Features<a href="#features-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li><strong>apify:</strong> add decryption for input secrets (<a href="https://github.com/apify/apify-sdk-js/issues/83" target="_blank" rel="noopener">#83</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/78bb990817c01254de19c828937181c1263e21eb" target="_blank" rel="noopener">78bb990</a>)</li><li>re-export the logger in actor sdk (<a href="https://github.com/apify/apify-sdk-js/issues/54" target="_blank" rel="noopener">#54</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c78d8a44d7af5de7fda7bf2e436fefda752a4b1a" target="_blank" rel="noopener">c78d8a4</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.0" target="_blank" rel="noopener">@apify/scraper-tools@1.1.0</a><a href="#apifyscraper-tools110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="110-2022-10-13">1.1.0 (2022-10-13)<a href="#110-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-7">Features<a href="#features-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li>add playwright scraper (<a href="https://github.com/apify/apify-sdk-js/issues/26" target="_blank" rel="noopener">#26</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/2dcd50ded777ae13bc7b75e6e0bc21a6a11315b7" target="_blank" rel="noopener">2dcd50d</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/changelog.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify3112" class="table-of-contents__link toc-highlight">apify@3.1.12</a></li><li><a href="#apify3111" class="table-of-contents__link toc-highlight">apify@3.1.11</a></li><li><a href="#apify3110" class="table-of-contents__link toc-highlight">apify@3.1.10</a></li><li><a href="#apify319" class="table-of-contents__link toc-highlight">apify@3.1.9</a></li><li><a href="#apifyscraper-tools112" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.2</a></li><li><a href="#apify318" class="table-of-contents__link toc-highlight">apify@3.1.8</a></li><li><a href="#apify317" class="table-of-contents__link toc-highlight">apify@3.1.7</a></li><li><a href="#apify316" class="table-of-contents__link toc-highlight">apify@3.1.6</a></li><li><a href="#apify315" class="table-of-contents__link toc-highlight">apify@3.1.5</a></li><li><a href="#apify314" class="table-of-contents__link toc-highlight">apify@3.1.4</a></li><li><a href="#apify313" class="table-of-contents__link toc-highlight">apify@3.1.3</a></li><li><a href="#apify312" class="table-of-contents__link toc-highlight">apify@3.1.2</a></li><li><a href="#apify311" class="table-of-contents__link toc-highlight">apify@3.1.1</a></li><li><a href="#apify310" class="table-of-contents__link toc-highlight">apify@3.1.0</a></li><li><a href="#apifyscraper-tools110" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.0</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples.html b/docs/examples.html index ef635cb0bb..e166c37588 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><header><h1 class="title_kItE">Examples</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/accept-user-input"><h2 class="text--truncate cardTitle_rnsV" title="Accept user input">📄️<!-- --> <!-- -->Accept user input</h2><p class="text--truncate cardDescription_PWke" title="This example accepts and logs user input:">This example accepts and logs user input:</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/add-data-to-dataset"><h2 class="text--truncate cardTitle_rnsV" title="Add data to dataset">📄️<!-- --> <!-- -->Add data to dataset</h2><p class="text--truncate cardDescription_PWke" title="This example saves data to the default dataset. If the dataset doesn't exist, it will be created.">This example saves data to the default dataset. If the dataset doesn't exist, it will be created.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/basic-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Basic crawler">📄️<!-- --> <!-- -->Basic crawler</h2><p class="text--truncate cardDescription_PWke" title="This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers">This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/call-actor"><h2 class="text--truncate cardTitle_rnsV" title="Call actor">📄️<!-- --> <!-- -->Call actor</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to start an Apify actor using">This example demonstrates how to start an Apify actor using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/cheerio-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Cheerio crawler">📄️<!-- --> <!-- -->Cheerio crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.">This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/crawl-all-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl all links on a website">📄️<!-- --> <!-- -->Crawl all links on a website</h2><p class="text--truncate cardDescription_PWke" title="This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the">This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/crawl-multiple-urls"><h2 class="text--truncate cardTitle_rnsV" title="Crawl multiple URLs">📄️<!-- --> <!-- -->Crawl multiple URLs</h2><p class="text--truncate cardDescription_PWke" title="This example crawls the specified list of URLs.">This example crawls the specified list of URLs.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/crawl-relative-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a website with relative links">📄️<!-- --> <!-- -->Crawl a website with relative links</h2><p class="text--truncate cardDescription_PWke" title="When crawling a website, you may encounter different types of links present that you may want to crawl.">When crawling a website, you may encounter different types of links present that you may want to crawl.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/crawl-single-url"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a single URL">📄️<!-- --> <!-- -->Crawl a single URL</h2><p class="text--truncate cardDescription_PWke" title="This example uses the got-scraping npm package">This example uses the got-scraping npm package</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/crawl-sitemap"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a sitemap">📄️<!-- --> <!-- -->Crawl a sitemap</h2><p class="text--truncate cardDescription_PWke" title="This example downloads and crawls the URLs from a sitemap.">This example downloads and crawls the URLs from a sitemap.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/crawl-some-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl some links on a website">📄️<!-- --> <!-- -->Crawl some links on a website</h2><p class="text--truncate cardDescription_PWke" title="This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.">This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/forms"><h2 class="text--truncate cardTitle_rnsV" title="Forms">📄️<!-- --> <!-- -->Forms</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler to">This example demonstrates how to use PuppeteerCrawler to</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/map-and-reduce"><h2 class="text--truncate cardTitle_rnsV" title="Dataset Map and Reduce methods">📄️<!-- --> <!-- -->Dataset Map and Reduce methods</h2><p class="text--truncate cardDescription_PWke" title="This example shows an easy use-case of the Dataset map">This example shows an easy use-case of the Dataset map</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/playwright-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Playwright crawler">📄️<!-- --> <!-- -->Playwright crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PlaywrightCrawler">This example demonstrates how to use PlaywrightCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/capture-screenshot"><h2 class="text--truncate cardTitle_rnsV" title="Capture a screenshot using Puppeteer">📄️<!-- --> <!-- -->Capture a screenshot using Puppeteer</h2><p class="text--truncate cardDescription_PWke" title="To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.">To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/puppeteer-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer crawler">📄️<!-- --> <!-- -->Puppeteer crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler in combination">This example demonstrates how to use PuppeteerCrawler in combination</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/puppeteer-recursive-crawl"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer recursive crawl">📄️<!-- --> <!-- -->Puppeteer recursive crawl</h2><p class="text--truncate cardDescription_PWke" title="Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.">Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/examples/puppeteer-with-proxy"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer with proxy">📄️<!-- --> <!-- -->Puppeteer with proxy</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.">This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/accept-user-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Accept user input</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/accept-user-input.html b/docs/examples/accept-user-input.html index 9c428a2acd..e00d7ea896 100644 --- a/docs/examples/accept-user-input.html +++ b/docs/examples/accept-user-input.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/accept_user_input.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/accept_user_input.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/add-data-to-dataset.html b/docs/examples/add-data-to-dataset.html index 79a23aee10..1161b6b4a9 100644 --- a/docs/examples/add-data-to-dataset.html +++ b/docs/examples/add-data-to-dataset.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/add-data-to-dataset">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/add-data-to-dataset">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Add data to dataset</h1></header><p>This example saves data to the default dataset. If the dataset doesn't exist, it will be created. -You can save data to custom datasets by using <a href="/sdk/js/api/apify/class/Dataset#open"><code>Actor.openDataset()</code></a></p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/add_data_to_dataset.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +You can save data to custom datasets by using <a href="/sdk/js/api/apify/class/Dataset#open"><code>Actor.openDataset()</code></a></p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/add_data_to_dataset.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/basic-crawler.html b/docs/examples/basic-crawler.html index 458c4826ef..5d2d663faa 100644 --- a/docs/examples/basic-crawler.html +++ b/docs/examples/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/basic-crawler">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/basic-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/basic-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/basic-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/basic-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Basic crawler</h1></header><p>This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the <a href="https://crawlee.dev/api/basic-crawler/class/BasicCrawler" target="_blank" rel="noopener noreferrer"><code>BasicCrawler</code></a>. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers like <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> or <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>.</p><p>The script simply downloads several web pages with plain HTTP requests using the <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> npm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in -<code>./storage/datasets/default</code>.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> BasicCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils gotScraping</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/basic_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>./storage/datasets/default</code>.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> BasicCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils gotScraping</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/basic_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/call-actor.html b/docs/examples/call-actor.html index 621914d8be..1447bcb5a2 100644 --- a/docs/examples/call-actor.html +++ b/docs/examples/call-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ Go to the <a href="https://console.apify.com/account?tab=integrations" target="_blank" rel="noopener">Settings - Integrations</a> page to obtain your API token and set it to the <a href="/sdk/js/docs/guides/environment-variables#APIFY_TOKEN"><code>APIFY_TOKEN</code></a> environment variable, or run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set -up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on Apify Platform, use the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> email </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Actor.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/call_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on Apify Platform, use the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> email </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Actor.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/call_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/capture-screenshot.html b/docs/examples/capture-screenshot.html index 9122b5c230..5dae3cfa87 100644 --- a/docs/examples/capture-screenshot.html +++ b/docs/examples/capture-screenshot.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/capture-screenshot">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/capture-screenshot">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/capture-screenshot">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/capture-screenshot">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/capture-screenshot">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Capture a screenshot using Puppeteer</h1></header><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><p>This example captures a screenshot of a web page using <code>Puppeteer</code>. It would look almost exactly the same with <code>Playwright</code>.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Page Screenshot</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Crawler Utils Screenshot</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>page.screenshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCB1cmwgPSAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nO1xcbi8vIFN0YXJ0IGEgYnJvd3NlclxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBPcGVuIG5ldyB0YWIgaW4gdGhlIGJyb3dzZXJcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuXFxuLy8gTmF2aWdhdGUgdG8gdGhlIFVSTFxcbmF3YWl0IHBhZ2UuZ290byh1cmwpO1xcblxcbi8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG5jb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuXFxuLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgnbXkta2V5Jywgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuXFxuLy8gQ2xvc2UgUHVwcGV0ZWVyXFxuYXdhaXQgYnJvd3Nlci5jbG9zZSgpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.xy-Qn13nROyNEPEB6pUG8xQ1VfIjq56rsat4wKqhq9o&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>puppeteerUtils.saveSnapshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciwgdXRpbHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgdXJsID0gJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vJztcXG4vLyBTdGFydCBhIGJyb3dzZXJcXG5jb25zdCBicm93c2VyID0gYXdhaXQgbGF1bmNoUHVwcGV0ZWVyKCk7XFxuXFxuLy8gT3BlbiBuZXcgdGFiIGluIHRoZSBicm93c2VyXFxuY29uc3QgcGFnZSA9IGF3YWl0IGJyb3dzZXIubmV3UGFnZSgpO1xcblxcbi8vIE5hdmlnYXRlIHRvIHRoZSBVUkxcXG5hd2FpdCBwYWdlLmdvdG8odXJsKTtcXG5cXG4vLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90XFxuYXdhaXQgdXRpbHMucHVwcGV0ZWVyLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleTogJ215LWtleScsIHNhdmVIdG1sOiBmYWxzZSB9KTtcXG5cXG4vLyBDbG9zZSBQdXBwZXRlZXJcXG5hd2FpdCBicm93c2VyLmNsb3NlKCk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.QSyAaQjtq2wJi2-pHooiFMBrLOELGoFYIBj8kQcDYtA&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> utils </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><p>This example captures a screenshot of multiple web pages when using <code>PuppeteerCrawler</code>:</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Page Screenshot</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Crawler Utils Screenshot</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>page.screenshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgUHVwcGV0ZWVyQ3Jhd2xlclxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUHVwcGV0ZWVyQ3Jhd2xlcih7XFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICAvLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90IHdpdGggUHVwcGV0ZWVyXFxuICAgICAgICBjb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuICAgICAgICAvLyBDb252ZXJ0IHRoZSBVUkwgaW50byBhIHZhbGlkIGtleVxcbiAgICAgICAgY29uc3Qga2V5ID0gcmVxdWVzdC51cmwucmVwbGFjZSgvWzovXS9nLCAnXycpO1xcbiAgICAgICAgLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG4gICAgICAgIGF3YWl0IEFjdG9yLnNldFZhbHVlKGtleSwgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyB9LFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.V_BcbfCWH__rcmGznaMSLm6R1wTtqF583QKH4Z3n5Uc&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot with Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>puppeteerUtils.saveSnapshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIHB1cHBldGVlclV0aWxzIH0gZnJvbSAnY3Jhd2xlZSc7XFxuaW1wb3J0IHsgQWN0b3IgfSBmcm9tICdhcGlmeSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIFB1cHBldGVlckNyYXdsZXJcXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgLy8gQ29udmVydCB0aGUgVVJMIGludG8gYSB2YWxpZCBrZXlcXG4gICAgICAgIGNvbnN0IGtleSA9IHJlcXVlc3QudXJsLnJlcGxhY2UoL1s6L10vZywgJ18nKTtcXG4gICAgICAgIC8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG4gICAgICAgIGF3YWl0IHB1cHBldGVlclV0aWxzLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleSwgc2F2ZUh0bWw6IGZhbHNlIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.2SyyQ1VmxXhmOlrpTJRLqsinn3178wgSbrygIl4JJdg&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> puppeteerUtils </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> puppeteerUtils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><p>In both examples using <code>page.screenshot()</code>, a <code>key</code> variable is created based on the URL of the web page. This variable is used as the key when saving -each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_capture_screenshot.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_capture_screenshot.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/cheerio-crawler.html b/docs/examples/cheerio-crawler.html index 0cf3cb7f80..59f34e2e09 100644 --- a/docs/examples/cheerio-crawler.html +++ b/docs/examples/cheerio-crawler.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> LogLevel </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Crawlers come with various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">LogLevel</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestHandlerTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">index</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/cheerio_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> LogLevel </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Crawlers come with various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">LogLevel</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestHandlerTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">index</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/cheerio_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/crawl-all-links.html b/docs/examples/crawl-all-links.html index 2f343448d1..c0bf8f541f 100644 --- a/docs/examples/crawl-all-links.html +++ b/docs/examples/crawl-all-links.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-all-links">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-all-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-all-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-all-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-all-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl all links on a website</h1></header><p>This example uses the <code>enqueueLinks()</code> method to add new links to the <code>RequestQueue</code> as the crawler navigates from page to page. If only the -required parameters are defined, all links will be crawled.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_all_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +required parameters are defined, all links will be crawled.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_all_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/crawl-multiple-urls.html b/docs/examples/crawl-multiple-urls.html index cb45ef0ce2..c4c670dbd7 100644 --- a/docs/examples/crawl-multiple-urls.html +++ b/docs/examples/crawl-multiple-urls.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_multiple_urls.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_multiple_urls.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/crawl-relative-links.html b/docs/examples/crawl-relative-links.html index 222df5a160..8e014d6ff5 100644 --- a/docs/examples/crawl-relative-links.html +++ b/docs/examples/crawl-relative-links.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ full domain or urls that point to any subdomain of the provided domain.</p><p>For instance, hyperlinks like <code>https://subdomain.example.com/some/path</code>, <code>https://example.com/some/path</code>, <code>/absolute/example</code> or <code>./relative/example</code> will all be matched by this strategy.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgaG9zdG5hbWVcXG4gICAgICAgICAgICAvLyBhcyByZXF1ZXN0LmxvYWRlZFVybCBvciByZXF1ZXN0LnVybFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogRW5xdWV1ZVN0cmF0ZWd5LlNhbWVIb3N0bmFtZSxcXG4gICAgICAgICAgICAvLyBBbHRlcm5hdGl2ZWx5LCB5b3UgY2FuIHBhc3MgaW4gdGhlIHN0cmluZyAnc2FtZS1ob3N0bmFtZSdcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtaG9zdG5hbWUnLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.yF2AJFRXorzWRuCXhRGjM8nWXBFT585D7nwOkBPAPf0&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> EnqueueStrategy </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-hostname'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-hostname',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>This is the default strategy when calling <code>enqueueLinks()</code>, so you don't have to specify it.</p></div></div><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>Example domains</div><div class="admonitionContent_S0QG"><p>For a url of <code>https://subdomain.example.com</code>, <code>enqueueLinks()</code> will only match relative urls or urls that point to the same full domain.</p><p>For instance, hyperlinks like <code>https://subdomain.example.com/some/path</code>, <code>/absolute/example</code> or <code>./relative/example</code> -will all be matched by this strategy, while <code>https://other-subdomain.example.com</code> or <code>https://otherexample.com</code> will not.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> EnqueueStrategy </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-subdomain'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-subdomain',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_relative_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +will all be matched by this strategy, while <code>https://other-subdomain.example.com</code> or <code>https://otherexample.com</code> will not.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> EnqueueStrategy </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-subdomain'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-subdomain',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_relative_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/crawl-single-url.html b/docs/examples/crawl-single-url.html index 7aaa1ec61e..d4cff3aa49 100644 --- a/docs/examples/crawl-single-url.html +++ b/docs/examples/crawl-single-url.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-single-url">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-single-url">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-single-url">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-single-url">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-single-url">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a single URL</h1></header><p>This example uses the <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> npm package -to grab the HTML of a web page.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_single_url.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +to grab the HTML of a web page.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_single_url.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/crawl-sitemap.html b/docs/examples/crawl-sitemap.html index e247739a7a..1be9e57e5b 100644 --- a/docs/examples/crawl-sitemap.html +++ b/docs/examples/crawl-sitemap.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_sitemap.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_sitemap.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/crawl-some-links.html b/docs/examples/crawl-some-links.html index c982abc1ff..d72b496cd7 100644 --- a/docs/examples/crawl-some-links.html +++ b/docs/examples/crawl-some-links.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> example uses the <a href="https://crawlee.dev/api/core/class/PseudoUrl" target="_blank" rel="noopener noreferrer"><code>pseudoUrls</code></a> property in the <a href="https://crawlee.dev/api/cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks" target="_blank" rel="noopener noreferrer"><code>enqueueLinks()</code></a> method to only add links to the <a href="/sdk/js/api/apify/class/RequestQueue"><code>RequestQueue</code></a> queue if they match the specified regular expression.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limits the crawler to only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to the crawler's RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL and run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_some_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> example uses the <a href="https://crawlee.dev/api/core/class/PseudoUrl" target="_blank" rel="noopener noreferrer"><code>pseudoUrls</code></a> property in the <a href="https://crawlee.dev/api/cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks" target="_blank" rel="noopener noreferrer"><code>enqueueLinks()</code></a> method to only add links to the <a href="/sdk/js/api/apify/class/RequestQueue"><code>RequestQueue</code></a> queue if they match the specified regular expression.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limits the crawler to only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to the crawler's RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL and run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/crawl_some_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/forms.html b/docs/examples/forms.html index 13ef1d37b0..b7c621d89b 100644 --- a/docs/examples/forms.html +++ b/docs/examples/forms.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ automatically fill and submit a search form to look up repositories on <a href="https://github.com" target="_blank" rel="noopener">GitHub</a> using headless Chrome / Puppeteer. The actor first fills in the search term, repository owner, start date and language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the -default <a href="/sdk/js/api/apify/class/Dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./storage/datasets/default</code>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token builtin">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/forms.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +default <a href="/sdk/js/api/apify/class/Dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./storage/datasets/default</code>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token builtin">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/forms.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/map-and-reduce.html b/docs/examples/map-and-reduce.html index afbe3de422..050938d63a 100644 --- a/docs/examples/map-and-reduce.html +++ b/docs/examples/map-and-reduce.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ array through a transformation function and an options parameter.</p><p>The <code>map</code> method used to check if are there more than 5 header elements on each page:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBkYXRhc2V0ID0gYXdhaXQgQWN0b3Iub3BlbkRhdGFzZXQ8eyBoZWFkaW5nQ291bnQ6IG51bWJlciB9PigpO1xcblxcbi8vIGNhbGxpbmcgbWFwIGZ1bmN0aW9uIGFuZCBmaWx0ZXJpbmcgdGhyb3VnaCBtYXBwZWQgaXRlbXNcXG5jb25zdCBtb3JlVGhhbjVoZWFkZXJzID0gKGF3YWl0IGRhdGFzZXQubWFwKChpdGVtKSA9PiBpdGVtLmhlYWRpbmdDb3VudCkpLmZpbHRlcigoY291bnQpID0-IGNvdW50ID4gNSk7XFxuXFxuLy8gc2F2aW5nIHJlc3VsdCBvZiBtYXAgdG8gZGVmYXVsdCBLZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgncGFnZXNfd2l0aF9tb3JlX3RoYW5fNV9oZWFkZXJzJywgbW9yZVRoYW41aGVhZGVycyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.Q-rNIQYAy8a-1WsGs9suJ81WRuf_op1ZO2rCzoYyeAs&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token generic-function function" style="color:#d73a49">openDataset</span><span class="token generic-function generic class-name operator" style="color:#393A34"><</span><span class="token generic-function generic class-name punctuation" style="color:#393A34">{</span><span class="token generic-function generic class-name"> headingCount</span><span class="token generic-function generic class-name operator" style="color:#393A34">:</span><span class="token generic-function generic class-name"> </span><span class="token generic-function generic class-name builtin">number</span><span class="token generic-function generic class-name"> </span><span class="token generic-function generic class-name punctuation" style="color:#393A34">}</span><span class="token generic-function generic class-name operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// calling map function and filtering through mapped items</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> moreThan5headers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">headingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_with_more_than_5_headers'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> moreThan5headers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>The <code>moreThan5headers</code> variable is an array of <code>headingCount</code> attributes where the number of headers is greater than 5.</p><p>The <code>map</code> method's result value saved to the <a href="/sdk/js/api/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="reduce">Reduce<a href="#reduce" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The dataset <code>reduce</code> method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through the items in the dataset using the <a href="/sdk/js/api/apify/class/Dataset#reduce"><code>memo</code> argument</a>. After performing the necessary calculation, the <code>memo</code> is sent to the next iteration, while the item just processed is reduced (removed).</p><p>Using the <code>reduce</code> method to get the total number of headers scraped (all items in the dataset):</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmNvbnN0IGRhdGFzZXQgPSBhd2FpdCBBY3Rvci5vcGVuRGF0YXNldCgpO1xcblxcbi8vIGNhbGxpbmcgcmVkdWNlIGZ1bmN0aW9uIGFuZCB1c2luZyBtZW1vIHRvIGNhbGN1bGF0ZSBudW1iZXIgb2YgaGVhZGVyc1xcbmNvbnN0IHBhZ2VzSGVhZGluZ0NvdW50ID0gYXdhaXQgZGF0YXNldC5yZWR1Y2UoKG1lbW8sIHZhbHVlKSA9PiB7XFxuICAgIHJldHVybiBtZW1vICs9IHZhbHVlLmhlYWRpbmdDb3VudDtcXG59LCAwKTtcXG5cXG4vLyBzYXZpbmcgcmVzdWx0IG9mIG1hcCB0byBkZWZhdWx0IEtleS12YWx1ZSBzdG9yZVxcbmF3YWl0IEFjdG9yLnNldFZhbHVlKCdwYWdlc19oZWFkaW5nX2NvdW50JywgcGFnZXNIZWFkaW5nQ291bnQpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.1ViXq6_den8WcUl-TG3DdWceExG2yJNw4qobM_aNXao&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// calling reduce function and using memo to calculate number of headers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> pagesHeadingCount </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">memo</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> memo </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">headingCount</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_heading_count'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pagesHeadingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>The original dataset will be reduced to a single value, <code>pagesHeadingCount</code>, which contains the count of all headers for all scraped pages (all -dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/api/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/map_and_reduce.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/api/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/map_and_reduce.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/playwright-crawler.html b/docs/examples/playwright-crawler.html index ebe9bea2af..d534a66d5b 100644 --- a/docs/examples/playwright-crawler.html +++ b/docs/examples/playwright-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/playwright-crawler">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/playwright-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/playwright-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/playwright-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/playwright-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Playwright crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a> in combination with <a href="/sdk/js/api/apify/class/RequestQueue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Playwright.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">processedRequests</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/playwright_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">processedRequests</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/playwright_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/puppeteer-crawler.html b/docs/examples/puppeteer-crawler.html index 2fbe8ad061..d8470c1c91 100644 --- a/docs/examples/puppeteer-crawler.html +++ b/docs/examples/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-crawler">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/puppeteer-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a> in combination with <a href="/sdk/js/api/apify/class/RequestQueue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Puppeteer.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/puppeteer-recursive-crawl.html b/docs/examples/puppeteer-recursive-crawl.html index 2795d90e49..7421553b36 100644 --- a/docs/examples/puppeteer-recursive-crawl.html +++ b/docs/examples/puppeteer-recursive-crawl.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_recursive_crawl.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_recursive_crawl.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/examples/puppeteer-with-proxy.html b/docs/examples/puppeteer-with-proxy.html index 7a147e5610..df7b312bfc 100644 --- a/docs/examples/puppeteer-with-proxy.html +++ b/docs/examples/puppeteer-with-proxy.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>.</p><p>To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your account from the SDK.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_with_proxy.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>.</p><p>To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your account from the SDK.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/examples/puppeteer_with_proxy.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides.html b/docs/guides.html index 3b3d7fc42c..71c4ee112b 100644 --- a/docs/guides.html +++ b/docs/guides.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/guides">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/docker-images">Running in Docker</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><header><h1 class="title_kItE">Guides</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/apify-platform"><h2 class="text--truncate cardTitle_rnsV" title="Apify Platform">📄️<!-- --> <!-- -->Apify Platform</h2><p class="text--truncate cardDescription_PWke" title="Apify platform - large-scale and high-performance web scraping">Apify platform - large-scale and high-performance web scraping</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/request-storage"><h2 class="text--truncate cardTitle_rnsV" title="Request Storage">📄️<!-- --> <!-- -->Request Storage</h2><p class="text--truncate cardDescription_PWke" title="The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the">The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/result-storage"><h2 class="text--truncate cardTitle_rnsV" title="Result Storage">📄️<!-- --> <!-- -->Result Storage</h2><p class="text--truncate cardDescription_PWke" title="The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the">The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/environment-variables"><h2 class="text--truncate cardTitle_rnsV" title="Environment Variables">📄️<!-- --> <!-- -->Environment Variables</h2><p class="text--truncate cardDescription_PWke" title="The following is a list of the environment variables used by Apify SDK that are available to the user.">The following is a list of the environment variables used by Apify SDK that are available to the user.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/proxy-management"><h2 class="text--truncate cardTitle_rnsV" title="Proxy Management">📄️<!-- --> <!-- -->Proxy Management</h2><p class="text--truncate cardDescription_PWke" title="IP address blocking is one of the oldest">IP address blocking is one of the oldest</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/session-management"><h2 class="text--truncate cardTitle_rnsV" title="Session Management">📄️<!-- --> <!-- -->Session Management</h2><p class="text--truncate cardDescription_PWke" title="&#8203;SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.">&#8203;SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/type-script-actor"><h2 class="text--truncate cardTitle_rnsV" title="TypeScript Actors">📄️<!-- --> <!-- -->TypeScript Actors</h2><p class="text--truncate cardDescription_PWke" title="Apify SDK supports TypeScript by covering public APIs with type declarations. This">Apify SDK supports TypeScript by covering public APIs with type declarations. This</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/guides/docker-images"><h2 class="text--truncate cardTitle_rnsV" title="Running in Docker">📄️<!-- --> <!-- -->Running in Docker</h2><p class="text--truncate cardDescription_PWke" title="Example Docker images to run your crawlers">Example Docker images to run your crawlers</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/apify-platform.html b/docs/guides/apify-platform.html index 6f3c6b9a8f..02f66c1e0f 100644 --- a/docs/guides/apify-platform.html +++ b/docs/guides/apify-platform.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -58,8 +58,8 @@ are available only to Apify Proxy users, mainly because Apify Proxy is what one would call a super-proxy. It's not a single proxy server, but an API endpoint that allows connection through millions of different IP addresses. So the class -essentially has two modes: Apify Proxy or Own (third party) proxy.</p><p>The difference is easy to remember.</p><ul><li>If you're using your own proxies - you should create an instance with the ProxyConfiguration <a href="/sdk/js/api/apify/class/ProxyConfiguration#constructor"><code>constructor</code></a> function based on the provided <a href="/sdk/js/api/apify/interface/ProxyConfigurationOptions"><code>ProxyConfigurationOptions</code></a>.</li><li>If you are planning to use Apify Proxy - you should create an instance using the <a href="https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration"><code>Actor.createProxyConfiguration()</code></a> function. <a href="/sdk/js/api/apify/interface/ProxyConfigurationOptions#proxyUrls"><code>ProxyConfigurationOptions.proxyUrls</code></a> and <a href="/sdk/js/api/apify/interface/ProxyConfigurationOptions#newUrlFunction"><code>ProxyConfigurationOptions.newUrlFunction</code></a> enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.</li></ul><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy docs</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/apify_platform.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guides</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-crawlee" class="table-of-contents__link toc-highlight">Logging into Apify platform from Crawlee</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li><li><a href="#log-in-with-configuration" class="table-of-contents__link toc-highlight">Log in with Configuration</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li><li><a href="#running-an-actor-locally" class="table-of-contents__link toc-highlight">Running an actor locally</a></li><li><a href="#running-crawlee-code-as-an-actor" class="table-of-contents__link toc-highlight">Running Crawlee code as an actor</a></li><li><a href="#deploying-an-actor-to-apify-platform" class="table-of-contents__link toc-highlight">Deploying an actor to Apify platform</a></li><li><a href="#usage-on-apify-platform" class="table-of-contents__link toc-highlight">Usage on Apify platform</a></li><li><a href="#storages" class="table-of-contents__link toc-highlight">Storages</a><ul><li><a href="#helper-functions-for-default-key-value-store-and-dataset" class="table-of-contents__link toc-highlight">Helper functions for default Key-Value Store and Dataset</a></li><li><a href="#using-platform-storage-in-a-local-actor" class="table-of-contents__link toc-highlight">Using platform storage in a local actor</a></li><li><a href="#getting-public-url-of-an-item-in-the-platform-storage" class="table-of-contents__link toc-highlight">Getting public url of an item in the platform storage</a></li><li><a href="#exporting-dataset-data" class="table-of-contents__link toc-highlight">Exporting dataset data</a></li></ul></li><li><a href="#environment-variables" class="table-of-contents__link toc-highlight">Environment variables</a><ul><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_token-and-crawlee_storage_dir" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_TOKEN</code> and <code>CRAWLEE_STORAGE_DIR</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li><li><a href="#proxy-management" class="table-of-contents__link toc-highlight">Proxy management</a><ul><li><a href="#apify-proxy" class="table-of-contents__link toc-highlight">Apify Proxy</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#apify-proxy-vs-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Own proxies</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +essentially has two modes: Apify Proxy or Own (third party) proxy.</p><p>The difference is easy to remember.</p><ul><li>If you're using your own proxies - you should create an instance with the ProxyConfiguration <a href="/sdk/js/api/apify/class/ProxyConfiguration#constructor"><code>constructor</code></a> function based on the provided <a href="/sdk/js/api/apify/interface/ProxyConfigurationOptions"><code>ProxyConfigurationOptions</code></a>.</li><li>If you are planning to use Apify Proxy - you should create an instance using the <a href="https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration"><code>Actor.createProxyConfiguration()</code></a> function. <a href="/sdk/js/api/apify/interface/ProxyConfigurationOptions#proxyUrls"><code>ProxyConfigurationOptions.proxyUrls</code></a> and <a href="/sdk/js/api/apify/interface/ProxyConfigurationOptions#newUrlFunction"><code>ProxyConfigurationOptions.newUrlFunction</code></a> enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.</li></ul><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy docs</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/apify_platform.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guides</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-crawlee" class="table-of-contents__link toc-highlight">Logging into Apify platform from Crawlee</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li><li><a href="#log-in-with-configuration" class="table-of-contents__link toc-highlight">Log in with Configuration</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li><li><a href="#running-an-actor-locally" class="table-of-contents__link toc-highlight">Running an actor locally</a></li><li><a href="#running-crawlee-code-as-an-actor" class="table-of-contents__link toc-highlight">Running Crawlee code as an actor</a></li><li><a href="#deploying-an-actor-to-apify-platform" class="table-of-contents__link toc-highlight">Deploying an actor to Apify platform</a></li><li><a href="#usage-on-apify-platform" class="table-of-contents__link toc-highlight">Usage on Apify platform</a></li><li><a href="#storages" class="table-of-contents__link toc-highlight">Storages</a><ul><li><a href="#helper-functions-for-default-key-value-store-and-dataset" class="table-of-contents__link toc-highlight">Helper functions for default Key-Value Store and Dataset</a></li><li><a href="#using-platform-storage-in-a-local-actor" class="table-of-contents__link toc-highlight">Using platform storage in a local actor</a></li><li><a href="#getting-public-url-of-an-item-in-the-platform-storage" class="table-of-contents__link toc-highlight">Getting public url of an item in the platform storage</a></li><li><a href="#exporting-dataset-data" class="table-of-contents__link toc-highlight">Exporting dataset data</a></li></ul></li><li><a href="#environment-variables" class="table-of-contents__link toc-highlight">Environment variables</a><ul><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_token-and-crawlee_storage_dir" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_TOKEN</code> and <code>CRAWLEE_STORAGE_DIR</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li><li><a href="#proxy-management" class="table-of-contents__link toc-highlight">Proxy management</a><ul><li><a href="#apify-proxy" class="table-of-contents__link toc-highlight">Apify Proxy</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#apify-proxy-vs-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Own proxies</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/docker-images.html b/docs/guides/docker-images.html index 357bd7007f..bd7df37f37 100644 --- a/docs/guides/docker-images.html +++ b/docs/guides/docker-images.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/docker-images">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/guides/docker-images">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/docker-images">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/docker-images">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/docker-images">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/guides/docker-images">Running in Docker</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/guides"><span itemprop="name">Guides</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Running in Docker</h1></header><p>Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the <a href="/sdk/js/docs/guides/apify-platform">Apify Platform</a>.</p><p>All images can be found in their <a href="https://github.com/apify/apify-actor-docker" target="_blank" rel="noopener">GitHub repo</a> and in our <a href="https://hub.docker.com/orgs/apify" target="_blank" rel="noopener">DockerHub</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="overview">Overview<a href="#overview" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images.</p><ul><li><a href="#actor-node"><code>apify/actor-node</code></a></li><li><a href="#actor-node-puppeteer-chrome"><code>apify/actor-node-puppeteer-chrome</code></a></li><li><a href="#actor-node-playwright"><code>apify/actor-node-playwright</code></a></li><li><a href="#actor-node-playwright-chrome"><code>apify/actor-node-playwright-chrome</code></a></li><li><a href="#actor-node-playwright-firefox"><code>apify/actor-node-playwright-firefox</code></a></li><li><a href="#actor-node-playwright-webkit"><code>apify/actor-node-playwright-webkit</code></a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="versioning">Versioning<a href="#versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version.</p><blockquote><p>We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nodejs-versioning">Node.js versioning<a href="#nodejs-versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js <strong>versions 16 and 18 are supported</strong> (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Use Node.js 16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="automation-library-versioning">Automation library versioning<a href="#automation-library-versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Images that include a pre-installed automation library, which means all images that include <code>puppeteer</code> or <code>playwright</code> in their name, are also tagged with the pre-installed version of the library. For example, <code>apify/actor-node-puppeteer-chrome:16-13.7.0</code> comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with <code>puppeteer</code> will not match the version of Chromium that's pre-installed.</p><p>Similarly <code>apify/actor-node-playwright-firefox:14-1.21.1</code> runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1.</p><p>Installing <code>apify/actor-node-puppeteer-chrome</code> (without a tag) will install the latest available version of Node.js and <code>puppeteer</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pre-release-tags">Pre-release tags<a href="#pre-release-tags" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a <code>beta</code> suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Without library version.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16-beta</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># With library version.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16-1.10.0-beta</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="best-practices">Best practices<a href="#best-practices" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Node.js version tag should <strong>always</strong> be used.</li><li>The automation library version tag should be used for <strong>added security</strong>.</li><li>Asterisk <code>*</code> should be used as the automation library version in our <code>package.json</code> files.</li></ul><p>It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"dependencies"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"crawlee"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"^3.0.0"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"playwright"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="warning-about-image-size">Warning about image size<a href="#warning-about-image-size" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need.</p><p>You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the<code>actor-node-puppeteer-chrome</code> image, but the resulting image will be about 3 times larger and extremely slow to download and build.</p><p>When you use only what you need, you'll be rewarded with reasonable build and start times.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-docker-images">Apify Docker Images<a href="#apify-docker-images" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node">actor-node<a href="#actor-node" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a>. It benefits from lightning fast builds and container startups.</p><p>​<a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>, <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a> and other browser based features will <strong>NOT</strong> work with this image.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-puppeteer-chrome">actor-node-puppeteer-chrome<a href="#actor-node-puppeteer-chrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> and <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>, but <strong>NOT</strong> with <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>.</p><p>The image supports XVFB by default, so you can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-puppeteer-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright">actor-node-playwright<a href="#actor-node-playwright" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-chrome">actor-node-playwright-chrome<a href="#actor-node-playwright-chrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Similar to <a href="#actor-node-puppeteer-chrome"><code>actor-node-puppeteer-chrome</code></a>, but for Playwright. You can run <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> and <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>, but <strong>NOT</strong> <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><p>It uses the <a href="https://playwright.dev/docs/api/environment-variables/" target="_blank" rel="noopener"><code>PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD</code></a> environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the <a href="#actor-node-playwright"><code>actor-node-playwright</code></a> image override this env var.</p><p>The image supports XVFB by default, so we can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-firefox">actor-node-playwright-firefox<a href="#actor-node-playwright-firefox" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with Firefox pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-firefox:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-webkit">actor-node-playwright-webkit<a href="#actor-node-playwright-webkit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with WebKit -pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example-dockerfile">Example Dockerfile<a href="#example-dockerfile" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>To use the above images, it's necessary to have a <a href="https://docs.docker.com/engine/reference/builder/" target="_blank" rel="noopener"><code>Dockerfile</code></a>. You can either use this example, or bootstrap your projects with the <a href="https://crawlee.dev/docs/introduction/setting-up" target="_blank" rel="noopener noreferrer">Crawlee CLI</a> which automatically adds the correct Dockerfile into our project folder.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Node+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Node+TypeScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+TypeScript</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in the <code>FROM</code> declaration.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in both <code>FROM</code> declarations.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction options"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> /home/myuser/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image. If you know you won't need headful browsers,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># you can remove the XVFB start script for a micro perf gain.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/docker_images.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#apify-docker-images" class="table-of-contents__link toc-highlight">Apify Docker Images</a><ul><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example-dockerfile">Example Dockerfile<a href="#example-dockerfile" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>To use the above images, it's necessary to have a <a href="https://docs.docker.com/engine/reference/builder/" target="_blank" rel="noopener"><code>Dockerfile</code></a>. You can either use this example, or bootstrap your projects with the <a href="https://crawlee.dev/docs/introduction/setting-up" target="_blank" rel="noopener noreferrer">Crawlee CLI</a> which automatically adds the correct Dockerfile into our project folder.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Node+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Node+TypeScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+TypeScript</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in the <code>FROM</code> declaration.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in both <code>FROM</code> declarations.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction options"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> /home/myuser/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image. If you know you won't need headful browsers,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># you can remove the XVFB start script for a micro perf gain.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/docker_images.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#apify-docker-images" class="table-of-contents__link toc-highlight">Apify Docker Images</a><ul><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/environment-variables.html b/docs/guides/environment-variables.html index 1f8607dcd8..3fd0aab9f6 100644 --- a/docs/guides/environment-variables.html +++ b/docs/guides/environment-variables.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -36,8 +36,8 @@ in the Apify Console. The password is automatically inferred using the <code>APIFY_TOKEN</code> env var, so in most cases, you don't need to touch it. You should use it when, for some reason, you need access to Apify Proxy, but no access to Apify API, or when you need access to -proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/environment_variables.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/environment_variables.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/proxy-management.html b/docs/guides/proxy-management.html index 9bf05fd4d7..49467a6f92 100644 --- a/docs/guides/proxy-management.html +++ b/docs/guides/proxy-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -32,8 +32,8 @@ in the <a href="https://console.apify.com/proxy" target="_blank" rel="noopener">proxy dashboard</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="inspecting-current-proxy-in-crawlers">Inspecting current proxy in Crawlers<a href="#inspecting-current-proxy-in-crawlers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><code>CheerioCrawler</code> and <code>PuppeteerCrawler</code> grant access to information about the currently used proxy in their <code>handlePageFunction</code> using a <a href="/sdk/js/api/apify/interface/ProxyInfo"><code>proxyInfo</code></a> object. With the object, you can easily access the proxy URL. If you're using Apify Proxy, the other -configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/proxy_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/proxy_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/request-storage.html b/docs/guides/request-storage.html index dfc261dda2..7cc4ec7c17 100644 --- a/docs/guides/request-storage.html +++ b/docs/guides/request-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable, or on the <a href="/sdk/js/docs/guides/apify-platform">Apify platform</a> under the user account identified by the API token defined by the <code>APIFY_TOKEN</code> environment variable. If neither of these variables is defined, by default Apify SDK sets <code>APIFY_LOCAL_STORAGE_DIR</code> to <code>./storage</code> in the current working directory and prints a warning.</p><p>Typically, you will be developing the code on your local computer and thus set the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the <code>APIFY_TOKEN</code> environment variable and thus use cloud storage. No code changes are needed.</p><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/storage" target="_blank" rel="noopener">Apify platform storage documentation</a></li><li><a href="https://console.apify.com/storage" target="_blank" rel="noopener">View storage in Apify Console</a></li><li><a href="https://docs.apify.com/api/v2#/reference/request-queues" target="_blank" rel="noopener">Request queues API reference</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-queue">Request queue<a href="#request-queue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.</p><p>Each actor run is associated with a <strong>default request queue</strong>, which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional.</p><p>In Apify SDK, the request queue is represented by the <a href="/sdk/js/api/apify/class/RequestQueue"><code>RequestQueue</code></a> class.</p><p>In local configuration, the request queue is emulated by <a href="https://github.com/apify/apify-storage-local-js" target="_blank" rel="noopener">@apify/storage-local</a> NPM package and its data is stored in SQLite database in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">request_queues</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">QUEUE_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">db</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sqlite</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{QUEUE_ID}</code> is the name or ID of the request queue. The default queue has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code> environment variable.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue the initial request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request queue with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-list">Request list<a href="#request-list" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default <a href="/sdk/js/docs/guides/result-storage#key-value-store">Key-Value Store</a> associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web.</p><p>Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional.</p><p>In Apify SDK, the request list is represented by the </p><div to="core/class/RequestList"><code>RequestList</code></div> class.<p></p><p>The following code demonstrates basic operations of the request list:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// List name is used to persist the sources and the list state in the key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Process the page (extract data, take page screenshot, etc).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the request list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request list with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="which-one-to-choose">Which one to choose?<a href="#which-one-to-choose" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either.</p><p>On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue.</p><p>Note that Request queue and Request list can be used together by the same crawler. In such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue). -In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/request_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/request_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/result-storage.html b/docs/guides/result-storage.html index 842f3dd647..b4065eac8f 100644 --- a/docs/guides/result-storage.html +++ b/docs/guides/result-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ results specific for the actor run. Its usage is optional.</p><p>In the Apify SDK, the dataset is represented by the <a href="/sdk/js/api/apify/class/Dataset"><code>Dataset</code></a> class. In order to simplify writes to the default dataset, the SDK also provides the <a href="/sdk/js/api/apify/class/Actor#pushData"><code>Actor.pushData()</code></a> function.</p><p>In local configuration, the data is stored in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">datasets</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">DATASET_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">INDEX</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{DATASET_ID}</code> is the name or ID of the dataset. The default dataset has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_DATASET_ID</code> environment variable. Each dataset item is stored as a separate JSON file, where <code>{INDEX}</code> is a zero-based index of the -item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/result_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/result_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/session-management.html b/docs/guides/session-management.html index 69d011abbe..c7bd19b2fe 100644 --- a/docs/guides/session-management.html +++ b/docs/guides/session-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ Last but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly, which should prevent burning out a small pool of available IPs.</p><p>Now let's take a look at how to use a Session pool.</p><p><strong>Example usage in <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookies to page before navigation automatically.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in puppeteer pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookie header to request automatically...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"title"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in BasicCrawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="https://crawlee.dev/api/basic-crawler/class/BasicCrawler" target="_blank" rel="noopener noreferrer"><code>BasicCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Allows access to proxyInfo object in handleRequestFunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">throwHttpErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the cookieJar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This way you get the Cookie headers string from session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">Cookie</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getCookieString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> response</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">requestOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"SomeNetworkError"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If a network error happens, such as timeout, socket hangup etc...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// There is usually a chance that it was just bad luck and the proxy works.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to throw it away.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Automatically retires the session based on response HTTP status code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retireOnBlockedStatusCodes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">statusCode</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">body</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">blocked</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You are sure it is blocked.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This will throw away the session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Everything is ok, you can get the data.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to call session.markGood -> BasicCrawler calls it for you.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the CookieJar in session you need.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setCookiesFromResponse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example solo usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPoolOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">SessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">sessionPoolOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> session </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> sessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getSession</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the errorScore.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Throw away the session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Lower the errorScore and marks the session good.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markGood</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These are the basics of configuring SessionPool. Please, bear in mind that a Session pool needs time to find working IPs and build up the pool, -so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/session_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/session_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/guides/type-script-actor.html b/docs/guides/type-script-actor.html index 23ad3a301a..4338636e88 100644 --- a/docs/guides/type-script-actor.html +++ b/docs/guides/type-script-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -30,8 +30,8 @@ return types, in the Apify SDK.</p><h1>Caveats</h1><p>As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties and parameters annotated with <code>any</code> type, therefore the settings <code>noImplicitAny</code> and <code>strictNullChecks</code>, set to <code>true</code>, may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary.</p><p>Besides the <em>implicit any</em> errors that might occur in the code when writing in TypeScript, the current typings doesn't offer generics that make outputs type-safe, so you need to declare your -types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/typescript_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/guides/typescript_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/changelog.html b/docs/next/changelog.html index 8e8a281f8f..1314d0314e 100644 --- a/docs/next/changelog.html +++ b/docs/next/changelog.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/changelog">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/changelog">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/changelog">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/changelog">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/changelog">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/changelog">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Changelog</h1></header><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.12" target="_blank" rel="noopener">apify@3.1.12</a><a href="#apify3112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3112-2023-10-05"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.11...apify@3.1.12" target="_blank" rel="noopener">3.1.12</a> (2023-10-05)<a href="#3112-2023-10-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add more logging to <code>Actor.init</code> and <code>Actor.exit</code> (<a href="https://github.com/apify/apify-sdk-js/issues/236" target="_blank" rel="noopener">#236</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/b7e01fc649de84d6f1391bf95e0f349f7ca32536" target="_blank" rel="noopener">b7e01fc</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3111"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.11" target="_blank" rel="noopener">apify@3.1.11</a><a href="#apify3111" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3111-2023-10-04"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.10...apify@3.1.11" target="_blank" rel="noopener">3.1.11</a> (2023-10-04)<a href="#3111-2023-10-04" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-1">Bug Fixes<a href="#bug-fixes-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>run the whole <code>Actor.exit()</code> code inside a timeout handler (<a href="https://github.com/apify/apify-sdk-js/issues/235" target="_blank" rel="noopener">#235</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c8aabaee5f2de1ab40947f47f95f54ccff37cad0" target="_blank" rel="noopener">c8aabae</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features">Features<a href="#features" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use <code>.reboot()</code> instead of <code>.metamorph()</code> for reboot (<a href="https://github.com/apify/apify-sdk-js/issues/227" target="_blank" rel="noopener">#227</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/8c0bff5a8d3ea65e532b3700b34b9c563856158a" target="_blank" rel="noopener">8c0bff5</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify3110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.10" target="_blank" rel="noopener">apify@3.1.10</a><a href="#apify3110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="3110-2023-09-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.9...apify@3.1.10" target="_blank" rel="noopener">3.1.10</a> (2023-09-07)<a href="#3110-2023-09-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-2">Bug Fixes<a href="#bug-fixes-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of crawlee to fix possible issues with <code>purgeDefaultStorages</code> (<a href="https://github.com/apify/apify-sdk-js/issues/226" target="_blank" rel="noopener">#226</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/95cf31f3d1d054a1c8e3daac89f41bbb0aaddbba" target="_blank" rel="noopener">95cf31f</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify319"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.9" target="_blank" rel="noopener">apify@3.1.9</a><a href="#apify319" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="319-2023-09-06"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.8...apify@3.1.9" target="_blank" rel="noopener">3.1.9</a> (2023-09-06)<a href="#319-2023-09-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools112"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">@apify/scraper-tools@1.1.2</a><a href="#apifyscraper-tools112" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="112-2023-07-28"><a href="https://github.com/apify/apify-sdk-js/compare/@apify/scraper-tools@1.1.1...@apify/scraper-tools@1.1.2" target="_blank" rel="noopener">1.1.2</a> (2023-07-28)<a href="#112-2023-07-28" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-3">Bug Fixes<a href="#bug-fixes-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-1">Features<a href="#features-1" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify318"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.8" target="_blank" rel="noopener">apify@3.1.8</a><a href="#apify318" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="318-2023-07-20"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.7...apify@3.1.8" target="_blank" rel="noopener">3.1.8</a> (2023-07-20)<a href="#318-2023-07-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-4">Bug Fixes<a href="#bug-fixes-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>require newer version of apify-client and other packages (<a href="https://github.com/apify/apify-sdk-js/commit/24a3a4b5bf2f61e690348727e7f24c06c45a0999" target="_blank" rel="noopener">24a3a4b</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-2">Features<a href="#features-2" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>Use Actor env vars (<a href="https://github.com/apify/apify-sdk-js/issues/216" target="_blank" rel="noopener">#216</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/11ff740ad3d2bdd37fce011d94b64ea01413b0d9" target="_blank" rel="noopener">11ff740</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify317"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.7" target="_blank" rel="noopener">apify@3.1.7</a><a href="#apify317" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="317-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.6...apify@3.1.7" target="_blank" rel="noopener">3.1.7</a> (2023-06-09)<a href="#317-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><strong>Note:</strong> Version bump only for package apify</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify316"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.6" target="_blank" rel="noopener">apify@3.1.6</a><a href="#apify316" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="316-2023-06-09"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.5...apify@3.1.6" target="_blank" rel="noopener">3.1.6</a> (2023-06-09)<a href="#316-2023-06-09" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-5">Bug Fixes<a href="#bug-fixes-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>only print status message when explicitly provided in <code>Actor.exit()</code> (<a href="https://github.com/apify/apify-sdk-js/issues/203" target="_blank" rel="noopener">#203</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/85159e499984c78eee90b6d92332ea63b9f46c8c" target="_blank" rel="noopener">85159e4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify315"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.5" target="_blank" rel="noopener">apify@3.1.5</a><a href="#apify315" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="315-2023-05-31"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.4...apify@3.1.5" target="_blank" rel="noopener">3.1.5</a> (2023-05-31)<a href="#315-2023-05-31" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-6">Bug Fixes<a href="#bug-fixes-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add missing <code>options</code> parameter to <code>Actor.setStatusMessage()</code> (<a href="https://github.com/apify/apify-sdk-js/commit/712e8c66755ac8baeb35fcc1ad000487da8b2c48" target="_blank" rel="noopener">712e8c6</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-3">Features<a href="#features-3" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.getInputOrThrow()</code> method (<a href="https://github.com/apify/apify-sdk-js/issues/198" target="_blank" rel="noopener">#198</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/5fbbfe4960a79fbbd23f4fdd7d07a1a5063820f4" target="_blank" rel="noopener">5fbbfe4</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify314"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.4" target="_blank" rel="noopener">apify@3.1.4</a><a href="#apify314" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="314-2023-03-23"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.3...apify@3.1.4" target="_blank" rel="noopener">3.1.4</a> (2023-03-23)<a href="#314-2023-03-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-7">Bug Fixes<a href="#bug-fixes-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>log status message only once and without prefix (<a href="https://github.com/apify/apify-sdk-js/issues/179" target="_blank" rel="noopener">#179</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1f11a6ad8ebc8a0cfaef58be47ba8b12c75018f1" target="_blank" rel="noopener">1f11a6a</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify313"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.3" target="_blank" rel="noopener">apify@3.1.3</a><a href="#apify313" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="313-2023-03-22"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.2...apify@3.1.3" target="_blank" rel="noopener">3.1.3</a> (2023-03-22)<a href="#313-2023-03-22" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-8">Bug Fixes<a href="#bug-fixes-8" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><code>call/callTask</code> accept <code>waitSecs</code> instead of <code>waitForFinish</code> (<a href="https://github.com/apify/apify-sdk-js/issues/176" target="_blank" rel="noopener">#176</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/f0c73d8765091212f2abb4b4faaf109f9447d90a" target="_blank" rel="noopener">f0c73d8</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-4">Features<a href="#features-4" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>terminal message on Actor.exit() (<a href="https://github.com/apify/apify-sdk-js/issues/172" target="_blank" rel="noopener">#172</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/e0feca895766af0d92fbf78ca4c2d7b49bd2acff" target="_blank" rel="noopener">e0feca8</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify312"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.2" target="_blank" rel="noopener">apify@3.1.2</a><a href="#apify312" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="312-2023-02-07"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.1...apify@3.1.2" target="_blank" rel="noopener">3.1.2</a> (2023-02-07)<a href="#312-2023-02-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-9">Bug Fixes<a href="#bug-fixes-9" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>declare missing dependency on tslib (<a href="https://github.com/apify/apify-sdk-js/commit/bc27118daab211857305f7617b1ee1433da13d4a" target="_blank" rel="noopener">bc27118</a>)</li><li>remove unused export of <code>QueueOperationInfoOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/b29fe4853d637ab527a7f7e3e53c7a5b0fe27a32" target="_blank" rel="noopener">b29fe48</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify311"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.1" target="_blank" rel="noopener">apify@3.1.1</a><a href="#apify311" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h4 class="anchor anchorWithStickyNavbar_LWe7" id="311-2022-11-13"><a href="https://github.com/apify/apify-sdk-js/compare/apify@3.1.0...apify@3.1.1" target="_blank" rel="noopener">3.1.1</a> (2022-11-13)<a href="#311-2022-11-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-5">Features<a href="#features-5" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>statusMessage</code> to <code>AbortOptions</code> (<a href="https://github.com/apify/apify-sdk-js/commit/fb10bb60c12c0af97e41ae88adcf0b2000286235" target="_blank" rel="noopener">fb10bb6</a>)</li><li>warn about actor not being initialized before using storage methods (<a href="https://github.com/apify/apify-sdk-js/issues/126" target="_blank" rel="noopener">#126</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/91cd2467d111de19490a6bf47b4a9138f26a37d4" target="_blank" rel="noopener">91cd246</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify310"><a href="https://github.com/apify/apify-sdk-js/releases/tag/apify@3.1.0" target="_blank" rel="noopener">apify@3.1.0</a><a href="#apify310" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="310-2022-10-13">3.1.0 (2022-10-13)<a href="#310-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="bug-fixes-10">Bug Fixes<a href="#bug-fixes-10" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li><strong>apify:</strong> add <code>@apify/timeout</code> to dependencies (<a href="https://github.com/apify/apify-sdk-js/issues/76" target="_blank" rel="noopener">#76</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/1d64a1fa8f0e88a96eb82c2669e85b09dd4f372d" target="_blank" rel="noopener">1d64a1f</a>)</li><li>use correct event manager for actor methods (<a href="https://github.com/apify/apify-sdk-js/issues/49" target="_blank" rel="noopener">#49</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/ef3a0c54359be64c89e76b0cac600cd780281321" target="_blank" rel="noopener">ef3a0c5</a>)</li><li>wait for memory storage to write changes before <code>Actor.exit</code> exists the process (<a href="https://github.com/apify/apify-sdk-js/commit/c721d988141cf5b7aa170fddeffb792ded769622" target="_blank" rel="noopener">c721d98</a>)</li></ul><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-6">Features<a href="#features-6" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li><strong>apify:</strong> add decryption for input secrets (<a href="https://github.com/apify/apify-sdk-js/issues/83" target="_blank" rel="noopener">#83</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/78bb990817c01254de19c828937181c1263e21eb" target="_blank" rel="noopener">78bb990</a>)</li><li>re-export the logger in actor sdk (<a href="https://github.com/apify/apify-sdk-js/issues/54" target="_blank" rel="noopener">#54</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/c78d8a44d7af5de7fda7bf2e436fefda752a4b1a" target="_blank" rel="noopener">c78d8a4</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apifyscraper-tools110"><a href="https://github.com/apify/apify-sdk-js/releases/tag/@apify/scraper-tools@1.1.0" target="_blank" rel="noopener">@apify/scraper-tools@1.1.0</a><a href="#apifyscraper-tools110" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="110-2022-10-13">1.1.0 (2022-10-13)<a href="#110-2022-10-13" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><h5 class="anchor anchorWithStickyNavbar_LWe7" id="features-7">Features<a href="#features-7" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h5><ul><li>add <code>Actor.useState()</code> helper (<a href="https://github.com/apify/apify-sdk-js/issues/98" target="_blank" rel="noopener">#98</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/27dc4139caa0a2d94c570edac2cb628f6b3f747c" target="_blank" rel="noopener">27dc413</a>)</li><li>add playwright scraper (<a href="https://github.com/apify/apify-sdk-js/issues/26" target="_blank" rel="noopener">#26</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/2dcd50ded777ae13bc7b75e6e0bc21a6a11315b7" target="_blank" rel="noopener">2dcd50d</a>)</li><li>update @apify/scraper-tools (<a href="https://github.com/apify/apify-sdk-js/issues/37" target="_blank" rel="noopener">#37</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/788913e0cc669b15b35359df30202a449b881b5f" target="_blank" rel="noopener">788913e</a>)</li><li>update the scrapers (<a href="https://github.com/apify/apify-sdk-js/issues/70" target="_blank" rel="noopener">#70</a>) (<a href="https://github.com/apify/apify-sdk-js/commit/efbfc442bc8be4f07b5f2432a750cb861d7f05e8" target="_blank" rel="noopener">efbfc44</a>)</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/changelog.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apify3112" class="table-of-contents__link toc-highlight">apify@3.1.12</a></li><li><a href="#apify3111" class="table-of-contents__link toc-highlight">apify@3.1.11</a></li><li><a href="#apify3110" class="table-of-contents__link toc-highlight">apify@3.1.10</a></li><li><a href="#apify319" class="table-of-contents__link toc-highlight">apify@3.1.9</a></li><li><a href="#apifyscraper-tools112" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.2</a></li><li><a href="#apify318" class="table-of-contents__link toc-highlight">apify@3.1.8</a></li><li><a href="#apify317" class="table-of-contents__link toc-highlight">apify@3.1.7</a></li><li><a href="#apify316" class="table-of-contents__link toc-highlight">apify@3.1.6</a></li><li><a href="#apify315" class="table-of-contents__link toc-highlight">apify@3.1.5</a></li><li><a href="#apify314" class="table-of-contents__link toc-highlight">apify@3.1.4</a></li><li><a href="#apify313" class="table-of-contents__link toc-highlight">apify@3.1.3</a></li><li><a href="#apify312" class="table-of-contents__link toc-highlight">apify@3.1.2</a></li><li><a href="#apify311" class="table-of-contents__link toc-highlight">apify@3.1.1</a></li><li><a href="#apify310" class="table-of-contents__link toc-highlight">apify@3.1.0</a></li><li><a href="#apifyscraper-tools110" class="table-of-contents__link toc-highlight">@apify/scraper-tools@1.1.0</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples.html b/docs/next/examples.html index 3a5f4a6fbf..2649b5e514 100644 --- a/docs/next/examples.html +++ b/docs/next/examples.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><header><h1 class="title_kItE">Examples</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/accept-user-input"><h2 class="text--truncate cardTitle_rnsV" title="Accept user input">📄️<!-- --> <!-- -->Accept user input</h2><p class="text--truncate cardDescription_PWke" title="This example accepts and logs user input:">This example accepts and logs user input:</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/add-data-to-dataset"><h2 class="text--truncate cardTitle_rnsV" title="Add data to dataset">📄️<!-- --> <!-- -->Add data to dataset</h2><p class="text--truncate cardDescription_PWke" title="This example saves data to the default dataset. If the dataset doesn't exist, it will be created.">This example saves data to the default dataset. If the dataset doesn't exist, it will be created.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/basic-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Basic crawler">📄️<!-- --> <!-- -->Basic crawler</h2><p class="text--truncate cardDescription_PWke" title="This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers">This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the BasicCrawler. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/call-actor"><h2 class="text--truncate cardTitle_rnsV" title="Call actor">📄️<!-- --> <!-- -->Call actor</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to start an Apify actor using">This example demonstrates how to start an Apify actor using</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/cheerio-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Cheerio crawler">📄️<!-- --> <!-- -->Cheerio crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.">This example demonstrates how to use CheerioCrawler to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the Cheerio library and extract some data from it: the page title and all h1 tags.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/crawl-all-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl all links on a website">📄️<!-- --> <!-- -->Crawl all links on a website</h2><p class="text--truncate cardDescription_PWke" title="This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the">This example uses the enqueueLinks() method to add new links to the RequestQueue as the crawler navigates from page to page. If only the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/crawl-multiple-urls"><h2 class="text--truncate cardTitle_rnsV" title="Crawl multiple URLs">📄️<!-- --> <!-- -->Crawl multiple URLs</h2><p class="text--truncate cardDescription_PWke" title="This example crawls the specified list of URLs.">This example crawls the specified list of URLs.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/crawl-relative-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a website with relative links">📄️<!-- --> <!-- -->Crawl a website with relative links</h2><p class="text--truncate cardDescription_PWke" title="When crawling a website, you may encounter different types of links present that you may want to crawl.">When crawling a website, you may encounter different types of links present that you may want to crawl.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/crawl-single-url"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a single URL">📄️<!-- --> <!-- -->Crawl a single URL</h2><p class="text--truncate cardDescription_PWke" title="This example uses the got-scraping npm package">This example uses the got-scraping npm package</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/crawl-sitemap"><h2 class="text--truncate cardTitle_rnsV" title="Crawl a sitemap">📄️<!-- --> <!-- -->Crawl a sitemap</h2><p class="text--truncate cardDescription_PWke" title="This example downloads and crawls the URLs from a sitemap.">This example downloads and crawls the URLs from a sitemap.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/crawl-some-links"><h2 class="text--truncate cardTitle_rnsV" title="Crawl some links on a website">📄️<!-- --> <!-- -->Crawl some links on a website</h2><p class="text--truncate cardDescription_PWke" title="This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.">This CheerioCrawler example uses the pseudoUrls property in the enqueueLinks() method to only add links to the RequestQueue queue if they match the specified regular expression.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/forms"><h2 class="text--truncate cardTitle_rnsV" title="Forms">📄️<!-- --> <!-- -->Forms</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler to">This example demonstrates how to use PuppeteerCrawler to</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/map-and-reduce"><h2 class="text--truncate cardTitle_rnsV" title="Dataset Map and Reduce methods">📄️<!-- --> <!-- -->Dataset Map and Reduce methods</h2><p class="text--truncate cardDescription_PWke" title="This example shows an easy use-case of the Dataset map">This example shows an easy use-case of the Dataset map</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/playwright-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Playwright crawler">📄️<!-- --> <!-- -->Playwright crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PlaywrightCrawler">This example demonstrates how to use PlaywrightCrawler</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/capture-screenshot"><h2 class="text--truncate cardTitle_rnsV" title="Capture a screenshot using Puppeteer">📄️<!-- --> <!-- -->Capture a screenshot using Puppeteer</h2><p class="text--truncate cardDescription_PWke" title="To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.">To run this example on the Apify Platform, select the apify/actor-node-puppeteer-chrome image for your Dockerfile.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/puppeteer-crawler"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer crawler">📄️<!-- --> <!-- -->Puppeteer crawler</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to use PuppeteerCrawler in combination">This example demonstrates how to use PuppeteerCrawler in combination</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer recursive crawl">📄️<!-- --> <!-- -->Puppeteer recursive crawl</h2><p class="text--truncate cardDescription_PWke" title="Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.">Run the following example to perform a recursive crawl of a website using PuppeteerCrawler.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/examples/puppeteer-with-proxy"><h2 class="text--truncate cardTitle_rnsV" title="Puppeteer with proxy">📄️<!-- --> <!-- -->Puppeteer with proxy</h2><p class="text--truncate cardDescription_PWke" title="This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.">This example demonstrates how to load pages in headless Chrome / Puppeteer over Apify Proxy.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/docker-images"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Running in Docker</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/accept-user-input"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Accept user input</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/accept-user-input.html b/docs/next/examples/accept-user-input.html index c465ee595f..8453d6c1f6 100644 --- a/docs/next/examples/accept-user-input.html +++ b/docs/next/examples/accept-user-input.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/accept_user_input.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/accept-user-input">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/accept-user-input">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/accept-user-input">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/accept-user-input">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/accept-user-input">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/accept-user-input">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Accept user input</h1></header><p>This example accepts and logs user input:</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To provide the actor with input, create a <code>INPUT.json</code> file inside the "default" key-value store:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/key_value_stores/default/INPUT.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Anything in this file will be available to the actor when it runs.</p><p>To learn about other ways to provide an actor with input, refer to the <a href="https://apify.com/docs/actor#run" target="_blank" rel="noopener">Apify Platform Documentation</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/accept_user_input.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Examples</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Add data to dataset</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/add-data-to-dataset.html b/docs/next/examples/add-data-to-dataset.html index cb79123940..3e524c075f 100644 --- a/docs/next/examples/add-data-to-dataset.html +++ b/docs/next/examples/add-data-to-dataset.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/add-data-to-dataset">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/add-data-to-dataset">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/add-data-to-dataset">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/add-data-to-dataset">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/add-data-to-dataset">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/add-data-to-dataset">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Add data to dataset</h1></header><p>This example saves data to the default dataset. If the dataset doesn't exist, it will be created. -You can save data to custom datasets by using <a href="/sdk/js/api/next/apify/class/Dataset#open"><code>Actor.openDataset()</code></a></p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/add_data_to_dataset.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +You can save data to custom datasets by using <a href="/sdk/js/api/next/apify/class/Dataset#open"><code>Actor.openDataset()</code></a></p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIGRhdGFzZXQgd2hlcmUgd2Ugd2lsbCBzdG9yZSB0aGUgcmVzdWx0cy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGJvZHkgfSkge1xcbiAgICAgICAgLy8gU2F2ZSBkYXRhIHRvIGRlZmF1bHQgZGF0YXNldFxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.fhpAfqCjjEMd7THx-jtJurjuRe7si1RztaBrOcDRcQ8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save data to default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>Each item in this dataset will be saved to its own file in the following directory:</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain">PROJECT_FOLDER</span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain">/storage/datasets/default/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/add_data_to_dataset.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/accept-user-input"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Accept user input</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/basic-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Basic crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/basic-crawler.html b/docs/next/examples/basic-crawler.html index 96b3fd05eb..f4aa8511bd 100644 --- a/docs/next/examples/basic-crawler.html +++ b/docs/next/examples/basic-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/basic-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/basic-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/basic-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/basic-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/basic-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/basic-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Basic crawler</h1></header><p>This is the most bare-bones example of the Apify SDK, which demonstrates some of its building blocks such as the <a href="https://crawlee.dev/api/basic-crawler/class/BasicCrawler" target="_blank" rel="noopener noreferrer"><code>BasicCrawler</code></a>. You probably don't need to go this deep though, and it would be better to start with one of the full-featured crawlers like <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> or <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>.</p><p>The script simply downloads several web pages with plain HTTP requests using the <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> npm package and stores their raw HTML and URL in the default dataset. In local configuration, the data will be stored as JSON files in -<code>./storage/datasets/default</code>.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> BasicCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils gotScraping</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/basic_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<code>./storage/datasets/default</code>.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IEJhc2ljQ3Jhd2xlciB9IGZyb20gJ2NyYXdsZWUnO1xcbmltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgZGF0YXNldCB3aGVyZSB3ZSB3aWxsIHN0b3JlIHRoZSByZXN1bHRzLlxcbi8vIENyZWF0ZSBhIEJhc2ljQ3Jhd2xlciAtIHRoZSBzaW1wbGVzdCBjcmF3bGVyIHRoYXQgZW5hYmxlc1xcbi8vIHVzZXJzIHRvIGltcGxlbWVudCB0aGUgY3Jhd2xpbmcgbG9naWMgdGhlbXNlbHZlcy5cXG5jb25zdCBjcmF3bGVyID0gbmV3IEJhc2ljQ3Jhd2xlcih7XFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc3QgeyB1cmwgfSA9IHJlcXVlc3Q7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3VybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEZldGNoIHRoZSBwYWdlIEhUTUwgdmlhIEFwaWZ5IHV0aWxzIGdvdFNjcmFwaW5nXFxuICAgICAgICBjb25zdCB7IGJvZHkgfSA9IGF3YWl0IGdvdFNjcmFwaW5nKHsgdXJsIH0pO1xcblxcbiAgICAgICAgLy8gU3RvcmUgdGhlIEhUTUwgYW5kIFVSTCB0byB0aGUgZGVmYXVsdCBkYXRhc2V0LlxcbiAgICAgICAgYXdhaXQgQWN0b3IucHVzaERhdGEoe1xcbiAgICAgICAgICAgIHVybDogcmVxdWVzdC51cmwsXFxuICAgICAgICAgICAgaHRtbDogYm9keSxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFRoZSBpbml0aWFsIGxpc3Qgb2YgVVJMcyB0byBjcmF3bC4gSGVyZSB3ZSB1c2UganVzdCBhIGZldyBoYXJkLWNvZGVkIFVSTHMuXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZ29vZ2xlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy5iaW5nLmNvbS8nIH0sXFxuICAgIHsgdXJsOiAnaHR0cDovL3d3dy53aWtpcGVkaWEuY29tLycgfSxcXG5dKTtcXG5cXG5jb25zb2xlLmxvZygnQ3Jhd2xlciBmaW5pc2hlZC4nKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.-TdH8qt-fjSHPGoP8mJHr2LqYkhq6aWUhY9IdesMFrM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> BasicCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a dataset where we will store the results.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a BasicCrawler - the simplest crawler that enables</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// users to implement the crawling logic themselves.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Fetch the page HTML via Apify utils gotScraping</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the HTML and URL to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> body</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The initial list of URLs to crawl. Here we use just a few hard-coded URLs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.google.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.bing.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.wikipedia.com/'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/basic_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/add-data-to-dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Add data to dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/call-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Call actor</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/call-actor.html b/docs/next/examples/call-actor.html index 112f052434..aa2fe2a3be 100644 --- a/docs/next/examples/call-actor.html +++ b/docs/next/examples/call-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,8 +22,8 @@ Go to the <a href="https://console.apify.com/account?tab=integrations" target="_blank" rel="noopener">Settings - Integrations</a> page to obtain your API token and set it to the <a href="/sdk/js/docs/guides/environment-variables#APIFY_TOKEN"><code>APIFY_TOKEN</code></a> environment variable, or run the script using the Apify CLI. If you deploy this actor to the Apify Cloud, you can do things like set -up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on Apify Platform, use the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> email </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Actor.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/call_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +up a scheduler to run your actor early in the morning.</p><p>To see what other actors are available, visit the <a href="https://apify.com/store" target="_blank" rel="noopener">Apify Store</a>.</p><blockquote><p>To run this example on Apify Platform, use the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></blockquote><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> launchPuppeteer </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Obtaining own email address...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> apifyClient </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newClient</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> email </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> apifyClient</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">user</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Load randomword.com and get a random word</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fetching a random word.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://randomword.com/'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> randomWord </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#shared_section'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">outerHTML</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Send random word to your email. For that, you can use an actor we already</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// have available on the platform under the name: apify/send-mail.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The second parameter to the Actor.call() invocation is the actor's</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// desired input. You can find the required input parameters by checking</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// the actor's documentation page: https://apify.com/apify/send-mail</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Sending email to </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">user</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">email</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/send-mail'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">to</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> email</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">subject</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Random Word'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">html</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c"><h1>Random Word</h1></span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">randomWord</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Email sent. Good luck!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/call_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/basic-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Basic crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Cheerio crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/capture-screenshot.html b/docs/next/examples/capture-screenshot.html index 64339c0948..5967b06546 100644 --- a/docs/next/examples/capture-screenshot.html +++ b/docs/next/examples/capture-screenshot.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/capture-screenshot">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/capture-screenshot">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/capture-screenshot">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/capture-screenshot">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/capture-screenshot">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/capture-screenshot">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Capture a screenshot using Puppeteer</h1></header><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><p>This example captures a screenshot of a web page using <code>Puppeteer</code>. It would look almost exactly the same with <code>Playwright</code>.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Page Screenshot</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Crawler Utils Screenshot</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>page.screenshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCB1cmwgPSAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS8nO1xcbi8vIFN0YXJ0IGEgYnJvd3NlclxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBPcGVuIG5ldyB0YWIgaW4gdGhlIGJyb3dzZXJcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuXFxuLy8gTmF2aWdhdGUgdG8gdGhlIFVSTFxcbmF3YWl0IHBhZ2UuZ290byh1cmwpO1xcblxcbi8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG5jb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuXFxuLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgnbXkta2V5Jywgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuXFxuLy8gQ2xvc2UgUHVwcGV0ZWVyXFxuYXdhaXQgYnJvd3Nlci5jbG9zZSgpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.xy-Qn13nROyNEPEB6pUG8xQ1VfIjq56rsat4wKqhq9o&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>puppeteerUtils.saveSnapshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciwgdXRpbHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgdXJsID0gJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vJztcXG4vLyBTdGFydCBhIGJyb3dzZXJcXG5jb25zdCBicm93c2VyID0gYXdhaXQgbGF1bmNoUHVwcGV0ZWVyKCk7XFxuXFxuLy8gT3BlbiBuZXcgdGFiIGluIHRoZSBicm93c2VyXFxuY29uc3QgcGFnZSA9IGF3YWl0IGJyb3dzZXIubmV3UGFnZSgpO1xcblxcbi8vIE5hdmlnYXRlIHRvIHRoZSBVUkxcXG5hd2FpdCBwYWdlLmdvdG8odXJsKTtcXG5cXG4vLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90XFxuYXdhaXQgdXRpbHMucHVwcGV0ZWVyLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleTogJ215LWtleScsIHNhdmVIdG1sOiBmYWxzZSB9KTtcXG5cXG4vLyBDbG9zZSBQdXBwZXRlZXJcXG5hd2FpdCBicm93c2VyLmNsb3NlKCk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.QSyAaQjtq2wJi2-pHooiFMBrLOELGoFYIBj8kQcDYtA&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> utils </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> url </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Start a browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open new tab in the browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Navigate to the URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">puppeteer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><p>This example captures a screenshot of multiple web pages when using <code>PuppeteerCrawler</code>:</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Page Screenshot</li><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Crawler Utils Screenshot</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>page.screenshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGEgUHVwcGV0ZWVyQ3Jhd2xlclxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUHVwcGV0ZWVyQ3Jhd2xlcih7XFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICAvLyBDYXB0dXJlIHRoZSBzY3JlZW5zaG90IHdpdGggUHVwcGV0ZWVyXFxuICAgICAgICBjb25zdCBzY3JlZW5zaG90ID0gYXdhaXQgcGFnZS5zY3JlZW5zaG90KCk7XFxuICAgICAgICAvLyBDb252ZXJ0IHRoZSBVUkwgaW50byBhIHZhbGlkIGtleVxcbiAgICAgICAgY29uc3Qga2V5ID0gcmVxdWVzdC51cmwucmVwbGFjZSgvWzovXS9nLCAnXycpO1xcbiAgICAgICAgLy8gU2F2ZSB0aGUgc2NyZWVuc2hvdCB0byB0aGUgZGVmYXVsdCBrZXktdmFsdWUgc3RvcmVcXG4gICAgICAgIGF3YWl0IEFjdG9yLnNldFZhbHVlKGtleSwgc2NyZWVuc2hvdCwgeyBjb250ZW50VHlwZTogJ2ltYWdlL3BuZycgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyB9LFxcbiAgICB7IHVybDogJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyB9LFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.V_BcbfCWH__rcmGznaMSLm6R1wTtqF583QKH4Z3n5Uc&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot with Puppeteer</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> screenshot </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">screenshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Save the screenshot to the default key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> screenshot</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> contentType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'image/png'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>puppeteerUtils.saveSnapshot()</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIHB1cHBldGVlclV0aWxzIH0gZnJvbSAnY3Jhd2xlZSc7XFxuaW1wb3J0IHsgQWN0b3IgfSBmcm9tICdhcGlmeSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIFB1cHBldGVlckNyYXdsZXJcXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgLy8gQ29udmVydCB0aGUgVVJMIGludG8gYSB2YWxpZCBrZXlcXG4gICAgICAgIGNvbnN0IGtleSA9IHJlcXVlc3QudXJsLnJlcGxhY2UoL1s6L10vZywgJ18nKTtcXG4gICAgICAgIC8vIENhcHR1cmUgdGhlIHNjcmVlbnNob3RcXG4gICAgICAgIGF3YWl0IHB1cHBldGVlclV0aWxzLnNhdmVTbmFwc2hvdChwYWdlLCB7IGtleSwgc2F2ZUh0bWw6IGZhbHNlIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicgfSxcXG4gICAgeyB1cmw6ICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycgfSxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.2SyyQ1VmxXhmOlrpTJRLqsinn3178wgSbrygIl4JJdg&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> puppeteerUtils </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a PuppeteerCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Convert the URL into a valid key</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> key </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">replace</span><span class="token punctuation" style="color:#393A34">(</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-source language-regex" style="color:#36acaa">[:/]</span><span class="token regex regex-delimiter" style="color:#36acaa">/</span><span class="token regex regex-flags" style="color:#36acaa">g</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'_'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Capture the screenshot</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> puppeteerUtils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">saveSnapshot</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> key</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> saveHtml</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><p>In both examples using <code>page.screenshot()</code>, a <code>key</code> variable is created based on the URL of the web page. This variable is used as the key when saving -each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_capture_screenshot.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +each screenshot into a key-value store.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_capture_screenshot.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/playwright-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Playwright crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer crawler</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/cheerio-crawler.html b/docs/next/examples/cheerio-crawler.html index f5ffff800e..5dfea5f413 100644 --- a/docs/next/examples/cheerio-crawler.html +++ b/docs/next/examples/cheerio-crawler.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/cheerio-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> LogLevel </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Crawlers come with various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">LogLevel</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestHandlerTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">index</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/cheerio_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/cheerio-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/cheerio-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/cheerio-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/cheerio-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/cheerio-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/cheerio-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Cheerio crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> to crawl a list of URLs from an external file, load each URL using a plain HTTP request, parse the HTML using the <a href="https://www.npmjs.com/package/cheerio" target="_blank" rel="noopener">Cheerio library</a> and extract some data from it: the page title and all <code>h1</code> tags.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBsb2csIExvZ0xldmVsIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuLy8gQ3Jhd2xlcnMgY29tZSB3aXRoIHZhcmlvdXMgdXRpbGl0aWVzLCBlLmcuIGZvciBsb2dnaW5nLlxcbi8vIEhlcmUgd2UgdXNlIGRlYnVnIGxldmVsIG9mIGxvZ2dpbmcgdG8gaW1wcm92ZSB0aGUgZGVidWdnaW5nIGV4cGVyaWVuY2UuXFxuLy8gVGhpcyBmdW5jdGlvbmFsaXR5IGlzIG9wdGlvbmFsIVxcbmxvZy5zZXRMZXZlbChMb2dMZXZlbC5ERUJVRyk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBDaGVlcmlvQ3Jhd2xlciBjbGFzcyAtIGEgY3Jhd2xlclxcbi8vIHRoYXQgYXV0b21hdGljYWxseSBsb2FkcyB0aGUgVVJMcyBhbmQgcGFyc2VzIHRoZWlyIEhUTUwgdXNpbmcgdGhlIGNoZWVyaW8gbGlicmFyeS5cXG5jb25zdCBjcmF3bGVyID0gbmV3IENoZWVyaW9DcmF3bGVyKHtcXG4gICAgLy8gVGhlIGNyYXdsZXIgZG93bmxvYWRzIGFuZCBwcm9jZXNzZXMgdGhlIHdlYiBwYWdlcyBpbiBwYXJhbGxlbCwgd2l0aCBhIGNvbmN1cnJlbmN5XFxuICAgIC8vIGF1dG9tYXRpY2FsbHkgbWFuYWdlZCBiYXNlZCBvbiB0aGUgYXZhaWxhYmxlIHN5c3RlbSBtZW1vcnkgYW5kIENQVSAoc2VlIEF1dG9zY2FsZWRQb29sIGNsYXNzKS5cXG4gICAgLy8gSGVyZSB3ZSBkZWZpbmUgc29tZSBoYXJkIGxpbWl0cyBmb3IgdGhlIGNvbmN1cnJlbmN5LlxcbiAgICBtaW5Db25jdXJyZW5jeTogMTAsXFxuICAgIG1heENvbmN1cnJlbmN5OiA1MCxcXG5cXG4gICAgLy8gT24gZXJyb3IsIHJldHJ5IGVhY2ggcGFnZSBhdCBtb3N0IG9uY2UuXFxuICAgIG1heFJlcXVlc3RSZXRyaWVzOiAxLFxcblxcbiAgICAvLyBJbmNyZWFzZSB0aGUgdGltZW91dCBmb3IgcHJvY2Vzc2luZyBvZiBlYWNoIHBhZ2UuXFxuICAgIHJlcXVlc3RIYW5kbGVyVGltZW91dFNlY3M6IDMwLFxcblxcbiAgICAvLyBMaW1pdCB0byAxMCByZXF1ZXN0cyBwZXIgb25lIGNyYXdsXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcblxcbiAgICAvLyBUaGlzIGZ1bmN0aW9uIHdpbGwgYmUgY2FsbGVkIGZvciBlYWNoIFVSTCB0byBjcmF3bC5cXG4gICAgLy8gSXQgYWNjZXB0cyBhIHNpbmdsZSBwYXJhbWV0ZXIsIHdoaWNoIGlzIGFuIG9iamVjdCB3aXRoIG9wdGlvbnMgYXM6XFxuICAgIC8vIGh0dHBzOi8vc2RrLmFwaWZ5LmNvbS9kb2NzL3R5cGVkZWZzL2NoZWVyaW8tY3Jhd2xlci1vcHRpb25zI2hhbmRsZXBhZ2VmdW5jdGlvblxcbiAgICAvLyBXZSB1c2UgZm9yIGRlbW9uc3RyYXRpb24gb25seSAyIG9mIHRoZW06XFxuICAgIC8vIC0gcmVxdWVzdDogYW4gaW5zdGFuY2Ugb2YgdGhlIFJlcXVlc3QgY2xhc3Mgd2l0aCBpbmZvcm1hdGlvbiBzdWNoIGFzIFVSTCBhbmQgSFRUUCBtZXRob2RcXG4gICAgLy8gLSAkOiB0aGUgY2hlZXJpbyBvYmplY3QgY29udGFpbmluZyBwYXJzZWQgSFRNTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsICQgfSkge1xcbiAgICAgICAgbG9nLmRlYnVnKGBQcm9jZXNzaW5nICR7cmVxdWVzdC51cmx9Li4uYCk7XFxuXFxuICAgICAgICAvLyBFeHRyYWN0IGRhdGEgZnJvbSB0aGUgcGFnZSB1c2luZyBjaGVlcmlvLlxcbiAgICAgICAgY29uc3QgdGl0bGUgPSAkKCd0aXRsZScpLnRleHQoKTtcXG4gICAgICAgIGNvbnN0IGgxdGV4dHMgPSBbXTtcXG4gICAgICAgICQoJ2gxJykuZWFjaCgoaW5kZXgsIGVsKSA9PiB7XFxuICAgICAgICAgICAgaDF0ZXh0cy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGV4dDogJChlbCkudGV4dCgpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICAvLyBTdG9yZSB0aGUgcmVzdWx0cyB0byB0aGUgZGF0YXNldC4gSW4gbG9jYWwgY29uZmlndXJhdGlvbixcXG4gICAgICAgIC8vIHRoZSBkYXRhIHdpbGwgYmUgc3RvcmVkIGFzIEpTT04gZmlsZXMgaW4gLi9zdG9yYWdlL2RhdGFzZXRzL2RlZmF1bHRcXG4gICAgICAgIGF3YWl0IEFjdG9yLnB1c2hEYXRhKHtcXG4gICAgICAgICAgICB1cmw6IHJlcXVlc3QudXJsLFxcbiAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgIGgxdGV4dHMsXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG5cXG4gICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBjYWxsZWQgaWYgdGhlIHBhZ2UgcHJvY2Vzc2luZyBmYWlsZWQgbW9yZSB0aGFuIG1heFJlcXVlc3RSZXRyaWVzKzEgdGltZXMuXFxuICAgIGZhaWxlZFJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBsb2cuZGVidWcoYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHR3aWNlLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKCk7XFxuXFxubG9nLmRlYnVnKCdDcmF3bGVyIGZpbmlzaGVkLicpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.dOZILM56nUwSSVMoLgQB0brbbjQm2W2FDao35eLD72s&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> LogLevel </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Crawlers come with various utilities, e.g. for logging.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Here we use debug level of logging to improve the debugging experience.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This functionality is optional!</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">LogLevel</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the CheerioCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs and parses their HTML using the cheerio library.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The crawler downloads and processes the web pages in parallel, with a concurrency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// automatically managed based on the available system memory and CPU (see AutoscaledPool class).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here we define some hard limits for the concurrency.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> minConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxConcurrency</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// On error, retry each page at most once.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestRetries</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the timeout for processing of each page.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestHandlerTimeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limit to 10 requests per one crawl</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// It accepts a single parameter, which is an object with options as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://sdk.apify.com/docs/typedefs/cheerio-crawler-options#handlepagefunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We use for demonstration only 2 of them:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - $: the cheerio object containing parsed HTML</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Extract data from the page using cheerio.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> h1texts </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'h1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">each</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">index</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> text</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the dataset. In local configuration,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the data will be stored as JSON files in ./storage/datasets/default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> h1texts</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed twice.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">debug</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/cheerio_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/call-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Call actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-all-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl all links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/crawl-all-links.html b/docs/next/examples/crawl-all-links.html index 8bc1efba37..cf7f8db9d5 100644 --- a/docs/next/examples/crawl-all-links.html +++ b/docs/next/examples/crawl-all-links.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-all-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-all-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-all-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-all-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-all-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-all-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl all links on a website</h1></header><p>This example uses the <code>enqueueLinks()</code> method to add new links to the <code>RequestQueue</code> as the crawler navigates from page to page. If only the -required parameters are defined, all links will be crawled.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_all_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +required parameters are defined, all links will be crawled.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.WZ0oMu6yd1pBKWHbkngs3qzaOVhpacPP6PKxjXnRLbc&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIGFsbCBsaW5rcyBmcm9tIHBhZ2UgdG8gUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3MoKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYWxsIGxpbmtzKVxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.gNhqxwBfIYMReWTkgUMf9WC-YJ_1Vy7-cQOmxNZDobM&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgICAgICAvLyBBZGQgYWxsIGxpbmtzIGZyb20gcGFnZSB0byBSZXF1ZXN0UXVldWVcXG4gICAgICAgIGF3YWl0IGVucXVldWVMaW5rcygpO1xcbiAgICB9LFxcbiAgICBtYXhSZXF1ZXN0c1BlckNyYXdsOiAxMCwgLy8gTGltaXRhdGlvbiBmb3Igb25seSAxMCByZXF1ZXN0cyAoZG8gbm90IHVzZSBpZiB5b3Ugd2FudCB0byBjcmF3bCBhbGwgbGlua3MpXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.eVg0BTpLuA9jZtmijHGMjetPuME0zmTZX4oo8kxSAh8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add all links from page to RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_all_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/cheerio-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Cheerio crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl multiple URLs</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/crawl-multiple-urls.html b/docs/next/examples/crawl-multiple-urls.html index 13c278faae..3e205c46bc 100644 --- a/docs/next/examples/crawl-multiple-urls.html +++ b/docs/next/examples/crawl-multiple-urls.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-multiple-urls">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_multiple_urls.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-multiple-urls">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-multiple-urls">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-multiple-urls">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-multiple-urls">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-multiple-urls">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl multiple URLs</h1></header><p>This example crawls the specified list of URLs.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgQ2hlZXJpb0NyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgJCB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9ICQoJ3RpdGxlJykudGV4dCgpO1xcbiAgICAgICAgY29uc29sZS5sb2coYFVSTDogJHtyZXF1ZXN0LnVybH1cXFxcblRJVExFOiAke3RpdGxlfWApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFtcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0xJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0yJyxcXG4gICAgJ2h0dHA6Ly93d3cuZXhhbXBsZS5jb20vcGFnZS0zJyxcXG5dKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.CeiVEdnjPDfQ0i8PLiJLQhDJFF2dN9OtHDx7MiAmQD8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> $ </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'title'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">text</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgLy8gRnVuY3Rpb24gY2FsbGVkIGZvciBlYWNoIFVSTFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVVJMOiAke3JlcXVlc3QudXJsfVxcXFxuVElUTEU6ICR7dGl0bGV9YCk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oW1xcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTEnLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTInLFxcbiAgICAnaHR0cDovL3d3dy5leGFtcGxlLmNvbS9wYWdlLTMnLFxcbl0pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.N3_G0e276h-8f8FDQW4iLmyjhKEPItvUgrKXe3Rpxy8&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbmNvbnN0IGNyYXdsZXIgPSBuZXcgUGxheXdyaWdodENyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCwgcGFnZSB9KSB7XFxuICAgICAgICBjb25zdCB0aXRsZSA9IGF3YWl0IHBhZ2UudGl0bGUoKTtcXG4gICAgICAgIGNvbnNvbGUubG9nKGBVUkw6ICR7cmVxdWVzdC51cmx9XFxcXG5USVRMRTogJHt0aXRsZX1gKTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBSdW4gdGhlIGNyYXdsZXJcXG5hd2FpdCBjcmF3bGVyLnJ1bihbXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMScsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMicsXFxuICAgICdodHRwOi8vd3d3LmV4YW1wbGUuY29tL3BhZ2UtMycsXFxuXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.tFxeTZWttzvkWqmTccMmErP36zwOU4YG608H07ALpD0&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">URL: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">\nTITLE: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_multiple_urls.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-all-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl all links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a website with relative links</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/crawl-relative-links.html b/docs/next/examples/crawl-relative-links.html index 16efb9316f..81f93d1e3d 100644 --- a/docs/next/examples/crawl-relative-links.html +++ b/docs/next/examples/crawl-relative-links.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,8 +23,8 @@ full domain or urls that point to any subdomain of the provided domain.</p><p>For instance, hyperlinks like <code>https://subdomain.example.com/some/path</code>, <code>https://example.com/some/path</code>, <code>/absolute/example</code> or <code>./relative/example</code> will all be matched by this strategy.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgaG9zdG5hbWVcXG4gICAgICAgICAgICAvLyBhcyByZXF1ZXN0LmxvYWRlZFVybCBvciByZXF1ZXN0LnVybFxcbiAgICAgICAgICAgIC8vIGhpZ2hsaWdodC1uZXh0LWxpbmVcXG4gICAgICAgICAgICBzdHJhdGVneTogRW5xdWV1ZVN0cmF0ZWd5LlNhbWVIb3N0bmFtZSxcXG4gICAgICAgICAgICAvLyBBbHRlcm5hdGl2ZWx5LCB5b3UgY2FuIHBhc3MgaW4gdGhlIHN0cmluZyAnc2FtZS1ob3N0bmFtZSdcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtaG9zdG5hbWUnLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxufSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS8nXSk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.yF2AJFRXorzWRuCXhRGjM8nWXBFT585D7nwOkBPAPf0&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> EnqueueStrategy </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-hostname'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-hostname',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6"><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>This is the default strategy when calling <code>enqueueLinks()</code>, so you don't have to specify it.</p></div></div><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>Example domains</div><div class="admonitionContent_S0QG"><p>For a url of <code>https://subdomain.example.com</code>, <code>enqueueLinks()</code> will only match relative urls or urls that point to the same full domain.</p><p>For instance, hyperlinks like <code>https://subdomain.example.com/some/path</code>, <code>/absolute/example</code> or <code>./relative/example</code> -will all be matched by this strategy, while <code>https://other-subdomain.example.com</code> or <code>https://otherexample.com</code> will not.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> EnqueueStrategy </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-subdomain'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-subdomain',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_relative_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +will all be matched by this strategy, while <code>https://other-subdomain.example.com</code> or <code>https://otherexample.com</code> will not.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBFbnF1ZXVlU3RyYXRlZ3kgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgYXdhaXQgZW5xdWV1ZUxpbmtzKHtcXG4gICAgICAgICAgICAvLyBTZXR0aW5nIHRoZSBzdHJhdGVneSB0byAnc2FtZS1zdWJkb21haW4nIHdpbGwgZW5xdWV1ZSBhbGwgbGlua3MgZm91bmQgdGhhdCBhcmUgb24gdGhlIHNhbWUgc3ViZG9tYWluIGFuZCBob3N0bmFtZVxcbiAgICAgICAgICAgIC8vIGFzIHJlcXVlc3QubG9hZGVkVXJsIG9yIHJlcXVlc3QudXJsXFxuICAgICAgICAgICAgLy8gaGlnaGxpZ2h0LW5leHQtbGluZVxcbiAgICAgICAgICAgIHN0cmF0ZWd5OiBFbnF1ZXVlU3RyYXRlZ3kuU2FtZUhvc3RuYW1lLFxcbiAgICAgICAgICAgIC8vIEFsdGVybmF0aXZlbHksIHlvdSBjYW4gcGFzcyBpbiB0aGUgc3RyaW5nICdzYW1lLXN1YmRvbWFpbidcXG4gICAgICAgICAgICAvLyBzdHJhdGVneTogJ3NhbWUtc3ViZG9tYWluJyxcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9hcGlmeS5jb20vJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5IjoxMDI0LCJ0aW1lb3V0IjoxODB9fQ.dyU8vmMEV9LyeUOm-72BRE7THBxt7nDR7zN35H27ulw&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> EnqueueStrategy </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Setting the strategy to 'same-subdomain' will enqueue all links found that are on the same subdomain and hostname</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// as request.loadedUrl or request.url</span><span class="token plain"></span><br></span><span class="token-line theme-code-block-highlighted-line" style="color:#393A34"><span class="token plain"> strategy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> EnqueueStrategy</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">SameHostname</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Alternatively, you can pass in the string 'same-subdomain'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// strategy: 'same-subdomain',</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_relative_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-multiple-urls"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl multiple URLs</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-single-url"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a single URL</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/crawl-single-url.html b/docs/next/examples/crawl-single-url.html index 2f0a8acb0f..184c146ea0 100644 --- a/docs/next/examples/crawl-single-url.html +++ b/docs/next/examples/crawl-single-url.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-single-url">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-single-url">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-single-url">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-single-url">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-single-url">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-single-url">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a single URL</h1></header><p>This example uses the <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> npm package -to grab the HTML of a web page.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/next/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_single_url.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +to grab the HTML of a web page.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IGdvdFNjcmFwaW5nIH0gZnJvbSAnZ290LXNjcmFwaW5nJztcXG5cXG4vLyBHZXQgdGhlIEhUTUwgb2YgYSB3ZWIgcGFnZVxcbmNvbnN0IHsgYm9keSB9ID0gYXdhaXQgZ290U2NyYXBpbmcoeyB1cmw6ICdodHRwczovL3d3dy5leGFtcGxlLmNvbScgfSk7XFxuY29uc29sZS5sb2coYm9keSk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.0S1i1yD10_82mLCH3VWFtCZTU4-BDrDU1UGY208IqgE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the HTML of a web page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> body </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://www.example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>If you don't want to hard-code the URL into the script, refer to the <a href="/sdk/js/docs/next/examples/accept-user-input">Accept User Input</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_single_url.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-relative-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a website with relative links</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl a sitemap</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/crawl-sitemap.html b/docs/next/examples/crawl-sitemap.html index 4a51df56b9..68ce5fb8c1 100644 --- a/docs/next/examples/crawl-sitemap.html +++ b/docs/next/examples/crawl-sitemap.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-sitemap">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_sitemap.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-sitemap">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-sitemap">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-sitemap">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-sitemap">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-sitemap">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-sitemap">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl a sitemap</h1></header><p>This example downloads and crawls the URLs from a sitemap.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Cheerio Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Puppeteer Crawler</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Playwright Crawler</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><p>Using <code>CheerioCrawler</code>:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.mjmmhoSL7b0V2s0TY-HSOQg91w6fOa-Mp3r5P63y9XY&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PuppeteerCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIsIGRvd25sb2FkTGlzdE9mVXJscyB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBGdW5jdGlvbiBjYWxsZWQgZm9yIGVhY2ggVVJMXFxuICAgIGFzeW5jIHJlcXVlc3RIYW5kbGVyKHsgcmVxdWVzdCB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhyZXF1ZXN0LnVybCk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLCAvLyBMaW1pdGF0aW9uIGZvciBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGEgc2l0ZW1hcClcXG59KTtcXG5cXG5jb25zdCBsaXN0T2ZVcmxzID0gYXdhaXQgZG93bmxvYWRMaXN0T2ZVcmxzKHsgdXJsOiAnaHR0cHM6Ly9hcGlmeS5jb20vc2l0ZW1hcC54bWwnIH0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlclxcbmF3YWl0IGNyYXdsZXIucnVuKGxpc3RPZlVybHMpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.a8BCwUkWxYn4sOiNxIqxqQ6FQfsKpHqw30RW56dHbig&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>Using <code>PlaywrightCrawler</code>:</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyLCBkb3dubG9hZExpc3RPZlVybHMgfSBmcm9tICdjcmF3bGVlJztcXG5pbXBvcnQgeyBBY3RvciB9IGZyb20gJ2FwaWZ5JztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQbGF5d3JpZ2h0Q3Jhd2xlcih7XFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0IH0pIHtcXG4gICAgICAgIGNvbnNvbGUubG9nKHJlcXVlc3QudXJsKTtcXG4gICAgfSxcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsIC8vIExpbWl0YXRpb24gZm9yIG9ubHkgMTAgcmVxdWVzdHMgKGRvIG5vdCB1c2UgaWYgeW91IHdhbnQgdG8gY3Jhd2wgYSBzaXRlbWFwKVxcbn0pO1xcblxcbmNvbnN0IGxpc3RPZlVybHMgPSBhd2FpdCBkb3dubG9hZExpc3RPZlVybHMoeyB1cmw6ICdodHRwczovL2FwaWZ5LmNvbS9zaXRlbWFwLnhtbCcgfSk7XFxuXFxuLy8gUnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4obGlzdE9mVXJscyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.FSqg5eweSp1Lf5NDrY70g6qyegn1fmR1EJAs4J6rC8c&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> downloadListOfUrls </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limitation for only 10 requests (do not use if you want to crawl a sitemap)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> listOfUrls </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">downloadListOfUrls</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://apify.com/sitemap.xml'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">listOfUrls</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_sitemap.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-single-url"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a single URL</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/crawl-some-links"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Crawl some links on a website</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/crawl-some-links.html b/docs/next/examples/crawl-some-links.html index 6120a3d476..3c3321d322 100644 --- a/docs/next/examples/crawl-some-links.html +++ b/docs/next/examples/crawl-some-links.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-some-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> example uses the <a href="https://crawlee.dev/api/core/class/PseudoUrl" target="_blank" rel="noopener noreferrer"><code>pseudoUrls</code></a> property in the <a href="https://crawlee.dev/api/cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks" target="_blank" rel="noopener noreferrer"><code>enqueueLinks()</code></a> method to only add links to the <a href="/sdk/js/api/next/apify/class/RequestQueue"><code>RequestQueue</code></a> queue if they match the specified regular expression.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limits the crawler to only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to the crawler's RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL and run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_some_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/crawl-some-links">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/crawl-some-links">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/crawl-some-links">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/crawl-some-links">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/crawl-some-links">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/crawl-some-links">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Crawl some links on a website</h1></header><p>This <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> example uses the <a href="https://crawlee.dev/api/core/class/PseudoUrl" target="_blank" rel="noopener noreferrer"><code>pseudoUrls</code></a> property in the <a href="https://crawlee.dev/api/cheerio-crawler/interface/CheerioRequestHandlerInputs#enqueueLinks" target="_blank" rel="noopener noreferrer"><code>enqueueLinks()</code></a> method to only add links to the <a href="/sdk/js/api/next/apify/class/RequestQueue"><code>RequestQueue</code></a> queue if they match the specified regular expression.</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IENoZWVyaW9DcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhIENoZWVyaW9DcmF3bGVyXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBDaGVlcmlvQ3Jhd2xlcih7XFxuICAgIC8vIExpbWl0cyB0aGUgY3Jhd2xlciB0byBvbmx5IDEwIHJlcXVlc3RzIChkbyBub3QgdXNlIGlmIHlvdSB3YW50IHRvIGNyYXdsIGFsbCBsaW5rcylcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogMTAsXFxuICAgIC8vIEZ1bmN0aW9uIGNhbGxlZCBmb3IgZWFjaCBVUkxcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2cocmVxdWVzdC51cmwpO1xcbiAgICAgICAgLy8gQWRkIHNvbWUgbGlua3MgZnJvbSBwYWdlIHRvIHRoZSBjcmF3bGVyJ3MgUmVxdWVzdFF1ZXVlXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cFtzP106Ly9hcGlmeS5jb20vWy4rXS9bLitdJ10sXFxuICAgICAgICB9KTtcXG4gICAgfSxcXG59KTtcXG5cXG4vLyBEZWZpbmUgdGhlIHN0YXJ0aW5nIFVSTCBhbmQgcnVuIHRoZSBjcmF3bGVyXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwczovL2FwaWZ5LmNvbS9zdG9yZSddKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6MTAyNCwidGltZW91dCI6MTgwfX0.wHLH-CdKCylWDVcIRISOGWdcfzTZHeVAVlfiQhkzdko&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> CheerioCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create a CheerioCrawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Limits the crawler to only 10 requests (do not use if you want to crawl all links)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Function called for each URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">url</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add some links from page to the crawler's RequestQueue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http[s?]://apify.com/[.+]/[.+]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Define the starting URL and run the crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://apify.com/store'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/crawl_some_links.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-sitemap"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl a sitemap</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/forms"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Forms</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/forms.html b/docs/next/examples/forms.html index fab86ea7bc..24d81b53fa 100644 --- a/docs/next/examples/forms.html +++ b/docs/next/examples/forms.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ automatically fill and submit a search form to look up repositories on <a href="https://github.com" target="_blank" rel="noopener">GitHub</a> using headless Chrome / Puppeteer. The actor first fills in the search term, repository owner, start date and language of the repository, then submits the form and prints out the results. Finally, the results are saved either on the Apify platform to the -default <a href="/sdk/js/api/next/apify/class/Dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./storage/datasets/default</code>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token builtin">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/forms.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +default <a href="/sdk/js/api/next/apify/class/Dataset"><code>dataset</code></a> or on the local machine as JSON files in <code>./storage/datasets/default</code>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IGxhdW5jaFB1cHBldGVlciB9IGZyb20gJ2NyYXdsZWUnO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG4vLyBMYXVuY2ggdGhlIHdlYiBicm93c2VyLlxcbmNvbnN0IGJyb3dzZXIgPSBhd2FpdCBsYXVuY2hQdXBwZXRlZXIoKTtcXG5cXG4vLyBDcmVhdGUgYW5kIG5hdmlnYXRlIG5ldyBwYWdlXFxuY29uc29sZS5sb2coJ09wZW4gdGFyZ2V0IHBhZ2UnKTtcXG5jb25zdCBwYWdlID0gYXdhaXQgYnJvd3Nlci5uZXdQYWdlKCk7XFxuYXdhaXQgcGFnZS5nb3RvKCdodHRwczovL2dpdGh1Yi5jb20vc2VhcmNoL2FkdmFuY2VkJyk7XFxuXFxuLy8gRmlsbCBmb3JtIGZpZWxkcyBhbmQgc2VsZWN0IGRlc2lyZWQgc2VhcmNoIG9wdGlvbnNcXG5jb25zb2xlLmxvZygnRmlsbCBpbiBzZWFyY2ggZm9ybScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI2Fkdl9jb2RlX3NlYXJjaCBpbnB1dC5qcy1hZHZhbmNlZC1zZWFyY2gtaW5wdXQnLCAnYXBpZnktanMnKTtcXG5hd2FpdCBwYWdlLnR5cGUoJyNzZWFyY2hfZnJvbScsICdhcGlmeScpO1xcbmF3YWl0IHBhZ2UudHlwZSgnI3NlYXJjaF9kYXRlJywgJz4yMDE1Jyk7XFxuYXdhaXQgcGFnZS5zZWxlY3QoJ3NlbGVjdCNzZWFyY2hfbGFuZ3VhZ2UnLCAnSmF2YVNjcmlwdCcpO1xcblxcbi8vIFN1Ym1pdCB0aGUgZm9ybSBhbmQgd2FpdCBmb3IgZnVsbCBsb2FkIG9mIG5leHQgcGFnZVxcbmNvbnNvbGUubG9nKCdTdWJtaXQgc2VhcmNoIGZvcm0nKTtcXG5hd2FpdCBQcm9taXNlLmFsbChbXFxuICAgIHBhZ2Uud2FpdEZvck5hdmlnYXRpb24oKSxcXG4gICAgcGFnZS5jbGljaygnI2Fkdl9jb2RlX3NlYXJjaCBidXR0b25bdHlwZT1cXFwic3VibWl0XFxcIl0nKSxcXG5dKTtcXG5cXG4vLyBPYnRhaW4gYW5kIHByaW50IGxpc3Qgb2Ygc2VhcmNoIHJlc3VsdHNcXG5jb25zdCByZXN1bHRzID0gYXdhaXQgcGFnZS4kJGV2YWwoJ2Rpdi5mNC50ZXh0LW5vcm1hbCBhJywgKG5vZGVzKSA9PiBub2Rlcy5tYXAoKG5vZGUpID0-ICh7XFxuICAgIHVybDogbm9kZS5ocmVmLFxcbiAgICBuYW1lOiBub2RlLmlubmVyVGV4dCxcXG59KSkpO1xcblxcbmNvbnNvbGUubG9nKCdSZXN1bHRzOicsIHJlc3VsdHMpO1xcblxcbi8vIFN0b3JlIGRhdGEgaW4gZGVmYXVsdCBkYXRhc2V0XFxuYXdhaXQgQWN0b3IucHVzaERhdGEocmVzdWx0cyk7XFxuXFxuLy8gQ2xvc2UgYnJvd3NlclxcbmF3YWl0IGJyb3dzZXIuY2xvc2UoKTtcXG5cXG5hd2FpdCBBY3Rvci5leGl0KCk7XFxuXCJ9Iiwib3B0aW9ucyI6eyJidWlsZCI6ImxhdGVzdCIsImNvbnRlbnRUeXBlIjoiYXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOCIsIm1lbW9yeSI6NDA5NiwidGltZW91dCI6MTgwfX0.DmRFuL_IvNKlGP6PPjiqTNvmyuQDiP_ZX9s7i9fnV-E&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> launchPuppeteer </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Launch the web browser.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> browser </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create and navigate new page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Open target page'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> page </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">newPage</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">goto</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'https://github.com/search/advanced'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Fill form fields and select desired search options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Fill in search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search input.js-advanced-search-input'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify-js'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_from'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">type</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#search_date'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'>2015'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">select</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'select#search_language'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'JavaScript'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Submit the form and wait for full load of next page</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Submit search form'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token builtin">Promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">all</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">waitForNavigation</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">click</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'#adv_code_search button[type="submit"]'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Obtain and print list of search results</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> results </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'div.f4.text-normal a'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">nodes</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> nodes</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">node</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> name</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> node</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Results:'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Store data in default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">results</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Close browser</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> browser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">close</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/forms.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/crawl-some-links"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Crawl some links on a website</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/map-and-reduce"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/map-and-reduce.html b/docs/next/examples/map-and-reduce.html index a3cd3508b6..a591b0d20a 100644 --- a/docs/next/examples/map-and-reduce.html +++ b/docs/next/examples/map-and-reduce.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ array through a transformation function and an options parameter.</p><p>The <code>map</code> method used to check if are there more than 5 header elements on each page:</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmF3YWl0IEFjdG9yLmluaXQoKTtcXG5cXG5jb25zdCBkYXRhc2V0ID0gYXdhaXQgQWN0b3Iub3BlbkRhdGFzZXQ8eyBoZWFkaW5nQ291bnQ6IG51bWJlciB9PigpO1xcblxcbi8vIGNhbGxpbmcgbWFwIGZ1bmN0aW9uIGFuZCBmaWx0ZXJpbmcgdGhyb3VnaCBtYXBwZWQgaXRlbXNcXG5jb25zdCBtb3JlVGhhbjVoZWFkZXJzID0gKGF3YWl0IGRhdGFzZXQubWFwKChpdGVtKSA9PiBpdGVtLmhlYWRpbmdDb3VudCkpLmZpbHRlcigoY291bnQpID0-IGNvdW50ID4gNSk7XFxuXFxuLy8gc2F2aW5nIHJlc3VsdCBvZiBtYXAgdG8gZGVmYXVsdCBLZXktdmFsdWUgc3RvcmVcXG5hd2FpdCBBY3Rvci5zZXRWYWx1ZSgncGFnZXNfd2l0aF9tb3JlX3RoYW5fNV9oZWFkZXJzJywgbW9yZVRoYW41aGVhZGVycyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.Q-rNIQYAy8a-1WsGs9suJ81WRuf_op1ZO2rCzoYyeAs&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token generic-function function" style="color:#d73a49">openDataset</span><span class="token generic-function generic class-name operator" style="color:#393A34"><</span><span class="token generic-function generic class-name punctuation" style="color:#393A34">{</span><span class="token generic-function generic class-name"> headingCount</span><span class="token generic-function generic class-name operator" style="color:#393A34">:</span><span class="token generic-function generic class-name"> </span><span class="token generic-function generic class-name builtin">number</span><span class="token generic-function generic class-name"> </span><span class="token generic-function generic class-name punctuation" style="color:#393A34">}</span><span class="token generic-function generic class-name operator" style="color:#393A34">></span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// calling map function and filtering through mapped items</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> moreThan5headers </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">map</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> item</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">headingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">filter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">count</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> count </span><span class="token operator" style="color:#393A34">></span><span class="token plain"> </span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_with_more_than_5_headers'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> moreThan5headers</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>The <code>moreThan5headers</code> variable is an array of <code>headingCount</code> attributes where the number of headers is greater than 5.</p><p>The <code>map</code> method's result value saved to the <a href="/sdk/js/api/next/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">11</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">8</span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="reduce">Reduce<a href="#reduce" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The dataset <code>reduce</code> method does not produce a new array of values - it reduces a list of values down to a single value. The method iterates through the items in the dataset using the <a href="/sdk/js/api/next/apify/class/Dataset#reduce"><code>memo</code> argument</a>. After performing the necessary calculation, the <code>memo</code> is sent to the next iteration, while the item just processed is reduced (removed).</p><p>Using the <code>reduce</code> method to get the total number of headers scraped (all items in the dataset):</p><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/kk67IcZkKSSBTslXI?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcblxcbmNvbnN0IGRhdGFzZXQgPSBhd2FpdCBBY3Rvci5vcGVuRGF0YXNldCgpO1xcblxcbi8vIGNhbGxpbmcgcmVkdWNlIGZ1bmN0aW9uIGFuZCB1c2luZyBtZW1vIHRvIGNhbGN1bGF0ZSBudW1iZXIgb2YgaGVhZGVyc1xcbmNvbnN0IHBhZ2VzSGVhZGluZ0NvdW50ID0gYXdhaXQgZGF0YXNldC5yZWR1Y2UoKG1lbW8sIHZhbHVlKSA9PiB7XFxuICAgIHJldHVybiBtZW1vICs9IHZhbHVlLmhlYWRpbmdDb3VudDtcXG59LCAwKTtcXG5cXG4vLyBzYXZpbmcgcmVzdWx0IG9mIG1hcCB0byBkZWZhdWx0IEtleS12YWx1ZSBzdG9yZVxcbmF3YWl0IEFjdG9yLnNldFZhbHVlKCdwYWdlc19oZWFkaW5nX2NvdW50JywgcGFnZXNIZWFkaW5nQ291bnQpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjEwMjQsInRpbWVvdXQiOjE4MH19.1ViXq6_den8WcUl-TG3DdWceExG2yJNw4qobM_aNXao&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// calling reduce function and using memo to calculate number of headers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> pagesHeadingCount </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">reduce</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">memo</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> memo </span><span class="token operator" style="color:#393A34">+=</span><span class="token plain"> value</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">headingCount</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// saving result of map to default Key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'pages_heading_count'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> pagesHeadingCount</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><p>The original dataset will be reduced to a single value, <code>pagesHeadingCount</code>, which contains the count of all headers for all scraped pages (all -dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/api/next/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/map_and_reduce.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +dataset items).</p><p>The <code>reduce</code> method's result value saved to the <a href="/sdk/js/api/next/apify/class/KeyValueStore"><code>key-value store</code></a> should be:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token number" style="color:#36acaa">23</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/map_and_reduce.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/forms"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Forms</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/playwright-crawler"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Playwright crawler</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#map" class="table-of-contents__link toc-highlight">Map</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight">Reduce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/playwright-crawler.html b/docs/next/examples/playwright-crawler.html index 13b30122ed..de2f8f02fd 100644 --- a/docs/next/examples/playwright-crawler.html +++ b/docs/next/examples/playwright-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/playwright-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/playwright-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/playwright-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/playwright-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/playwright-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/playwright-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Playwright crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a> in combination with <a href="/sdk/js/api/next/apify/class/RequestQueue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Playwright.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">processedRequests</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/playwright_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-playwright-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/6i5QsHBMtm3hKph70?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFBsYXl3cmlnaHRDcmF3bGVyIH0gZnJvbSAnY3Jhd2xlZSc7XFxuXFxuYXdhaXQgQWN0b3IuaW5pdCgpO1xcblxcbi8vIENyZWF0ZSBhbiBpbnN0YW5jZSBvZiB0aGUgUGxheXdyaWdodENyYXdsZXIgY2xhc3MgLSBhIGNyYXdsZXJcXG4vLyB0aGF0IGF1dG9tYXRpY2FsbHkgbG9hZHMgdGhlIFVSTHMgaW4gaGVhZGxlc3MgQ2hyb21lIC8gUGxheXdyaWdodC5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFBsYXl3cmlnaHRDcmF3bGVyKHtcXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgLy8gSGVyZSB5b3UgY2FuIHNldCBvcHRpb25zIHRoYXQgYXJlIHBhc3NlZCB0byB0aGUgcGxheXdyaWdodCAubGF1bmNoKCkgZnVuY3Rpb24uXFxuICAgICAgICBsYXVuY2hPcHRpb25zOiB7XFxuICAgICAgICAgICAgaGVhZGxlc3M6IHRydWUsXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFBsYXl3cmlnaHQgc2NyaXB0cyB5b3UgYXJlIGZhbWlsaWFyIHdpdGgsXFxuICAgIC8vIHdpdGggdGhlIGV4Y2VwdGlvbiB0aGF0IGJyb3dzZXJzIGFuZCBwYWdlcyBhcmUgYXV0b21hdGljYWxseSBtYW5hZ2VkIGJ5IHRoZSBBcGlmeSBTREsuXFxuICAgIC8vIFRoZSBmdW5jdGlvbiBhY2NlcHRzIGEgc2luZ2xlIHBhcmFtZXRlciwgd2hpY2ggaXMgYW4gb2JqZWN0IHdpdGggYSBsb3Qgb2YgcHJvcGVydGllcyxcXG4gICAgLy8gdGhlIG1vc3QgaW1wb3J0YW50IGJlaW5nOlxcbiAgICAvLyAtIHJlcXVlc3Q6IGFuIGluc3RhbmNlIG9mIHRoZSBSZXF1ZXN0IGNsYXNzIHdpdGggaW5mb3JtYXRpb24gc3VjaCBhcyBVUkwgYW5kIEhUVFAgbWV0aG9kXFxuICAgIC8vIC0gcGFnZTogUGxheXdyaWdodCdzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wbGF5d3JpZ2h0LmRldi9kb2NzL2FwaS9jbGFzcy1wYWdlKVxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QsIHBhZ2UsIGVucXVldWVMaW5rcyB9KSB7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJvY2Vzc2luZyAke3JlcXVlc3QudXJsfS4uLmApO1xcblxcbiAgICAgICAgLy8gQSBmdW5jdGlvbiB0byBiZSBldmFsdWF0ZWQgYnkgUGxheXdyaWdodCB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLnByb2Nlc3NlZFJlcXVlc3RzLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.kt3UXVDBPuO5BGjh8ZGuYNiKR_W8ilbU9XBQeJvrZFs&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PlaywrightCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PlaywrightCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Playwright.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the playwright .launch() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Playwright scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with a lot of properties,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// the most important being:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Playwright's Page object (see https://playwright.dev/docs/api/class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Playwright within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">processedRequests</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/playwright_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/map-and-reduce"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset Map and Reduce methods</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/capture-screenshot"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/puppeteer-crawler.html b/docs/next/examples/puppeteer-crawler.html index 9d56ed4619..070d5fd4a9 100644 --- a/docs/next/examples/puppeteer-crawler.html +++ b/docs/next/examples/puppeteer-crawler.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,8 +17,8 @@ <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/puppeteer-crawler">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-crawler">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-crawler">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-crawler">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-crawler">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-crawler">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer crawler</h1></header><p>This example demonstrates how to use <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a> in combination with <a href="/sdk/js/api/next/apify/class/RequestQueue"><code>RequestQueue</code></a> to recursively scrape the <a href="https://news.ycombinator.com" target="_blank" rel="noopener">Hacker News website</a> using headless Chrome / Puppeteer.</p><p>The crawler starts with a single URL, finds links to next pages, enqueues them and continues until no more desired links are available. The results -are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +are stored to the default dataset. In local configuration, the results are stored as JSON files in <code>./storage/datasets/default</code></p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gQ3JlYXRlIGFuIGluc3RhbmNlIG9mIHRoZSBQdXBwZXRlZXJDcmF3bGVyIGNsYXNzIC0gYSBjcmF3bGVyXFxuLy8gdGhhdCBhdXRvbWF0aWNhbGx5IGxvYWRzIHRoZSBVUkxzIGluIGhlYWRsZXNzIENocm9tZSAvIFB1cHBldGVlci5cXG5jb25zdCBjcmF3bGVyID0gbmV3IFB1cHBldGVlckNyYXdsZXIoe1xcbiAgICAvLyBIZXJlIHlvdSBjYW4gc2V0IG9wdGlvbnMgdGhhdCBhcmUgcGFzc2VkIHRvIHRoZSBsYXVuY2hQdXBwZXRlZXIoKSBmdW5jdGlvbi5cXG4gICAgbGF1bmNoQ29udGV4dDoge1xcbiAgICAgICAgbGF1bmNoT3B0aW9uczoge1xcbiAgICAgICAgICAgIGhlYWRsZXNzOiB0cnVlLFxcbiAgICAgICAgICAgIC8vIE90aGVyIFB1cHBldGVlciBvcHRpb25zXFxuICAgICAgICB9LFxcbiAgICB9LFxcblxcbiAgICAvLyBTdG9wIGNyYXdsaW5nIGFmdGVyIHNldmVyYWwgcGFnZXNcXG4gICAgbWF4UmVxdWVzdHNQZXJDcmF3bDogNTAsXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gd2lsbCBiZSBjYWxsZWQgZm9yIGVhY2ggVVJMIHRvIGNyYXdsLlxcbiAgICAvLyBIZXJlIHlvdSBjYW4gd3JpdGUgdGhlIFB1cHBldGVlciBzY3JpcHRzIHlvdSBhcmUgZmFtaWxpYXIgd2l0aCxcXG4gICAgLy8gd2l0aCB0aGUgZXhjZXB0aW9uIHRoYXQgYnJvd3NlcnMgYW5kIHBhZ2VzIGFyZSBhdXRvbWF0aWNhbGx5IG1hbmFnZWQgYnkgdGhlIEFwaWZ5IFNESy5cXG4gICAgLy8gVGhlIGZ1bmN0aW9uIGFjY2VwdHMgYSBzaW5nbGUgcGFyYW1ldGVyLCB3aGljaCBpcyBhbiBvYmplY3Qgd2l0aCB0aGUgZm9sbG93aW5nIGZpZWxkczpcXG4gICAgLy8gLSByZXF1ZXN0OiBhbiBpbnN0YW5jZSBvZiB0aGUgUmVxdWVzdCBjbGFzcyB3aXRoIGluZm9ybWF0aW9uIHN1Y2ggYXMgVVJMIGFuZCBIVFRQIG1ldGhvZFxcbiAgICAvLyAtIHBhZ2U6IFB1cHBldGVlcidzIFBhZ2Ugb2JqZWN0IChzZWUgaHR0cHM6Ly9wcHRyLmRldi8jc2hvdz1hcGktY2xhc3MtcGFnZSlcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFByb2Nlc3NpbmcgJHtyZXF1ZXN0LnVybH0uLi5gKTtcXG5cXG4gICAgICAgIC8vIEEgZnVuY3Rpb24gdG8gYmUgZXZhbHVhdGVkIGJ5IFB1cHBldGVlciB3aXRoaW4gdGhlIGJyb3dzZXIgY29udGV4dC5cXG4gICAgICAgIGNvbnN0IGRhdGEgPSBhd2FpdCBwYWdlLiQkZXZhbCgnLmF0aGluZycsICgkcG9zdHMpID0-IHtcXG4gICAgICAgICAgICBjb25zdCBzY3JhcGVkRGF0YSA9IFtdO1xcblxcbiAgICAgICAgICAgIC8vIFdlJ3JlIGdldHRpbmcgdGhlIHRpdGxlLCByYW5rIGFuZCBVUkwgb2YgZWFjaCBwb3N0IG9uIEhhY2tlciBOZXdzLlxcbiAgICAgICAgICAgICRwb3N0cy5mb3JFYWNoKCgkcG9zdCkgPT4ge1xcbiAgICAgICAgICAgICAgICBzY3JhcGVkRGF0YS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAkcG9zdC5xdWVyeVNlbGVjdG9yKCcudGl0bGUgYScpLmlubmVyVGV4dCxcXG4gICAgICAgICAgICAgICAgICAgIHJhbms6ICRwb3N0LnF1ZXJ5U2VsZWN0b3IoJy5yYW5rJykuaW5uZXJUZXh0LFxcbiAgICAgICAgICAgICAgICAgICAgaHJlZjogJHBvc3QucXVlcnlTZWxlY3RvcignLnRpdGxlIGEnKS5ocmVmLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICByZXR1cm4gc2NyYXBlZERhdGE7XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHRzIHRvIHRoZSBkZWZhdWx0IGRhdGFzZXQuXFxuICAgICAgICBhd2FpdCBBY3Rvci5wdXNoRGF0YShkYXRhKTtcXG5cXG4gICAgICAgIC8vIEZpbmQgYSBsaW5rIHRvIHRoZSBuZXh0IHBhZ2UgYW5kIGVucXVldWUgaXQgaWYgaXQgZXhpc3RzLlxcbiAgICAgICAgY29uc3QgaW5mb3MgPSBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHNlbGVjdG9yOiAnLm1vcmVsaW5rJyxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgaWYgKGluZm9zLmxlbmd0aCA9PT0gMCkgY29uc29sZS5sb2coYCR7cmVxdWVzdC51cmx9IGlzIHRoZSBsYXN0IHBhZ2UhYCk7XFxuICAgIH0sXFxuXFxuICAgIC8vIFRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIGlmIHRoZSBwYWdlIHByb2Nlc3NpbmcgZmFpbGVkIG1vcmUgdGhhbiBtYXhSZXF1ZXN0UmV0cmllcysxIHRpbWVzLlxcbiAgICBmYWlsZWRSZXF1ZXN0SGFuZGxlcih7IHJlcXVlc3QgfSkge1xcbiAgICAgICAgY29uc29sZS5sb2coYFJlcXVlc3QgJHtyZXF1ZXN0LnVybH0gZmFpbGVkIHRvbyBtYW55IHRpbWVzLmApO1xcbiAgICB9LFxcbn0pO1xcblxcbi8vIFJ1biB0aGUgY3Jhd2xlciBhbmQgd2FpdCBmb3IgaXQgdG8gZmluaXNoLlxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly9uZXdzLnljb21iaW5hdG9yLmNvbS8nXSk7XFxuXFxuY29uc29sZS5sb2coJ0NyYXdsZXIgZmluaXNoZWQuJyk7XFxuXFxuYXdhaXQgQWN0b3IuZXhpdCgpO1xcblwifSIsIm9wdGlvbnMiOnsiYnVpbGQiOiJsYXRlc3QiLCJjb250ZW50VHlwZSI6ImFwcGxpY2F0aW9uL2pzb247IGNoYXJzZXQ9dXRmLTgiLCJtZW1vcnkiOjQwOTYsInRpbWVvdXQiOjE4MH19.88cqtP3DJA1811DUd2fOqdjsLFRPvz91Pi_WHe8Yt5U&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Create an instance of the PuppeteerCrawler class - a crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// that automatically loads the URLs in headless Chrome / Puppeteer.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can set options that are passed to the launchPuppeteer() function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Other Puppeteer options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Stop crawling after several pages</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">50</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function will be called for each URL to crawl.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Here you can write the Puppeteer scripts you are familiar with,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// with the exception that browsers and pages are automatically managed by the Apify SDK.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The function accepts a single parameter, which is an object with the following fields:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - request: an instance of the Request class with information such as URL and HTTP method</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Processing </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">...</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// A function to be evaluated by Puppeteer within the browser context.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> data </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.athing'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$posts</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> scrapedData </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We're getting the title, rank and URL of each post on Hacker News.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> $posts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">$post</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> title</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> rank</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.rank'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">innerText</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> href</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> $post</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">querySelector</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'.title a'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">href</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> scrapedData</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Store the results to the default dataset.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">data</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Find a link to the next page and enqueue it if it exists.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> infos </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> selector</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'.morelink'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">infos</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">length </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is the last page!</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This function is called if the page processing failed more than maxRequestRetries+1 times.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">failedRequestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Request </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> failed too many times.</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Run the crawler and wait for it to finish.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://news.ycombinator.com/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawler finished.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_crawler.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/capture-screenshot"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Capture a screenshot using Puppeteer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/puppeteer-recursive-crawl.html b/docs/next/examples/puppeteer-recursive-crawl.html index c6ef92571f..2dcececbf7 100644 --- a/docs/next/examples/puppeteer-recursive-crawl.html +++ b/docs/next/examples/puppeteer-recursive-crawl.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_recursive_crawl.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-recursive-crawl">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-recursive-crawl">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-recursive-crawl">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-recursive-crawl">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-recursive-crawl">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer recursive crawl</h1></header><p>Run the following example to perform a recursive crawl of a website using <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgYXN5bmMgcmVxdWVzdEhhbmRsZXIoeyByZXF1ZXN0LCBwYWdlLCBlbnF1ZXVlTGlua3MgfSkge1xcbiAgICAgICAgY29uc3QgdGl0bGUgPSBhd2FpdCBwYWdlLnRpdGxlKCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgVGl0bGUgb2YgJHtyZXF1ZXN0LnVybH06ICR7dGl0bGV9YCk7XFxuXFxuICAgICAgICBhd2FpdCBlbnF1ZXVlTGlua3Moe1xcbiAgICAgICAgICAgIHBzZXVkb1VybHM6IFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvWy4qXSddLFxcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIG1heFJlcXVlc3RzUGVyQ3Jhd2w6IDEwLFxcbn0pO1xcblxcbmF3YWl0IGNyYXdsZXIucnVuKFsnaHR0cHM6Ly93d3cuaWFuYS5vcmcvJ10pO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.8btSf7N11TyAU4POBztQTOCmNYkaZxZ9FeoCUoRa5YE&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">url</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> pseudoUrls</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/[.*]'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> maxRequestsPerCrawl</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">10</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://www.iana.org/'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_recursive_crawl.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/puppeteer-crawler"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer crawler</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Puppeteer with proxy</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/examples/puppeteer-with-proxy.html b/docs/next/examples/puppeteer-with-proxy.html index 343d8d95d4..32b5e9cb89 100644 --- a/docs/next/examples/puppeteer-with-proxy.html +++ b/docs/next/examples/puppeteer-with-proxy.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-with-proxy">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>.</p><p>To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your account from the SDK.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_with_proxy.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/examples/puppeteer-with-proxy">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/examples/puppeteer-with-proxy">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/examples/puppeteer-with-proxy">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/examples/puppeteer-with-proxy">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/accept-user-input">Accept user input</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/add-data-to-dataset">Add data to dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/basic-crawler">Basic crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/call-actor">Call actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-all-links">Crawl all links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-multiple-urls">Crawl multiple URLs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-relative-links">Crawl a website with relative links</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-single-url">Crawl a single URL</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-sitemap">Crawl a sitemap</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/crawl-some-links">Crawl some links on a website</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/forms">Forms</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/map-and-reduce">Dataset Map and Reduce methods</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/playwright-crawler">Playwright crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/capture-screenshot">Capture a screenshot using Puppeteer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-crawler">Puppeteer crawler</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl">Puppeteer recursive crawl</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/examples/puppeteer-with-proxy">Puppeteer with proxy</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/examples/puppeteer-with-proxy">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/examples"><span itemprop="name">Examples</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Puppeteer with proxy</h1></header><p>This example demonstrates how to load pages in headless Chrome / Puppeteer over <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy</a>.</p><p>To make it work, you'll need an Apify account with access to the proxy. Visit the <a href="/sdk/js/docs/guides/apify-platform">Apify platform introduction</a> to find how to log into your account from the SDK.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_S0QG"><p>To run this example on the Apify Platform, select the <code>apify/actor-node-puppeteer-chrome</code> image for your Dockerfile.</p></div></div><div class="container_Hlvv runnable-code-block"><a href="https://console.apify.com/actors/7tWSD8hrYzuc9Lte7?runConfig=eyJ1IjoiRWdQdHczb2VqNlRhRHQ1cW4iLCJ2IjoxfQ.eyJpbnB1dCI6IntcImNvZGVcIjpcImltcG9ydCB7IEFjdG9yIH0gZnJvbSAnYXBpZnknO1xcbmltcG9ydCB7IFB1cHBldGVlckNyYXdsZXIgfSBmcm9tICdjcmF3bGVlJztcXG5cXG5hd2FpdCBBY3Rvci5pbml0KCk7XFxuXFxuLy8gUHJveHkgY29ubmVjdGlvbiBpcyBhdXRvbWF0aWNhbGx5IGVzdGFibGlzaGVkIGluIHRoZSBDcmF3bGVyXFxuY29uc3QgcHJveHlDb25maWd1cmF0aW9uID0gYXdhaXQgQWN0b3IuY3JlYXRlUHJveHlDb25maWd1cmF0aW9uKCk7XFxuXFxuY29uc3QgY3Jhd2xlciA9IG5ldyBQdXBwZXRlZXJDcmF3bGVyKHtcXG4gICAgcHJveHlDb25maWd1cmF0aW9uLFxcbiAgICBhc3luYyByZXF1ZXN0SGFuZGxlcih7IHBhZ2UgfSkge1xcbiAgICAgICAgY29uc3Qgc3RhdHVzID0gYXdhaXQgcGFnZS4kZXZhbCgndGQuc3RhdHVzJywgKGVsKSA9PiBlbC50ZXh0Q29udGVudCk7XFxuICAgICAgICBjb25zb2xlLmxvZyhgUHJveHkgU3RhdHVzOiAke3N0YXR1c31gKTtcXG4gICAgfSxcXG59KTtcXG5cXG5jb25zb2xlLmxvZygnUnVubmluZyBQdXBwZXRlZXIgc2NyaXB0Li4uJyk7XFxuXFxuYXdhaXQgY3Jhd2xlci5ydW4oWydodHRwOi8vcHJveHkuYXBpZnkuY29tJ10pO1xcblxcbmNvbnNvbGUubG9nKCdQdXBwZXRlZXIgY2xvc2VkLicpO1xcblxcbmF3YWl0IEFjdG9yLmV4aXQoKTtcXG5cIn0iLCJvcHRpb25zIjp7ImJ1aWxkIjoibGF0ZXN0IiwiY29udGVudFR5cGUiOiJhcHBsaWNhdGlvbi9qc29uOyBjaGFyc2V0PXV0Zi04IiwibWVtb3J5Ijo0MDk2LCJ0aW1lb3V0IjoxODB9fQ.Z2NfopKj1DbaGy58OZ3N2Og8hM7AvkFTeEbBFCwOtGk&asrc=run_on_apify" target="_blank" rel="follow" class="button_JNna">Run on<svg width="91" height="25" viewBox="0 0 91 25" fill="none" xmlns="http://www.w3.org/2000/svg" class="apify-logo-light alignMiddle_src-theme-Footer-index-module"><path d="M3.135 2.85A3.409 3.409 0 0 0 .227 6.699l2.016 14.398 8.483-19.304-7.59 1.059Z" fill="#97D700"></path><path d="M23.604 14.847 22.811 3.78a3.414 3.414 0 0 0-3.64-3.154c-.077 0-.153.014-.228.025l-3.274.452 7.192 16.124c.54-.67.805-1.52.743-2.379Z" fill="#71C5E8"></path><path d="M5.336 24.595c.58.066 1.169-.02 1.706-.248l12.35-5.211L13.514 5.97 5.336 24.595Z" fill="#FF9013"></path><path d="M33.83 5.304h3.903l5.448 14.623h-3.494l-1.022-2.994h-5.877l-1.025 2.994h-3.384L33.83 5.304Zm-.177 9.032h4.14l-2-5.994h-.086l-2.054 5.994ZM58.842 5.304h3.302v14.623h-3.302V5.304ZM64.634 5.304h10.71v2.7h-7.4v4.101h5.962v2.632h-5.963v5.186h-3.309V5.303ZM82.116 14.38l-5.498-9.076h3.748l3.428 6.016h.085l3.599-6.016H91l-5.56 9.054v5.569h-3.324v-5.548ZM51.75 5.304h-7.292v14.623h3.3v-4.634h3.993a4.995 4.995 0 1 0 0-9.99Zm-.364 7.417h-3.628V7.875h3.627a2.423 2.423 0 0 1 0 4.846Z" class="apify-logo" fill="#000"></path></svg></a><div class="code-block no-title language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> PuppeteerCrawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Proxy connection is automatically established in the Crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> status </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">$eval</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'td.status'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">el</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> el</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">textContent</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Proxy Status: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">status</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Running Puppeteer script...'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'http://proxy.apify.com'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token builtin">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Puppeteer closed.'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/examples/puppeteer_with_proxy.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/puppeteer-recursive-crawl"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer recursive crawl</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides.html b/docs/next/guides.html index 2472cec468..581f090a60 100644 --- a/docs/next/guides.html +++ b/docs/next/guides.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/guides">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/docker-images">Running in Docker</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><header><h1 class="title_kItE">Guides</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/apify-platform"><h2 class="text--truncate cardTitle_rnsV" title="Apify Platform">📄️<!-- --> <!-- -->Apify Platform</h2><p class="text--truncate cardDescription_PWke" title="Apify platform - large-scale and high-performance web scraping">Apify platform - large-scale and high-performance web scraping</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/request-storage"><h2 class="text--truncate cardTitle_rnsV" title="Request Storage">📄️<!-- --> <!-- -->Request Storage</h2><p class="text--truncate cardDescription_PWke" title="The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the">The Apify SDK has several request storage types that are useful for specific tasks. The requests are stored either on local disk to a directory defined by the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/result-storage"><h2 class="text--truncate cardTitle_rnsV" title="Result Storage">📄️<!-- --> <!-- -->Result Storage</h2><p class="text--truncate cardDescription_PWke" title="The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the">The Apify SDK has several result storage types that are useful for specific tasks. The data is stored either on local disk to a directory defined by the</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/environment-variables"><h2 class="text--truncate cardTitle_rnsV" title="Environment Variables">📄️<!-- --> <!-- -->Environment Variables</h2><p class="text--truncate cardDescription_PWke" title="The following is a list of the environment variables used by Apify SDK that are available to the user.">The following is a list of the environment variables used by Apify SDK that are available to the user.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/proxy-management"><h2 class="text--truncate cardTitle_rnsV" title="Proxy Management">📄️<!-- --> <!-- -->Proxy Management</h2><p class="text--truncate cardDescription_PWke" title="IP address blocking is one of the oldest">IP address blocking is one of the oldest</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/session-management"><h2 class="text--truncate cardTitle_rnsV" title="Session Management">📄️<!-- --> <!-- -->Session Management</h2><p class="text--truncate cardDescription_PWke" title="&#8203;SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.">&#8203;SessionPool is a class that allows you to handle the rotation of proxy IP addresses along with cookies and other custom settings in Apify SDK.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/type-script-actor"><h2 class="text--truncate cardTitle_rnsV" title="TypeScript Actors">📄️<!-- --> <!-- -->TypeScript Actors</h2><p class="text--truncate cardDescription_PWke" title="Apify SDK supports TypeScript by covering public APIs with type declarations. This">Apify SDK supports TypeScript by covering public APIs with type declarations. This</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/guides/docker-images"><h2 class="text--truncate cardTitle_rnsV" title="Running in Docker">📄️<!-- --> <!-- -->Running in Docker</h2><p class="text--truncate cardDescription_PWke" title="Example Docker images to run your crawlers">Example Docker images to run your crawlers</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/apify-platform"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Apify Platform</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/apify-platform.html b/docs/next/guides/apify-platform.html index e5dc5d92c2..c33d4f57a8 100644 --- a/docs/next/guides/apify-platform.html +++ b/docs/next/guides/apify-platform.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -58,8 +58,8 @@ are available only to Apify Proxy users, mainly because Apify Proxy is what one would call a super-proxy. It's not a single proxy server, but an API endpoint that allows connection through millions of different IP addresses. So the class -essentially has two modes: Apify Proxy or Own (third party) proxy.</p><p>The difference is easy to remember.</p><ul><li>If you're using your own proxies - you should create an instance with the ProxyConfiguration <a href="/sdk/js/api/next/apify/class/ProxyConfiguration#constructor"><code>constructor</code></a> function based on the provided <a href="/sdk/js/api/next/apify/interface/ProxyConfigurationOptions"><code>ProxyConfigurationOptions</code></a>.</li><li>If you are planning to use Apify Proxy - you should create an instance using the <a href="https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration"><code>Actor.createProxyConfiguration()</code></a> function. <a href="/sdk/js/api/next/apify/interface/ProxyConfigurationOptions#proxyUrls"><code>ProxyConfigurationOptions.proxyUrls</code></a> and <a href="/sdk/js/api/next/apify/interface/ProxyConfigurationOptions#newUrlFunction"><code>ProxyConfigurationOptions.newUrlFunction</code></a> enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.</li></ul><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy docs</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/apify_platform.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guides</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-crawlee" class="table-of-contents__link toc-highlight">Logging into Apify platform from Crawlee</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li><li><a href="#log-in-with-configuration" class="table-of-contents__link toc-highlight">Log in with Configuration</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li><li><a href="#running-an-actor-locally" class="table-of-contents__link toc-highlight">Running an actor locally</a></li><li><a href="#running-crawlee-code-as-an-actor" class="table-of-contents__link toc-highlight">Running Crawlee code as an actor</a></li><li><a href="#deploying-an-actor-to-apify-platform" class="table-of-contents__link toc-highlight">Deploying an actor to Apify platform</a></li><li><a href="#usage-on-apify-platform" class="table-of-contents__link toc-highlight">Usage on Apify platform</a></li><li><a href="#storages" class="table-of-contents__link toc-highlight">Storages</a><ul><li><a href="#helper-functions-for-default-key-value-store-and-dataset" class="table-of-contents__link toc-highlight">Helper functions for default Key-Value Store and Dataset</a></li><li><a href="#using-platform-storage-in-a-local-actor" class="table-of-contents__link toc-highlight">Using platform storage in a local actor</a></li><li><a href="#getting-public-url-of-an-item-in-the-platform-storage" class="table-of-contents__link toc-highlight">Getting public url of an item in the platform storage</a></li><li><a href="#exporting-dataset-data" class="table-of-contents__link toc-highlight">Exporting dataset data</a></li></ul></li><li><a href="#environment-variables" class="table-of-contents__link toc-highlight">Environment variables</a><ul><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_token-and-crawlee_storage_dir" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_TOKEN</code> and <code>CRAWLEE_STORAGE_DIR</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li><li><a href="#proxy-management" class="table-of-contents__link toc-highlight">Proxy management</a><ul><li><a href="#apify-proxy" class="table-of-contents__link toc-highlight">Apify Proxy</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#apify-proxy-vs-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Own proxies</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +essentially has two modes: Apify Proxy or Own (third party) proxy.</p><p>The difference is easy to remember.</p><ul><li>If you're using your own proxies - you should create an instance with the ProxyConfiguration <a href="/sdk/js/api/next/apify/class/ProxyConfiguration#constructor"><code>constructor</code></a> function based on the provided <a href="/sdk/js/api/next/apify/interface/ProxyConfigurationOptions"><code>ProxyConfigurationOptions</code></a>.</li><li>If you are planning to use Apify Proxy - you should create an instance using the <a href="https://sdk.apify.com/api/apify/class/Actor#createProxyConfiguration"><code>Actor.createProxyConfiguration()</code></a> function. <a href="/sdk/js/api/next/apify/interface/ProxyConfigurationOptions#proxyUrls"><code>ProxyConfigurationOptions.proxyUrls</code></a> and <a href="/sdk/js/api/next/apify/interface/ProxyConfigurationOptions#newUrlFunction"><code>ProxyConfigurationOptions.newUrlFunction</code></a> enable use of your custom proxy URLs, whereas all the other options are there to configure Apify Proxy.</li></ul><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/proxy" target="_blank" rel="noopener">Apify Proxy docs</a></li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/apify_platform.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Guides</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/request-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Request Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#logging-into-apify-platform-from-crawlee" class="table-of-contents__link toc-highlight">Logging into Apify platform from Crawlee</a><ul><li><a href="#log-in-with-cli" class="table-of-contents__link toc-highlight">Log in with CLI</a></li><li><a href="#log-in-with-environment-variables" class="table-of-contents__link toc-highlight">Log in with environment variables</a></li><li><a href="#log-in-with-configuration" class="table-of-contents__link toc-highlight">Log in with Configuration</a></li></ul></li><li><a href="#what-is-an-actor" class="table-of-contents__link toc-highlight">What is an actor</a></li><li><a href="#running-an-actor-locally" class="table-of-contents__link toc-highlight">Running an actor locally</a></li><li><a href="#running-crawlee-code-as-an-actor" class="table-of-contents__link toc-highlight">Running Crawlee code as an actor</a></li><li><a href="#deploying-an-actor-to-apify-platform" class="table-of-contents__link toc-highlight">Deploying an actor to Apify platform</a></li><li><a href="#usage-on-apify-platform" class="table-of-contents__link toc-highlight">Usage on Apify platform</a></li><li><a href="#storages" class="table-of-contents__link toc-highlight">Storages</a><ul><li><a href="#helper-functions-for-default-key-value-store-and-dataset" class="table-of-contents__link toc-highlight">Helper functions for default Key-Value Store and Dataset</a></li><li><a href="#using-platform-storage-in-a-local-actor" class="table-of-contents__link toc-highlight">Using platform storage in a local actor</a></li><li><a href="#getting-public-url-of-an-item-in-the-platform-storage" class="table-of-contents__link toc-highlight">Getting public url of an item in the platform storage</a></li><li><a href="#exporting-dataset-data" class="table-of-contents__link toc-highlight">Exporting dataset data</a></li></ul></li><li><a href="#environment-variables" class="table-of-contents__link toc-highlight">Environment variables</a><ul><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_token-and-crawlee_storage_dir" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_TOKEN</code> and <code>CRAWLEE_STORAGE_DIR</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li><li><a href="#proxy-management" class="table-of-contents__link toc-highlight">Proxy management</a><ul><li><a href="#apify-proxy" class="table-of-contents__link toc-highlight">Apify Proxy</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#apify-proxy-vs-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Own proxies</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/docker-images.html b/docs/next/guides/docker-images.html index 29a5ec6f97..6a2e78a485 100644 --- a/docs/next/guides/docker-images.html +++ b/docs/next/guides/docker-images.html @@ -9,15 +9,15 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/guides/docker-images">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/docker-images">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/docker-images">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/docker-images">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/docker-images">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/apify-platform">Apify Platform</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/request-storage">Request Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/result-storage">Result Storage</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/environment-variables">Environment Variables</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/proxy-management">Proxy Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/session-management">Session Management</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/guides/type-script-actor">TypeScript Actors</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/guides/docker-images">Running in Docker</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/guides/docker-images">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/guides"><span itemprop="name">Guides</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Running in Docker</h1></header><p>Running headless browsers in Docker requires a lot of setup to do it right. But there's no need to worry about that, because we already created base images that you can freely use. We use them every day on the <a href="/sdk/js/docs/next/guides/apify-platform">Apify Platform</a>.</p><p>All images can be found in their <a href="https://github.com/apify/apify-actor-docker" target="_blank" rel="noopener">GitHub repo</a> and in our <a href="https://hub.docker.com/orgs/apify" target="_blank" rel="noopener">DockerHub</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="overview">Overview<a href="#overview" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Browsers are pretty big, so we try to provide a wide variety of images to suit the specific needs. Here's a full list of our Docker images.</p><ul><li><a href="#actor-node"><code>apify/actor-node</code></a></li><li><a href="#actor-node-puppeteer-chrome"><code>apify/actor-node-puppeteer-chrome</code></a></li><li><a href="#actor-node-playwright"><code>apify/actor-node-playwright</code></a></li><li><a href="#actor-node-playwright-chrome"><code>apify/actor-node-playwright-chrome</code></a></li><li><a href="#actor-node-playwright-firefox"><code>apify/actor-node-playwright-firefox</code></a></li><li><a href="#actor-node-playwright-webkit"><code>apify/actor-node-playwright-webkit</code></a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="versioning">Versioning<a href="#versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Each image is tagged with up to 2 version tags, depending on the type of the image. One for Node.js version and second for pre-installed web automation library version. If you use the image name without a version tag, you'll always get the latest available version.</p><blockquote><p>We recommend always using at least the Node.js version tag in production Dockerfiles. It will ensure that a future update of Node.js will not break our automations.</p></blockquote><h3 class="anchor anchorWithStickyNavbar_LWe7" id="nodejs-versioning">Node.js versioning<a href="#nodejs-versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Our images are built with multiple Node.js versions to ensure backwards compatibility. Currently, Node.js <strong>versions 16 and 18 are supported</strong> (legacy versions still exist, see DockerHub). To select the preferred version, use the appropriate number as the image tag.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Use Node.js 16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="automation-library-versioning">Automation library versioning<a href="#automation-library-versioning" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Images that include a pre-installed automation library, which means all images that include <code>puppeteer</code> or <code>playwright</code> in their name, are also tagged with the pre-installed version of the library. For example, <code>apify/actor-node-puppeteer-chrome:16-13.7.0</code> comes with Node.js 16 and Puppeteer v13.7.0. If you try to install a different version of Puppeteer into this image, you may run into compatibility issues, because the Chromium version bundled with <code>puppeteer</code> will not match the version of Chromium that's pre-installed.</p><p>Similarly <code>apify/actor-node-playwright-firefox:14-1.21.1</code> runs on Node.js 14 and is pre-installed with the Firefox version that comes with v1.21.1.</p><p>Installing <code>apify/actor-node-puppeteer-chrome</code> (without a tag) will install the latest available version of Node.js and <code>puppeteer</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="pre-release-tags">Pre-release tags<a href="#pre-release-tags" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We also build pre-release versions of the images to test the changes we make. Those are typically denoted by a <code>beta</code> suffix, but it can vary depending on our needs. If you need to try a pre-release version, you can do it like this:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Without library version.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16-beta</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># With library version.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16-1.10.0-beta</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="best-practices">Best practices<a href="#best-practices" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Node.js version tag should <strong>always</strong> be used.</li><li>The automation library version tag should be used for <strong>added security</strong>.</li><li>Asterisk <code>*</code> should be used as the automation library version in our <code>package.json</code> files.</li></ul><p>It makes sure the pre-installed version of Puppeteer or Playwright is not re-installed on build. This is important, because those libraries are only guaranteed to work with specific versions of browsers, and those browsers come pre-installed in the image.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"dependencies"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"crawlee"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"^3.0.0"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"playwright"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="warning-about-image-size">Warning about image size<a href="#warning-about-image-size" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Browsers are huge. If you don't need them all in your image, it's better to use a smaller image with only the one browser you need.</p><p>You should also be careful when installing new dependencies. Nothing prevents you from installing Playwright into the<code>actor-node-puppeteer-chrome</code> image, but the resulting image will be about 3 times larger and extremely slow to download and build.</p><p>When you use only what you need, you'll be rewarded with reasonable build and start times.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-docker-images">Apify Docker Images<a href="#apify-docker-images" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node">actor-node<a href="#actor-node" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>This is the smallest image we have based on Alpine Linux. It does not include any browsers, and it's therefore best used with <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a>. It benefits from lightning fast builds and container startups.</p><p>​<a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>, <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a> and other browser based features will <strong>NOT</strong> work with this image.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-puppeteer-chrome">actor-node-puppeteer-chrome<a href="#actor-node-puppeteer-chrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>This image includes Puppeteer (Chromium) and the Chrome browser. It can be used with <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> and <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>, but <strong>NOT</strong> with <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>.</p><p>The image supports XVFB by default, so you can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-puppeteer-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright">actor-node-playwright<a href="#actor-node-playwright" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>A very large and slow image that can run all Playwright browsers: Chromium, Chrome, Firefox, WebKit. Everything is installed. If you need to develop or test with multiple browsers, this is the image to choose, but in most cases, it's better to use the specialized images below.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-chrome">actor-node-playwright-chrome<a href="#actor-node-playwright-chrome" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Similar to <a href="#actor-node-puppeteer-chrome"><code>actor-node-puppeteer-chrome</code></a>, but for Playwright. You can run <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a> and <a href="https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler" target="_blank" rel="noopener noreferrer"><code>PlaywrightCrawler</code></a>, but <strong>NOT</strong> <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a>.</p><p>It uses the <a href="https://playwright.dev/docs/api/environment-variables/" target="_blank" rel="noopener"><code>PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD</code></a> environment variable to block installation of more browsers into the image to keep it small. If you want more browsers, either use the <a href="#actor-node-playwright"><code>actor-node-playwright</code></a> image override this env var.</p><p>The image supports XVFB by default, so we can run both <code>headless</code> and <code>headful</code> browsers with it.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-firefox">actor-node-playwright-firefox<a href="#actor-node-playwright-firefox" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with Firefox pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-firefox:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="actor-node-playwright-webkit">actor-node-playwright-webkit<a href="#actor-node-playwright-webkit" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Same idea as <a href="#actor-node-playwright-chrome"><code>actor-node-playwright-chrome</code></a>, but with WebKit -pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example-dockerfile">Example Dockerfile<a href="#example-dockerfile" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>To use the above images, it's necessary to have a <a href="https://docs.docker.com/engine/reference/builder/" target="_blank" rel="noopener"><code>Dockerfile</code></a>. You can either use this example, or bootstrap your projects with the <a href="https://crawlee.dev/docs/introduction/setting-up" target="_blank" rel="noopener noreferrer">Crawlee CLI</a> which automatically adds the correct Dockerfile into our project folder.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Node+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Node+TypeScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+TypeScript</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in the <code>FROM</code> declaration.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in both <code>FROM</code> declarations.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction options"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> /home/myuser/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image. If you know you won't need headful browsers,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># you can remove the XVFB start script for a micro perf gain.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/docker_images.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#apify-docker-images" class="table-of-contents__link toc-highlight">Apify Docker Images</a><ul><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +pre-installed.</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-webkit:16</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="example-dockerfile">Example Dockerfile<a href="#example-dockerfile" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>To use the above images, it's necessary to have a <a href="https://docs.docker.com/engine/reference/builder/" target="_blank" rel="noopener"><code>Dockerfile</code></a>. You can either use this example, or bootstrap your projects with the <a href="https://crawlee.dev/docs/introduction/setting-up" target="_blank" rel="noopener noreferrer">Crawlee CLI</a> which automatically adds the correct Dockerfile into our project folder.</p><div class="tabs-container tabList__CuJ"><ul role="tablist" aria-orientation="horizontal" class="tabs"><li role="tab" tabindex="0" aria-selected="true" class="tabs__item tabItem_LNqP tabs__item--active">Node+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Node+TypeScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+JavaScript</li><li role="tab" tabindex="-1" aria-selected="false" class="tabs__item tabItem_LNqP">Browser+TypeScript</li></ul><div class="margin-top--md"><div role="tabpanel" class="tabItem_Ymn6"><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in the <code>FROM</code> declaration.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm start --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden="">This example is for Playwright. If you want to use Puppeteer, simply replace <b>playwright</b>with <b>puppeteer</b> in both <code>FROM</code> declarations.<div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># Specify the base Docker image. You can read more about</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># the available images at https://crawlee.dev/docs/guides/docker-images</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># You can also use any other image from Docker Hub.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies. Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev --audit=false</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the source files using the user set</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># in the base image.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install all dependencies and build the project.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Don't audit to speed up the installation.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node-playwright-chrome:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy only built JS files from builder image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction options"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> /home/myuser/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Copy just package.json and package-lock.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># to speed up the build using Docker layer cache.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Install NPM packages, skip optional and development dependencies to</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># keep the image small. Avoid logging too much and print the dependency</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># tree for debugging</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --omit=dev --omit=optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --omit=dev --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Next, copy the remaining files and directories with the source code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Since we do this after NPM install, quick build will be really fast</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># for most source file changes.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--chown</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">myuser</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># Run the image. If you know you won't need headful browsers,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># you can remove the XVFB start script for a micro perf gain.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> ./start_xvfb_and_run_cmd.sh && npm run start:prod --silent</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/docker_images.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/type-script-actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">TypeScript Actors</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/examples"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Examples</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li><li><a href="#versioning" class="table-of-contents__link toc-highlight">Versioning</a><ul><li><a href="#nodejs-versioning" class="table-of-contents__link toc-highlight">Node.js versioning</a></li><li><a href="#automation-library-versioning" class="table-of-contents__link toc-highlight">Automation library versioning</a></li><li><a href="#pre-release-tags" class="table-of-contents__link toc-highlight">Pre-release tags</a></li></ul></li><li><a href="#best-practices" class="table-of-contents__link toc-highlight">Best practices</a><ul><li><a href="#warning-about-image-size" class="table-of-contents__link toc-highlight">Warning about image size</a></li></ul></li><li><a href="#apify-docker-images" class="table-of-contents__link toc-highlight">Apify Docker Images</a><ul><li><a href="#actor-node" class="table-of-contents__link toc-highlight">actor-node</a></li><li><a href="#actor-node-puppeteer-chrome" class="table-of-contents__link toc-highlight">actor-node-puppeteer-chrome</a></li><li><a href="#actor-node-playwright" class="table-of-contents__link toc-highlight">actor-node-playwright</a></li><li><a href="#actor-node-playwright-chrome" class="table-of-contents__link toc-highlight">actor-node-playwright-chrome</a></li><li><a href="#actor-node-playwright-firefox" class="table-of-contents__link toc-highlight">actor-node-playwright-firefox</a></li><li><a href="#actor-node-playwright-webkit" class="table-of-contents__link toc-highlight">actor-node-playwright-webkit</a></li></ul></li><li><a href="#example-dockerfile" class="table-of-contents__link toc-highlight">Example Dockerfile</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/environment-variables.html b/docs/next/guides/environment-variables.html index 457edecbaa..18049b577a 100644 --- a/docs/next/guides/environment-variables.html +++ b/docs/next/guides/environment-variables.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -36,8 +36,8 @@ in the Apify Console. The password is automatically inferred using the <code>APIFY_TOKEN</code> env var, so in most cases, you don't need to touch it. You should use it when, for some reason, you need access to Apify Proxy, but no access to Apify API, or when you need access to -proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/environment_variables.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +proxy from a different account than your token represents.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/environment_variables.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/result-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Result Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/proxy-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Proxy Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#important-env-vars" class="table-of-contents__link toc-highlight">Important env vars</a><ul><li><a href="#apify_local_storage_dir" class="table-of-contents__link toc-highlight"><code>APIFY_LOCAL_STORAGE_DIR</code></a></li><li><a href="#apify_token" class="table-of-contents__link toc-highlight"><code>APIFY_TOKEN</code></a></li><li><a href="#combinations-of-apify_local_storage_dir-and-apify_token" class="table-of-contents__link toc-highlight">Combinations of <code>APIFY_LOCAL_STORAGE_DIR</code> and <code>APIFY_TOKEN</code></a></li></ul></li><li><a href="#convenience-env-vars" class="table-of-contents__link toc-highlight">Convenience env vars</a><ul><li><a href="#apify_headless" class="table-of-contents__link toc-highlight"><code>APIFY_HEADLESS</code></a></li><li><a href="#apify_log_level" class="table-of-contents__link toc-highlight"><code>APIFY_LOG_LEVEL</code></a></li><li><a href="#apify_memory_mbytes" class="table-of-contents__link toc-highlight"><code>APIFY_MEMORY_MBYTES</code></a></li><li><a href="#apify_proxy_password" class="table-of-contents__link toc-highlight"><code>APIFY_PROXY_PASSWORD</code></a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/proxy-management.html b/docs/next/guides/proxy-management.html index 4ac10c09f1..831003de10 100644 --- a/docs/next/guides/proxy-management.html +++ b/docs/next/guides/proxy-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -32,8 +32,8 @@ in the <a href="https://console.apify.com/proxy" target="_blank" rel="noopener">proxy dashboard</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="inspecting-current-proxy-in-crawlers">Inspecting current proxy in Crawlers<a href="#inspecting-current-proxy-in-crawlers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p><code>CheerioCrawler</code> and <code>PuppeteerCrawler</code> grant access to information about the currently used proxy in their <code>handlePageFunction</code> using a <a href="/sdk/js/api/next/apify/interface/ProxyInfo"><code>proxyInfo</code></a> object. With the object, you can easily access the proxy URL. If you're using Apify Proxy, the other -configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/proxy_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +configuration parameters will also be available in the <code>proxyInfo</code> object.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/proxy_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/environment-variables"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Environment Variables</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/session-management"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Session Management</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#quick-start" class="table-of-contents__link toc-highlight">Quick start</a></li><li><a href="#proxy-configuration" class="table-of-contents__link toc-highlight">Proxy Configuration</a><ul><li><a href="#crawler-integration" class="table-of-contents__link toc-highlight">Crawler integration</a></li><li><a href="#ip-rotation-and-session-management" class="table-of-contents__link toc-highlight">IP Rotation and session management</a></li></ul></li><li><a href="#apify-proxy-vs-your-own-proxies" class="table-of-contents__link toc-highlight">Apify Proxy vs. Your own proxies</a></li><li><a href="#apify-proxy-configuration" class="table-of-contents__link toc-highlight">Apify Proxy Configuration</a></li><li><a href="#inspecting-current-proxy-in-crawlers" class="table-of-contents__link toc-highlight">Inspecting current proxy in Crawlers</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/request-storage.html b/docs/next/guides/request-storage.html index 457b3e7346..12478b3597 100644 --- a/docs/next/guides/request-storage.html +++ b/docs/next/guides/request-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -18,8 +18,8 @@ <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable, or on the <a href="/sdk/js/docs/guides/apify-platform">Apify platform</a> under the user account identified by the API token defined by the <code>APIFY_TOKEN</code> environment variable. If neither of these variables is defined, by default Apify SDK sets <code>APIFY_LOCAL_STORAGE_DIR</code> to <code>./storage</code> in the current working directory and prints a warning.</p><p>Typically, you will be developing the code on your local computer and thus set the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable. Once the code is ready, you will deploy it to the Apify platform, where it will automatically set the <code>APIFY_TOKEN</code> environment variable and thus use cloud storage. No code changes are needed.</p><p><strong>Related links</strong></p><ul><li><a href="https://docs.apify.com/storage" target="_blank" rel="noopener">Apify platform storage documentation</a></li><li><a href="https://console.apify.com/storage" target="_blank" rel="noopener">View storage in Apify Console</a></li><li><a href="https://docs.apify.com/api/v2#/reference/request-queues" target="_blank" rel="noopener">Request queues API reference</a></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-queue">Request queue<a href="#request-queue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request queue is a storage of URLs to crawl. The queue is used for the deep crawling of websites, where you start with several URLs and then recursively follow links to other pages. The data structure supports both breadth-first and depth-first crawling orders.</p><p>Each actor run is associated with a <strong>default request queue</strong>, which is created exclusively for the actor run. Typically, it is used to store URLs to crawl in the specific actor run. Its usage is optional.</p><p>In Apify SDK, the request queue is represented by the <a href="/sdk/js/api/next/apify/class/RequestQueue"><code>RequestQueue</code></a> class.</p><p>In local configuration, the request queue is emulated by <a href="https://github.com/apify/apify-storage-local-js" target="_blank" rel="noopener">@apify/storage-local</a> NPM package and its data is stored in SQLite database in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">request_queues</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">QUEUE_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">db</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sqlite</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{QUEUE_ID}</code> is the name or ID of the request queue. The default queue has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code> environment variable.</p><p>The following code demonstrates basic operations of the request queue:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue associated with the actor run</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Enqueue the initial request</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https://example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> $</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request queue with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-crawler">Puppeteer Crawler</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="request-list">Request list<a href="#request-list" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The request list is not a storage per se - it represents the list of URLs to crawl that is stored in a run memory (or optionally in default <a href="/sdk/js/docs/next/guides/result-storage#key-value-store">Key-Value Store</a> associated with the run, if specified). The list is used for the crawling of a large number of URLs, when you know all the URLs which should be visited by the crawler and no URLs would be added during the run. The URLs can be provided either in code or parsed from a text file hosted on the web.</p><p>Request list is created exclusively for the actor run and only if its usage is explicitly specified in the code. Its usage is optional.</p><p>In Apify SDK, the request list is represented by the </p><div to="core/class/RequestList"><code>RequestList</code></div> class.<p></p><p>The following code demonstrates basic operations of the request list:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// List name is used to persist the sources and the list state in the key-value store</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> request </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Process the page (extract data, take page screenshot, etc).</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the request list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see more detailed example of how to use the request list with a crawler, see the <a href="/sdk/js/docs/examples/puppeteer-with-proxy">Puppeteer with proxy</a> example.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="which-one-to-choose">Which one to choose?<a href="#which-one-to-choose" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When using Request queue - you would normally have several start URLs (e.g. category pages on e-commerce website) and then recursively add more (e.g. individual item pages) programmatically to the queue, it supports dynamic adding and removing of requests. No more URLs can be added to Request list after its initialization as it is immutable, URLs cannot be removed from the list either.</p><p>On the other hand, the Request queue is not optimized for adding or removing numerous URLs in a batch. This is technically possible, but requests are added one by one to the queue, and thus it would take significant time with a larger number of requests. Request list however can contain even millions of URLs, and it would take significantly less time to add them to the list, compared to the queue.</p><p>Note that Request queue and Request list can be used together by the same crawler. In such cases, each request from the Request list is enqueued into the Request queue first (to the foremost position in the queue, even if Request queue is not empty) and then consumed from the latter. This is necessary to avoid the same URL being processed more than once (from the list first and then possibly from the queue). -In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/request_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +In practical terms, such a combination can be useful when there are numerous initial URLs, but more URLs would be added dynamically by the crawler.</p><p>The following code demonstrates how to use Request queue and Request list in the same crawler:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Prepare the sources array with URLs to visit (it can contain millions of URLs)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sources </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-1'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/page-3'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the request list</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestList </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestList</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-list'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> sources</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open the default request queue. It's not necessary to add any requests to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestQueue </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">RequestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// The crawler will automatically process requests from the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestList</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Each request from the request list is enqueued to the request queue one by one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// At this point request with the same URL would exist in the list and the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add new request to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">addRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'http://www.example.com/new-page'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Add links found on page to the queue</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> requestQueue </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// The requests above would be added to the queue (but not to the list)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and would be processed after the request list is empty.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No more requests could be added to the list here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/request_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/apify-platform"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Apify Platform</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/result-storage"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Result Storage</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#request-queue" class="table-of-contents__link toc-highlight">Request queue</a></li><li><a href="#request-list" class="table-of-contents__link toc-highlight">Request list</a></li><li><a href="#which-one-to-choose" class="table-of-contents__link toc-highlight">Which one to choose?</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/result-storage.html b/docs/next/guides/result-storage.html index 45a888c1a4..0633a8d9c4 100644 --- a/docs/next/guides/result-storage.html +++ b/docs/next/guides/result-storage.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -35,8 +35,8 @@ results specific for the actor run. Its usage is optional.</p><p>In the Apify SDK, the dataset is represented by the <a href="/sdk/js/api/next/apify/class/Dataset"><code>Dataset</code></a> class. In order to simplify writes to the default dataset, the SDK also provides the <a href="/sdk/js/api/next/apify/class/Actor#pushData"><code>Actor.pushData()</code></a> function.</p><p>In local configuration, the data is stored in the directory specified by the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable as follows:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">APIFY_LOCAL_STORAGE_DIR</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token plain">datasets</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">DATASET_ID</span><span class="token punctuation" style="color:#393A34">}</span><span class="token operator" style="color:#393A34">/</span><span class="token punctuation" style="color:#393A34">{</span><span class="token constant" style="color:#36acaa">INDEX</span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note that <code>{DATASET_ID}</code> is the name or ID of the dataset. The default dataset has ID <code>default</code>, unless you override it by setting the <code>APIFY_DEFAULT_DATASET_ID</code> environment variable. Each dataset item is stored as a separate JSON file, where <code>{INDEX}</code> is a zero-based index of the -item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/result_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +item in the dataset.</p><p>The following code demonstrates basic operations of the dataset:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Write a single row to the default dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col1</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Open a named dataset</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'some-name'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write a single row</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Write multiple rows</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'bar2'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col2</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'val2'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">col3</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>To see how to use the dataset to store crawler results, see the <a href="/sdk/js/docs/next/examples/cheerio-crawler">Cheerio Crawler</a> example.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/result_storage.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/request-storage"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Request Storage</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/environment-variables"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Environment Variables</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#key-value-store" class="table-of-contents__link toc-highlight">Key-value store</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight">Dataset</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/session-management.html b/docs/next/guides/session-management.html index 08baa7a090..784908283f 100644 --- a/docs/next/guides/session-management.html +++ b/docs/next/guides/session-management.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ Last but not least, another benefit is the even rotation of IP addresses - SessionPool picks the session randomly, which should prevent burning out a small pool of available IPs.</p><p>Now let's take a look at how to use a Session pool.</p><p><strong>Example usage in <a href="https://crawlee.dev/api/puppeteer-crawler/class/PuppeteerCrawler" target="_blank" rel="noopener noreferrer"><code>PuppeteerCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PuppeteerCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookies to page before navigation automatically.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in puppeteer pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="https://crawlee.dev/api/cheerio-crawler/class/CheerioCrawler" target="_blank" rel="noopener noreferrer"><code>CheerioCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Activates the Session pool.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Overrides default Session pool configuration.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Set to true if you want the crawler to save cookies per session,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// and set the cookie header to request automatically...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">persistCookiesPerSession</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handlePageFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> $</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">$</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"title"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Blocked"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">title </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Not sure if blocked, might also be a connection error"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// session.markGood() - this step is done automatically in BasicCrawler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example usage in <a href="https://crawlee.dev/api/basic-crawler/class/BasicCrawler" target="_blank" rel="noopener noreferrer"><code>BasicCrawler</code></a></strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> gotScraping </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> requestQueue</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Allows access to proxyInfo object in handleRequestFunction</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useSessionPool</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">sessionPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function-variable function" style="color:#d73a49">handleRequestFunction</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter">request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> session</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// To use the proxy IP session rotation logic, you must turn the proxy usage on.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> requestOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyUrl</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">throwHttpErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headers</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the cookieJar.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This way you get the Cookie headers string from session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">Cookie</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getCookieString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">let</span><span class="token plain"> response</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">requestOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">e </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"SomeNetworkError"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If a network error happens, such as timeout, socket hangup etc...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// There is usually a chance that it was just bad luck and the proxy works.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to throw it away.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">throw</span><span class="token plain"> e</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Automatically retires the session based on response HTTP status code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retireOnBlockedStatusCodes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">statusCode</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">body</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">blocked</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// You are sure it is blocked.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This will throw away the session.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Everything is ok, you can get the data.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// No need to call session.markGood -> BasicCrawler calls it for you.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you want to use the CookieJar in session you need.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setCookiesFromResponse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">response</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><strong>Example solo usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPoolOptions </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">maxPoolSize</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">100</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionPool </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">SessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">sessionPoolOptions</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Get session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> session </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> sessionPool</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getSession</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Increase the errorScore.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markBad</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Throw away the session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">retire</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Lower the errorScore and marks the session good.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> session</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">markGood</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These are the basics of configuring SessionPool. Please, bear in mind that a Session pool needs time to find working IPs and build up the pool, -so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/session_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +so you will probably see a lot of errors until it becomes stabilized.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/session_management.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/proxy-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Proxy Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/type-script-actor"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">TypeScript Actors</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/guides/type-script-actor.html b/docs/next/guides/type-script-actor.html index e7280954ca..c71a45223c 100644 --- a/docs/next/guides/type-script-actor.html +++ b/docs/next/guides/type-script-actor.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -30,8 +30,8 @@ return types, in the Apify SDK.</p><h1>Caveats</h1><p>As of version 1.0+, the generated typings, due to JSDoc limitations, have some properties and parameters annotated with <code>any</code> type, therefore the settings <code>noImplicitAny</code> and <code>strictNullChecks</code>, set to <code>true</code>, may not be advised. You may try enabling them, but it might hinder development because of the need for typecasts to be able to compile, your mileage may vary.</p><p>Besides the <em>implicit any</em> errors that might occur in the code when writing in TypeScript, the current typings doesn't offer generics that make outputs type-safe, so you need to declare your -types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/typescript_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +types, as such:</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">MySchema</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam1</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> expectedParam2</span><span class="token operator" style="color:#393A34">?</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> MySchema </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">any</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// getInput returns Promise<Object<string, *>|string|Buffer|null> here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token operator" style="color:#393A34">!</span><span class="token plain">input</span><span class="token operator" style="color:#393A34">?.</span><span class="token plain">expectedParam1</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// input is MySchema now and you can check in a type-safe way</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">throw</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Missing expectedParam1'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>There are also other places where you need to explicitly provide your interface / type, like in Dataset iterators (<code>map</code>, <code>reduce</code>, <code>forEach</code>):</p><div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">interface</span><span class="token plain"> </span><span class="token class-name">ExpectedShape</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> id</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token builtin">string</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> someFields</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Fields</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> dataset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">openDataset</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> dataset</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">forEach</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">item</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> ExpectedShape</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// deal with item.id / item.someFields</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// otherwise item is "any"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/guides/typescript_actor.mdx" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/guides/session-management"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Session Management</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/guides/docker-images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Running in Docker</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/readme/introduction.html b/docs/next/readme/introduction.html index ebddf8f29b..848f44ea65 100644 --- a/docs/next/readme/introduction.html +++ b/docs/next/readme/introduction.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ The SDK is available as the <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> NPM package. It can be used either stand-alone in your own applications or in <a href="https://docs.apify.com/actor" target="_blank" rel="noopener">actors</a> -running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/readme/overview.html b/docs/next/readme/overview.html index db6d981227..1d21af77f1 100644 --- a/docs/next/readme/overview.html +++ b/docs/next/readme/overview.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ records or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs or to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.</p></li></ul><p>Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus take advantage of its pool of proxies, job scheduler, data storage, etc. -For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/readme/support.html b/docs/next/readme/support.html index 8104da7228..1a15878f8f 100644 --- a/docs/next/readme/support.html +++ b/docs/next/readme/support.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ For contribution guidelines and the code of conduct, see <a href="https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-js/blob/master/LICENSE.md" target="_blank" rel="noopener">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener">Chema Balsas</a> for giving up the <code>apify</code> package name -on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/upgrading.html b/docs/next/upgrading.html index 7805534d5d..0774c13376 100644 --- a/docs/next/upgrading.html +++ b/docs/next/upgrading.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/upgrading">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><header><h1 class="title_kItE">Upgrading</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/upgrading/upgrading-to-v1"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v1">📄️<!-- --> <!-- -->Upgrading to v1</h2><p class="text--truncate cardDescription_PWke" title="Summary">Summary</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/upgrading/upgrading-to-v2"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v2">📄️<!-- --> <!-- -->Upgrading to v2</h2><p class="text--truncate cardDescription_PWke" title="- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.">- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/next/upgrading/upgrading-to-v3"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v3">📄️<!-- --> <!-- -->Upgrading to v3</h2><p class="text--truncate cardDescription_PWke" title="This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.">This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v1</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/upgrading/upgrading-to-v1.html b/docs/next/upgrading/upgrading-to-v1.html index 920b0c715d..7775e44b47 100644 --- a/docs/next/upgrading/upgrading-to-v1.html +++ b/docs/next/upgrading/upgrading-to-v1.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -81,8 +81,8 @@ the functions also have access to the <code>crawlingContext</code> of the <code>request</code> that triggered the launch.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> preLaunchHooks </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">maybeLaunchChrome</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">pageId</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> launchContext</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">crawlingContexts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">pageId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">userData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">useHeadful</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">launchOptions</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headless</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="launch-functions">Launch functions<a href="#launch-functions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In addition to <code>Apify.launchPuppeteer()</code> we now also have <code>Apify.launchPlaywright()</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="updated-arguments">Updated arguments<a href="#updated-arguments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We <a href="#launchpuppeteeroptions--launchcontext">updated the launch options object</a> because it was a frequent source of confusion.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// OLD</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// NEW</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-modules">Custom modules<a href="#custom-modules" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><code>Apify.launchPuppeteer</code> already supported the <code>puppeteerModule</code> option. With Playwright, we normalized the name to <code>launcher</code> because the <code>playwright</code> module itself does not -launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v2</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v2</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/upgrading/upgrading-to-v2.html b/docs/next/upgrading/upgrading-to-v2.html index 513abb1ffb..bd8a999b10 100644 --- a/docs/next/upgrading/upgrading-to-v2.html +++ b/docs/next/upgrading/upgrading-to-v2.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v2">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v2">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v2</h1></header><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v2.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v2">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v2">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v2</h1></header><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v2.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/next/upgrading/upgrading-to-v3.html b/docs/next/upgrading/upgrading-to-v3.html index 6bb3a3a439..c94e5d4d4c 100644 --- a/docs/next/upgrading/upgrading-to-v3.html +++ b/docs/next/upgrading/upgrading-to-v3.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v3">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v3">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v3</h1></header><p>This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Crawlee vs Apify SDK v2</div><div class="admonitionContent_S0QG"><p>Up until version 3 of <code>apify</code>, the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:</p><ul><li><a href="https://github.com/apify/crawlee" target="_blank" rel="noopener">Crawlee</a>, the new web-scraping library, available as <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package on NPM</li><li><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener">Apify SDK</a>, helpers for the Apify platform, available as <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> package on NPM</li></ul></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawlee-monorepo">Crawlee monorepo<a href="#crawlee-monorepo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package consists of several smaller packages, released separately under <code>@crawlee</code> namespace:</p><ul><li><code>@crawlee/core</code>: the base for all the crawler implementations, also contains things like <code>Request</code>, <code>RequestQueue</code>, <code>RequestList</code> or <code>Dataset</code> classes</li><li><code>@crawlee/basic</code>: exports <code>BasicCrawler</code></li><li><code>@crawlee/http</code>: exports <code>HttpCrawler</code> (which is used for creating <code>@crawlee/dom</code> and <code>@crawlee/cheerio</code>)</li><li><code>@crawlee/dom</code>: exports <code>DOMCrawler</code></li><li><code>@crawlee/cheerio</code>: exports <code>CheerioCrawler</code></li><li><code>@crawlee/browser</code>: exports <code>BrowserCrawler</code> (which is used for creating <code>@crawlee/playwright</code> and <code>@crawlee/puppeteer</code>)</li><li><code>@crawlee/playwright</code>: exports <code>PlaywrightCrawler</code></li><li><code>@crawlee/puppeteer</code>: exports <code>PuppeteerCrawler</code></li><li><code>@crawlee/memory-storage</code>: <code>@apify/storage-local</code> alternative</li><li><code>@crawlee/browser-pool</code>: previously <code>browser-pool</code> package</li><li><code>@crawlee/utils</code>: utility methods</li><li><code>@crawlee/types</code>: holds TS interfaces mainly about the <code>StorageClient</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installing-crawlee">Installing Crawlee<a href="#installing-crawlee" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. <code>@crawlee/playwright</code> if you plan on using <code>playwright</code> - it already contains everything from the <code>@crawlee/browser</code> package, which includes everything from <code>@crawlee/basic</code>, which includes everything from <code>@crawlee/core</code>.</p><p>If we don't care much about additional code being pulled in, we can just use the <code>crawlee</code> meta-package, which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Or if all we need is cheerio support, we can install only <code>@crawlee/cheerio</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> @crawlee/cheerio</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When using <code>playwright</code> or <code>puppeteer</code>, we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee playwright</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or npm install @crawlee/playwright playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Alternatively we can also use the <code>crawlee</code> meta-package which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><blockquote><p>Sometimes you might want to use some utility methods from <code>@crawlee/utils</code>, so you might want to install that as well. This package contains some utilities that were previously available under <code>Apify.utils</code>. Browser related utilities can be also found in the crawler packages (e.g. <code>@crawlee/playwright</code>).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="full-typescript-support">Full TypeScript support<a href="#full-typescript-support" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from <code>@apify/tsconfig</code> package. Don't forget to set the <code>module</code> and <code>target</code> to <code>ES2022</code> or above to be able to use top level await.</p><blockquote><p>The <code>@apify/tsconfig</code> config has <a href="https://www.typescriptlang.org/tsconfig#noImplicitAny" target="_blank" rel="noopener"><code>noImplicitAny</code></a> enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.</p></blockquote><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">tsconfig.json</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"extends"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"@apify/tsconfig"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"compilerOptions"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"module"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"target"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"outDir"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"dist"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"lib"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"DOM"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"include"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./src/**/*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="docker-build">Docker build<a href="#docker-build" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>For <code>Dockerfile</code> we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Dockerfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># using multistage build, as we need dev deps to build the TS source code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy all files, install all dependencies (including dev deps) and build the project</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy only necessary files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/README.md ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/apify.json ./apify.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># install only prod deps</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --only=prod --no-optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --only=prod --no-optional --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># run compiled code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="browser-fingerprints">Browser fingerprints<a href="#browser-fingerprints" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously we had a magical <code>stealth</code> option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints.</p><p>In case we don't want to have dynamic fingerprints, we can disable this behaviour via <code>useFingerprints</code> in <code>browserPoolOptions</code>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="session-cookie-method-renames">Session cookie method renames<a href="#session-cookie-method-renames" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call <code>session.getPuppeteerCookies()</code> or <code>session.setPuppeteerCookies()</code>. Since this method could be used for any of our crawlers, not just <code>PuppeteerCrawler</code>, the methods have been renamed to <code>session.getCookies()</code> and <code>session.setCookies()</code> respectively. Otherwise, their usage is exactly the same!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="memory-storage">Memory storage<a href="#memory-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When we store some data or intermediate state (like the one <code>RequestQueue</code> holds), we now use <code>@crawlee/memory-storage</code> by default. It is an alternative to the <code>@apify/storage-local</code>, that stores the state inside memory (as opposed to SQLite database used by <code>@apify/storage-local</code>). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the <code>INPUT.json</code> file).</p><p>When we want to run the crawler on Apify platform, we need to use <code>Actor.init</code> or <code>Actor.main</code>, which will automatically switch the storage client to <code>ApifyClient</code> when on the Apify platform.</p><p>We can still use the <code>@apify/storage-local</code>, to do it, first install it pass it to the <code>Actor.init</code> or <code>Actor.main</code> options:</p><blockquote><p><code>@apify/storage-local</code> v2.1.0+ is required for Crawlee</p></blockquote><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> ApifyStorageLocal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@apify/storage-local'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> storage </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">ApifyStorageLocal</span><span class="token punctuation" style="color:#393A34">(</span><span class="token comment" style="color:#999988;font-style:italic">/* options like `enableWalMode` belong here */</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> storage </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="purging-of-the-default-storage">Purging of the default storage<a href="#purging-of-the-default-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously the state was preserved between local runs, and we had to use <code>--purge</code> argument of the <code>apify-cli</code>. With Crawlee, this is now the default behaviour, we purge the storage automatically on <code>Actor.init/main</code> call. We can opt out of it via <code>purge: false</code> in the <code>Actor.init</code> options.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-crawler-options-and-interfaces">Renamed crawler options and interfaces<a href="#renamed-crawler-options-and-interfaces" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level.</p><ul><li><code>handleRequestFunction</code> -> <code>requestHandler</code></li><li><code>handlePageFunction</code> -> <code>requestHandler</code></li><li><code>handleRequestTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>handlePageTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>requestTimeoutSecs</code> -> <code>navigationTimeoutSecs</code></li><li><code>handleFailedRequestFunction</code> -> <code>failedRequestHandler</code></li></ul><p>We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:</p><ul><li><code>CheerioHandlePageInputs</code> -> <code>CheerioCrawlingContext</code></li><li><code>PlaywrightHandlePageFunction</code> -> <code>PlaywrightCrawlingContext</code></li><li><code>PuppeteerHandlePageFunction</code> -> <code>PuppeteerCrawlingContext</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="context-aware-helpers">Context aware helpers<a href="#context-aware-helpers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some utilities previously available under <code>Apify.utils</code> namespace are now moved to the crawling context and are <em>context aware</em>. This means they have some parameters automatically filled in from the context, like the current <code>Request</code> instance or current <code>Page</code> object, or the <code>RequestQueue</code> bound to the crawler.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enqueuing-links">Enqueuing links<a href="#enqueuing-links" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>One common helper that received more attention is the <code>enqueueLinks</code>. As mentioned above, it is context aware - we no longer need pass in the <code>requestQueue</code> or <code>page</code> arguments (or the cheerio handle <code>$</code>). In addition to that, it now offers 3 enqueuing strategies:</p><ul><li><code>EnqueueStrategy.All</code> (<code>'all'</code>): Matches any URLs found</li><li><code>EnqueueStrategy.SameHostname</code> (<code>'same-hostname'</code>) Matches any URLs that have the same subdomain as the base URL (default)</li><li><code>EnqueueStrategy.SameDomain</code> (<code>'same-domain'</code>) Matches any URLs that have the same domain name. For example, <code>https://wow.an.example.com</code> and <code>https://example.com</code> will both be matched for a base url of <code>https://example.com</code>.</li></ul><p>This means we can even call <code>enqueueLinks()</code> without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain.</p><p>Moreover, we can specify patterns the URL should match via globs:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev/*/*'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can also use `regexps` and `pseudoUrls` keys here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="implicit-requestqueue-instance">Implicit <code>RequestQueue</code> instance<a href="#implicit-requestqueue-instance" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>All crawlers now have the <code>RequestQueue</code> instance automatically available via <code>crawler.getRequestQueue()</code> method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the <code>RequestQueue</code> instance manually, and we can just use <code>crawler.addRequests()</code> method described underneath.</p><blockquote><p>We can still create the <code>RequestQueue</code> explicitly, the <code>crawler.getRequestQueue()</code> method will respect that and return the instance provided via crawler options.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawleraddrequests"><code>crawler.addRequests()</code><a href="#crawleraddrequests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>We can now add multiple requests in batches. The newly added <code>addRequests</code> method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of <code>RequestQueue</code> and <code>RequestList</code>.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// will resolve right after the initial batch of 1000 requests is added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addRequests</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token comment" style="color:#999988;font-style:italic">/* many requests, can be even millions */</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">waitForAllRequestsToBeAdded</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="less-verbose-error-logging">Less verbose error logging<a href="#less-verbose-error-logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the <code>CRAWLEE_VERBOSE_LOG</code> env var.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlabel-shortcut"><code>Request.label</code> shortcut<a href="#requestlabel-shortcut" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Labeling requests used to work via the <code>Request.userData</code> object. With Crawlee, we can also use the <code>Request.label</code> shortcut. It is implemented as a <code>get/set</code> pair, using the value from <code>Request.userData</code>. The support for this shortcut is also added to the <code>enqueueLinks</code> options interface.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">label </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> label</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-requestasbrowser">Removal of <code>requestAsBrowser</code><a href="#removal-of-requestasbrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In v1 we replaced the underlying implementation of <code>requestAsBrowser</code> to be just a proxy over calling <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> - our custom extension to <code>got</code> that tries to mimic the real browsers as much as possible. With v3, we are removing the <code>requestAsBrowser</code>, encouraging the use of <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> directly.</p><p>For easier migration, we also added <code>context.sendRequest()</code> helper that allows processing the context bound <code>Request</code> object through <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sendRequest</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can use the options parameter to override gotScraping options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sendRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> responseType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'json'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'received body'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-sendrequest">How to use <code>sendRequest()</code>?<a href="#how-to-use-sendrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>See <a href="https://crawlee.dev/docs/guides/got-scraping" target="_blank" rel="noopener">the Got Scraping guide</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="removed-options">Removed options<a href="#removed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The <code>useInsecureHttpParser</code> option has been removed. It's permanently set to <code>true</code> in order to better mimic browsers' behavior.</p><p>Got Scraping automatically performs protocol negotiation, hence we removed the <code>useHttp2</code> option. It's set to <code>true</code> - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-options">Renamed options<a href="#renamed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>In the <code>requestAsBrowser</code> approach, some of the options were named differently. Here's a list of renamed options:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This options represents the body to send. It could be a <code>string</code> or a <code>Buffer</code>. However, there is no <code>payload</code> option anymore. You need to use <code>body</code> instead. Or, if you wish to send JSON, <code>json</code>. Here's an example:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>It has been renamed to <code>https.rejectUnauthorized</code>. By default, it's set to <code>false</code> for convenience. However, if you want to make sure the connection is secure, you can do the following:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ignoreSslErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> https</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> rejectUnauthorized</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Please note: the meanings are opposite! So we needed to invert the values as well.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="header-generator-options"><code>header-generator</code> options<a href="#header-generator-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>useMobileVersion</code>, <code>languageCode</code> and <code>countryCode</code> no longer exist. Instead, you need to use <code>headerGeneratorOptions</code> directly:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useMobileVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> languageCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'en'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headerGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'mobile'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// or ['desktop']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> locales</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'en-US'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutsecs"><code>timeoutSecs</code><a href="#timeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>In order to set a timeout, use <code>timeout.request</code> (which is <strong>milliseconds</strong> now).</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeout</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> request</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="throwonhttperrors"><code>throwOnHttpErrors</code><a href="#throwonhttperrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>throwOnHttpErrors</code> → <code>throwHttpErrors</code>. This options throws on unsuccessful HTTP status codes, for example <code>404</code>. By default, it's set to <code>false</code>.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="decodebody"><code>decodeBody</code><a href="#decodebody" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>decodeBody</code> → <code>decompress</code>. This options decompresses the body. Defaults to <code>true</code> - please do not change this or websites will break (unless you know what you're doing!).</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This function used to make the promise throw on specific responses, if it returned <code>true</code>. However, it wasn't that useful.</p><p>You probably want to cancel the request instead, which you can do in the following way:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> promise </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">…</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'request'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Please note this is not a Got Request instance, but a ClientRequest one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://nodejs.org/api/http.html#class-httpclientrequest</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">protocol </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Unsecure request, abort.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cancel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you set `isStream` to `true`, please use `stream.destroy()` instead.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-browser-pool-plugin-mixing">Removal of browser pool plugin mixing<a href="#removal-of-browser-pool-plugin-mixing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type).</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Confused?</div><div class="admonitionContent_S0QG"><p>As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="handling-requests-outside-of-browser">Handling requests outside of browser<a href="#handling-requests-outside-of-browser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of <code>Request.skipNavigation</code> and <code>context.sendRequest()</code>.</p><p>Take a look at how to achieve this by checking out the <a href="https://crawlee.dev/docs/examples/skip-navigation" target="_blank" rel="noopener">Skipping navigation for certain requests</a> example!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logging">Logging<a href="#logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Crawlee exports the default <code>log</code> instance directly as a named export. We also have a scoped <code>log</code> instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Opened </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="auto-saved-crawler-state">Auto-saved crawler state<a href="#auto-saved-crawler-state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Every crawler instance now has <code>useState()</code> method that will return a state object we can use. It will be automatically saved when <code>persistState</code> event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> crawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> state </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">useState</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// just change the value, no need to care about saving it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> state</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-sdk">Apify SDK<a href="#apify-sdk" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The Apify platform helpers can be now found in the Apify SDK (<code>apify</code> NPM package). It exports the <code>Actor</code> class that offers following static helpers:</p><ul><li><code>ApifyClient</code> shortcuts: <code>addWebhook()</code>, <code>call()</code>, <code>callTask()</code>, <code>metamorph()</code></li><li>helpers for running on Apify platform: <code>init()</code>, <code>exit()</code>, <code>fail()</code>, <code>main()</code>, <code>isAtHome()</code>, <code>createProxyConfiguration()</code></li><li>storage support: <code>getInput()</code>, <code>getValue()</code>, <code>openDataset()</code>, <code>openKeyValueStore()</code>, <code>openRequestQueue()</code>, <code>pushData()</code>, <code>setValue()</code></li><li>events support: <code>on()</code>, <code>off()</code></li><li>other utilities: <code>getEnv()</code>, <code>newClient()</code>, <code>reboot()</code></li></ul><p><code>Actor.main</code> is now just a syntax sugar around calling <code>Actor.init()</code> at the beginning and <code>Actor.exit()</code> at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> statusMessage</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>Actor.init()</code> will conditionally set the storage implementation of Crawlee to the <code>ApifyClient</code> when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). <code>Actor.exit()</code> will handle the tear down and calls <code>process.exit()</code> to ensure our process won't hang indefinitely for some reason.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="events">Events<a href="#events" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Apify SDK (v2) exports <code>Apify.events</code>, which is an <code>EventEmitter</code> instance. With Crawlee, the events are managed by <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> class instead. We can either access it via <code>Actor.eventManager</code> getter, or use <code>Actor.on</code> and <code>Actor.off</code> shortcuts instead.</p><div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">Apify.events.on(...);</span><br></span><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">Actor.on(...);</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>We can also get the <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> instance via <code>Configuration.getEventManager()</code>.</p></blockquote><p>In addition to the existing events, we now have an <code>exit</code> event fired when calling <code>Actor.exit()</code> (which is called at the end of <code>Actor.main()</code>). This event allows you to gracefully shut down any resources when <code>Actor.exit</code> is called.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="smallerinternal-breaking-changes">Smaller/internal breaking changes<a href="#smallerinternal-breaking-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><code>Apify.call()</code> is now just a shortcut for running <code>ApifyClient.actor(actorId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.callTask()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.metamorph()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).metamorph(input, options)</code>, while also taking the ACTOR_RUN_ID inside env vars into account</li><li><code>Apify.waitForRunToFinish()</code> has been removed, use <code>ApifyClient.waitForFinish()</code> instead</li><li><code>Actor.main/init</code> purges the storage by default</li><li>remove <code>purgeLocalStorage</code> helper, move purging to the storage class directly<ul><li><code>StorageClient</code> interface now has optional <code>purge</code> method</li><li>purging happens automatically via <code>Actor.init()</code> (you can opt out via <code>purge: false</code> in the options of <code>init/main</code> methods)</li></ul></li><li><code>QueueOperationInfo.request</code> is no longer available</li><li><code>Request.handledAt</code> is now string date in ISO format</li><li><code>Request.inProgress</code> and <code>Request.reclaimed</code> are now <code>Set</code>s instead of POJOs</li><li><code>injectUnderscore</code> from puppeteer utils has been removed</li><li><code>APIFY_MEMORY_MBYTES</code> is no longer taken into account, use <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> instead</li><li>some <code>AutoscaledPool</code> options are no longer available:<ul><li><code>cpuSnapshotIntervalSecs</code> and <code>memorySnapshotIntervalSecs</code> has been replaced with top level <code>systemInfoIntervalMillis</code> configuration</li><li><code>maxUsedCpuRatio</code> has been moved to the top level configuration</li></ul></li><li><code>ProxyConfiguration.newUrlFunction</code> can be async. <code>.newUrl()</code> and <code>.newProxyInfo()</code> now return promises.</li><li><code>prepareRequestFunction</code> and <code>postResponseFunction</code> options are removed, use navigation hooks instead</li><li><code>gotoFunction</code> and <code>gotoTimeoutSecs</code> are removed</li><li>removed compatibility fix for old/broken request queues with null <code>Request</code> props</li><li><code>fingerprintsOptions</code> renamed to <code>fingerprintOptions</code> (<code>fingerprints</code> -> <code>fingerprint</code>).</li><li><code>fingerprintOptions</code> now accept <code>useFingerprintCache</code> and <code>fingerprintCacheSize</code> (instead of <code>useFingerprintPerProxyCache</code> and <code>fingerprintPerProxyCacheSize</code>, which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v3.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v2</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#crawlee-monorepo" class="table-of-contents__link toc-highlight">Crawlee monorepo</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#requestlabel-shortcut" class="table-of-contents__link toc-highlight"><code>Request.label</code> shortcut</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/next/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/next/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/next/guides/apify-platform">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/upgrading/upgrading-to-v3">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/next/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/next/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for <!-- -->SDK for JavaScript | Apify Documentation<!-- --> <b>Next</b> version.</div><div class="margin-top--md">For up-to-date documentation, see the <b><a href="/sdk/js/docs/upgrading/upgrading-to-v3">latest version</a></b> (<!-- -->3.1<!-- -->).</div></div><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/next/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v3</h1></header><p>This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Crawlee vs Apify SDK v2</div><div class="admonitionContent_S0QG"><p>Up until version 3 of <code>apify</code>, the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:</p><ul><li><a href="https://github.com/apify/crawlee" target="_blank" rel="noopener">Crawlee</a>, the new web-scraping library, available as <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package on NPM</li><li><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener">Apify SDK</a>, helpers for the Apify platform, available as <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> package on NPM</li></ul></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawlee-monorepo">Crawlee monorepo<a href="#crawlee-monorepo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package consists of several smaller packages, released separately under <code>@crawlee</code> namespace:</p><ul><li><code>@crawlee/core</code>: the base for all the crawler implementations, also contains things like <code>Request</code>, <code>RequestQueue</code>, <code>RequestList</code> or <code>Dataset</code> classes</li><li><code>@crawlee/basic</code>: exports <code>BasicCrawler</code></li><li><code>@crawlee/http</code>: exports <code>HttpCrawler</code> (which is used for creating <code>@crawlee/dom</code> and <code>@crawlee/cheerio</code>)</li><li><code>@crawlee/dom</code>: exports <code>DOMCrawler</code></li><li><code>@crawlee/cheerio</code>: exports <code>CheerioCrawler</code></li><li><code>@crawlee/browser</code>: exports <code>BrowserCrawler</code> (which is used for creating <code>@crawlee/playwright</code> and <code>@crawlee/puppeteer</code>)</li><li><code>@crawlee/playwright</code>: exports <code>PlaywrightCrawler</code></li><li><code>@crawlee/puppeteer</code>: exports <code>PuppeteerCrawler</code></li><li><code>@crawlee/memory-storage</code>: <code>@apify/storage-local</code> alternative</li><li><code>@crawlee/browser-pool</code>: previously <code>browser-pool</code> package</li><li><code>@crawlee/utils</code>: utility methods</li><li><code>@crawlee/types</code>: holds TS interfaces mainly about the <code>StorageClient</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installing-crawlee">Installing Crawlee<a href="#installing-crawlee" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. <code>@crawlee/playwright</code> if you plan on using <code>playwright</code> - it already contains everything from the <code>@crawlee/browser</code> package, which includes everything from <code>@crawlee/basic</code>, which includes everything from <code>@crawlee/core</code>.</p><p>If we don't care much about additional code being pulled in, we can just use the <code>crawlee</code> meta-package, which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Or if all we need is cheerio support, we can install only <code>@crawlee/cheerio</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> @crawlee/cheerio</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When using <code>playwright</code> or <code>puppeteer</code>, we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee playwright</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or npm install @crawlee/playwright playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Alternatively we can also use the <code>crawlee</code> meta-package which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><blockquote><p>Sometimes you might want to use some utility methods from <code>@crawlee/utils</code>, so you might want to install that as well. This package contains some utilities that were previously available under <code>Apify.utils</code>. Browser related utilities can be also found in the crawler packages (e.g. <code>@crawlee/playwright</code>).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="full-typescript-support">Full TypeScript support<a href="#full-typescript-support" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from <code>@apify/tsconfig</code> package. Don't forget to set the <code>module</code> and <code>target</code> to <code>ES2022</code> or above to be able to use top level await.</p><blockquote><p>The <code>@apify/tsconfig</code> config has <a href="https://www.typescriptlang.org/tsconfig#noImplicitAny" target="_blank" rel="noopener"><code>noImplicitAny</code></a> enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.</p></blockquote><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">tsconfig.json</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"extends"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"@apify/tsconfig"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"compilerOptions"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"module"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"target"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"outDir"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"dist"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"lib"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"DOM"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"include"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./src/**/*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="docker-build">Docker build<a href="#docker-build" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>For <code>Dockerfile</code> we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Dockerfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># using multistage build, as we need dev deps to build the TS source code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy all files, install all dependencies (including dev deps) and build the project</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy only necessary files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/README.md ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/apify.json ./apify.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># install only prod deps</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --only=prod --no-optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --only=prod --no-optional --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># run compiled code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="browser-fingerprints">Browser fingerprints<a href="#browser-fingerprints" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously we had a magical <code>stealth</code> option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints.</p><p>In case we don't want to have dynamic fingerprints, we can disable this behaviour via <code>useFingerprints</code> in <code>browserPoolOptions</code>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="session-cookie-method-renames">Session cookie method renames<a href="#session-cookie-method-renames" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call <code>session.getPuppeteerCookies()</code> or <code>session.setPuppeteerCookies()</code>. Since this method could be used for any of our crawlers, not just <code>PuppeteerCrawler</code>, the methods have been renamed to <code>session.getCookies()</code> and <code>session.setCookies()</code> respectively. Otherwise, their usage is exactly the same!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="memory-storage">Memory storage<a href="#memory-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When we store some data or intermediate state (like the one <code>RequestQueue</code> holds), we now use <code>@crawlee/memory-storage</code> by default. It is an alternative to the <code>@apify/storage-local</code>, that stores the state inside memory (as opposed to SQLite database used by <code>@apify/storage-local</code>). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the <code>INPUT.json</code> file).</p><p>When we want to run the crawler on Apify platform, we need to use <code>Actor.init</code> or <code>Actor.main</code>, which will automatically switch the storage client to <code>ApifyClient</code> when on the Apify platform.</p><p>We can still use the <code>@apify/storage-local</code>, to do it, first install it pass it to the <code>Actor.init</code> or <code>Actor.main</code> options:</p><blockquote><p><code>@apify/storage-local</code> v2.1.0+ is required for Crawlee</p></blockquote><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> ApifyStorageLocal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@apify/storage-local'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> storage </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">ApifyStorageLocal</span><span class="token punctuation" style="color:#393A34">(</span><span class="token comment" style="color:#999988;font-style:italic">/* options like `enableWalMode` belong here */</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> storage </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="purging-of-the-default-storage">Purging of the default storage<a href="#purging-of-the-default-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously the state was preserved between local runs, and we had to use <code>--purge</code> argument of the <code>apify-cli</code>. With Crawlee, this is now the default behaviour, we purge the storage automatically on <code>Actor.init/main</code> call. We can opt out of it via <code>purge: false</code> in the <code>Actor.init</code> options.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-crawler-options-and-interfaces">Renamed crawler options and interfaces<a href="#renamed-crawler-options-and-interfaces" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level.</p><ul><li><code>handleRequestFunction</code> -> <code>requestHandler</code></li><li><code>handlePageFunction</code> -> <code>requestHandler</code></li><li><code>handleRequestTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>handlePageTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>requestTimeoutSecs</code> -> <code>navigationTimeoutSecs</code></li><li><code>handleFailedRequestFunction</code> -> <code>failedRequestHandler</code></li></ul><p>We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:</p><ul><li><code>CheerioHandlePageInputs</code> -> <code>CheerioCrawlingContext</code></li><li><code>PlaywrightHandlePageFunction</code> -> <code>PlaywrightCrawlingContext</code></li><li><code>PuppeteerHandlePageFunction</code> -> <code>PuppeteerCrawlingContext</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="context-aware-helpers">Context aware helpers<a href="#context-aware-helpers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some utilities previously available under <code>Apify.utils</code> namespace are now moved to the crawling context and are <em>context aware</em>. This means they have some parameters automatically filled in from the context, like the current <code>Request</code> instance or current <code>Page</code> object, or the <code>RequestQueue</code> bound to the crawler.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enqueuing-links">Enqueuing links<a href="#enqueuing-links" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>One common helper that received more attention is the <code>enqueueLinks</code>. As mentioned above, it is context aware - we no longer need pass in the <code>requestQueue</code> or <code>page</code> arguments (or the cheerio handle <code>$</code>). In addition to that, it now offers 3 enqueuing strategies:</p><ul><li><code>EnqueueStrategy.All</code> (<code>'all'</code>): Matches any URLs found</li><li><code>EnqueueStrategy.SameHostname</code> (<code>'same-hostname'</code>) Matches any URLs that have the same subdomain as the base URL (default)</li><li><code>EnqueueStrategy.SameDomain</code> (<code>'same-domain'</code>) Matches any URLs that have the same domain name. For example, <code>https://wow.an.example.com</code> and <code>https://example.com</code> will both be matched for a base url of <code>https://example.com</code>.</li></ul><p>This means we can even call <code>enqueueLinks()</code> without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain.</p><p>Moreover, we can specify patterns the URL should match via globs:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev/*/*'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can also use `regexps` and `pseudoUrls` keys here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="implicit-requestqueue-instance">Implicit <code>RequestQueue</code> instance<a href="#implicit-requestqueue-instance" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>All crawlers now have the <code>RequestQueue</code> instance automatically available via <code>crawler.getRequestQueue()</code> method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the <code>RequestQueue</code> instance manually, and we can just use <code>crawler.addRequests()</code> method described underneath.</p><blockquote><p>We can still create the <code>RequestQueue</code> explicitly, the <code>crawler.getRequestQueue()</code> method will respect that and return the instance provided via crawler options.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawleraddrequests"><code>crawler.addRequests()</code><a href="#crawleraddrequests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>We can now add multiple requests in batches. The newly added <code>addRequests</code> method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of <code>RequestQueue</code> and <code>RequestList</code>.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// will resolve right after the initial batch of 1000 requests is added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addRequests</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token comment" style="color:#999988;font-style:italic">/* many requests, can be even millions */</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">waitForAllRequestsToBeAdded</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="less-verbose-error-logging">Less verbose error logging<a href="#less-verbose-error-logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the <code>CRAWLEE_VERBOSE_LOG</code> env var.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlabel-shortcut"><code>Request.label</code> shortcut<a href="#requestlabel-shortcut" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Labeling requests used to work via the <code>Request.userData</code> object. With Crawlee, we can also use the <code>Request.label</code> shortcut. It is implemented as a <code>get/set</code> pair, using the value from <code>Request.userData</code>. The support for this shortcut is also added to the <code>enqueueLinks</code> options interface.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">label </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> label</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-requestasbrowser">Removal of <code>requestAsBrowser</code><a href="#removal-of-requestasbrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In v1 we replaced the underlying implementation of <code>requestAsBrowser</code> to be just a proxy over calling <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> - our custom extension to <code>got</code> that tries to mimic the real browsers as much as possible. With v3, we are removing the <code>requestAsBrowser</code>, encouraging the use of <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> directly.</p><p>For easier migration, we also added <code>context.sendRequest()</code> helper that allows processing the context bound <code>Request</code> object through <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sendRequest</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can use the options parameter to override gotScraping options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sendRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> responseType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'json'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'received body'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-sendrequest">How to use <code>sendRequest()</code>?<a href="#how-to-use-sendrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>See <a href="https://crawlee.dev/docs/guides/got-scraping" target="_blank" rel="noopener">the Got Scraping guide</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="removed-options">Removed options<a href="#removed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The <code>useInsecureHttpParser</code> option has been removed. It's permanently set to <code>true</code> in order to better mimic browsers' behavior.</p><p>Got Scraping automatically performs protocol negotiation, hence we removed the <code>useHttp2</code> option. It's set to <code>true</code> - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-options">Renamed options<a href="#renamed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>In the <code>requestAsBrowser</code> approach, some of the options were named differently. Here's a list of renamed options:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This options represents the body to send. It could be a <code>string</code> or a <code>Buffer</code>. However, there is no <code>payload</code> option anymore. You need to use <code>body</code> instead. Or, if you wish to send JSON, <code>json</code>. Here's an example:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>It has been renamed to <code>https.rejectUnauthorized</code>. By default, it's set to <code>false</code> for convenience. However, if you want to make sure the connection is secure, you can do the following:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ignoreSslErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> https</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> rejectUnauthorized</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Please note: the meanings are opposite! So we needed to invert the values as well.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="header-generator-options"><code>header-generator</code> options<a href="#header-generator-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>useMobileVersion</code>, <code>languageCode</code> and <code>countryCode</code> no longer exist. Instead, you need to use <code>headerGeneratorOptions</code> directly:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useMobileVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> languageCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'en'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headerGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'mobile'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// or ['desktop']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> locales</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'en-US'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutsecs"><code>timeoutSecs</code><a href="#timeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>In order to set a timeout, use <code>timeout.request</code> (which is <strong>milliseconds</strong> now).</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeout</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> request</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="throwonhttperrors"><code>throwOnHttpErrors</code><a href="#throwonhttperrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>throwOnHttpErrors</code> → <code>throwHttpErrors</code>. This options throws on unsuccessful HTTP status codes, for example <code>404</code>. By default, it's set to <code>false</code>.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="decodebody"><code>decodeBody</code><a href="#decodebody" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>decodeBody</code> → <code>decompress</code>. This options decompresses the body. Defaults to <code>true</code> - please do not change this or websites will break (unless you know what you're doing!).</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This function used to make the promise throw on specific responses, if it returned <code>true</code>. However, it wasn't that useful.</p><p>You probably want to cancel the request instead, which you can do in the following way:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> promise </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">…</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'request'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Please note this is not a Got Request instance, but a ClientRequest one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://nodejs.org/api/http.html#class-httpclientrequest</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">protocol </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Unsecure request, abort.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cancel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you set `isStream` to `true`, please use `stream.destroy()` instead.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-browser-pool-plugin-mixing">Removal of browser pool plugin mixing<a href="#removal-of-browser-pool-plugin-mixing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type).</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Confused?</div><div class="admonitionContent_S0QG"><p>As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="handling-requests-outside-of-browser">Handling requests outside of browser<a href="#handling-requests-outside-of-browser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of <code>Request.skipNavigation</code> and <code>context.sendRequest()</code>.</p><p>Take a look at how to achieve this by checking out the <a href="https://crawlee.dev/docs/examples/skip-navigation" target="_blank" rel="noopener">Skipping navigation for certain requests</a> example!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logging">Logging<a href="#logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Crawlee exports the default <code>log</code> instance directly as a named export. We also have a scoped <code>log</code> instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Opened </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="auto-saved-crawler-state">Auto-saved crawler state<a href="#auto-saved-crawler-state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Every crawler instance now has <code>useState()</code> method that will return a state object we can use. It will be automatically saved when <code>persistState</code> event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> crawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> state </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">useState</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// just change the value, no need to care about saving it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> state</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-sdk">Apify SDK<a href="#apify-sdk" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The Apify platform helpers can be now found in the Apify SDK (<code>apify</code> NPM package). It exports the <code>Actor</code> class that offers following static helpers:</p><ul><li><code>ApifyClient</code> shortcuts: <code>addWebhook()</code>, <code>call()</code>, <code>callTask()</code>, <code>metamorph()</code></li><li>helpers for running on Apify platform: <code>init()</code>, <code>exit()</code>, <code>fail()</code>, <code>main()</code>, <code>isAtHome()</code>, <code>createProxyConfiguration()</code></li><li>storage support: <code>getInput()</code>, <code>getValue()</code>, <code>openDataset()</code>, <code>openKeyValueStore()</code>, <code>openRequestQueue()</code>, <code>pushData()</code>, <code>setValue()</code></li><li>events support: <code>on()</code>, <code>off()</code></li><li>other utilities: <code>getEnv()</code>, <code>newClient()</code>, <code>reboot()</code></li></ul><p><code>Actor.main</code> is now just a syntax sugar around calling <code>Actor.init()</code> at the beginning and <code>Actor.exit()</code> at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> statusMessage</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>Actor.init()</code> will conditionally set the storage implementation of Crawlee to the <code>ApifyClient</code> when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). <code>Actor.exit()</code> will handle the tear down and calls <code>process.exit()</code> to ensure our process won't hang indefinitely for some reason.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="events">Events<a href="#events" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Apify SDK (v2) exports <code>Apify.events</code>, which is an <code>EventEmitter</code> instance. With Crawlee, the events are managed by <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> class instead. We can either access it via <code>Actor.eventManager</code> getter, or use <code>Actor.on</code> and <code>Actor.off</code> shortcuts instead.</p><div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">Apify.events.on(...);</span><br></span><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">Actor.on(...);</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>We can also get the <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> instance via <code>Configuration.getEventManager()</code>.</p></blockquote><p>In addition to the existing events, we now have an <code>exit</code> event fired when calling <code>Actor.exit()</code> (which is called at the end of <code>Actor.main()</code>). This event allows you to gracefully shut down any resources when <code>Actor.exit</code> is called.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="smallerinternal-breaking-changes">Smaller/internal breaking changes<a href="#smallerinternal-breaking-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><code>Apify.call()</code> is now just a shortcut for running <code>ApifyClient.actor(actorId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.callTask()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.metamorph()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).metamorph(input, options)</code>, while also taking the ACTOR_RUN_ID inside env vars into account</li><li><code>Apify.waitForRunToFinish()</code> has been removed, use <code>ApifyClient.waitForFinish()</code> instead</li><li><code>Actor.main/init</code> purges the storage by default</li><li>remove <code>purgeLocalStorage</code> helper, move purging to the storage class directly<ul><li><code>StorageClient</code> interface now has optional <code>purge</code> method</li><li>purging happens automatically via <code>Actor.init()</code> (you can opt out via <code>purge: false</code> in the options of <code>init/main</code> methods)</li></ul></li><li><code>QueueOperationInfo.request</code> is no longer available</li><li><code>Request.handledAt</code> is now string date in ISO format</li><li><code>Request.inProgress</code> and <code>Request.reclaimed</code> are now <code>Set</code>s instead of POJOs</li><li><code>injectUnderscore</code> from puppeteer utils has been removed</li><li><code>APIFY_MEMORY_MBYTES</code> is no longer taken into account, use <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> instead</li><li>some <code>AutoscaledPool</code> options are no longer available:<ul><li><code>cpuSnapshotIntervalSecs</code> and <code>memorySnapshotIntervalSecs</code> has been replaced with top level <code>systemInfoIntervalMillis</code> configuration</li><li><code>maxUsedCpuRatio</code> has been moved to the top level configuration</li></ul></li><li><code>ProxyConfiguration.newUrlFunction</code> can be async. <code>.newUrl()</code> and <code>.newProxyInfo()</code> now return promises.</li><li><code>prepareRequestFunction</code> and <code>postResponseFunction</code> options are removed, use navigation hooks instead</li><li><code>gotoFunction</code> and <code>gotoTimeoutSecs</code> are removed</li><li>removed compatibility fix for old/broken request queues with null <code>Request</code> props</li><li><code>fingerprintsOptions</code> renamed to <code>fingerprintOptions</code> (<code>fingerprints</code> -> <code>fingerprint</code>).</li><li><code>fingerprintOptions</code> now accept <code>useFingerprintCache</code> and <code>fingerprintCacheSize</code> (instead of <code>useFingerprintPerProxyCache</code> and <code>fingerprintPerProxyCacheSize</code>, which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/../docs/upgrading/upgrading_v3.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/next/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v2</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/next/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#crawlee-monorepo" class="table-of-contents__link toc-highlight">Crawlee monorepo</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#requestlabel-shortcut" class="table-of-contents__link toc-highlight"><code>Request.label</code> shortcut</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/readme/introduction.html b/docs/readme/introduction.html index fea1993a13..19d9ae05b3 100644 --- a/docs/readme/introduction.html +++ b/docs/readme/introduction.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -21,8 +21,8 @@ The SDK is available as the <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> NPM package. It can be used either stand-alone in your own applications or in <a href="https://docs.apify.com/actor" target="_blank" rel="noopener">actors</a> -running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +running on the <a href="https://apify.com/" target="_blank" rel="noopener">Apify Cloud</a>.</p><p><strong>View full documentation, guides and examples on the <a href="https://sdk.apify.com">Apify SDK project website</a></strong></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/introduction.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/readme/overview.html b/docs/readme/overview.html index 89a16358c4..4141080328 100644 --- a/docs/readme/overview.html +++ b/docs/readme/overview.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,8 +24,8 @@ records or files, along with their MIME content type. It is ideal for saving screenshots of web pages, PDFs or to persist the state of your crawlers. The data is stored on a local filesystem or in the Apify Cloud.</p></li></ul><p>Additionally, the package provides various helper functions to simplify running your code on the Apify Cloud and thus take advantage of its pool of proxies, job scheduler, data storage, etc. -For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +For more information, see the <a href="https://sdk.apify.com">Apify SDK Programmer's Reference</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/overview.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#overview" class="table-of-contents__link toc-highlight">Overview</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/readme/support.html b/docs/readme/support.html index 6a7213da15..28b47baf1a 100644 --- a/docs/readme/support.html +++ b/docs/readme/support.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -20,8 +20,8 @@ For contribution guidelines and the code of conduct, see <a href="https://github.com/apify/apify-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-js/blob/master/LICENSE.md" target="_blank" rel="noopener">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener">Chema Balsas</a> for giving up the <code>apify</code> package name -on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener">jsdocify</a>.</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/readme/support.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#support" class="table-of-contents__link toc-highlight">Support</a></li><li><a href="#contributing" class="table-of-contents__link toc-highlight">Contributing</a></li><li><a href="#license" class="table-of-contents__link toc-highlight">License</a></li><li><a href="#acknowledgments" class="table-of-contents__link toc-highlight">Acknowledgments</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/upgrading.html b/docs/upgrading.html index b13fc70552..4e8d1d37b2 100644 --- a/docs/upgrading.html +++ b/docs/upgrading.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/upgrading">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible menu__list-item-collapsible--active"><a class="menu__link menu__link--sublist menu__link--active" aria-current="page" aria-expanded="true" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="generatedIndexPage_vN6x"><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><header><h1 class="title_kItE">Upgrading</h1></header><article class="margin-top--lg"><section class="row list_eTzJ"><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/upgrading/upgrading-to-v1"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v1">📄️<!-- --> <!-- -->Upgrading to v1</h2><p class="text--truncate cardDescription_PWke" title="Summary">Summary</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/upgrading/upgrading-to-v2"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v2">📄️<!-- --> <!-- -->Upgrading to v2</h2><p class="text--truncate cardDescription_PWke" title="- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.">- BREAKING: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</p></a></article><article class="col col--6 margin-bottom--lg"><a class="card padding--lg cardContainer_fWXF" href="/sdk/js/docs/upgrading/upgrading-to-v3"><h2 class="text--truncate cardTitle_rnsV" title="Upgrading to v3">📄️<!-- --> <!-- -->Upgrading to v3</h2><p class="text--truncate cardDescription_PWke" title="This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.">This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p></a></article></section></article><footer class="margin-top--lg"><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/examples/puppeteer-with-proxy"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Puppeteer with proxy</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v1</div></a></nav></footer></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/upgrading/upgrading-to-v1.html b/docs/upgrading/upgrading-to-v1.html index 2b88d14f16..1de6bb103e 100644 --- a/docs/upgrading/upgrading-to-v1.html +++ b/docs/upgrading/upgrading-to-v1.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -81,8 +81,8 @@ the functions also have access to the <code>crawlingContext</code> of the <code>request</code> that triggered the launch.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> preLaunchHooks </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">maybeLaunchChrome</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">pageId</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> launchContext</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">crawlingContexts</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">get</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">pageId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">userData</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">useHeadful</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> launchContext</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">launchOptions</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">headless</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">]</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="launch-functions">Launch functions<a href="#launch-functions" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In addition to <code>Apify.launchPuppeteer()</code> we now also have <code>Apify.launchPlaywright()</code>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="updated-arguments">Updated arguments<a href="#updated-arguments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>We <a href="#launchpuppeteeroptions--launchcontext">updated the launch options object</a> because it was a frequent source of confusion.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// OLD</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// NEW</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">useChrome</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launchOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">headless</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-modules">Custom modules<a href="#custom-modules" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p><code>Apify.launchPuppeteer</code> already supported the <code>puppeteerModule</code> option. With Playwright, we normalized the name to <code>launcher</code> because the <code>playwright</code> module itself does not -launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v2</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +launch browsers.</p><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> puppeteer </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'puppeteer'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> playwright </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">require</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'playwright'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPuppeteer</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> puppeteer</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Is the same as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">launchPlaywright</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">launcher</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> playwright</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">chromium</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v1.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v2</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#summary" class="table-of-contents__link toc-highlight">Summary</a></li><li><a href="#migration-guide" class="table-of-contents__link toc-highlight">Migration Guide</a></li><li><a href="#installation" class="table-of-contents__link toc-highlight">Installation</a></li><li><a href="#running-on-apify-platform" class="table-of-contents__link toc-highlight">Running on Apify Platform</a></li><li><a href="#handler-arguments-are-now-crawling-context" class="table-of-contents__link toc-highlight">Handler arguments are now Crawling Context</a><ul><li><a href="#map-of-crawling-contexts-and-their-ids" class="table-of-contents__link toc-highlight"><code>Map</code> of crawling contexts and their IDs</a></li><li><a href="#autoscaledpool-was-moved-under-crawlingcontextcrawler" class="table-of-contents__link toc-highlight"><code>autoscaledPool</code> was moved under <code>crawlingContext.crawler</code></a></li></ul></li><li><a href="#replacement-of-puppeteerpool-with-browserpool" class="table-of-contents__link toc-highlight">Replacement of <code>PuppeteerPool</code> with <code>BrowserPool</code></a><ul><li><a href="#access-to-running-browserpool" class="table-of-contents__link toc-highlight">Access to running <code>BrowserPool</code></a></li><li><a href="#pages-now-have-ids" class="table-of-contents__link toc-highlight">Pages now have IDs</a></li><li><a href="#configuration-and-lifecycle-hooks" class="table-of-contents__link toc-highlight">Configuration and lifecycle hooks</a></li><li><a href="#introduction-of-browsercontroller" class="table-of-contents__link toc-highlight">Introduction of <code>BrowserController</code></a></li><li><a href="#browserpool-methods-vs-puppeteerpool" class="table-of-contents__link toc-highlight"><code>BrowserPool</code> methods vs <code>PuppeteerPool</code></a></li></ul></li><li><a href="#updated-puppeteercrawleroptions" class="table-of-contents__link toc-highlight">Updated <code>PuppeteerCrawlerOptions</code></a><ul><li><a href="#removal-of-gotofunction" class="table-of-contents__link toc-highlight">Removal of <code>gotoFunction</code></a></li><li><a href="#launchpuppeteeroptions--launchcontext" class="table-of-contents__link toc-highlight"><code>launchPuppeteerOptions</code> => <code>launchContext</code></a></li><li><a href="#removal-of-launchpuppeteerfunction" class="table-of-contents__link toc-highlight">Removal of <code>launchPuppeteerFunction</code></a></li></ul></li><li><a href="#launch-functions" class="table-of-contents__link toc-highlight">Launch functions</a><ul><li><a href="#updated-arguments" class="table-of-contents__link toc-highlight">Updated arguments</a></li><li><a href="#custom-modules" class="table-of-contents__link toc-highlight">Custom modules</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/upgrading/upgrading-to-v2.html b/docs/upgrading/upgrading-to-v2.html index 4c5248d4f0..b0ec57e0ff 100644 --- a/docs/upgrading/upgrading-to-v2.html +++ b/docs/upgrading/upgrading-to-v2.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/upgrading/upgrading-to-v2">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v2</h1></header><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v2.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v2">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/upgrading/upgrading-to-v2">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v2">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v2</h1></header><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v2.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading/upgrading-to-v1"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v1</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/upgrading/upgrading-to-v3"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Upgrading to v3</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/docs/upgrading/upgrading-to-v3.html b/docs/upgrading/upgrading-to-v3.html index f682a56384..61cd87bfbd 100644 --- a/docs/upgrading/upgrading-to-v3.html +++ b/docs/upgrading/upgrading-to-v3.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/upgrading/upgrading-to-v3">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v3</h1></header><p>This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Crawlee vs Apify SDK v2</div><div class="admonitionContent_S0QG"><p>Up until version 3 of <code>apify</code>, the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:</p><ul><li><a href="https://github.com/apify/crawlee" target="_blank" rel="noopener">Crawlee</a>, the new web-scraping library, available as <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package on NPM</li><li><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener">Apify SDK</a>, helpers for the Apify platform, available as <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> package on NPM</li></ul></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawlee-monorepo">Crawlee monorepo<a href="#crawlee-monorepo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package consists of several smaller packages, released separately under <code>@crawlee</code> namespace:</p><ul><li><code>@crawlee/core</code>: the base for all the crawler implementations, also contains things like <code>Request</code>, <code>RequestQueue</code>, <code>RequestList</code> or <code>Dataset</code> classes</li><li><code>@crawlee/basic</code>: exports <code>BasicCrawler</code></li><li><code>@crawlee/http</code>: exports <code>HttpCrawler</code> (which is used for creating <code>@crawlee/dom</code> and <code>@crawlee/cheerio</code>)</li><li><code>@crawlee/dom</code>: exports <code>DOMCrawler</code></li><li><code>@crawlee/cheerio</code>: exports <code>CheerioCrawler</code></li><li><code>@crawlee/browser</code>: exports <code>BrowserCrawler</code> (which is used for creating <code>@crawlee/playwright</code> and <code>@crawlee/puppeteer</code>)</li><li><code>@crawlee/playwright</code>: exports <code>PlaywrightCrawler</code></li><li><code>@crawlee/puppeteer</code>: exports <code>PuppeteerCrawler</code></li><li><code>@crawlee/memory-storage</code>: <code>@apify/storage-local</code> alternative</li><li><code>@crawlee/browser-pool</code>: previously <code>browser-pool</code> package</li><li><code>@crawlee/utils</code>: utility methods</li><li><code>@crawlee/types</code>: holds TS interfaces mainly about the <code>StorageClient</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installing-crawlee">Installing Crawlee<a href="#installing-crawlee" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. <code>@crawlee/playwright</code> if you plan on using <code>playwright</code> - it already contains everything from the <code>@crawlee/browser</code> package, which includes everything from <code>@crawlee/basic</code>, which includes everything from <code>@crawlee/core</code>.</p><p>If we don't care much about additional code being pulled in, we can just use the <code>crawlee</code> meta-package, which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Or if all we need is cheerio support, we can install only <code>@crawlee/cheerio</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> @crawlee/cheerio</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When using <code>playwright</code> or <code>puppeteer</code>, we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee playwright</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or npm install @crawlee/playwright playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Alternatively we can also use the <code>crawlee</code> meta-package which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><blockquote><p>Sometimes you might want to use some utility methods from <code>@crawlee/utils</code>, so you might want to install that as well. This package contains some utilities that were previously available under <code>Apify.utils</code>. Browser related utilities can be also found in the crawler packages (e.g. <code>@crawlee/playwright</code>).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="full-typescript-support">Full TypeScript support<a href="#full-typescript-support" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from <code>@apify/tsconfig</code> package. Don't forget to set the <code>module</code> and <code>target</code> to <code>ES2022</code> or above to be able to use top level await.</p><blockquote><p>The <code>@apify/tsconfig</code> config has <a href="https://www.typescriptlang.org/tsconfig#noImplicitAny" target="_blank" rel="noopener"><code>noImplicitAny</code></a> enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.</p></blockquote><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">tsconfig.json</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"extends"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"@apify/tsconfig"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"compilerOptions"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"module"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"target"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"outDir"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"dist"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"lib"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"DOM"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"include"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./src/**/*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="docker-build">Docker build<a href="#docker-build" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>For <code>Dockerfile</code> we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Dockerfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># using multistage build, as we need dev deps to build the TS source code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy all files, install all dependencies (including dev deps) and build the project</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy only necessary files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/README.md ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/apify.json ./apify.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># install only prod deps</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --only=prod --no-optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --only=prod --no-optional --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># run compiled code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="browser-fingerprints">Browser fingerprints<a href="#browser-fingerprints" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously we had a magical <code>stealth</code> option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints.</p><p>In case we don't want to have dynamic fingerprints, we can disable this behaviour via <code>useFingerprints</code> in <code>browserPoolOptions</code>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="session-cookie-method-renames">Session cookie method renames<a href="#session-cookie-method-renames" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call <code>session.getPuppeteerCookies()</code> or <code>session.setPuppeteerCookies()</code>. Since this method could be used for any of our crawlers, not just <code>PuppeteerCrawler</code>, the methods have been renamed to <code>session.getCookies()</code> and <code>session.setCookies()</code> respectively. Otherwise, their usage is exactly the same!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="memory-storage">Memory storage<a href="#memory-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When we store some data or intermediate state (like the one <code>RequestQueue</code> holds), we now use <code>@crawlee/memory-storage</code> by default. It is an alternative to the <code>@apify/storage-local</code>, that stores the state inside memory (as opposed to SQLite database used by <code>@apify/storage-local</code>). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the <code>INPUT.json</code> file).</p><p>When we want to run the crawler on Apify platform, we need to use <code>Actor.init</code> or <code>Actor.main</code>, which will automatically switch the storage client to <code>ApifyClient</code> when on the Apify platform.</p><p>We can still use the <code>@apify/storage-local</code>, to do it, first install it pass it to the <code>Actor.init</code> or <code>Actor.main</code> options:</p><blockquote><p><code>@apify/storage-local</code> v2.1.0+ is required for Crawlee</p></blockquote><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> ApifyStorageLocal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@apify/storage-local'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> storage </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">ApifyStorageLocal</span><span class="token punctuation" style="color:#393A34">(</span><span class="token comment" style="color:#999988;font-style:italic">/* options like `enableWalMode` belong here */</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> storage </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="purging-of-the-default-storage">Purging of the default storage<a href="#purging-of-the-default-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously the state was preserved between local runs, and we had to use <code>--purge</code> argument of the <code>apify-cli</code>. With Crawlee, this is now the default behaviour, we purge the storage automatically on <code>Actor.init/main</code> call. We can opt out of it via <code>purge: false</code> in the <code>Actor.init</code> options.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-crawler-options-and-interfaces">Renamed crawler options and interfaces<a href="#renamed-crawler-options-and-interfaces" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level.</p><ul><li><code>handleRequestFunction</code> -> <code>requestHandler</code></li><li><code>handlePageFunction</code> -> <code>requestHandler</code></li><li><code>handleRequestTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>handlePageTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>requestTimeoutSecs</code> -> <code>navigationTimeoutSecs</code></li><li><code>handleFailedRequestFunction</code> -> <code>failedRequestHandler</code></li></ul><p>We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:</p><ul><li><code>CheerioHandlePageInputs</code> -> <code>CheerioCrawlingContext</code></li><li><code>PlaywrightHandlePageFunction</code> -> <code>PlaywrightCrawlingContext</code></li><li><code>PuppeteerHandlePageFunction</code> -> <code>PuppeteerCrawlingContext</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="context-aware-helpers">Context aware helpers<a href="#context-aware-helpers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some utilities previously available under <code>Apify.utils</code> namespace are now moved to the crawling context and are <em>context aware</em>. This means they have some parameters automatically filled in from the context, like the current <code>Request</code> instance or current <code>Page</code> object, or the <code>RequestQueue</code> bound to the crawler.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enqueuing-links">Enqueuing links<a href="#enqueuing-links" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>One common helper that received more attention is the <code>enqueueLinks</code>. As mentioned above, it is context aware - we no longer need pass in the <code>requestQueue</code> or <code>page</code> arguments (or the cheerio handle <code>$</code>). In addition to that, it now offers 3 enqueuing strategies:</p><ul><li><code>EnqueueStrategy.All</code> (<code>'all'</code>): Matches any URLs found</li><li><code>EnqueueStrategy.SameHostname</code> (<code>'same-hostname'</code>) Matches any URLs that have the same subdomain as the base URL (default)</li><li><code>EnqueueStrategy.SameDomain</code> (<code>'same-domain'</code>) Matches any URLs that have the same domain name. For example, <code>https://wow.an.example.com</code> and <code>https://example.com</code> will both be matched for a base url of <code>https://example.com</code>.</li></ul><p>This means we can even call <code>enqueueLinks()</code> without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain.</p><p>Moreover, we can specify patterns the URL should match via globs:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev/*/*'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can also use `regexps` and `pseudoUrls` keys here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="implicit-requestqueue-instance">Implicit <code>RequestQueue</code> instance<a href="#implicit-requestqueue-instance" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>All crawlers now have the <code>RequestQueue</code> instance automatically available via <code>crawler.getRequestQueue()</code> method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the <code>RequestQueue</code> instance manually, and we can just use <code>crawler.addRequests()</code> method described underneath.</p><blockquote><p>We can still create the <code>RequestQueue</code> explicitly, the <code>crawler.getRequestQueue()</code> method will respect that and return the instance provided via crawler options.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawleraddrequests"><code>crawler.addRequests()</code><a href="#crawleraddrequests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>We can now add multiple requests in batches. The newly added <code>addRequests</code> method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of <code>RequestQueue</code> and <code>RequestList</code>.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// will resolve right after the initial batch of 1000 requests is added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addRequests</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token comment" style="color:#999988;font-style:italic">/* many requests, can be even millions */</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">waitForAllRequestsToBeAdded</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="less-verbose-error-logging">Less verbose error logging<a href="#less-verbose-error-logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the <code>CRAWLEE_VERBOSE_LOG</code> env var.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlabel-shortcut"><code>Request.label</code> shortcut<a href="#requestlabel-shortcut" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Labeling requests used to work via the <code>Request.userData</code> object. With Crawlee, we can also use the <code>Request.label</code> shortcut. It is implemented as a <code>get/set</code> pair, using the value from <code>Request.userData</code>. The support for this shortcut is also added to the <code>enqueueLinks</code> options interface.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">label </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> label</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-requestasbrowser">Removal of <code>requestAsBrowser</code><a href="#removal-of-requestasbrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In v1 we replaced the underlying implementation of <code>requestAsBrowser</code> to be just a proxy over calling <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> - our custom extension to <code>got</code> that tries to mimic the real browsers as much as possible. With v3, we are removing the <code>requestAsBrowser</code>, encouraging the use of <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> directly.</p><p>For easier migration, we also added <code>context.sendRequest()</code> helper that allows processing the context bound <code>Request</code> object through <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sendRequest</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can use the options parameter to override gotScraping options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sendRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> responseType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'json'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'received body'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-sendrequest">How to use <code>sendRequest()</code>?<a href="#how-to-use-sendrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>See <a href="https://crawlee.dev/docs/guides/got-scraping" target="_blank" rel="noopener">the Got Scraping guide</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="removed-options">Removed options<a href="#removed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The <code>useInsecureHttpParser</code> option has been removed. It's permanently set to <code>true</code> in order to better mimic browsers' behavior.</p><p>Got Scraping automatically performs protocol negotiation, hence we removed the <code>useHttp2</code> option. It's set to <code>true</code> - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-options">Renamed options<a href="#renamed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>In the <code>requestAsBrowser</code> approach, some of the options were named differently. Here's a list of renamed options:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This options represents the body to send. It could be a <code>string</code> or a <code>Buffer</code>. However, there is no <code>payload</code> option anymore. You need to use <code>body</code> instead. Or, if you wish to send JSON, <code>json</code>. Here's an example:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>It has been renamed to <code>https.rejectUnauthorized</code>. By default, it's set to <code>false</code> for convenience. However, if you want to make sure the connection is secure, you can do the following:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ignoreSslErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> https</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> rejectUnauthorized</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Please note: the meanings are opposite! So we needed to invert the values as well.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="header-generator-options"><code>header-generator</code> options<a href="#header-generator-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>useMobileVersion</code>, <code>languageCode</code> and <code>countryCode</code> no longer exist. Instead, you need to use <code>headerGeneratorOptions</code> directly:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useMobileVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> languageCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'en'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headerGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'mobile'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// or ['desktop']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> locales</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'en-US'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutsecs"><code>timeoutSecs</code><a href="#timeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>In order to set a timeout, use <code>timeout.request</code> (which is <strong>milliseconds</strong> now).</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeout</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> request</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="throwonhttperrors"><code>throwOnHttpErrors</code><a href="#throwonhttperrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>throwOnHttpErrors</code> → <code>throwHttpErrors</code>. This options throws on unsuccessful HTTP status codes, for example <code>404</code>. By default, it's set to <code>false</code>.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="decodebody"><code>decodeBody</code><a href="#decodebody" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>decodeBody</code> → <code>decompress</code>. This options decompresses the body. Defaults to <code>true</code> - please do not change this or websites will break (unless you know what you're doing!).</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This function used to make the promise throw on specific responses, if it returned <code>true</code>. However, it wasn't that useful.</p><p>You probably want to cancel the request instead, which you can do in the following way:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> promise </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">…</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'request'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Please note this is not a Got Request instance, but a ClientRequest one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://nodejs.org/api/http.html#class-httpclientrequest</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">protocol </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Unsecure request, abort.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cancel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you set `isStream` to `true`, please use `stream.destroy()` instead.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-browser-pool-plugin-mixing">Removal of browser pool plugin mixing<a href="#removal-of-browser-pool-plugin-mixing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type).</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Confused?</div><div class="admonitionContent_S0QG"><p>As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="handling-requests-outside-of-browser">Handling requests outside of browser<a href="#handling-requests-outside-of-browser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of <code>Request.skipNavigation</code> and <code>context.sendRequest()</code>.</p><p>Take a look at how to achieve this by checking out the <a href="https://crawlee.dev/docs/examples/skip-navigation" target="_blank" rel="noopener">Skipping navigation for certain requests</a> example!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logging">Logging<a href="#logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Crawlee exports the default <code>log</code> instance directly as a named export. We also have a scoped <code>log</code> instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Opened </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="auto-saved-crawler-state">Auto-saved crawler state<a href="#auto-saved-crawler-state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Every crawler instance now has <code>useState()</code> method that will return a state object we can use. It will be automatically saved when <code>persistState</code> event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> crawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> state </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">useState</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// just change the value, no need to care about saving it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> state</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-sdk">Apify SDK<a href="#apify-sdk" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The Apify platform helpers can be now found in the Apify SDK (<code>apify</code> NPM package). It exports the <code>Actor</code> class that offers following static helpers:</p><ul><li><code>ApifyClient</code> shortcuts: <code>addWebhook()</code>, <code>call()</code>, <code>callTask()</code>, <code>metamorph()</code></li><li>helpers for running on Apify platform: <code>init()</code>, <code>exit()</code>, <code>fail()</code>, <code>main()</code>, <code>isAtHome()</code>, <code>createProxyConfiguration()</code></li><li>storage support: <code>getInput()</code>, <code>getValue()</code>, <code>openDataset()</code>, <code>openKeyValueStore()</code>, <code>openRequestQueue()</code>, <code>pushData()</code>, <code>setValue()</code></li><li>events support: <code>on()</code>, <code>off()</code></li><li>other utilities: <code>getEnv()</code>, <code>newClient()</code>, <code>reboot()</code></li></ul><p><code>Actor.main</code> is now just a syntax sugar around calling <code>Actor.init()</code> at the beginning and <code>Actor.exit()</code> at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> statusMessage</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>Actor.init()</code> will conditionally set the storage implementation of Crawlee to the <code>ApifyClient</code> when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). <code>Actor.exit()</code> will handle the tear down and calls <code>process.exit()</code> to ensure our process won't hang indefinitely for some reason.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="events">Events<a href="#events" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Apify SDK (v2) exports <code>Apify.events</code>, which is an <code>EventEmitter</code> instance. With Crawlee, the events are managed by <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> class instead. We can either access it via <code>Actor.eventManager</code> getter, or use <code>Actor.on</code> and <code>Actor.off</code> shortcuts instead.</p><div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">Apify.events.on(...);</span><br></span><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">Actor.on(...);</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>We can also get the <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> instance via <code>Configuration.getEventManager()</code>.</p></blockquote><p>In addition to the existing events, we now have an <code>exit</code> event fired when calling <code>Actor.exit()</code> (which is called at the end of <code>Actor.main()</code>). This event allows you to gracefully shut down any resources when <code>Actor.exit</code> is called.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="smallerinternal-breaking-changes">Smaller/internal breaking changes<a href="#smallerinternal-breaking-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><code>Apify.call()</code> is now just a shortcut for running <code>ApifyClient.actor(actorId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.callTask()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.metamorph()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).metamorph(input, options)</code>, while also taking the ACTOR_RUN_ID inside env vars into account</li><li><code>Apify.waitForRunToFinish()</code> has been removed, use <code>ApifyClient.waitForFinish()</code> instead</li><li><code>Actor.main/init</code> purges the storage by default</li><li>remove <code>purgeLocalStorage</code> helper, move purging to the storage class directly<ul><li><code>StorageClient</code> interface now has optional <code>purge</code> method</li><li>purging happens automatically via <code>Actor.init()</code> (you can opt out via <code>purge: false</code> in the options of <code>init/main</code> methods)</li></ul></li><li><code>QueueOperationInfo.request</code> is no longer available</li><li><code>Request.handledAt</code> is now string date in ISO format</li><li><code>Request.inProgress</code> and <code>Request.reclaimed</code> are now <code>Set</code>s instead of POJOs</li><li><code>injectUnderscore</code> from puppeteer utils has been removed</li><li><code>APIFY_MEMORY_MBYTES</code> is no longer taken into account, use <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> instead</li><li>some <code>AutoscaledPool</code> options are no longer available:<ul><li><code>cpuSnapshotIntervalSecs</code> and <code>memorySnapshotIntervalSecs</code> has been replaced with top level <code>systemInfoIntervalMillis</code> configuration</li><li><code>maxUsedCpuRatio</code> has been moved to the top level configuration</li></ul></li><li><code>ProxyConfiguration.newUrlFunction</code> can be async. <code>.newUrl()</code> and <code>.newProxyInfo()</code> now return promises.</li><li><code>prepareRequestFunction</code> and <code>postResponseFunction</code> options are removed, use navigation hooks instead</li><li><code>gotoFunction</code> and <code>gotoTimeoutSecs</code> are removed</li><li>removed compatibility fix for old/broken request queues with null <code>Request</code> props</li><li><code>fingerprintsOptions</code> renamed to <code>fingerprintOptions</code> (<code>fingerprints</code> -> <code>fingerprint</code>).</li><li><code>fingerprintOptions</code> now accept <code>useFingerprintCache</code> and <code>fingerprintCacheSize</code> (instead of <code>useFingerprintPerProxyCache</code> and <code>fingerprintPerProxyCacheSize</code>, which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v3.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-10-31T11:42:28.000Z">Oct 31, 2023</time></b> by <b>Vlad Frangu</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v2</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#crawlee-monorepo" class="table-of-contents__link toc-highlight">Crawlee monorepo</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#requestlabel-shortcut" class="table-of-contents__link toc-highlight"><code>Request.label</code> shortcut</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/upgrading/upgrading-to-v3">Next</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/sdk/js/docs/upgrading/upgrading-to-v3">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/upgrading/upgrading-to-v3">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/guides">Guides</a><button aria-label="Toggle the collapsible sidebar category 'Guides'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" href="/sdk/js/docs/examples">Examples</a><button aria-label="Toggle the collapsible sidebar category 'Examples'" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--active" aria-expanded="true" href="/sdk/js/docs/upgrading">Upgrading</a><button aria-label="Toggle the collapsible sidebar category 'Upgrading'" type="button" class="clean-btn menu__caret"></button></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v1">Upgrading to v1</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v2">Upgrading to v2</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/docs/upgrading/upgrading-to-v3">Upgrading to v3</a></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/docs/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item"><a class="breadcrumbs__link" itemprop="item" href="/sdk/js/docs/upgrading"><span itemprop="name">Upgrading</span></a><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Upgrading to v3</h1></header><p>This page summarizes most of the breaking changes between Crawlee (v3) and Apify SDK (v2). Crawlee is the spiritual successor to Apify SDK, so we decided to keep the versioning and release Crawlee as v3.</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Crawlee vs Apify SDK v2</div><div class="admonitionContent_S0QG"><p>Up until version 3 of <code>apify</code>, the package contained both scraping related tools and Apify platform related helper methods. With v3 we are splitting the whole project into two main parts:</p><ul><li><a href="https://github.com/apify/crawlee" target="_blank" rel="noopener">Crawlee</a>, the new web-scraping library, available as <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package on NPM</li><li><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener">Apify SDK</a>, helpers for the Apify platform, available as <a href="https://www.npmjs.com/package/apify" target="_blank" rel="noopener"><code>apify</code></a> package on NPM</li></ul></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawlee-monorepo">Crawlee monorepo<a href="#crawlee-monorepo" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The <a href="https://www.npmjs.com/package/crawlee" target="_blank" rel="noopener"><code>crawlee</code></a> package consists of several smaller packages, released separately under <code>@crawlee</code> namespace:</p><ul><li><code>@crawlee/core</code>: the base for all the crawler implementations, also contains things like <code>Request</code>, <code>RequestQueue</code>, <code>RequestList</code> or <code>Dataset</code> classes</li><li><code>@crawlee/basic</code>: exports <code>BasicCrawler</code></li><li><code>@crawlee/http</code>: exports <code>HttpCrawler</code> (which is used for creating <code>@crawlee/dom</code> and <code>@crawlee/cheerio</code>)</li><li><code>@crawlee/dom</code>: exports <code>DOMCrawler</code></li><li><code>@crawlee/cheerio</code>: exports <code>CheerioCrawler</code></li><li><code>@crawlee/browser</code>: exports <code>BrowserCrawler</code> (which is used for creating <code>@crawlee/playwright</code> and <code>@crawlee/puppeteer</code>)</li><li><code>@crawlee/playwright</code>: exports <code>PlaywrightCrawler</code></li><li><code>@crawlee/puppeteer</code>: exports <code>PuppeteerCrawler</code></li><li><code>@crawlee/memory-storage</code>: <code>@apify/storage-local</code> alternative</li><li><code>@crawlee/browser-pool</code>: previously <code>browser-pool</code> package</li><li><code>@crawlee/utils</code>: utility methods</li><li><code>@crawlee/types</code>: holds TS interfaces mainly about the <code>StorageClient</code></li></ul><h3 class="anchor anchorWithStickyNavbar_LWe7" id="installing-crawlee">Installing Crawlee<a href="#installing-crawlee" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Most of the Crawlee packages are extending and reexporting each other, so it's enough to install just the one you plan on using, e.g. <code>@crawlee/playwright</code> if you plan on using <code>playwright</code> - it already contains everything from the <code>@crawlee/browser</code> package, which includes everything from <code>@crawlee/basic</code>, which includes everything from <code>@crawlee/core</code>.</p><p>If we don't care much about additional code being pulled in, we can just use the <code>crawlee</code> meta-package, which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Or if all we need is cheerio support, we can install only <code>@crawlee/cheerio</code>.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> @crawlee/cheerio</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>When using <code>playwright</code> or <code>puppeteer</code>, we still need to install those dependencies explicitly - this allows the users to be in control of which version will be used.</p><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee playwright</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># or npm install @crawlee/playwright playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Alternatively we can also use the <code>crawlee</code> meta-package which contains (re-exports) most of the <code>@crawlee/*</code> packages, and therefore contains all the crawler classes.</p><blockquote><p>Sometimes you might want to use some utility methods from <code>@crawlee/utils</code>, so you might want to install that as well. This package contains some utilities that were previously available under <code>Apify.utils</code>. Browser related utilities can be also found in the crawler packages (e.g. <code>@crawlee/playwright</code>).</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="full-typescript-support">Full TypeScript support<a href="#full-typescript-support" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Both Crawlee and Apify SDK are full TypeScript rewrite, so they include up-to-date types in the package. For your TypeScript crawlers we recommend using our predefined TypeScript configuration from <code>@apify/tsconfig</code> package. Don't forget to set the <code>module</code> and <code>target</code> to <code>ES2022</code> or above to be able to use top level await.</p><blockquote><p>The <code>@apify/tsconfig</code> config has <a href="https://www.typescriptlang.org/tsconfig#noImplicitAny" target="_blank" rel="noopener"><code>noImplicitAny</code></a> enabled, you might want to disable it during the initial development as it will cause build failures if you left some unused local variables in your code.</p></blockquote><div class="language-json codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">tsconfig.json</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-json codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"extends"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"@apify/tsconfig"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"compilerOptions"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"module"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"target"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"ES2022"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"outDir"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"dist"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"lib"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">"DOM"</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token property" style="color:#36acaa">"include"</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token string" style="color:#e3116c">"./src/**/*"</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="docker-build">Docker build<a href="#docker-build" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>For <code>Dockerfile</code> we recommend using multi-stage build, so you don't install the dev dependencies like TypeScript in your final image:</p><div class="language-dockerfile codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Dockerfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-dockerfile codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic"># using multistage build, as we need dev deps to build the TS source code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16 </span><span class="token instruction keyword" style="color:#00009f">AS</span><span class="token instruction"> builder</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy all files, install all dependencies (including dev deps) and build the project</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> . ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm install --include=dev </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm run build</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># create final image</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">FROM</span><span class="token instruction"> apify/actor-node:16</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># copy only necessary files</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/package*.json ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/README.md ./</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/dist ./dist</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/apify.json ./apify.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">COPY</span><span class="token instruction"> </span><span class="token instruction options property" style="color:#36acaa">--from</span><span class="token instruction options punctuation" style="color:#393A34">=</span><span class="token instruction options string" style="color:#e3116c">builder</span><span class="token instruction"> /usr/src/app/INPUT_SCHEMA.json ./INPUT_SCHEMA.json</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># install only prod deps</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">RUN</span><span class="token instruction"> npm --quiet set progress=false </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm install --only=prod --no-optional </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Installed NPM packages:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && (npm list --only=prod --no-optional --all || true) </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"Node.js version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && node --version </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && echo </span><span class="token instruction string" style="color:#e3116c">"NPM version:"</span><span class="token instruction"> </span><span class="token instruction operator" style="color:#393A34">\</span><span class="token instruction"></span><br></span><span class="token-line" style="color:#393A34"><span class="token instruction"> && npm --version</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic"># run compiled code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token instruction keyword" style="color:#00009f">CMD</span><span class="token instruction"> npm run start:prod</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="browser-fingerprints">Browser fingerprints<a href="#browser-fingerprints" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously we had a magical <code>stealth</code> option in the puppeteer crawler that enabled several tricks aiming to mimic the real users as much as possible. While this worked to a certain degree, we decided to replace it with generated browser fingerprints.</p><p>In case we don't want to have dynamic fingerprints, we can disable this behaviour via <code>useFingerprints</code> in <code>browserPoolOptions</code>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> browserPoolOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useFingerprints</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="session-cookie-method-renames">Session cookie method renames<a href="#session-cookie-method-renames" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, if we wanted to get or add cookies for the session that would be used for the request, we had to call <code>session.getPuppeteerCookies()</code> or <code>session.setPuppeteerCookies()</code>. Since this method could be used for any of our crawlers, not just <code>PuppeteerCrawler</code>, the methods have been renamed to <code>session.getCookies()</code> and <code>session.setCookies()</code> respectively. Otherwise, their usage is exactly the same!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="memory-storage">Memory storage<a href="#memory-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>When we store some data or intermediate state (like the one <code>RequestQueue</code> holds), we now use <code>@crawlee/memory-storage</code> by default. It is an alternative to the <code>@apify/storage-local</code>, that stores the state inside memory (as opposed to SQLite database used by <code>@apify/storage-local</code>). While the state is stored in memory, it also dumps it to the file system, so we can observe it, as well as respects the existing data stored in KeyValueStore (e.g. the <code>INPUT.json</code> file).</p><p>When we want to run the crawler on Apify platform, we need to use <code>Actor.init</code> or <code>Actor.main</code>, which will automatically switch the storage client to <code>ApifyClient</code> when on the Apify platform.</p><p>We can still use the <code>@apify/storage-local</code>, to do it, first install it pass it to the <code>Actor.init</code> or <code>Actor.main</code> options:</p><blockquote><p><code>@apify/storage-local</code> v2.1.0+ is required for Crawlee</p></blockquote><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> ApifyStorageLocal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'@apify/storage-local'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> storage </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">ApifyStorageLocal</span><span class="token punctuation" style="color:#393A34">(</span><span class="token comment" style="color:#999988;font-style:italic">/* options like `enableWalMode` belong here */</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> storage </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="purging-of-the-default-storage">Purging of the default storage<a href="#purging-of-the-default-storage" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously the state was preserved between local runs, and we had to use <code>--purge</code> argument of the <code>apify-cli</code>. With Crawlee, this is now the default behaviour, we purge the storage automatically on <code>Actor.init/main</code> call. We can opt out of it via <code>purge: false</code> in the <code>Actor.init</code> options.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-crawler-options-and-interfaces">Renamed crawler options and interfaces<a href="#renamed-crawler-options-and-interfaces" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some options were renamed to better reflect what they do. We still support all the old parameter names too, but not at the TS level.</p><ul><li><code>handleRequestFunction</code> -> <code>requestHandler</code></li><li><code>handlePageFunction</code> -> <code>requestHandler</code></li><li><code>handleRequestTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>handlePageTimeoutSecs</code> -> <code>requestHandlerTimeoutSecs</code></li><li><code>requestTimeoutSecs</code> -> <code>navigationTimeoutSecs</code></li><li><code>handleFailedRequestFunction</code> -> <code>failedRequestHandler</code></li></ul><p>We also renamed the crawling context interfaces, so they follow the same convention and are more meaningful:</p><ul><li><code>CheerioHandlePageInputs</code> -> <code>CheerioCrawlingContext</code></li><li><code>PlaywrightHandlePageFunction</code> -> <code>PlaywrightCrawlingContext</code></li><li><code>PuppeteerHandlePageFunction</code> -> <code>PuppeteerCrawlingContext</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="context-aware-helpers">Context aware helpers<a href="#context-aware-helpers" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Some utilities previously available under <code>Apify.utils</code> namespace are now moved to the crawling context and are <em>context aware</em>. This means they have some parameters automatically filled in from the context, like the current <code>Request</code> instance or current <code>Page</code> object, or the <code>RequestQueue</code> bound to the crawler.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="enqueuing-links">Enqueuing links<a href="#enqueuing-links" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>One common helper that received more attention is the <code>enqueueLinks</code>. As mentioned above, it is context aware - we no longer need pass in the <code>requestQueue</code> or <code>page</code> arguments (or the cheerio handle <code>$</code>). In addition to that, it now offers 3 enqueuing strategies:</p><ul><li><code>EnqueueStrategy.All</code> (<code>'all'</code>): Matches any URLs found</li><li><code>EnqueueStrategy.SameHostname</code> (<code>'same-hostname'</code>) Matches any URLs that have the same subdomain as the base URL (default)</li><li><code>EnqueueStrategy.SameDomain</code> (<code>'same-domain'</code>) Matches any URLs that have the same domain name. For example, <code>https://wow.an.example.com</code> and <code>https://example.com</code> will both be matched for a base url of <code>https://example.com</code>.</li></ul><p>This means we can even call <code>enqueueLinks()</code> without any parameters. By default, it will go through all the links found on current page and filter only those targeting the same subdomain.</p><p>Moreover, we can specify patterns the URL should match via globs:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev/*/*'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can also use `regexps` and `pseudoUrls` keys here</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="implicit-requestqueue-instance">Implicit <code>RequestQueue</code> instance<a href="#implicit-requestqueue-instance" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>All crawlers now have the <code>RequestQueue</code> instance automatically available via <code>crawler.getRequestQueue()</code> method. It will create the instance for you if it does not exist yet. This mean we no longer need to create the <code>RequestQueue</code> instance manually, and we can just use <code>crawler.addRequests()</code> method described underneath.</p><blockquote><p>We can still create the <code>RequestQueue</code> explicitly, the <code>crawler.getRequestQueue()</code> method will respect that and return the instance provided via crawler options.</p></blockquote><h2 class="anchor anchorWithStickyNavbar_LWe7" id="crawleraddrequests"><code>crawler.addRequests()</code><a href="#crawleraddrequests" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>We can now add multiple requests in batches. The newly added <code>addRequests</code> method will handle everything for us. It enqueues the first 1000 requests and resolves, while continuing with the rest in the background, again in a smaller 1000 items batches, so we don't fall into any API rate limits. This means the crawling will start almost immediately (within few seconds at most), something previously possible only with a combination of <code>RequestQueue</code> and <code>RequestList</code>.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// will resolve right after the initial batch of 1000 requests is added</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> result </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addRequests</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token comment" style="color:#999988;font-style:italic">/* many requests, can be even millions */</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// if we want to wait for all the requests to be added, we can await the `waitForAllRequestsToBeAdded` promise</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> result</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">waitForAllRequestsToBeAdded</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="less-verbose-error-logging">Less verbose error logging<a href="#less-verbose-error-logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously an error thrown from inside request handler resulted in full error object being logged. With Crawlee, we log only the error message as a warning as long as we know the request will be retried. If you want to enable verbose logging like in v2, use the <code>CRAWLEE_VERBOSE_LOG</code> env var.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="requestlabel-shortcut"><code>Request.label</code> shortcut<a href="#requestlabel-shortcut" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Labeling requests used to work via the <code>Request.userData</code> object. With Crawlee, we can also use the <code>Request.label</code> shortcut. It is implemented as a <code>get/set</code> pair, using the value from <code>Request.userData</code>. The support for this shortcut is also added to the <code>enqueueLinks</code> options interface.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> enqueueLinks </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">label </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> globs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'...'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> label</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'DETAIL'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-requestasbrowser">Removal of <code>requestAsBrowser</code><a href="#removal-of-requestasbrowser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>In v1 we replaced the underlying implementation of <code>requestAsBrowser</code> to be just a proxy over calling <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> - our custom extension to <code>got</code> that tries to mimic the real browsers as much as possible. With v3, we are removing the <code>requestAsBrowser</code>, encouraging the use of <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a> directly.</p><p>For easier migration, we also added <code>context.sendRequest()</code> helper that allows processing the context bound <code>Request</code> object through <a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener"><code>got-scraping</code></a>:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> sendRequest</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> log </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// we can use the options parameter to override gotScraping options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> res </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">sendRequest</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> responseType</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'json'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'received body'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> res</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">body</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-to-use-sendrequest">How to use <code>sendRequest()</code>?<a href="#how-to-use-sendrequest" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>See <a href="https://crawlee.dev/docs/guides/got-scraping" target="_blank" rel="noopener">the Got Scraping guide</a>.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="removed-options">Removed options<a href="#removed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>The <code>useInsecureHttpParser</code> option has been removed. It's permanently set to <code>true</code> in order to better mimic browsers' behavior.</p><p>Got Scraping automatically performs protocol negotiation, hence we removed the <code>useHttp2</code> option. It's set to <code>true</code> - 100% of browsers nowadays are capable of HTTP/2 requests. Oh, more and more of the web is using it too!</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="renamed-options">Renamed options<a href="#renamed-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>In the <code>requestAsBrowser</code> approach, some of the options were named differently. Here's a list of renamed options:</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="payload"><code>payload</code><a href="#payload" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This options represents the body to send. It could be a <code>string</code> or a <code>Buffer</code>. However, there is no <code>payload</code> option anymore. You need to use <code>body</code> instead. Or, if you wish to send JSON, <code>json</code>. Here's an example:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> payload</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Hello, world!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> body</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> Buffer</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">from</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'c0ffe'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'hex'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> json</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> hello</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'world'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="ignoresslerrors"><code>ignoreSslErrors</code><a href="#ignoresslerrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>It has been renamed to <code>https.rejectUnauthorized</code>. By default, it's set to <code>false</code> for convenience. However, if you want to make sure the connection is secure, you can do the following:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ignoreSslErrors</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> https</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> rejectUnauthorized</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Please note: the meanings are opposite! So we needed to invert the values as well.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="header-generator-options"><code>header-generator</code> options<a href="#header-generator-options" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>useMobileVersion</code>, <code>languageCode</code> and <code>countryCode</code> no longer exist. Instead, you need to use <code>headerGeneratorOptions</code> directly:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> useMobileVersion</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">true</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> languageCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'en'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> headerGeneratorOptions</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> devices</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'mobile'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// or ['desktop']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> locales</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'en-US'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="timeoutsecs"><code>timeoutSecs</code><a href="#timeoutsecs" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>In order to set a timeout, use <code>timeout.request</code> (which is <strong>milliseconds</strong> now).</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Before:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Apify</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">utils</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">requestAsBrowser</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeoutSecs</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// After:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> …</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> timeout</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> request</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">*</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">1000</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h4 class="anchor anchorWithStickyNavbar_LWe7" id="throwonhttperrors"><code>throwOnHttpErrors</code><a href="#throwonhttperrors" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>throwOnHttpErrors</code> → <code>throwHttpErrors</code>. This options throws on unsuccessful HTTP status codes, for example <code>404</code>. By default, it's set to <code>false</code>.</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="decodebody"><code>decodeBody</code><a href="#decodebody" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p><code>decodeBody</code> → <code>decompress</code>. This options decompresses the body. Defaults to <code>true</code> - please do not change this or websites will break (unless you know what you're doing!).</p><h4 class="anchor anchorWithStickyNavbar_LWe7" id="abortfunction"><code>abortFunction</code><a href="#abortfunction" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h4><p>This function used to make the promise throw on specific responses, if it returned <code>true</code>. However, it wasn't that useful.</p><p>You probably want to cancel the request instead, which you can do in the following way:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> promise </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">…</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">on</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'request'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Please note this is not a Got Request instance, but a ClientRequest one.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// https://nodejs.org/api/http.html#class-httpclientrequest</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">protocol </span><span class="token operator" style="color:#393A34">!==</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'https:'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Unsecure request, abort.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">cancel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// If you set `isStream` to `true`, please use `stream.destroy()` instead.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> response </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> promise</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="removal-of-browser-pool-plugin-mixing">Removal of browser pool plugin mixing<a href="#removal-of-browser-pool-plugin-mixing" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Previously, you were able to have a browser pool that would mix Puppeteer and Playwright plugins (or even your own custom plugins if you've built any). As of this version, that is no longer allowed, and creating such a browser pool will cause an error to be thrown (it's expected that all plugins that will be used are of the same type).</p><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Confused?</div><div class="admonitionContent_S0QG"><p>As an example, this change disallows a pool to mix Puppeteer with Playwright. You can still create pools that use multiple Playwright plugins, each with a different launcher if you want!</p></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="handling-requests-outside-of-browser">Handling requests outside of browser<a href="#handling-requests-outside-of-browser" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>One small feature worth mentioning is the ability to handle requests with browser crawlers outside the browser. To do that, we can use a combination of <code>Request.skipNavigation</code> and <code>context.sendRequest()</code>.</p><p>Take a look at how to achieve this by checking out the <a href="https://crawlee.dev/docs/examples/skip-navigation" target="_blank" rel="noopener">Skipping navigation for certain requests</a> example!</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="logging">Logging<a href="#logging" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Crawlee exports the default <code>log</code> instance directly as a named export. We also have a scoped <code>log</code> instance provided in the crawling context - this one will log messages prefixed with the crawler name and should be preferred for logging inside the request handler.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> request </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">info</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Opened </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="auto-saved-crawler-state">Auto-saved crawler state<a href="#auto-saved-crawler-state" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Every crawler instance now has <code>useState()</code> method that will return a state object we can use. It will be automatically saved when <code>persistState</code> event occurs. The value is cached, so we can freely call this method multiple times and get the exact same reference. No need to worry about saving the value either, as it will happen automatically.</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> crawler </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> state </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">useState</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">as</span><span class="token plain"> </span><span class="token builtin">number</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// just change the value, no need to care about saving it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> state</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">foo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">push</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">123</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_LWe7" id="apify-sdk">Apify SDK<a href="#apify-sdk" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>The Apify platform helpers can be now found in the Apify SDK (<code>apify</code> NPM package). It exports the <code>Actor</code> class that offers following static helpers:</p><ul><li><code>ApifyClient</code> shortcuts: <code>addWebhook()</code>, <code>call()</code>, <code>callTask()</code>, <code>metamorph()</code></li><li>helpers for running on Apify platform: <code>init()</code>, <code>exit()</code>, <code>fail()</code>, <code>main()</code>, <code>isAtHome()</code>, <code>createProxyConfiguration()</code></li><li>storage support: <code>getInput()</code>, <code>getValue()</code>, <code>openDataset()</code>, <code>openKeyValueStore()</code>, <code>openRequestQueue()</code>, <code>pushData()</code>, <code>setValue()</code></li><li>events support: <code>on()</code>, <code>off()</code></li><li>other utilities: <code>getEnv()</code>, <code>newClient()</code>, <code>reboot()</code></li></ul><p><code>Actor.main</code> is now just a syntax sugar around calling <code>Actor.init()</code> at the beginning and <code>Actor.exit()</code> at the end (plus wrapping the user function in try/catch block). All those methods are async and should be awaited - with node 16 we can use the top level await for that. In other words, following is equivalent:</p><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-ts codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-ts codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">import</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> Actor </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">await</span><span class="token plain"> Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// your code</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> statusMessage</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'Crawling finished!'</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p><code>Actor.init()</code> will conditionally set the storage implementation of Crawlee to the <code>ApifyClient</code> when running on the Apify platform, or keep the default (memory storage) implementation otherwise. It will also subscribe to the websocket events (or mimic them locally). <code>Actor.exit()</code> will handle the tear down and calls <code>process.exit()</code> to ensure our process won't hang indefinitely for some reason.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="events">Events<a href="#events" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Apify SDK (v2) exports <code>Apify.events</code>, which is an <code>EventEmitter</code> instance. With Crawlee, the events are managed by <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> class instead. We can either access it via <code>Actor.eventManager</code> getter, or use <code>Actor.on</code> and <code>Actor.off</code> shortcuts instead.</p><div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted prefix deleted" style="color:#d73a49">-</span><span class="token deleted-sign deleted line" style="color:#d73a49">Apify.events.on(...);</span><br></span><span class="token-line" style="color:#393A34"><span class="token deleted-sign deleted line" style="color:#d73a49"></span><span class="token inserted-sign inserted prefix inserted" style="color:#36acaa">+</span><span class="token inserted-sign inserted line" style="color:#36acaa">Actor.on(...);</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><blockquote><p>We can also get the <a href="https://crawlee.dev/api/core/class/EventManager" target="_blank" rel="noopener noreferrer"><code>EventManager</code></a> instance via <code>Configuration.getEventManager()</code>.</p></blockquote><p>In addition to the existing events, we now have an <code>exit</code> event fired when calling <code>Actor.exit()</code> (which is called at the end of <code>Actor.main()</code>). This event allows you to gracefully shut down any resources when <code>Actor.exit</code> is called.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="smallerinternal-breaking-changes">Smaller/internal breaking changes<a href="#smallerinternal-breaking-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><code>Apify.call()</code> is now just a shortcut for running <code>ApifyClient.actor(actorId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.callTask()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).call(input, options)</code>, while also taking the token inside env vars into account</li><li><code>Apify.metamorph()</code> is now just a shortcut for running <code>ApifyClient.task(taskId).metamorph(input, options)</code>, while also taking the ACTOR_RUN_ID inside env vars into account</li><li><code>Apify.waitForRunToFinish()</code> has been removed, use <code>ApifyClient.waitForFinish()</code> instead</li><li><code>Actor.main/init</code> purges the storage by default</li><li>remove <code>purgeLocalStorage</code> helper, move purging to the storage class directly<ul><li><code>StorageClient</code> interface now has optional <code>purge</code> method</li><li>purging happens automatically via <code>Actor.init()</code> (you can opt out via <code>purge: false</code> in the options of <code>init/main</code> methods)</li></ul></li><li><code>QueueOperationInfo.request</code> is no longer available</li><li><code>Request.handledAt</code> is now string date in ISO format</li><li><code>Request.inProgress</code> and <code>Request.reclaimed</code> are now <code>Set</code>s instead of POJOs</li><li><code>injectUnderscore</code> from puppeteer utils has been removed</li><li><code>APIFY_MEMORY_MBYTES</code> is no longer taken into account, use <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> instead</li><li>some <code>AutoscaledPool</code> options are no longer available:<ul><li><code>cpuSnapshotIntervalSecs</code> and <code>memorySnapshotIntervalSecs</code> has been replaced with top level <code>systemInfoIntervalMillis</code> configuration</li><li><code>maxUsedCpuRatio</code> has been moved to the top level configuration</li></ul></li><li><code>ProxyConfiguration.newUrlFunction</code> can be async. <code>.newUrl()</code> and <code>.newProxyInfo()</code> now return promises.</li><li><code>prepareRequestFunction</code> and <code>postResponseFunction</code> options are removed, use navigation hooks instead</li><li><code>gotoFunction</code> and <code>gotoTimeoutSecs</code> are removed</li><li>removed compatibility fix for old/broken request queues with null <code>Request</code> props</li><li><code>fingerprintsOptions</code> renamed to <code>fingerprintOptions</code> (<code>fingerprints</code> -> <code>fingerprint</code>).</li><li><code>fingerprintOptions</code> now accept <code>useFingerprintCache</code> and <code>fingerprintCacheSize</code> (instead of <code>useFingerprintPerProxyCache</code> and <code>fingerprintPerProxyCacheSize</code>, which are now no longer available). This is because the cached fingerprints are no longer connected to proxy URLs but to sessions.</li></ul></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apify/apify-sdk-js/edit/master/website/versioned_docs/version-3.1/upgrading/upgrading_v3.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">Last updated<!-- --> on <b><time datetime="2023-11-01T05:44:25.000Z">Nov 1, 2023</time></b> by <b>renovate[bot]</b></span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/docs/upgrading/upgrading-to-v2"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Upgrading to v2</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/docs/changelog"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Changelog</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#crawlee-monorepo" class="table-of-contents__link toc-highlight">Crawlee monorepo</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#requestlabel-shortcut" class="table-of-contents__link toc-highlight"><code>Request.label</code> shortcut</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/index.html b/index.html index 97abc411f1..2062ee546d 100644 --- a/index.html +++ b/index.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div id="__docusaurus-base-url-issue-banner-container"></div><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><header class="container heroBanner_qdFl"><div class="row padding-horiz--md"><div class="col col--7"><div class="relative_WWZZ row"><div class="col"><h1 class="tagline_Bqj_">Apify SDK for JavaScript and Node.js</h1><h1 class="tagline_Bqj_"><span>Apify SDK</span> for <span>JavaScript</span> and <span>Node.js</span></h1></div></div><div class="row"><div class="col"><h2>Toolkit for building <a href="https://docs.apify.com/actors">Actors</a>—serverless microservices running (not only) on the Apify platform.</h2></div></div><div class="row"><div class="col"><div class="heroButtons_r52D"><a class="getStarted_D36F" href="/sdk/js/docs/guides/apify-platform">Get started</a><iframe src="https://ghbtns.com/github-btn.html?user=apify&repo=apify-sdk-js&type=star&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe></div></div></div></div><div class="relative_WWZZ col col--5"><div class="logoBlur_PmTz"><img src="/sdk/js/img/logo-blur.png" class="hideSmall__p9W"></div><div class="codeBlock_NVHr"><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">npx apify-cli create my-crawler</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div></header><section class="container features_cAfv"><div class="row"><div class="col text--center"><h2>Apify SDK v3 is out 🚀<br> What's new? Read below 👇</h2></div></div><div class="row"><div class="col col--6"><p>Four years ago, Apify released its <b>open-source Node.js</b> library for web scraping and automation, <b>Apify SDK</b>. It became popular among the community, but there was a problem. Despite being open-source, <b>the library's name caused users to think its features were restricted to the Apify platform</b>, which was never the case.</p><p>With this in mind, we decided to split Apify SDK into two libraries,<a href="https://crawlee.dev" target="_blank" rel="noreferrer"><b> Crawlee</b></a> and <b>Apify SDK v3</b>.<b> Crawlee</b> will retain all the <b>crawling and scraping-related tools </b>and will always strive to be the best web scraping library for its community. At the same time, <b>Apify SDK</b> will continue to exist, but keep only the Apify-specific features related to <b>building actors</b> on the <a href="https://apify.com" target="_blank" rel="noreferrer"> <b>Apify platform</b></a>.</p></div><div class="col col--6 text--center"><img src="/sdk/js/img/sdk-split-light.png" class="themedImage_ToTc themedImage--light_HNdA hideSmall__p9W"><img src="/sdk/js/img/sdk-split-dark.png" class="themedImage_ToTc themedImage--dark_i4oU hideSmall__p9W"></div></div></section><section class="try_iMNP container"><h2 class="text--center">How it works now</h2><div class="row"><div class="col"><h3>Outside of the Apify platform</h3></div></div><div class="row"><div class="col col--6"><p>If you want to use the <b>crawling functionality</b> of Apify SDK v2 outside of the Apify platform, head to <a href="https://crawlee.dev" target="_blank" rel="noreferrer"><b> Crawlee documentation</b></a> to get started. The interface is almost exactly the same as the original SDK, but we've made a lot of improvements under the hood to improve the developer experience.</p></div><div class="col col--6 padding-vert--lg"><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> crawlee</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div class="row"><h3 class="col">On the Apify platform</h3></div><div class="row"><p class="col">In <b>Apify SDK v2</b>, both the <b>crawling and actor building logic were mixed</b> together. This made it easy to build crawlers on the Apify platform, but confusing to build anything else.<b> Apify SDK v3 includes only the Apify platform specific functionality</b>. To build crawlers on the Apify platform, you need to combine it with <a href="https://crawlee.dev" target="_blank" rel="noreferrer"><b>Crawlee</b></a>. Or you can use it standalone for other projects.</p></div><div class="row"><div class="col"><h3>Build a crawler like you're used to</h3></div></div><div class="row"><p class="col col--6">The following example shows how to build an <b>SDK-v2-like crawler on the Apify platform</b>. To use <code>PlaywrightCrawler</code> you need to install 3 libraries. Apify SDK v3, Crawlee and Playwright. In v2, you only needed to install Apify SDK v2 and Playwright.</p><div class="col col--6 padding-vert--lg"><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> apify crawlee playwright</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div class="row"><div class="col"><div class="theme-admonition theme-admonition-caution alert alert--warning admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>Don't forget about module imports</div><div class="admonitionContent_S0QG">To run the example, add a <code>"type": "module"</code> clause into your <code>package.json</code> or copy it into a file with an <code>.mjs</code> suffix. This enables <code>import</code> statements in Node.js. See <a href="https://nodejs.org/dist/latest-v16.x/docs/api/esm.html#enabling" target="_blank" rel="noreferrer">Node.js docs</a> for more information.</div></div><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// Apify SDK v3 uses named exports instead of the Apify object.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// You can import Dataset, KeyValueStore and more.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// We moved all the crawling components to Crawlee.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// See the documentation on https://crawlee.dev</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">PlaywrightCrawler</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Initialize the actor on the platform. This function connects your</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// actor to platform events, storages and API. It replaces Apify.main()</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">PlaywrightCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// handle(Page|Request)Functions of all Crawlers</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// are now simply called a requestHandler.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> request</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> page</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> enqueueLinks </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> title </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> page</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">title</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Title of </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">request</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">loadedUrl</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> is '</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">title</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">'</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Use Actor instead of the Apify object to save data.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> title</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">url</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> request</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">loadedUrl</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// We simplified enqueuing links a lot, see the docs.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// This way the function adds only links to same hostname.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">enqueueLinks</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// You can now add requests to the queue directly from the run function.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// No need to create an instance of the queue separately.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> crawler</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">run</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'https://crawlee.dev'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This function disconnects the actor from the platform</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// and optionally sends an exit message.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div class="row"><div class="col"><div class="theme-admonition theme-admonition-tip alert alert--success admonition_LlT9"><div class="admonitionHeading_tbUL"><span class="admonitionIcon_kALy"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>upgrading guide</div><div class="admonitionContent_S0QG"><p>For more information, see the<a href="docs/upgrading/upgrading-to-v3"> upgrading guide</a> that explains all the changes in great detail.</p></div></div></div></div><div class="row"><div class="col"><h3>Build an actor without Crawlee</h3></div></div><div class="row"><div class="col col--6"><p>If your actors are not crawlers, or you want to simply wrap existing code and turn it into an actor on the Apify platform, you can do that with standalone Apify SDK v3.</p></div><div class="col col--6"><div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token function" style="color:#d73a49">npm</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">install</span><span class="token plain"> apify</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><div class="row"><div class="col"><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">Actor</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'apify'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Initialize the actor on the platform. This function connects your</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// actor to platform events, storages and API. It replaces Apify.main()</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">init</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Do something with the input in your own code.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> output </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">magicallyCreateOutput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">input</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-output'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> output</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// This function disconnects the actor from the platform</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// and optionally sends an exit message.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">exit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></section><div class="container"><div class="row"><div class="col text--center padding-top--lg padding-bottom--xl"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1080 1080" style="enable-background:new 0 0 1080 1080" xml:space="preserve" class="bottomLogo_ktCI"><path d="M189.4 148.8C114.7 159.3 62.7 228.3 73.1 303l80.6 576.8 339.2-773.3-303.5 42.3z" style="fill:#6bb435"></path><path d="M1007.9 629.4 976.2 186c-5.6-78.8-76.8-136.4-155.1-125.5L690.5 78.8l287.5 646c21.2-26.3 32.4-60.2 29.9-95.4z" style="fill:#0099c5"></path><path d="M277.1 1020c22.3 2.5 45.6-.4 68.2-10L839 801.2 604.3 273.9 277.1 1020z" style="fill:#ff7800"></path></svg></div></div></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference.html b/reference.html index 043f3286c2..1a36add7e0 100644 --- a/reference.html +++ b/reference.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,7 +26,7 @@ see <a href="https://github.com/apify/apify-sdk-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-sdk-js/blob/master/LICENSE.md" target="_blank" rel="noopener noreferrer">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener noreferrer">Chema Balsas</a> for giving up the <code>apify</code> package name on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener noreferrer">jsdocify</a>.</p></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Classes</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/Actor"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Actor</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/ApifyClient"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ApifyClient</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/Configuration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Configuration</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/KeyValueStore"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>KeyValueStore</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/Log"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Log</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/Logger"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Logger</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/LoggerJson"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>LoggerJson</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/LoggerText"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>LoggerText</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/PlatformEventManager"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>PlatformEventManager</a></li></ul></div><h3 class="tsd-panel-header">Result Stores</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/Dataset"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Dataset</a></li></ul></div><h3 class="tsd-panel-header">Scaling</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/ProxyConfiguration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ProxyConfiguration</a></li></ul></div><h3 class="tsd-panel-header">Sources</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/class/RequestQueue"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>RequestQueue</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Enumerations</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/enum/LogLevel"><i class="codicon codicon-symbol-enum" style="color:var(--ifm-color-danger)"></i>LogLevel</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Interfaces</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/AbortOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>AbortOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ActorRun"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ActorRun</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ApifyClientOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyClientOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ApifyEnv"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyEnv</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/CallOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/CallTaskOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallTaskOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetContent"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetContent</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetDataOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetDataOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetMapper"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetMapper</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/DatasetReducer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetReducer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ExitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ExitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/InitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>InitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/KeyConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/KeyValueStoreOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/LoggerOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>LoggerOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/MainOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MainOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/MetamorphOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MetamorphOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/OpenStorageOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>OpenStorageOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ProxyConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/ProxyInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/QueueOperationInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>QueueOperationInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/RecordOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RecordOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/RequestQueueOperationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOperationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/RequestQueueOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/interface/WebhookOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>WebhookOptions</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Type Aliases</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference#UserFunc"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Variables</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference#log"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success)"></i>log</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Type Aliases<!-- --> <a class="tsd-anchor" href="#Type Aliases"><span class="tsd-anchor-id" id="Type Aliases"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#UserFunc"><span class="tsd-anchor-id" id="UserFunc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1577" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>UserFunc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><div class="tds-type-parameters"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">unknown</span></span></li></ul></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Variables<!-- --> <a class="tsd-anchor" href="#Variables"><span class="tsd-anchor-id" id="Variables"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#log"><span class="tsd-anchor-id" id="log"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/index.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-const">const</span>log</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success)"></i>log<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Log">Log</a></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#UserFunc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger);"></i> UserFunc</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success);"></i> log</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0.html b/reference/3.0.html index 475a78fb60..ebccca509b 100644 --- a/reference/3.0.html +++ b/reference/3.0.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,7 +26,7 @@ see <a href="https://github.com/apify/apify-sdk-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-sdk-js/blob/master/LICENSE.md" target="_blank" rel="noopener noreferrer">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener noreferrer">Chema Balsas</a> for giving up the <code>apify</code> package name on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener noreferrer">jsdocify</a>.</p></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Classes</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/Actor"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Actor</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/ApifyClient"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ApifyClient</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/Configuration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Configuration</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/KeyValueStore"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>KeyValueStore</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/PlatformEventManager"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>PlatformEventManager</a></li></ul></div><h3 class="tsd-panel-header">Result Stores</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/Dataset"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Dataset</a></li></ul></div><h3 class="tsd-panel-header">Scaling</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/ProxyConfiguration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ProxyConfiguration</a></li></ul></div><h3 class="tsd-panel-header">Sources</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/class/RequestQueue"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>RequestQueue</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Interfaces</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/AbortOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>AbortOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ActorRun"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ActorRun</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ApifyClientOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyClientOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ApifyEnv"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyEnv</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/CallOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/CallTaskOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallTaskOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetContent"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetContent</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetDataOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetDataOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetMapper"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetMapper</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/DatasetReducer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetReducer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ExitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ExitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/InitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>InitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/KeyConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/MainOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MainOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/MetamorphOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MetamorphOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/OpenStorageOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>OpenStorageOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/ProxyInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/QueueOperationInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>QueueOperationInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>QueueOperationInfoOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/RecordOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RecordOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOperationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/RequestQueueOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0/interface/WebhookOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>WebhookOptions</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Type Aliases</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/3.0#UserFunc"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Type Aliases<!-- --> <a class="tsd-anchor" href="#Type Aliases"><span class="tsd-anchor-id" id="Type Aliases"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#UserFunc"><span class="tsd-anchor-id" id="UserFunc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1437" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>UserFunc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><div class="tds-type-parameters"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">unknown</span></span></li></ul></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#UserFunc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger);"></i> UserFunc</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/changelog.html b/reference/3.0/changelog.html index f6c9e4d368..56675f086a 100644 --- a/reference/3.0/changelog.html +++ b/reference/3.0/changelog.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -33,7 +33,7 @@ early as possible.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mitigation-of-zero-concurrency-issue">Mitigation of zero concurrency issue<a href="#mitigation-of-zero-concurrency-issue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Several new timeouts were added to the task function, which should help mitigate the zero concurrency bug. Namely fetching of next request information and reclaiming failed requests back to the queue are now executed with a timeout with 3 additional retries before the task fails. The timeout is always at least 300s (5 minutes), or <code>requestHandlerTimeoutSecs</code> if that value is higher.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="full-list-of-changes">Full list of changes<a href="#full-list-of-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><ul><li>fix <code>RequestError: URI malformed</code> in cheerio crawler (#1205)</li><li>only provide Cookie header if cookies are present (#1218)</li><li>handle extra cases for <code>diffCookie</code> (#1217)</li><li>add timeout for task function (#1234)</li><li>implement proxy per page in browser crawlers (#1228)</li><li>add fingerprinting support (#1243)</li><li>implement abortable timeouts (#1245)</li><li>add timeouts with retries to <code>runTaskFunction()</code> (#1250)</li><li>automatically convert google spreadsheet URLs to CSV exports (#1255)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="210-2021-10-07"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.7...v2.1.0" target="_blank" rel="noopener noreferrer">2.1.0</a> (2021-10-07)<a href="#210-2021-10-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>automatically convert google docs share urls to csv download ones in request list (#1174)</li><li>use puppeteer emulating scrolls instead of <code>window.scrollBy</code> (#1170)</li><li>warn if apify proxy is used in proxyUrls (#1173)</li><li>fix <code>YOUTUBE_REGEX_STRING</code> being too greedy (#1171)</li><li>add <code>purgeLocalStorage</code> utility method (#1187)</li><li>catch errors inside request interceptors (#1188, #1190)</li><li>add support for cgroups v2 (#1177)</li><li>fix incorrect offset in <code>fixUrl</code> function (#1184)</li><li>support channel and user links in YouTube regex (#1178)</li><li>fix: allow passing <code>requestsFromUrl</code> to <code>RequestListOptions</code> in TS (#1191)</li><li>allow passing <code>forceCloud</code> down to the KV store (#1186), closes #752</li><li>merge cookies from session with user provided ones (#1201), closes #1197</li><li>use <code>ApifyClient</code> v2 (full rewrite to TS)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="207-2021-09-08"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.6...v2.0.7" target="_blank" rel="noopener noreferrer">2.0.7</a> (2021-09-08)<a href="#207-2021-09-08" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix casting of int/bool environment variables (e.g. <code>APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE</code>), closes #956</li><li>Fix incognito pages and user data dir (#1145)</li><li>Add <code>@ts-ignore</code> comments to imports of optional peer dependencies (#1152)</li><li>Use config instance in <code>sdk.openSessionPool()</code> (#1154)</li><li>Add a breaking callback to <code>infiniteScroll</code> (#1140)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="206-2021-08-27"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.5...v2.0.6" target="_blank" rel="noopener noreferrer">2.0.6</a> (2021-08-27)<a href="#206-2021-08-27" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix deprecation messages logged from <code>ProxyConfiguration</code> and <code>CheerioCrawler</code>.</li><li>Update <code>got-scraping</code> to receive multiple improvements.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="205-2021-08-24"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.4...v2.0.5" target="_blank" rel="noopener noreferrer">2.0.5</a> (2021-08-24)<a href="#205-2021-08-24" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix error handling in puppeteer crawler</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="204-2021-08-23"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.3...v2.0.4" target="_blank" rel="noopener noreferrer">2.0.4</a> (2021-08-23)<a href="#204-2021-08-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Use <code>sessionToken</code> with <code>got-scraping</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="203-2021-08-20"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.2...v2.0.3" target="_blank" rel="noopener noreferrer">2.0.3</a> (2021-08-20)<a href="#203-2021-08-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><strong>BREAKING IN EDGE CASES</strong> * We removed <code>forceUrlEncoding</code> in <code>requestAsBrowser</code> because we found out that recent versions of the underlying HTTP client <code>got</code> already encode URLs and <code>forceUrlEncoding</code> could lead to weird behavior. We think of this as fixing a bug, so we're not bumping the major version.</li><li>Limit <code>handleRequestTimeoutMillis</code> to max valid value to prevent Node.js fallback to <code>1</code>.</li><li>Use <code>got-scraping@^3.0.1</code></li><li>Disable SSL validation on MITM proxie</li><li>Limit <code>handleRequestTimeoutMillis</code> to max valid value</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="202-2021-08-12"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.1...v2.0.2" target="_blank" rel="noopener noreferrer">2.0.2</a> (2021-08-12)<a href="#202-2021-08-12" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix serialization issues in <code>CheerioCrawler</code> caused by parser conflicts in recent versions of <code>cheerio</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="201-2021-08-06"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.0...v2.0.1" target="_blank" rel="noopener noreferrer">2.0.1</a> (2021-08-06)<a href="#201-2021-08-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Use <code>got-scraping</code> 2.0.1 until fully compatible.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="200-2021-08-05"><a href="https://github.com/apify/apify-sdk-js/compare/v1.3.4...v2.0.0" target="_blank" rel="noopener noreferrer">2.0.0</a> (2021-08-05)<a href="#200-2021-08-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#3112-2023-10-05" class="table-of-contents__link toc-highlight">3.1.12 (2023-10-05)</a><ul><li><a href="#bug-fixes" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#3111-2023-10-04" class="table-of-contents__link toc-highlight">3.1.11 (2023-10-04)</a><ul><li><a href="#bug-fixes-1" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#3110-2023-09-07" class="table-of-contents__link toc-highlight">3.1.10 (2023-09-07)</a><ul><li><a href="#bug-fixes-2" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#319-2023-09-06" class="table-of-contents__link toc-highlight">3.1.9 (2023-09-06)</a></li><li><a href="#318-2023-07-20" class="table-of-contents__link toc-highlight">3.1.8 (2023-07-20)</a><ul><li><a href="#bug-fixes-3" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-1" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#317-2023-06-09" class="table-of-contents__link toc-highlight">3.1.7 (2023-06-09)</a></li><li><a href="#316-2023-06-09" class="table-of-contents__link toc-highlight">3.1.6 (2023-06-09)</a><ul><li><a href="#bug-fixes-4" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#315-2023-05-31" class="table-of-contents__link toc-highlight">3.1.5 (2023-05-31)</a><ul><li><a href="#bug-fixes-5" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-2" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#314-2023-03-23" class="table-of-contents__link toc-highlight">3.1.4 (2023-03-23)</a><ul><li><a href="#bug-fixes-6" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#313-2023-03-22" class="table-of-contents__link toc-highlight">3.1.3 (2023-03-22)</a><ul><li><a href="#bug-fixes-7" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-3" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#312-2023-02-07" class="table-of-contents__link toc-highlight">3.1.2 (2023-02-07)</a><ul><li><a href="#bug-fixes-8" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#311-2022-11-13" class="table-of-contents__link toc-highlight">3.1.1 (2022-11-13)</a><ul><li><a href="#features-4" class="table-of-contents__link toc-highlight">Features</a></li><li><a href="#bug-fixes-9" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-5" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#300-2022-07-13" class="table-of-contents__link toc-highlight">3.0.0 (2022-07-13)</a><ul><li><a href="#crawlee-vs-apify-sdk" class="table-of-contents__link toc-highlight">Crawlee vs Apify SDK</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a><ul><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#header-generator-options" class="table-of-contents__link toc-highlight"><code>header-generator</code> options</a></li><li><a href="#timeoutsecs" class="table-of-contents__link toc-highlight"><code>timeoutSecs</code></a></li><li><a href="#throwonhttperrors" class="table-of-contents__link toc-highlight"><code>throwOnHttpErrors</code></a></li><li><a href="#decodebody" class="table-of-contents__link toc-highlight"><code>decodeBody</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li></ul></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></li><li><a href="#232-2022-05-05" class="table-of-contents__link toc-highlight">2.3.2 (2022-05-05)</a></li><li><a href="#231-2022-05-03" class="table-of-contents__link toc-highlight">2.3.1 (2022-05-03)</a></li><li><a href="#230-2022-04-07" class="table-of-contents__link toc-highlight">2.3.0 (2022-04-07)</a><ul><li><a href="#0-concurrency-mitigation" class="table-of-contents__link toc-highlight">0 concurrency mitigation</a></li></ul></li><li><a href="#222-2022-02-14" class="table-of-contents__link toc-highlight">2.2.2 (2022-02-14)</a></li><li><a href="#221-2022-01-03" class="table-of-contents__link toc-highlight">2.2.1 (2022-01-03)</a></li><li><a href="#220-2021-12-17" class="table-of-contents__link toc-highlight">2.2.0 (2021-12-17)</a><ul><li><a href="#proxy-per-page" class="table-of-contents__link toc-highlight">Proxy per page</a></li><li><a href="#abortable-timeouts" class="table-of-contents__link toc-highlight">Abortable timeouts</a></li><li><a href="#mitigation-of-zero-concurrency-issue" class="table-of-contents__link toc-highlight">Mitigation of zero concurrency issue</a></li><li><a href="#full-list-of-changes" class="table-of-contents__link toc-highlight">Full list of changes</a></li></ul></li><li><a href="#210-2021-10-07" class="table-of-contents__link toc-highlight">2.1.0 (2021-10-07)</a></li><li><a href="#207-2021-09-08" class="table-of-contents__link toc-highlight">2.0.7 (2021-09-08)</a></li><li><a href="#206-2021-08-27" class="table-of-contents__link toc-highlight">2.0.6 (2021-08-27)</a></li><li><a href="#205-2021-08-24" class="table-of-contents__link toc-highlight">2.0.5 (2021-08-24)</a></li><li><a href="#204-2021-08-23" class="table-of-contents__link toc-highlight">2.0.4 (2021-08-23)</a></li><li><a href="#203-2021-08-20" class="table-of-contents__link toc-highlight">2.0.3 (2021-08-20)</a></li><li><a href="#202-2021-08-12" class="table-of-contents__link toc-highlight">2.0.2 (2021-08-12)</a></li><li><a href="#201-2021-08-06" class="table-of-contents__link toc-highlight">2.0.1 (2021-08-06)</a></li><li><a href="#200-2021-08-05" class="table-of-contents__link toc-highlight">2.0.0 (2021-08-05)</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/Actor.html b/reference/3.0/class/Actor.html index 68f3dfc1b1..6625a169bd 100644 --- a/reference/3.0/class/Actor.html +++ b/reference/3.0/class/Actor.html @@ -13,7 +13,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -223,7 +223,7 @@ <div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> run </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">start</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/hello-world'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myInput</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>actorId: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Allowed formats are <code>username/actor-name</code>, <code>userId/actor-name</code> or actor ID.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>input: <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Input for the actor. If it is an object, it will be stringified to JSON and its content type set to <code>application/json; charset=utf-8</code>. Otherwise the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/ApifyClient"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyClient</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#apifyClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info);"></i> apifyClient</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info);"></i> config</a></li><li><a href="#abort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> abort</a></li><li><a href="#addWebhook" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addWebhook</a></li><li><a href="#call" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> call</a></li><li><a href="#callTask" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> callTask</a></li><li><a href="#createProxyConfiguration" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> createProxyConfiguration</a></li><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exit</a></li><li><a href="#fail" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> fail</a></li><li><a href="#getEnv" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEnv</a></li><li><a href="#getInput" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInput</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#init" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> init</a></li><li><a href="#isAtHome" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isAtHome</a></li><li><a href="#main" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> main</a></li><li><a href="#metamorph" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> metamorph</a></li><li><a href="#newClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newClient</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#openDataset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openDataset</a></li><li><a href="#openKeyValueStore" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openKeyValueStore</a></li><li><a href="#openRequestQueue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openRequestQueue</a></li><li><a href="#pushData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> pushData</a></li><li><a href="#reboot" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reboot</a></li><li><a href="#setStatusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setStatusMessage</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#start" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> start</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/ApifyClient.html b/reference/3.0/class/ApifyClient.html index fb18196658..e830d49ac8 100644 --- a/reference/3.0/class/ApifyClient.html +++ b/reference/3.0/class/ApifyClient.html @@ -11,14 +11,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/Actor">Actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/class/ApifyClient">ApifyClient</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/Configuration">Configuration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/Dataset">Dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/KeyValueStore">KeyValueStore</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/PlatformEventManager">PlatformEventManager</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/ProxyConfiguration">ProxyConfiguration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/class/RequestQueue">RequestQueue</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Classes</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ApifyClient<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>ApifyClient is the official library to access <a href="https://docs.apify.com/api/v2" target="_blank" rel="noopener noreferrer">Apify API</a> from your JavaScript applications. It runs both in Node.js and browser.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#baseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl</a></li><li><a href="#httpClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>httpClient</a></li><li><a href="#logger" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger</a></li><li><a href="#stats" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actor" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actor</a></li><li><a href="#actors" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actors</a></li><li><a href="#build" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>build</a></li><li><a href="#dataset" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>dataset</a></li><li><a href="#datasets" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>datasets</a></li><li><a href="#keyValueStore" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStore</a></li><li><a href="#keyValueStores" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStores</a></li><li><a href="#log" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>log</a></li><li><a href="#requestQueue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueue</a></li><li><a href="#requestQueues" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueues</a></li><li><a href="#run" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>run</a></li><li><a href="#schedule" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedule</a></li><li><a href="#schedules" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedules</a></li><li><a href="#task" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>task</a></li><li><a href="#tasks" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>tasks</a></li><li><a href="#user" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>user</a></li><li><a href="#webhook" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhook</a></li><li><a href="#webhookDispatch" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatch</a></li><li><a href="#webhookDispatches" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatches</a></li><li><a href="#webhooks" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhooks</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new ApifyClient<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#baseUrl"><span class="tsd-anchor-id" id="baseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L30" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>baseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#httpClient"><span class="tsd-anchor-id" id="httpClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>httpClient</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>httpClient<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">HttpClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logger"><span class="tsd-anchor-id" id="logger"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L33" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>logger</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Log</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#stats"><span class="tsd-anchor-id" id="stats"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L32" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>stats</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Statistics</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L31" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actor"><span class="tsd-anchor-id" id="actor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actor<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ActorClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actors/actor-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actors/actor-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ActorClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actors"><span class="tsd-anchor-id" id="actors"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L40" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actors</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actors<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ActorCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actors/actor-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actors/actor-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ActorCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#build"><span class="tsd-anchor-id" id="build"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L48" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>build</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>build<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">BuildClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-builds/build-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-builds/build-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">BuildClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#dataset"><span class="tsd-anchor-id" id="dataset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>dataset</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>dataset<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DatasetClient</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/datasets/dataset" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/datasets/dataset</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DatasetClient</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#datasets"><span class="tsd-anchor-id" id="datasets"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L52" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>datasets</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>datasets<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DatasetCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/datasets/dataset-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/datasets/dataset-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DatasetCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#keyValueStore"><span class="tsd-anchor-id" id="keyValueStore"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L64" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>keyValueStore</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStore<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">KeyValueStoreClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/key-value-stores/store-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/key-value-stores/store-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">KeyValueStoreClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#keyValueStores"><span class="tsd-anchor-id" id="keyValueStores"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>keyValueStores</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStores<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">KeyValueStoreCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">KeyValueStoreCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#log"><span class="tsd-anchor-id" id="log"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L68" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>log</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>log<span class="tsd-signature-symbol">(</span><span>buildOrRunId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">LogClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/logs" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/logs</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>buildOrRunId: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">LogClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestQueue"><span class="tsd-anchor-id" id="requestQueue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L76" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestQueue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueue<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">RequestQueueUserOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RequestQueueClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/request-queues/queue" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/request-queues/queue</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">RequestQueueUserOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RequestQueueClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestQueues"><span class="tsd-anchor-id" id="requestQueues"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L72" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestQueues</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueues<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RequestQueueCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/request-queues/queue-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/request-queues/queue-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RequestQueueCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#run"><span class="tsd-anchor-id" id="run"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L80" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>run</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>run<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RunClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RunClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#schedule"><span class="tsd-anchor-id" id="schedule"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L96" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>schedule</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedule<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ScheduleClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/schedules/schedule-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/schedules/schedule-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ScheduleClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#schedules"><span class="tsd-anchor-id" id="schedules"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L92" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>schedules</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedules<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ScheduleCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/schedules/schedules-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/schedules/schedules-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ScheduleCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#task"><span class="tsd-anchor-id" id="task"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L88" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>task</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>task<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TaskClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-tasks/task-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-tasks/task-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TaskClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#tasks"><span class="tsd-anchor-id" id="tasks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L84" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>tasks</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>tasks<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TaskCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TaskCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#user"><span class="tsd-anchor-id" id="user"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L100" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>user</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>user<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">UserClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/users" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/users</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">UserClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhook"><span class="tsd-anchor-id" id="webhook"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L108" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhook</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhook<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhooks/webhook-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhooks/webhook-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhookDispatch"><span class="tsd-anchor-id" id="webhookDispatch"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L116" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhookDispatch</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatch<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookDispatchClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookDispatchClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhookDispatches"><span class="tsd-anchor-id" id="webhookDispatches"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L112" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhookDispatches</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatches<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookDispatchCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhook-dispatches" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhook-dispatches</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookDispatchCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L104" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhooks</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhooks<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookCollectionClient</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/Actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/Configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#baseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> baseUrl</a></li><li><a href="#httpClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> httpClient</a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logger</a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> stats</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#actor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> actor</a></li><li><a href="#actors" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> actors</a></li><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> build</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> dataset</a></li><li><a href="#datasets" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> datasets</a></li><li><a href="#keyValueStore" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> keyValueStore</a></li><li><a href="#keyValueStores" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> keyValueStores</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#requestQueue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> requestQueue</a></li><li><a href="#requestQueues" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> requestQueues</a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> run</a></li><li><a href="#schedule" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> schedule</a></li><li><a href="#schedules" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> schedules</a></li><li><a href="#task" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> task</a></li><li><a href="#tasks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> tasks</a></li><li><a href="#user" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> user</a></li><li><a href="#webhook" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhook</a></li><li><a href="#webhookDispatch" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhookDispatch</a></li><li><a href="#webhookDispatches" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhookDispatches</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/Configuration.html b/reference/3.0/class/Configuration.html index 38cdf249d5..95e44d3727 100644 --- a/reference/3.0/class/Configuration.html +++ b/reference/3.0/class/Configuration.html @@ -139,7 +139,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -154,7 +154,7 @@ <h2>Supported Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>memoryMbytes</code></td><td><code>APIFY_MEMORY_MBYTES</code></td><td>-</td></tr><tr><td><code>headless</code></td><td><code>APIFY_HEADLESS</code></td><td>-</td></tr><tr><td><code>persistStateIntervalMillis</code></td><td><code>APIFY_PERSIST_STATE_INTERVAL_MILLIS</code></td><td><code>60e3</code></td></tr><tr><td><code>token</code></td><td><code>APIFY_TOKEN</code></td><td>-</td></tr><tr><td><code>isAtHome</code></td><td><code>APIFY_IS_AT_HOME</code></td><td>-</td></tr><tr><td><code>defaultDatasetId</code></td><td><code>APIFY_DEFAULT_DATASET_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultKeyValueStoreId</code></td><td><code>APIFY_DEFAULT_KEY_VALUE_STORE_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultRequestQueueId</code></td><td><code>APIFY_DEFAULT_REQUEST_QUEUE_ID</code></td><td><code>'default'</code></td></tr></tbody></table><h2>Advanced Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>actorEventsWsUrl</code></td><td><code>APIFY_ACTOR_EVENTS_WS_URL</code></td><td>-</td></tr><tr><td><code>actorId</code></td><td><code>APIFY_ACTOR_ID</code></td><td>-</td></tr><tr><td><code>actorRunId</code></td><td><code>APIFY_ACTOR_RUN_ID</code></td><td>-</td></tr><tr><td><code>actorTaskId</code></td><td><code>APIFY_ACTOR_TASK_ID</code></td><td>-</td></tr><tr><td><code>apiBaseUrl</code></td><td><code>APIFY_API_BASE_URL</code></td><td><code>'https://api.apify.com'</code></td></tr><tr><td><code>containerPort</code></td><td><code>APIFY_CONTAINER_PORT</code></td><td><code>4321</code></td></tr><tr><td><code>containerUrl</code></td><td><code>APIFY_CONTAINER_URL</code></td><td><code>'http://localhost:4321'</code></td></tr><tr><td><code>inputKey</code></td><td><code>APIFY_INPUT_KEY</code></td><td><code>'INPUT'</code></td></tr><tr><td><code>metamorphAfterSleepMillis</code></td><td><code>APIFY_METAMORPH_AFTER_SLEEP_MILLIS</code></td><td><code>300e3</code></td></tr><tr><td><code>proxyHostname</code></td><td><code>APIFY_PROXY_HOSTNAME</code></td><td><code>'proxy.apify.com'</code></td></tr><tr><td><code>proxyPassword</code></td><td><code>APIFY_PROXY_PASSWORD</code></td><td>-</td></tr><tr><td><code>proxyPort</code></td><td><code>APIFY_PROXY_PORT</code></td><td><code>8000</code></td></tr><tr><td><code>proxyStatusUrl</code></td><td><code>APIFY_PROXY_STATUS_URL</code></td><td><code>'http://proxy.apify.com'</code></td></tr><tr><td><code>userId</code></td><td><code>APIFY_USER_ID</code></td><td>-</td></tr><tr><td><code>xvfb</code></td><td><code>APIFY_XVFB</code></td><td>-</td></tr><tr><td><code>chromeExecutablePath</code></td><td><code>APIFY_CHROME_EXECUTABLE_PATH</code></td><td>-</td></tr><tr><td><code>defaultBrowserPath</code></td><td><code>APIFY_DEFAULT_BROWSER_PATH</code></td><td>-</td></tr></tbody></table></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Configuration</span><ul class="tsd-hierarchy"><li><em class="tsd-target">Configuration</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#globalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#get" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#getGlobalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig</a></li><li><a href="#getStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient</a></li><li><a href="#resetGlobalState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L213" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new Configuration<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.constructor</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates new <code>Configuration</code> instance with provided options. Env vars will have precedence over those.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">ConfigurationOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/Configuration">Configuration</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#globalConfig"><span class="tsd-anchor-id" id="globalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L93" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-optional">optional</span>globalConfig</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/Configuration">Configuration</a></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.globalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#get"><span class="tsd-anchor-id" id="get"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L157" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>get</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>U<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.get</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li><strong>U</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">StorageClient</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventManager</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">U</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type tsd-signature-type-generic">U</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L236" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#set"><span class="tsd-anchor-id" id="set"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L164" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>set</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.set</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>value: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useEventManager"><span class="tsd-anchor-id" id="useEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L243" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager<span class="tsd-signature-symbol">(</span><span>events<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useEventManager</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>events: <span class="tsd-signature-type">EventManager</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useStorageClient"><span class="tsd-anchor-id" id="useStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L242" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient<span class="tsd-signature-symbol">(</span><span>client<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useStorageClient</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>client: <span class="tsd-signature-type">StorageClient</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L255" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default EventManager instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getGlobalConfig"><span class="tsd-anchor-id" id="getGlobalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L171" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getGlobalConfig</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.getGlobalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/Configuration">Configuration</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getStorageClient"><span class="tsd-anchor-id" id="getStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L251" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getStorageClient</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default StorageClient instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">StorageClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#resetGlobalState"><span class="tsd-anchor-id" id="resetGlobalState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L184" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>resetGlobalState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.resetGlobalState</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Resets global configuration instance. The default instance holds configuration based on env vars, if we want to change them, we need to first reset the global state. Used mainly for testing purposes.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/ApifyClient"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyClient</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/Dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#globalConfig" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> globalConfig</a></li><li><a href="#get" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> get</a></li><li><a href="#getEventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventManager</a></li><li><a href="#set" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> set</a></li><li><a href="#useEventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useEventManager</a></li><li><a href="#useStorageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useStorageClient</a></li><li><a href="#getGlobalConfig" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getGlobalConfig</a></li><li><a href="#getStorageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getStorageClient</a></li><li><a href="#resetGlobalState" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> resetGlobalState</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/Dataset.html b/reference/3.0/class/Dataset.html index 5a57308909..2fb39dfd83 100644 --- a/reference/3.0/class/Dataset.html +++ b/reference/3.0/class/Dataset.html @@ -97,7 +97,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -181,7 +181,7 @@ <p>For more details and code examples, see the <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>datasetIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the dataset to be opened. If <code>null</code> or <code>undefined</code>, the function returns the default dataset associated with the crawler run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StorageManagerOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Storage manager options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/Configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/KeyValueStore"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> log</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#forEach" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEach</a></li><li><a href="#getData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getData</a></li><li><a href="#getInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInfo</a></li><li><a href="#map" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> map</a></li><li><a href="#pushData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> pushData</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reduce</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/KeyValueStore.html b/reference/3.0/class/KeyValueStore.html index d41a864712..3c5704c918 100644 --- a/reference/3.0/class/KeyValueStore.html +++ b/reference/3.0/class/KeyValueStore.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -69,7 +69,7 @@ otherwise the crawler process might finish before the value is stored!</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Unique key of the record. It can be at most 256 characters long and only consist of the following characters: <code>a</code>-<code>z</code>, <code>A</code>-<code>Z</code>, <code>0</code>-<code>9</code> and <code>!-_.'()</code></p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>value: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record data, which can be one of the following values:</p><ul><li>If <code>null</code>, the record in the key-value store is deleted.</li><li>If no <code>options.contentType</code> is specified, <code>value</code> can be any JavaScript object and it will be stringified to JSON.</li><li>If <code>options.contentType</code> is set, <code>value</code> is taken as is and it must be a <code>String</code> or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener noreferrer"><code>Buffer</code></a>. For any other value an error will be thrown.</li></ul></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getAutoSavedValue"><span class="tsd-anchor-id" id="getAutoSavedValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L236" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getAutoSavedValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getAutoSavedValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getAutoSavedValue</span></p></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#open"><span class="tsd-anchor-id" id="open"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/key_value_store.ts#L19" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>open</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>open<span class="tsd-signature-symbol">(</span><span>storeIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">StorageManagerOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreKeyValueStore.open</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>storeIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li><li><h5>options: <span class="tsd-signature-type">StorageManagerOptions</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/Dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/PlatformEventManager"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlatformEventManager</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#forEachKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEachKey</a></li><li><a href="#getAutoSavedValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getAutoSavedValue</a></li><li><a href="#getPublicUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getPublicUrl</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/PlatformEventManager.html b/reference/3.0/class/PlatformEventManager.html index 7d7b51fbfe..b762c398f3 100644 --- a/reference/3.0/class/PlatformEventManager.html +++ b/reference/3.0/class/PlatformEventManager.html @@ -77,7 +77,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -113,7 +113,7 @@ of Apify package such as <code>persistState</code>. This is automatically called at the end of <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#emit"><span class="tsd-anchor-id" id="emit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>emit</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>emit<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.emit</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#init"><span class="tsd-anchor-id" id="init"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/platform_event_manager.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>init</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.init</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Initializes <code>Actor.events</code> event emitter by creating a connection to a websocket that provides them. This is an internal function that is automatically called by <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isInitialized"><span class="tsd-anchor-id" id="isInitialized"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L36" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>isInitialized</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isInitialized<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.isInitialized</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#off"><span class="tsd-anchor-id" id="off"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>off</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.off</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#on"><span class="tsd-anchor-id" id="on"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L33" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>on</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.on</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/KeyValueStore"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/ProxyConfiguration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#close" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> close</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#init" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> init</a></li><li><a href="#isInitialized" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isInitialized</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/ProxyConfiguration.html b/reference/3.0/class/ProxyConfiguration.html index 495f95d251..b04daa80a8 100644 --- a/reference/3.0/class/ProxyConfiguration.html +++ b/reference/3.0/class/ProxyConfiguration.html @@ -67,7 +67,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -110,7 +110,7 @@ will use the same target proxy server (i.e. the same IP address). The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A string with a proxy URL, including authentication credentials and port number. For example, <code>http://bob:password123@proxy.example.com:8000</code></p></div></div></div></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/PlatformEventManager"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlatformEventManager</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/class/RequestQueue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#isManInTheMiddle" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isManInTheMiddle</a></li><li><a href="#initialize" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> initialize</a></li><li><a href="#newProxyInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newProxyInfo</a></li><li><a href="#newUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/class/RequestQueue.html b/reference/3.0/class/RequestQueue.html index c9e2dd92b6..302917b1bf 100644 --- a/reference/3.0/class/RequestQueue.html +++ b/reference/3.0/class/RequestQueue.html @@ -93,7 +93,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -188,7 +188,7 @@ <p>For more details and code examples, see the <a href="/sdk/js/reference/3.0/class/RequestQueue">RequestQueue</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>queueIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the request queue to be opened. If <code>null</code> or <code>undefined</code>, the function returns the default request queue associated with the crawler run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StorageManagerOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Open Request Queue options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/3.0/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/ProxyConfiguration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/AbortOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AbortOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#assumedHandledCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> assumedHandledCount</a></li><li><a href="#assumedTotalCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> assumedTotalCount</a></li><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#clientKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> clientKey</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#inProgress" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inProgress</a></li><li><a href="#internalTimeoutMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> internalTimeoutMillis</a></li><li><a href="#lastActivity" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> lastActivity</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> log</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#queryQueueHeadPromise" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> queryQueueHeadPromise</a></li><li><a href="#recentlyHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> recentlyHandled</a></li><li><a href="#requestsCache" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestsCache</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li><li><a href="#addRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequest</a></li><li><a href="#addRequests" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequests</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#fetchNextRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> fetchNextRequest</a></li><li><a href="#getInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInfo</a></li><li><a href="#getRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getRequest</a></li><li><a href="#handledCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> handledCount</a></li><li><a href="#isEmpty" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isEmpty</a></li><li><a href="#isFinished" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isFinished</a></li><li><a href="#markRequestHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> markRequestHandled</a></li><li><a href="#reclaimRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reclaimRequest</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/AbortOptions.html b/reference/3.0/interface/AbortOptions.html index dd1f42bbf2..f608f16ebe 100644 --- a/reference/3.0/interface/AbortOptions.html +++ b/reference/3.0/interface/AbortOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>AbortOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">RunAbortOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">AbortOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#gracefully" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#gracefully"><span class="tsd-anchor-id" id="gracefully"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/run.d.ts#L76" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>gracefully</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RunAbortOptions.gracefully</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1457" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/class/RequestQueue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ActorRun"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#gracefully" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> gracefully</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ActorRun.html b/reference/3.0/interface/ActorRun.html index 0b5e7cbd1f..00cf5200bc 100644 --- a/reference/3.0/interface/ActorRun.html +++ b/reference/3.0/interface/ActorRun.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ActorRun<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#buildId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildId</a></li><li><a href="#buildNumber" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildNumber</a></li><li><a href="#containerUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#finishedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>finishedAt</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#meta" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>meta</a></li><li><a href="#options" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>options</a></li><li><a href="#startedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt</a></li><li><a href="#stats" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats</a></li><li><a href="#status" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>status</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actId"><span class="tsd-anchor-id" id="actId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L161" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#buildId"><span class="tsd-anchor-id" id="buildId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L169" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>buildId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#buildNumber"><span class="tsd-anchor-id" id="buildNumber"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L173" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>buildNumber</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildNumber<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerUrl"><span class="tsd-anchor-id" id="containerUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L174" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>containerUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultDatasetId"><span class="tsd-anchor-id" id="defaultDatasetId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L172" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultDatasetId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultKeyValueStoreId"><span class="tsd-anchor-id" id="defaultKeyValueStoreId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L171" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultKeyValueStoreId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L170" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#finishedAt"><span class="tsd-anchor-id" id="finishedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L163" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>finishedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>finishedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L158" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#meta"><span class="tsd-anchor-id" id="meta"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L166" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>meta</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>meta<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunMeta</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#options"><span class="tsd-anchor-id" id="options"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L168" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>options</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>options<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunOptions</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L162" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#stats"><span class="tsd-anchor-id" id="stats"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L167" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>stats</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunStats</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#status"><span class="tsd-anchor-id" id="status"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L164" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>status</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>status<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">READY</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RUNNING</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">SUCCEEDED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">FAILED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ABORTING</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ABORTED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TIMING-OUT</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TIMED-OUT</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L165" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L160" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/AbortOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AbortOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ApifyClientOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyClientOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#buildId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> buildId</a></li><li><a href="#buildNumber" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> buildNumber</a></li><li><a href="#containerUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerUrl</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#finishedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> finishedAt</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> meta</a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> options</a></li><li><a href="#startedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> startedAt</a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> stats</a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> status</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ApifyClientOptions.html b/reference/3.0/interface/ApifyClientOptions.html index 748158a22d..78128c6e7f 100644 --- a/reference/3.0/interface/ApifyClientOptions.html +++ b/reference/3.0/interface/ApifyClientOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ApifyClientOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#baseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl</a></li><li><a href="#maxRetries" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxRetries</a></li><li><a href="#minDelayBetweenRetriesMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>minDelayBetweenRetriesMillis</a></li><li><a href="#requestInterceptors" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestInterceptors</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#baseUrl"><span class="tsd-anchor-id" id="baseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L120" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>baseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">https://api.apify.com</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxRetries"><span class="tsd-anchor-id" id="maxRetries"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L122" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxRetries</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxRetries<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">8</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#minDelayBetweenRetriesMillis"><span class="tsd-anchor-id" id="minDelayBetweenRetriesMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L124" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>minDelayBetweenRetriesMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>minDelayBetweenRetriesMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">500</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestInterceptors"><span class="tsd-anchor-id" id="requestInterceptors"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L126" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>requestInterceptors</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestInterceptors<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ApifyRequestConfig</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ApifyRequestConfig</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L128" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">360</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L129" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ActorRun"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ApifyEnv"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#baseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> baseUrl</a></li><li><a href="#maxRetries" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxRetries</a></li><li><a href="#minDelayBetweenRetriesMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> minDelayBetweenRetriesMillis</a></li><li><a href="#requestInterceptors" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestInterceptors</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ApifyEnv.html b/reference/3.0/interface/ApifyEnv.html index 9553483e72..b4c1a19cbc 100644 --- a/reference/3.0/interface/ApifyEnv.html +++ b/reference/3.0/interface/ApifyEnv.html @@ -11,7 +11,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,7 +23,7 @@ in megabytes (APIFY_MEMORY_MBYTES)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1411" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor was started (APIFY_STARTED_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutAt"><span class="tsd-anchor-id" id="timeoutAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1416" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>timeoutAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor will time out (APIFY_TIMEOUT_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1406" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1400" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ApifyClientOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyClientOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/CallOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CallOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actorId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorId</a></li><li><a href="#actorRunId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorRunId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#memoryMbytes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memoryMbytes</a></li><li><a href="#startedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> startedAt</a></li><li><a href="#timeoutAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutAt</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/CallOptions.html b/reference/3.0/interface/CallOptions.html index 43f38305ce..791d8ddb35 100644 --- a/reference/3.0/interface/CallOptions.html +++ b/reference/3.0/interface/CallOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -26,7 +26,7 @@ If <code>waitSecs</code> is null or undefined, the function waits for the actor to finish (default behavior).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L155" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorStartOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed, see <a href="https://docs.apify.com/webhooks/ad-hoc-webhooks" target="_blank" rel="noopener noreferrer">ad hook webhooks documentation</a> for detailed description.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ApifyEnv"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/CallTaskOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CallTaskOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li><li><a href="#memory" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memory</a></li><li><a href="#timeout" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeout</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#waitForFinish" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> waitForFinish</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/CallTaskOptions.html b/reference/3.0/interface/CallTaskOptions.html index 734483f17d..8d7976db78 100644 --- a/reference/3.0/interface/CallTaskOptions.html +++ b/reference/3.0/interface/CallTaskOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,7 +23,7 @@ If <code>waitSecs</code> is null or undefined, the function waits for the actor to finish (default behavior).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L155" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskStartOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed, see <a href="https://docs.apify.com/webhooks/ad-hoc-webhooks" target="_blank" rel="noopener noreferrer">ad hook webhooks documentation</a> for detailed description.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/CallOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CallOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ConfigurationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#memory" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memory</a></li><li><a href="#timeout" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeout</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#waitForFinish" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> waitForFinish</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ConfigurationOptions.html b/reference/3.0/interface/ConfigurationOptions.html index 48dbf574b4..069d33dccd 100644 --- a/reference/3.0/interface/ConfigurationOptions.html +++ b/reference/3.0/interface/ConfigurationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -48,7 +48,7 @@ e.g. MemoryStorageOptions could be used to adjust the MemoryStorage behavior.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#systemInfoIntervalMillis"><span class="tsd-anchor-id" id="systemInfoIntervalMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L84" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>systemInfoIntervalMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>systemInfoIntervalMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">60_000</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.systemInfoIntervalMillis</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the interval of emitting the <code>systemInfo</code> event.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/configuration.ts#L20" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#xvfb"><span class="tsd-anchor-id" id="xvfb"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L106" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>xvfb</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>xvfb<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.xvfb</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether to run X virtual framebuffer on the web browsers launched by Crawlee.</p> <p>Alternative to <code>CRAWLEE_XVFB</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/CallTaskOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CallTaskOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actorEventsWsUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorEventsWsUrl</a></li><li><a href="#actorId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorId</a></li><li><a href="#actorRunId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorRunId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#apiBaseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apiBaseUrl</a></li><li><a href="#availableMemoryRatio" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> availableMemoryRatio</a></li><li><a href="#chromeExecutablePath" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> chromeExecutablePath</a></li><li><a href="#containerPort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerPort</a></li><li><a href="#containerUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerUrl</a></li><li><a href="#defaultBrowserPath" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultBrowserPath</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultRequestQueueId</a></li><li><a href="#disableBrowserSandbox" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> disableBrowserSandbox</a></li><li><a href="#eventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventManager</a></li><li><a href="#headless" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> headless</a></li><li><a href="#inputKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputKey</a></li><li><a href="#isAtHome" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isAtHome</a></li><li><a href="#logLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logLevel</a></li><li><a href="#maxUsedCpuRatio" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxUsedCpuRatio</a></li><li><a href="#memoryMbytes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memoryMbytes</a></li><li><a href="#metamorphAfterSleepMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> metamorphAfterSleepMillis</a></li><li><a href="#persistStateIntervalMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> persistStateIntervalMillis</a></li><li><a href="#proxyHostname" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyHostname</a></li><li><a href="#proxyPassword" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyPassword</a></li><li><a href="#proxyPort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyPort</a></li><li><a href="#proxyStatusUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyStatusUrl</a></li><li><a href="#purgeOnStart" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> purgeOnStart</a></li><li><a href="#storageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageClient</a></li><li><a href="#storageClientOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageClientOptions</a></li><li><a href="#systemInfoIntervalMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> systemInfoIntervalMillis</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li><li><a href="#xvfb" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> xvfb</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetConsumer.html b/reference/3.0/interface/DatasetConsumer.html index bebcf4c9bd..3743d14384 100644 --- a/reference/3.0/interface/DatasetConsumer.html +++ b/reference/3.0/interface/DatasetConsumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetConsumer<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetConsumer<span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ConfigurationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetContent"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetContent.html b/reference/3.0/interface/DatasetContent.html index b22f75df35..51e2e8ee93 100644 --- a/reference/3.0/interface/DatasetContent.html +++ b/reference/3.0/interface/DatasetContent.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetContent<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#count" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>count</a></li><li><a href="#desc" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc</a></li><li><a href="#items" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>items</a></li><li><a href="#limit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit</a></li><li><a href="#offset" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset</a></li><li><a href="#total" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>total</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#count"><span class="tsd-anchor-id" id="count"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L329" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>count</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>count<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Count of dataset entries returned in this set.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#desc"><span class="tsd-anchor-id" id="desc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L335" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>desc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Should the results be in descending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#items"><span class="tsd-anchor-id" id="items"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L337" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>items</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>items<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Dataset entries based on chosen format parameter.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#limit"><span class="tsd-anchor-id" id="limit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L333" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>limit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Maximum number of dataset entries requested.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#offset"><span class="tsd-anchor-id" id="offset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L331" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>offset</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of the first returned entry in the dataset.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#total"><span class="tsd-anchor-id" id="total"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L327" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>total</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>total<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Total count of entries in the dataset.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetConsumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetDataOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetDataOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#count" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> count</a></li><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#items" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> items</a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> limit</a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> offset</a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> total</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetDataOptions.html b/reference/3.0/interface/DatasetDataOptions.html index 88ce058d91..67769f9376 100644 --- a/reference/3.0/interface/DatasetDataOptions.html +++ b/reference/3.0/interface/DatasetDataOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,7 +19,7 @@ Otherwise they are sorted in ascending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fields"><span class="tsd-anchor-id" id="fields"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>fields</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of field names that will be included in the result. If omitted, all fields are included in the results.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#limit"><span class="tsd-anchor-id" id="limit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>limit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">250000</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Maximum number of array elements to return.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#offset"><span class="tsd-anchor-id" id="offset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L29" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>offset</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">0</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Number of array elements that should be skipped at the start.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#skipEmpty"><span class="tsd-anchor-id" id="skipEmpty"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L66" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>skipEmpty</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>skipEmpty<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the function doesn’t return empty items. Note that in this case the returned number of items might be lower than limit parameter and pagination must be done using the <code>limit</code> value.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#skipHidden"><span class="tsd-anchor-id" id="skipHidden"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>skipHidden</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>skipHidden<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the function doesn’t return hidden fields (fields starting with “#” character).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#unwind"><span class="tsd-anchor-id" id="unwind"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>unwind</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default, the results are returned as they are.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetContent"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetIteratorOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#clean" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> clean</a></li><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#fields" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> fields</a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> limit</a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> offset</a></li><li><a href="#skipEmpty" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> skipEmpty</a></li><li><a href="#skipHidden" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> skipHidden</a></li><li><a href="#unwind" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> unwind</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetIteratorOptions.html b/reference/3.0/interface/DatasetIteratorOptions.html index 80d4dcc2a7..0a081fe293 100644 --- a/reference/3.0/interface/DatasetIteratorOptions.html +++ b/reference/3.0/interface/DatasetIteratorOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetIteratorOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">offset</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">limit</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">clean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">skipHidden</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">skipEmpty</span><span class="tsd-signature-symbol">></span><ul class="tsd-hierarchy"><li><em class="tsd-target">DatasetIteratorOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#desc" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc</a></li><li><a href="#fields" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields</a></li><li><a href="#unwind" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#desc"><span class="tsd-anchor-id" id="desc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L40" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>desc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.desc</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the objects are sorted by <code>createdAt</code> in descending order. Otherwise they are sorted in ascending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fields"><span class="tsd-anchor-id" id="fields"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>fields</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.fields</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of field names that will be included in the result. If omitted, all fields are included in the results.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#unwind"><span class="tsd-anchor-id" id="unwind"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>unwind</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.unwind</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default, the results are returned as they are.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetDataOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetDataOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetMapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#fields" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> fields</a></li><li><a href="#unwind" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> unwind</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetMapper.html b/reference/3.0/interface/DatasetMapper.html index 2f907a1db0..a64a4b0651 100644 --- a/reference/3.0/interface/DatasetMapper.html +++ b/reference/3.0/interface/DatasetMapper.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetMapper<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">, </span>R<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetMapper<span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">R</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User-function used in the <code>Dataset.map()</code> API.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">R</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetIteratorOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetOptions.html b/reference/3.0/interface/DatasetOptions.html index 0041b47e52..4ba4846fe0 100644 --- a/reference/3.0/interface/DatasetOptions.html +++ b/reference/3.0/interface/DatasetOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L323" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L321" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L322" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetMapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/DatasetReducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/DatasetReducer.html b/reference/3.0/interface/DatasetReducer.html index 6b60828a4a..92fbef36fe 100644 --- a/reference/3.0/interface/DatasetReducer.html +++ b/reference/3.0/interface/DatasetReducer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetReducer<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetReducer<span class="tsd-signature-symbol">(</span><span>memo<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>memo: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Previous state of the reduction.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/3.0/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ExitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ExitOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ExitOptions.html b/reference/3.0/interface/ExitOptions.html index d3ccb7f00c..1b79fae2cd 100644 --- a/reference/3.0/interface/ExitOptions.html +++ b/reference/3.0/interface/ExitOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ExitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">ExitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1521" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1519" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1512" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1517" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/DatasetReducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/InitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">InitOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/InitOptions.html b/reference/3.0/interface/InitOptions.html index b71011dbf0..ffbc649f41 100644 --- a/reference/3.0/interface/InitOptions.html +++ b/reference/3.0/interface/InitOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>InitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">InitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1371" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ExitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ExitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/KeyConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/KeyConsumer.html b/reference/3.0/interface/KeyConsumer.html index 7bf6b013a2..edc6cb829b 100644 --- a/reference/3.0/interface/KeyConsumer.html +++ b/reference/3.0/interface/KeyConsumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyConsumer<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>KeyConsumer<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span>info<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span><span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol"> }</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/3.0/class/KeyValueStore">KeyValueStore</a> key being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of the current key in <a href="/sdk/js/reference/3.0/class/KeyValueStore">KeyValueStore</a>.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>info: <span class="tsd-signature-symbol">{ </span><span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol"> }</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Information about the current <a href="/sdk/js/reference/3.0/class/KeyValueStore">KeyValueStore</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/InitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">InitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStoreIteratorOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/KeyValueStoreIteratorOptions.html b/reference/3.0/interface/KeyValueStoreIteratorOptions.html index 11568d4093..09275ebefa 100644 --- a/reference/3.0/interface/KeyValueStoreIteratorOptions.html +++ b/reference/3.0/interface/KeyValueStoreIteratorOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyValueStoreIteratorOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exclusiveStartKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exclusiveStartKey</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exclusiveStartKey"><span class="tsd-anchor-id" id="exclusiveStartKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L319" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>exclusiveStartKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exclusiveStartKey<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>All keys up to this one (including) are skipped from the result.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/KeyConsumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStoreOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exclusiveStartKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exclusiveStartKey</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/KeyValueStoreOptions.html b/reference/3.0/interface/KeyValueStoreOptions.html index 6d434d6c47..2a285c0f68 100644 --- a/reference/3.0/interface/KeyValueStoreOptions.html +++ b/reference/3.0/interface/KeyValueStoreOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyValueStoreOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L307" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L305" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L306" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStoreIteratorOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/MainOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MainOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/MainOptions.html b/reference/3.0/interface/MainOptions.html index 381a849357..615695e25e 100644 --- a/reference/3.0/interface/MainOptions.html +++ b/reference/3.0/interface/MainOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>MainOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a><ul class="tsd-hierarchy"><li><em class="tsd-target">MainOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1521" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exit</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1519" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exitCode</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1512" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.statusMessage</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1371" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">InitOptions.storage</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1517" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.timeoutSecs</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStoreOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MetamorphOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/MetamorphOptions.html b/reference/3.0/interface/MetamorphOptions.html index b2e843b2d7..c8a1f18928 100644 --- a/reference/3.0/interface/MetamorphOptions.html +++ b/reference/3.0/interface/MetamorphOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,7 +19,7 @@ <code>input</code> is expected to be an object that will be stringified to JSON and content type set to <code>application/json; charset=utf-8</code>. If <code>options.contentType</code> is specified, then <code>input</code> must be a <code>String</code> or <code>Buffer</code>.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/MainOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MainOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/OpenStorageOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">OpenStorageOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/OpenStorageOptions.html b/reference/3.0/interface/OpenStorageOptions.html index d536f4b702..8cd145611a 100644 --- a/reference/3.0/interface/OpenStorageOptions.html +++ b/reference/3.0/interface/OpenStorageOptions.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>OpenStorageOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forceCloud" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forceCloud"><span class="tsd-anchor-id" id="forceCloud"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1530" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>forceCloud</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code> then the cloud storage is used even if the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable is set. This way it is possible to combine local and cloud storage.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MetamorphOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#forceCloud" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> forceCloud</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ProxyConfigurationOptions.html b/reference/3.0/interface/ProxyConfigurationOptions.html index 376c2210bb..7aaad497d6 100644 --- a/reference/3.0/interface/ProxyConfigurationOptions.html +++ b/reference/3.0/interface/ProxyConfigurationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -31,7 +31,7 @@ environment variable, which is automatically set by the system when running the actors.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyUrls"><span class="tsd-anchor-id" id="proxyUrls"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L10" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>proxyUrls</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyUrls<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyConfigurationOptions.proxyUrls</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will cause an error to be thrown on initialize.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/OpenStorageOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">OpenStorageOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/ProxyInfo"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apifyProxyCountry" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apifyProxyCountry</a></li><li><a href="#apifyProxyGroups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apifyProxyGroups</a></li><li><a href="#countryCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> countryCode</a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> groups</a></li><li><a href="#newUrlFunction" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> newUrlFunction</a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> password</a></li><li><a href="#proxyUrls" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyUrls</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/ProxyInfo.html b/reference/3.0/interface/ProxyInfo.html index cb89390d8d..ae4df6c195 100644 --- a/reference/3.0/interface/ProxyInfo.html +++ b/reference/3.0/interface/ProxyInfo.html @@ -67,7 +67,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -89,7 +89,7 @@ If not provided, the proxy will select the groups automatically.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#hostname"><span class="tsd-anchor-id" id="hostname"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L68" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>hostname</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>hostname<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.hostname</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Hostname of your proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#password"><span class="tsd-anchor-id" id="password"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/proxy_configuration.ts#L115" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>password</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyInfo.password</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User’s password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> environment variable, which is automatically set by the system when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener noreferrer">Apify CLI</a>.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#port"><span class="tsd-anchor-id" id="port"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L72" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>port</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>port<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.port</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Proxy port.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#sessionId"><span class="tsd-anchor-id" id="sessionId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L52" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>sessionId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.sessionId</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The identifier of used Session, if used.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#url"><span class="tsd-anchor-id" id="url"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>url</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>url<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.url</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The URL of the proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#username"><span class="tsd-anchor-id" id="username"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>username</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>username<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.username</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Username for the proxy.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/QueueOperationInfo"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#countryCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> countryCode</a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> groups</a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> hostname</a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> password</a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> port</a></li><li><a href="#sessionId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> sessionId</a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> url</a></li><li><a href="#username" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> username</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/QueueOperationInfo.html b/reference/3.0/interface/QueueOperationInfo.html index d52dc4d8f4..78023c074c 100644 --- a/reference/3.0/interface/QueueOperationInfo.html +++ b/reference/3.0/interface/QueueOperationInfo.html @@ -11,14 +11,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>QueueOperationInfo<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>A helper class that is used to report results from various <a href="/sdk/js/reference/3.0/class/RequestQueue">RequestQueue</a> functions as well as enqueueLinks.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#requestId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId</a></li><li><a href="#uniqueKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>uniqueKey</a></li><li><a href="#wasAlreadyHandled" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled</a></li><li><a href="#wasAlreadyPresent" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyPresent</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestId"><span class="tsd-anchor-id" id="requestId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L51" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The ID of the added request</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#uniqueKey"><span class="tsd-anchor-id" id="uniqueKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L52" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>uniqueKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>uniqueKey<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyHandled"><span class="tsd-anchor-id" id="wasAlreadyHandled"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyHandled</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Indicates if request was already marked as handled.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyPresent"><span class="tsd-anchor-id" id="wasAlreadyPresent"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L47" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyPresent</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyPresent<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Indicates if request was already present in the queue.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/ProxyInfo"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfoOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestId</a></li><li><a href="#uniqueKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> uniqueKey</a></li><li><a href="#wasAlreadyHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyHandled</a></li><li><a href="#wasAlreadyPresent" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyPresent</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/QueueOperationInfoOptions.html b/reference/3.0/interface/QueueOperationInfoOptions.html index 5bb1f712e9..d6755e9e2e 100644 --- a/reference/3.0/interface/QueueOperationInfoOptions.html +++ b/reference/3.0/interface/QueueOperationInfoOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>QueueOperationInfoOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#requestId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId</a></li><li><a href="#wasAlreadyHandled" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestId"><span class="tsd-anchor-id" id="requestId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L315" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyHandled"><span class="tsd-anchor-id" id="wasAlreadyHandled"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L316" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyHandled</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/QueueOperationInfo"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/RecordOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RecordOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestId</a></li><li><a href="#wasAlreadyHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyHandled</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/RecordOptions.html b/reference/3.0/interface/RecordOptions.html index 82fcce3a5e..145cbb8385 100644 --- a/reference/3.0/interface/RecordOptions.html +++ b/reference/3.0/interface/RecordOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RecordOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#contentType" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#contentType"><span class="tsd-anchor-id" id="contentType"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L313" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>contentType</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a custom MIME content type of the record.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfoOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueueOperationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/RequestQueueOperationOptions.html b/reference/3.0/interface/RequestQueueOperationOptions.html index baa249f7ef..c98f3bbcab 100644 --- a/reference/3.0/interface/RequestQueueOperationOptions.html +++ b/reference/3.0/interface/RequestQueueOperationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RequestQueueOperationOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forefront" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forefront</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forefront"><span class="tsd-anchor-id" id="forefront"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L63" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>forefront</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forefront<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code>:</p><ul><li>while adding the request to the queue: the request will be added to the foremost position in the queue.</li><li>while reclaiming the request: the request will be placed to the beginning of the queue, so that it’s returned in the next call to <a href="/sdk/js/reference/3.0/class/RequestQueue#fetchNextRequest">RequestQueue.fetchNextRequest</a>. By default, it’s put to the end of the queue.</li></ul></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/RecordOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RecordOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueueOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#forefront" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> forefront</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/RequestQueueOptions.html b/reference/3.0/interface/RequestQueueOptions.html index ec862921e8..5f4de4f969 100644 --- a/reference/3.0/interface/RequestQueueOptions.html +++ b/reference/3.0/interface/RequestQueueOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/3.0/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/QueueOperationInfoOptions">QueueOperationInfoOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/3.0/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/3.0/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/3.0#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/3.0/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for version <b>3.0</b>.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.0</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RequestQueueOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L312" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L310" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L311" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/RequestQueueOperationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOperationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0/interface/WebhookOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">WebhookOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/3.0/interface/WebhookOptions.html b/reference/3.0/interface/WebhookOptions.html index 548585acaa..fa5db2dbb8 100644 --- a/reference/3.0/interface/WebhookOptions.html +++ b/reference/3.0/interface/WebhookOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,7 +24,7 @@ is available in the <a href="https://docs.apify.com/webhooks" target="_blank" rel="noopener noreferrer">Apify webhook documentation</a>. If <code>payloadTemplate</code> is omitted, the default payload template is used (<a href="https://docs.apify.com/webhooks/actions#payload-template" target="_blank" rel="noopener noreferrer">view docs</a>).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestUrl"><span class="tsd-anchor-id" id="requestUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/6c0563ac/packages/apify/src/actor.ts#L1470" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>requestUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>URL which will be requested using HTTP POST request, when actor run will reach the set event type.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/3.0/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/3.0#UserFunc"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">UserFunc</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#eventTypes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventTypes</a></li><li><a href="#idempotencyKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> idempotencyKey</a></li><li><a href="#payloadTemplate" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> payloadTemplate</a></li><li><a href="#requestUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/changelog.html b/reference/changelog.html index 710690b842..1cf970f1d6 100644 --- a/reference/changelog.html +++ b/reference/changelog.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -33,7 +33,7 @@ early as possible.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mitigation-of-zero-concurrency-issue">Mitigation of zero concurrency issue<a href="#mitigation-of-zero-concurrency-issue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Several new timeouts were added to the task function, which should help mitigate the zero concurrency bug. Namely fetching of next request information and reclaiming failed requests back to the queue are now executed with a timeout with 3 additional retries before the task fails. The timeout is always at least 300s (5 minutes), or <code>requestHandlerTimeoutSecs</code> if that value is higher.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="full-list-of-changes">Full list of changes<a href="#full-list-of-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><ul><li>fix <code>RequestError: URI malformed</code> in cheerio crawler (#1205)</li><li>only provide Cookie header if cookies are present (#1218)</li><li>handle extra cases for <code>diffCookie</code> (#1217)</li><li>add timeout for task function (#1234)</li><li>implement proxy per page in browser crawlers (#1228)</li><li>add fingerprinting support (#1243)</li><li>implement abortable timeouts (#1245)</li><li>add timeouts with retries to <code>runTaskFunction()</code> (#1250)</li><li>automatically convert google spreadsheet URLs to CSV exports (#1255)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="210-2021-10-07"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.7...v2.1.0" target="_blank" rel="noopener noreferrer">2.1.0</a> (2021-10-07)<a href="#210-2021-10-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>automatically convert google docs share urls to csv download ones in request list (#1174)</li><li>use puppeteer emulating scrolls instead of <code>window.scrollBy</code> (#1170)</li><li>warn if apify proxy is used in proxyUrls (#1173)</li><li>fix <code>YOUTUBE_REGEX_STRING</code> being too greedy (#1171)</li><li>add <code>purgeLocalStorage</code> utility method (#1187)</li><li>catch errors inside request interceptors (#1188, #1190)</li><li>add support for cgroups v2 (#1177)</li><li>fix incorrect offset in <code>fixUrl</code> function (#1184)</li><li>support channel and user links in YouTube regex (#1178)</li><li>fix: allow passing <code>requestsFromUrl</code> to <code>RequestListOptions</code> in TS (#1191)</li><li>allow passing <code>forceCloud</code> down to the KV store (#1186), closes #752</li><li>merge cookies from session with user provided ones (#1201), closes #1197</li><li>use <code>ApifyClient</code> v2 (full rewrite to TS)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="207-2021-09-08"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.6...v2.0.7" target="_blank" rel="noopener noreferrer">2.0.7</a> (2021-09-08)<a href="#207-2021-09-08" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix casting of int/bool environment variables (e.g. <code>APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE</code>), closes #956</li><li>Fix incognito pages and user data dir (#1145)</li><li>Add <code>@ts-ignore</code> comments to imports of optional peer dependencies (#1152)</li><li>Use config instance in <code>sdk.openSessionPool()</code> (#1154)</li><li>Add a breaking callback to <code>infiniteScroll</code> (#1140)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="206-2021-08-27"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.5...v2.0.6" target="_blank" rel="noopener noreferrer">2.0.6</a> (2021-08-27)<a href="#206-2021-08-27" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix deprecation messages logged from <code>ProxyConfiguration</code> and <code>CheerioCrawler</code>.</li><li>Update <code>got-scraping</code> to receive multiple improvements.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="205-2021-08-24"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.4...v2.0.5" target="_blank" rel="noopener noreferrer">2.0.5</a> (2021-08-24)<a href="#205-2021-08-24" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix error handling in puppeteer crawler</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="204-2021-08-23"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.3...v2.0.4" target="_blank" rel="noopener noreferrer">2.0.4</a> (2021-08-23)<a href="#204-2021-08-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Use <code>sessionToken</code> with <code>got-scraping</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="203-2021-08-20"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.2...v2.0.3" target="_blank" rel="noopener noreferrer">2.0.3</a> (2021-08-20)<a href="#203-2021-08-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><strong>BREAKING IN EDGE CASES</strong> * We removed <code>forceUrlEncoding</code> in <code>requestAsBrowser</code> because we found out that recent versions of the underlying HTTP client <code>got</code> already encode URLs and <code>forceUrlEncoding</code> could lead to weird behavior. We think of this as fixing a bug, so we're not bumping the major version.</li><li>Limit <code>handleRequestTimeoutMillis</code> to max valid value to prevent Node.js fallback to <code>1</code>.</li><li>Use <code>got-scraping@^3.0.1</code></li><li>Disable SSL validation on MITM proxie</li><li>Limit <code>handleRequestTimeoutMillis</code> to max valid value</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="202-2021-08-12"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.1...v2.0.2" target="_blank" rel="noopener noreferrer">2.0.2</a> (2021-08-12)<a href="#202-2021-08-12" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix serialization issues in <code>CheerioCrawler</code> caused by parser conflicts in recent versions of <code>cheerio</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="201-2021-08-06"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.0...v2.0.1" target="_blank" rel="noopener noreferrer">2.0.1</a> (2021-08-06)<a href="#201-2021-08-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Use <code>got-scraping</code> 2.0.1 until fully compatible.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="200-2021-08-05"><a href="https://github.com/apify/apify-sdk-js/compare/v1.3.4...v2.0.0" target="_blank" rel="noopener noreferrer">2.0.0</a> (2021-08-05)<a href="#200-2021-08-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#3112-2023-10-05" class="table-of-contents__link toc-highlight">3.1.12 (2023-10-05)</a><ul><li><a href="#bug-fixes" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#3111-2023-10-04" class="table-of-contents__link toc-highlight">3.1.11 (2023-10-04)</a><ul><li><a href="#bug-fixes-1" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#3110-2023-09-07" class="table-of-contents__link toc-highlight">3.1.10 (2023-09-07)</a><ul><li><a href="#bug-fixes-2" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#319-2023-09-06" class="table-of-contents__link toc-highlight">3.1.9 (2023-09-06)</a></li><li><a href="#318-2023-07-20" class="table-of-contents__link toc-highlight">3.1.8 (2023-07-20)</a><ul><li><a href="#bug-fixes-3" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-1" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#317-2023-06-09" class="table-of-contents__link toc-highlight">3.1.7 (2023-06-09)</a></li><li><a href="#316-2023-06-09" class="table-of-contents__link toc-highlight">3.1.6 (2023-06-09)</a><ul><li><a href="#bug-fixes-4" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#315-2023-05-31" class="table-of-contents__link toc-highlight">3.1.5 (2023-05-31)</a><ul><li><a href="#bug-fixes-5" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-2" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#314-2023-03-23" class="table-of-contents__link toc-highlight">3.1.4 (2023-03-23)</a><ul><li><a href="#bug-fixes-6" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#313-2023-03-22" class="table-of-contents__link toc-highlight">3.1.3 (2023-03-22)</a><ul><li><a href="#bug-fixes-7" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-3" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#312-2023-02-07" class="table-of-contents__link toc-highlight">3.1.2 (2023-02-07)</a><ul><li><a href="#bug-fixes-8" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#311-2022-11-13" class="table-of-contents__link toc-highlight">3.1.1 (2022-11-13)</a><ul><li><a href="#features-4" class="table-of-contents__link toc-highlight">Features</a></li><li><a href="#bug-fixes-9" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-5" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#300-2022-07-13" class="table-of-contents__link toc-highlight">3.0.0 (2022-07-13)</a><ul><li><a href="#crawlee-vs-apify-sdk" class="table-of-contents__link toc-highlight">Crawlee vs Apify SDK</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a><ul><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#header-generator-options" class="table-of-contents__link toc-highlight"><code>header-generator</code> options</a></li><li><a href="#timeoutsecs" class="table-of-contents__link toc-highlight"><code>timeoutSecs</code></a></li><li><a href="#throwonhttperrors" class="table-of-contents__link toc-highlight"><code>throwOnHttpErrors</code></a></li><li><a href="#decodebody" class="table-of-contents__link toc-highlight"><code>decodeBody</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li></ul></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></li><li><a href="#232-2022-05-05" class="table-of-contents__link toc-highlight">2.3.2 (2022-05-05)</a></li><li><a href="#231-2022-05-03" class="table-of-contents__link toc-highlight">2.3.1 (2022-05-03)</a></li><li><a href="#230-2022-04-07" class="table-of-contents__link toc-highlight">2.3.0 (2022-04-07)</a><ul><li><a href="#0-concurrency-mitigation" class="table-of-contents__link toc-highlight">0 concurrency mitigation</a></li></ul></li><li><a href="#222-2022-02-14" class="table-of-contents__link toc-highlight">2.2.2 (2022-02-14)</a></li><li><a href="#221-2022-01-03" class="table-of-contents__link toc-highlight">2.2.1 (2022-01-03)</a></li><li><a href="#220-2021-12-17" class="table-of-contents__link toc-highlight">2.2.0 (2021-12-17)</a><ul><li><a href="#proxy-per-page" class="table-of-contents__link toc-highlight">Proxy per page</a></li><li><a href="#abortable-timeouts" class="table-of-contents__link toc-highlight">Abortable timeouts</a></li><li><a href="#mitigation-of-zero-concurrency-issue" class="table-of-contents__link toc-highlight">Mitigation of zero concurrency issue</a></li><li><a href="#full-list-of-changes" class="table-of-contents__link toc-highlight">Full list of changes</a></li></ul></li><li><a href="#210-2021-10-07" class="table-of-contents__link toc-highlight">2.1.0 (2021-10-07)</a></li><li><a href="#207-2021-09-08" class="table-of-contents__link toc-highlight">2.0.7 (2021-09-08)</a></li><li><a href="#206-2021-08-27" class="table-of-contents__link toc-highlight">2.0.6 (2021-08-27)</a></li><li><a href="#205-2021-08-24" class="table-of-contents__link toc-highlight">2.0.5 (2021-08-24)</a></li><li><a href="#204-2021-08-23" class="table-of-contents__link toc-highlight">2.0.4 (2021-08-23)</a></li><li><a href="#203-2021-08-20" class="table-of-contents__link toc-highlight">2.0.3 (2021-08-20)</a></li><li><a href="#202-2021-08-12" class="table-of-contents__link toc-highlight">2.0.2 (2021-08-12)</a></li><li><a href="#201-2021-08-06" class="table-of-contents__link toc-highlight">2.0.1 (2021-08-06)</a></li><li><a href="#200-2021-08-05" class="table-of-contents__link toc-highlight">2.0.0 (2021-08-05)</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/Actor.html b/reference/class/Actor.html index a624899781..7342816064 100644 --- a/reference/class/Actor.html +++ b/reference/class/Actor.html @@ -13,7 +13,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -209,7 +209,7 @@ Otherwise the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/CallOptions">CallOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useState"><span class="tsd-anchor-id" id="useState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L950" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>useState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>State<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>name<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">State</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">UseStateOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Easily create and manage state values. All state values are automatically persisted.</p> <p>Values can be modified by simply using the assignment operator.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>State</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>name: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The name of the store to use.</p></div></div></div></li><li><h5>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol"> = <!-- -->...</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If the store does not yet have a value in it, the value will be initialized with the <code>defaultValue</code> you provide.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">UseStateOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An optional object parameter where a custom <code>keyValueStoreName</code> and <code>config</code> can be passed in.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/ApifyClient"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyClient</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#initialized" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> initialized</a></li><li><a href="#apifyClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info);"></i> apifyClient</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info);"></i> config</a></li><li><a href="#getInputOrThrow" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInputOrThrow</a></li><li><a href="#useState" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useState</a></li><li><a href="#abort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> abort</a></li><li><a href="#addWebhook" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addWebhook</a></li><li><a href="#call" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> call</a></li><li><a href="#callTask" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> callTask</a></li><li><a href="#createProxyConfiguration" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> createProxyConfiguration</a></li><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exit</a></li><li><a href="#fail" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> fail</a></li><li><a href="#getEnv" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEnv</a></li><li><a href="#getInput" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInput</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#init" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> init</a></li><li><a href="#isAtHome" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isAtHome</a></li><li><a href="#main" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> main</a></li><li><a href="#metamorph" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> metamorph</a></li><li><a href="#newClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newClient</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#openDataset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openDataset</a></li><li><a href="#openKeyValueStore" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openKeyValueStore</a></li><li><a href="#openRequestQueue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openRequestQueue</a></li><li><a href="#pushData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> pushData</a></li><li><a href="#reboot" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reboot</a></li><li><a href="#setStatusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setStatusMessage</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#start" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> start</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/ApifyClient.html b/reference/class/ApifyClient.html index e8bb9c9cf0..6154b9fae0 100644 --- a/reference/class/ApifyClient.html +++ b/reference/class/ApifyClient.html @@ -11,14 +11,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/class/Actor">Classes</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/Actor">Actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/class/ApifyClient">ApifyClient</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/Configuration">Configuration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/Dataset">Dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/KeyValueStore">KeyValueStore</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/Log">Log</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/Logger">Logger</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/LoggerJson">LoggerJson</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/LoggerText">LoggerText</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/PlatformEventManager">PlatformEventManager</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/ProxyConfiguration">ProxyConfiguration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/class/RequestQueue">RequestQueue</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Classes</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ApifyClient<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>ApifyClient is the official library to access <a href="https://docs.apify.com/api/v2" target="_blank" rel="noopener noreferrer">Apify API</a> from your JavaScript applications. It runs both in Node.js and browser.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#baseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl</a></li><li><a href="#httpClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>httpClient</a></li><li><a href="#logger" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger</a></li><li><a href="#stats" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actor" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actor</a></li><li><a href="#actors" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actors</a></li><li><a href="#build" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>build</a></li><li><a href="#dataset" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>dataset</a></li><li><a href="#datasets" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>datasets</a></li><li><a href="#keyValueStore" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStore</a></li><li><a href="#keyValueStores" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStores</a></li><li><a href="#log" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>log</a></li><li><a href="#requestQueue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueue</a></li><li><a href="#requestQueues" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueues</a></li><li><a href="#run" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>run</a></li><li><a href="#schedule" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedule</a></li><li><a href="#schedules" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedules</a></li><li><a href="#setStatusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage</a></li><li><a href="#task" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>task</a></li><li><a href="#tasks" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>tasks</a></li><li><a href="#user" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>user</a></li><li><a href="#webhook" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhook</a></li><li><a href="#webhookDispatch" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatch</a></li><li><a href="#webhookDispatches" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatches</a></li><li><a href="#webhooks" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhooks</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L36" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new ApifyClient<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#baseUrl"><span class="tsd-anchor-id" id="baseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L31" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>baseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#httpClient"><span class="tsd-anchor-id" id="httpClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>httpClient</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>httpClient<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">HttpClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logger"><span class="tsd-anchor-id" id="logger"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>logger</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Log">Log</a></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#stats"><span class="tsd-anchor-id" id="stats"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L33" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>stats</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Statistics</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L32" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actor"><span class="tsd-anchor-id" id="actor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L45" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actor<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ActorClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actors/actor-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actors/actor-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ActorClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actors"><span class="tsd-anchor-id" id="actors"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L41" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actors</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actors<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ActorCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actors/actor-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actors/actor-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ActorCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#build"><span class="tsd-anchor-id" id="build"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>build</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>build<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">BuildClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-builds/build-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-builds/build-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">BuildClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#dataset"><span class="tsd-anchor-id" id="dataset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L57" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>dataset</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>dataset<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DatasetClient</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/datasets/dataset" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/datasets/dataset</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DatasetClient</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#datasets"><span class="tsd-anchor-id" id="datasets"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L53" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>datasets</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>datasets<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DatasetCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/datasets/dataset-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/datasets/dataset-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DatasetCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#keyValueStore"><span class="tsd-anchor-id" id="keyValueStore"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L65" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>keyValueStore</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStore<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">KeyValueStoreClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/key-value-stores/store-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/key-value-stores/store-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">KeyValueStoreClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#keyValueStores"><span class="tsd-anchor-id" id="keyValueStores"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L61" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>keyValueStores</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStores<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">KeyValueStoreCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">KeyValueStoreCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#log"><span class="tsd-anchor-id" id="log"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L69" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>log</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>log<span class="tsd-signature-symbol">(</span><span>buildOrRunId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">LogClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/logs" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/logs</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>buildOrRunId: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">LogClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestQueue"><span class="tsd-anchor-id" id="requestQueue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L77" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestQueue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueue<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">RequestQueueUserOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RequestQueueClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/request-queues/queue" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/request-queues/queue</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">RequestQueueUserOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RequestQueueClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestQueues"><span class="tsd-anchor-id" id="requestQueues"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L73" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestQueues</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueues<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RequestQueueCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/request-queues/queue-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/request-queues/queue-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RequestQueueCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#run"><span class="tsd-anchor-id" id="run"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L81" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>run</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>run<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RunClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RunClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#schedule"><span class="tsd-anchor-id" id="schedule"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L97" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>schedule</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedule<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ScheduleClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/schedules/schedule-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/schedules/schedule-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ScheduleClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#schedules"><span class="tsd-anchor-id" id="schedules"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L93" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>schedules</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedules<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ScheduleCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/schedules/schedules-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/schedules/schedules-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ScheduleCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setStatusMessage"><span class="tsd-anchor-id" id="setStatusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L118" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>setStatusMessage</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">SetStatusMessageOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">SetStatusMessageOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#task"><span class="tsd-anchor-id" id="task"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L89" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>task</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>task<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TaskClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-tasks/task-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-tasks/task-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TaskClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#tasks"><span class="tsd-anchor-id" id="tasks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L85" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>tasks</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>tasks<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TaskCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TaskCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#user"><span class="tsd-anchor-id" id="user"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L101" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>user</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>user<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">UserClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/users" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/users</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">UserClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhook"><span class="tsd-anchor-id" id="webhook"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L109" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhook</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhook<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhooks/webhook-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhooks/webhook-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhookDispatch"><span class="tsd-anchor-id" id="webhookDispatch"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L117" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhookDispatch</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatch<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookDispatchClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookDispatchClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhookDispatches"><span class="tsd-anchor-id" id="webhookDispatches"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L113" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhookDispatches</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatches<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookDispatchCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhook-dispatches" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhook-dispatches</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookDispatchCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L105" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhooks</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhooks<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookCollectionClient</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/Actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/Configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#baseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> baseUrl</a></li><li><a href="#httpClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> httpClient</a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logger</a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> stats</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#actor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> actor</a></li><li><a href="#actors" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> actors</a></li><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> build</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> dataset</a></li><li><a href="#datasets" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> datasets</a></li><li><a href="#keyValueStore" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> keyValueStore</a></li><li><a href="#keyValueStores" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> keyValueStores</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#requestQueue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> requestQueue</a></li><li><a href="#requestQueues" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> requestQueues</a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> run</a></li><li><a href="#schedule" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> schedule</a></li><li><a href="#schedules" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> schedules</a></li><li><a href="#setStatusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setStatusMessage</a></li><li><a href="#task" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> task</a></li><li><a href="#tasks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> tasks</a></li><li><a href="#user" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> user</a></li><li><a href="#webhook" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhook</a></li><li><a href="#webhookDispatch" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhookDispatch</a></li><li><a href="#webhookDispatches" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhookDispatches</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/Configuration.html b/reference/class/Configuration.html index f519655f77..421a953618 100644 --- a/reference/class/Configuration.html +++ b/reference/class/Configuration.html @@ -139,7 +139,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -155,7 +155,7 @@ <h2>Supported Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>memoryMbytes</code></td><td><code>ACTOR_MEMORY_MBYTES</code></td><td>-</td></tr><tr><td><code>headless</code></td><td><code>APIFY_HEADLESS</code></td><td>-</td></tr><tr><td><code>persistStateIntervalMillis</code></td><td><code>APIFY_PERSIST_STATE_INTERVAL_MILLIS</code></td><td><code>60e3</code></td></tr><tr><td><code>token</code></td><td><code>APIFY_TOKEN</code></td><td>-</td></tr><tr><td><code>isAtHome</code></td><td><code>APIFY_IS_AT_HOME</code></td><td>-</td></tr><tr><td><code>defaultDatasetId</code></td><td><code>ACTOR_DEFAULT_DATASET_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultKeyValueStoreId</code></td><td><code>ACTOR_DEFAULT_KEY_VALUE_STORE_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultRequestQueueId</code></td><td><code>ACTOR_DEFAULT_REQUEST_QUEUE_ID</code></td><td><code>'default'</code></td></tr></tbody></table><h2>Advanced Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>actorEventsWsUrl</code></td><td><code>ACTOR_EVENTS_WEBSOCKET_URL</code></td><td>-</td></tr><tr><td><code>actorId</code></td><td><code>ACTOR_ID</code></td><td>-</td></tr><tr><td><code>actorRunId</code></td><td><code>ACTOR_RUN_ID</code></td><td>-</td></tr><tr><td><code>actorTaskId</code></td><td><code>ACTOR_TASK_ID</code></td><td>-</td></tr><tr><td><code>apiBaseUrl</code></td><td><code>APIFY_API_BASE_URL</code></td><td><code>'https://api.apify.com'</code></td></tr><tr><td><code>containerPort</code></td><td><code>ACTOR_WEB_SERVER_PORT</code></td><td><code>4321</code></td></tr><tr><td><code>containerUrl</code></td><td><code>ACTOR_WEB_SERVER_URL</code></td><td><code>'http://localhost:4321'</code></td></tr><tr><td><code>inputKey</code></td><td><code>ACTOR_INPUT_KEY</code></td><td><code>'INPUT'</code></td></tr><tr><td><code>metamorphAfterSleepMillis</code></td><td><code>APIFY_METAMORPH_AFTER_SLEEP_MILLIS</code></td><td><code>300e3</code></td></tr><tr><td><code>proxyHostname</code></td><td><code>APIFY_PROXY_HOSTNAME</code></td><td><code>'proxy.apify.com'</code></td></tr><tr><td><code>proxyPassword</code></td><td><code>APIFY_PROXY_PASSWORD</code></td><td>-</td></tr><tr><td><code>proxyPort</code></td><td><code>APIFY_PROXY_PORT</code></td><td><code>8000</code></td></tr><tr><td><code>proxyStatusUrl</code></td><td><code>APIFY_PROXY_STATUS_URL</code></td><td><code>'http://proxy.apify.com'</code></td></tr><tr><td><code>userId</code></td><td><code>APIFY_USER_ID</code></td><td>-</td></tr><tr><td><code>xvfb</code></td><td><code>APIFY_XVFB</code></td><td>-</td></tr><tr><td><code>chromeExecutablePath</code></td><td><code>APIFY_CHROME_EXECUTABLE_PATH</code></td><td>-</td></tr><tr><td><code>defaultBrowserPath</code></td><td><code>APIFY_DEFAULT_BROWSER_PATH</code></td><td>-</td></tr></tbody></table></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Configuration</span><ul class="tsd-hierarchy"><li><em class="tsd-target">Configuration</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#globalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#get" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#getGlobalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig</a></li><li><a href="#getStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient</a></li><li><a href="#resetGlobalState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L223" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new Configuration<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.constructor</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates new <code>Configuration</code> instance with provided options. Env vars will have precedence over those.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">ConfigurationOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Configuration">Configuration</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#globalConfig"><span class="tsd-anchor-id" id="globalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L100" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-optional">optional</span>globalConfig</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Configuration">Configuration</a></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.globalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#get"><span class="tsd-anchor-id" id="get"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L179" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>get</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>U<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.get</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li><strong>U</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">StorageClient</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventManager</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">U</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type tsd-signature-type-generic">U</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L251" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#set"><span class="tsd-anchor-id" id="set"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L186" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>set</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.set</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>value: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useEventManager"><span class="tsd-anchor-id" id="useEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L259" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager<span class="tsd-signature-symbol">(</span><span>events<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useEventManager</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>events: <span class="tsd-signature-type">EventManager</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useStorageClient"><span class="tsd-anchor-id" id="useStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L257" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient<span class="tsd-signature-symbol">(</span><span>client<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useStorageClient</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>client: <span class="tsd-signature-type">StorageClient</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L271" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default EventManager instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getGlobalConfig"><span class="tsd-anchor-id" id="getGlobalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L193" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getGlobalConfig</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.getGlobalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Configuration">Configuration</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getStorageClient"><span class="tsd-anchor-id" id="getStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L267" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getStorageClient</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default StorageClient instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">StorageClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#resetGlobalState"><span class="tsd-anchor-id" id="resetGlobalState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L206" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>resetGlobalState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.resetGlobalState</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Resets global configuration instance. The default instance holds configuration based on env vars, if we want to change them, we need to first reset the global state. Used mainly for testing purposes.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#set"><span class="tsd-anchor-id" id="set"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L240" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>set</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">keyof<!-- --> </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.set</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets value for given option. Only affects the global <code>Configuration</code> instance, the value will not be propagated down to the env var. To reset a value, we can omit the <code>value</code> argument or pass <code>undefined</code> there.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-symbol">keyof<!-- --> </span><span class="tsd-signature-type">ConfigurationOptions</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>value: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useStorageClient"><span class="tsd-anchor-id" id="useStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L258" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>useStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient<span class="tsd-signature-symbol">(</span><span>client<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useStorageClient</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>client: <span class="tsd-signature-type">StorageClient</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/ApifyClient"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyClient</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/Dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#globalConfig" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> globalConfig</a></li><li><a href="#get" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> get</a></li><li><a href="#getEventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventManager</a></li><li><a href="#set" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> set</a></li><li><a href="#useEventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useEventManager</a></li><li><a href="#useStorageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useStorageClient</a></li><li><a href="#getGlobalConfig" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getGlobalConfig</a></li><li><a href="#getStorageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getStorageClient</a></li><li><a href="#resetGlobalState" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> resetGlobalState</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/Dataset.html b/reference/class/Dataset.html index 0cd9813d62..5a9dbbfcc2 100644 --- a/reference/class/Dataset.html +++ b/reference/class/Dataset.html @@ -103,7 +103,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -187,7 +187,7 @@ <p>For more details and code examples, see the <a href="/sdk/js/reference/class/Dataset">Dataset</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>datasetIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the dataset to be opened. If <code>null</code> or <code>undefined</code>, the function returns the default dataset associated with the crawler run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StorageManagerOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Storage manager options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/Configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/KeyValueStore"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> log</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#exportTo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exportTo</a></li><li><a href="#exportToCSV" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exportToCSV</a></li><li><a href="#exportToJSON" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exportToJSON</a></li><li><a href="#forEach" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEach</a></li><li><a href="#getData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getData</a></li><li><a href="#getInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInfo</a></li><li><a href="#map" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> map</a></li><li><a href="#pushData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> pushData</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reduce</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/KeyValueStore.html b/reference/class/KeyValueStore.html index 2de9615bd8..6e3469d31b 100644 --- a/reference/class/KeyValueStore.html +++ b/reference/class/KeyValueStore.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -69,7 +69,7 @@ otherwise the crawler process might finish before the value is stored!</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Unique key of the record. It can be at most 256 characters long and only consist of the following characters: <code>a</code>-<code>z</code>, <code>A</code>-<code>Z</code>, <code>0</code>-<code>9</code> and <code>!-_.'()</code></p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>value: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record data, which can be one of the following values:</p><ul><li>If <code>null</code>, the record in the key-value store is deleted.</li><li>If no <code>options.contentType</code> is specified, <code>value</code> can be any JavaScript object and it will be stringified to JSON.</li><li>If <code>options.contentType</code> is set, <code>value</code> is taken as is and it must be a <code>String</code> or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener noreferrer"><code>Buffer</code></a>. For any other value an error will be thrown.</li></ul></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getAutoSavedValue"><span class="tsd-anchor-id" id="getAutoSavedValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L295" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getAutoSavedValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getAutoSavedValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getAutoSavedValue</span></p></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#open"><span class="tsd-anchor-id" id="open"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/key_value_store.ts#L19" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>open</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>open<span class="tsd-signature-symbol">(</span><span>storeIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">StorageManagerOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreKeyValueStore.open</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>storeIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li><li><h5>options: <span class="tsd-signature-type">StorageManagerOptions</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/Dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/Log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#forEachKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEachKey</a></li><li><a href="#getAutoSavedValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getAutoSavedValue</a></li><li><a href="#getPublicUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getPublicUrl</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/Log.html b/reference/class/Log.html index e86a91061b..f35309f514 100644 --- a/reference/class/Log.html +++ b/reference/class/Log.html @@ -131,7 +131,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -177,7 +177,7 @@ <div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">LEVELS</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div> <p>Default log level is INFO.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>level: <a class="tsd-signature-type" data-tsd-kind="Enumeration" href="/sdk/js/reference/enum/LogLevel">LogLevel</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setOptions"><span class="tsd-anchor-id" id="setOptions"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L122" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>setOptions</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setOptions<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a><span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Configures logger.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>options: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#softFail"><span class="tsd-anchor-id" id="softFail"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L141" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>softFail</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>softFail<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>data<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">AdditionalData</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>data: <span class="tsd-signature-type">AdditionalData</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#warning"><span class="tsd-anchor-id" id="warning"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L145" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>warning</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>warning<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>data<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">AdditionalData</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Logs a <code>WARNING</code> level message. Data are stringified and appended to the message.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>data: <span class="tsd-signature-type">AdditionalData</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#warningOnce"><span class="tsd-anchor-id" id="warningOnce"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L162" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>warningOnce</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>warningOnce<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Logs a <code>WARNING</code> level message only once.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/KeyValueStore"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/Logger"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Logger</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#LEVELS" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> LEVELS</a></li><li><a href="#child" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> child</a></li><li><a href="#debug" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> debug</a></li><li><a href="#deprecated" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> deprecated</a></li><li><a href="#error" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> error</a></li><li><a href="#exception" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exception</a></li><li><a href="#getLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getLevel</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#info" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> info</a></li><li><a href="#internal" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> internal</a></li><li><a href="#perf" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> perf</a></li><li><a href="#setLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setLevel</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#softFail" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> softFail</a></li><li><a href="#warning" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> warning</a></li><li><a href="#warningOnce" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> warningOnce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/Logger.html b/reference/class/Logger.html index e2665df6ad..839e95cb63 100644 --- a/reference/class/Logger.html +++ b/reference/class/Logger.html @@ -15,7 +15,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -180,7 +180,7 @@ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p> <div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> once </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ee </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ac </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">AbortController</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">emitter</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">once</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">emitter</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> signal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'event emitted!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'AbortError'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Waiting for the event was canceled!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'There was an error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Abort waiting for the event</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">emit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Prints: Waiting for the event was canceled!</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v11.13.0, v10.16.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>emitter: <span class="tsd-signature-type">_NodeEventTarget</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>eventName: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StaticEventEmitterOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setMaxListeners"><span class="tsd-anchor-id" id="setMaxListeners"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@types/node/events.d.ts#L311" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>setMaxListeners</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setMaxListeners<span class="tsd-signature-symbol">(</span><span>n<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>eventTargets<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventEmitter.setMaxListeners</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> setMaxListeners</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> target </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventTarget</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> emitter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">setMaxListeners</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> target</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> emitter</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v15.4.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>n: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>eventTargets: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/Log"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Log</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/LoggerJson"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerJson</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#captureRejectionSymbol" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejectionSymbol</a></li><li><a href="#captureRejections" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejections</a></li><li><a href="#defaultMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultMaxListeners</a></li><li><a href="#errorMonitor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> errorMonitor</a></li><li><a href="#_log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _log</a></li><li><a href="#_outputWithConsole" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _outputWithConsole</a></li><li><a href="#addListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addListener</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#eventNames" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> eventNames</a></li><li><a href="#getMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getMaxListeners</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#listenerCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listenerCount</a></li><li><a href="#listeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listeners</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#once" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> once</a></li><li><a href="#prependListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependListener</a></li><li><a href="#prependOnceListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependOnceListener</a></li><li><a href="#rawListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> rawListeners</a></li><li><a href="#removeAllListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeAllListeners</a></li><li><a href="#removeListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeListener</a></li><li><a href="#setMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setMaxListeners</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#getEventListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventListeners</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/LoggerJson.html b/reference/class/LoggerJson.html index 1a73aea471..2129392aa4 100644 --- a/reference/class/LoggerJson.html +++ b/reference/class/LoggerJson.html @@ -15,7 +15,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -180,7 +180,7 @@ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p> <div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> once </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ee </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ac </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">AbortController</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">emitter</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">once</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">emitter</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> signal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'event emitted!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'AbortError'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Waiting for the event was canceled!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'There was an error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Abort waiting for the event</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">emit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Prints: Waiting for the event was canceled!</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v11.13.0, v10.16.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>emitter: <span class="tsd-signature-type">_NodeEventTarget</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>eventName: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StaticEventEmitterOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setMaxListeners"><span class="tsd-anchor-id" id="setMaxListeners"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@types/node/events.d.ts#L311" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>setMaxListeners</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setMaxListeners<span class="tsd-signature-symbol">(</span><span>n<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>eventTargets<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type tsd-signature-type-generic">Logger.setMaxListeners</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> setMaxListeners</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> target </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventTarget</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> emitter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">setMaxListeners</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> target</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> emitter</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v15.4.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>n: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>eventTargets: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/Logger"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Logger</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/LoggerText"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerText</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#captureRejectionSymbol" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejectionSymbol</a></li><li><a href="#captureRejections" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejections</a></li><li><a href="#defaultMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultMaxListeners</a></li><li><a href="#errorMonitor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> errorMonitor</a></li><li><a href="#_log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _log</a></li><li><a href="#_outputWithConsole" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _outputWithConsole</a></li><li><a href="#addListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addListener</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#eventNames" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> eventNames</a></li><li><a href="#getMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getMaxListeners</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#listenerCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listenerCount</a></li><li><a href="#listeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listeners</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#once" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> once</a></li><li><a href="#prependListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependListener</a></li><li><a href="#prependOnceListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependOnceListener</a></li><li><a href="#rawListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> rawListeners</a></li><li><a href="#removeAllListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeAllListeners</a></li><li><a href="#removeListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeListener</a></li><li><a href="#setMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setMaxListeners</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#getEventListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventListeners</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/LoggerText.html b/reference/class/LoggerText.html index fa4675c0b7..c2b0d2ecb9 100644 --- a/reference/class/LoggerText.html +++ b/reference/class/LoggerText.html @@ -15,7 +15,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -180,7 +180,7 @@ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p> <div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> once </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ee </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ac </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">AbortController</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">emitter</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">once</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">emitter</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> signal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'event emitted!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'AbortError'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Waiting for the event was canceled!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'There was an error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Abort waiting for the event</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">emit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Prints: Waiting for the event was canceled!</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v11.13.0, v10.16.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>emitter: <span class="tsd-signature-type">_NodeEventTarget</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>eventName: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StaticEventEmitterOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setMaxListeners"><span class="tsd-anchor-id" id="setMaxListeners"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@types/node/events.d.ts#L311" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>setMaxListeners</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setMaxListeners<span class="tsd-signature-symbol">(</span><span>n<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>eventTargets<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type tsd-signature-type-generic">Logger.setMaxListeners</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> setMaxListeners</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> target </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventTarget</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> emitter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">setMaxListeners</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> target</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> emitter</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v15.4.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>n: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>eventTargets: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/LoggerJson"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerJson</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/PlatformEventManager"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlatformEventManager</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#captureRejectionSymbol" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejectionSymbol</a></li><li><a href="#captureRejections" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejections</a></li><li><a href="#defaultMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultMaxListeners</a></li><li><a href="#errorMonitor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> errorMonitor</a></li><li><a href="#_log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _log</a></li><li><a href="#_outputWithConsole" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _outputWithConsole</a></li><li><a href="#_parseException" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _parseException</a></li><li><a href="#addListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addListener</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#eventNames" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> eventNames</a></li><li><a href="#getMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getMaxListeners</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#listenerCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listenerCount</a></li><li><a href="#listeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listeners</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#once" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> once</a></li><li><a href="#prependListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependListener</a></li><li><a href="#prependOnceListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependOnceListener</a></li><li><a href="#rawListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> rawListeners</a></li><li><a href="#removeAllListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeAllListeners</a></li><li><a href="#removeListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeListener</a></li><li><a href="#setMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setMaxListeners</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#getEventListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventListeners</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/PlatformEventManager.html b/reference/class/PlatformEventManager.html index d6aed19eee..fa90e4504e 100644 --- a/reference/class/PlatformEventManager.html +++ b/reference/class/PlatformEventManager.html @@ -79,7 +79,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -116,7 +116,7 @@ of Apify package such as <code>persistState</code>. This is automatically called at the end of <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#emit"><span class="tsd-anchor-id" id="emit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>emit</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>emit<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.emit</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#init"><span class="tsd-anchor-id" id="init"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/platform_event_manager.ts#L57" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>init</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.init</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Initializes <code>Actor.events</code> event emitter by creating a connection to a websocket that provides them. This is an internal function that is automatically called by <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isInitialized"><span class="tsd-anchor-id" id="isInitialized"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L36" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>isInitialized</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isInitialized<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.isInitialized</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#off"><span class="tsd-anchor-id" id="off"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>off</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.off</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#on"><span class="tsd-anchor-id" id="on"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L33" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>on</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.on</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/LoggerText"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerText</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/ProxyConfiguration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#close" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> close</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#init" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> init</a></li><li><a href="#isInitialized" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isInitialized</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/ProxyConfiguration.html b/reference/class/ProxyConfiguration.html index 44a4791712..e4de2de05d 100644 --- a/reference/class/ProxyConfiguration.html +++ b/reference/class/ProxyConfiguration.html @@ -67,7 +67,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -110,7 +110,7 @@ will use the same target proxy server (i.e. the same IP address). The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A string with a proxy URL, including authentication credentials and port number. For example, <code>http://bob:password123@proxy.example.com:8000</code></p></div></div></div></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/PlatformEventManager"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlatformEventManager</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/class/RequestQueue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#isManInTheMiddle" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isManInTheMiddle</a></li><li><a href="#initialize" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> initialize</a></li><li><a href="#newProxyInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newProxyInfo</a></li><li><a href="#newUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/class/RequestQueue.html b/reference/class/RequestQueue.html index 9e0cdb0166..b102d3d093 100644 --- a/reference/class/RequestQueue.html +++ b/reference/class/RequestQueue.html @@ -93,7 +93,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -191,7 +191,7 @@ <p>For more details and code examples, see the <a href="/sdk/js/reference/class/RequestQueue">RequestQueue</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>queueIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the request queue to be opened. If <code>null</code> or <code>undefined</code>, the function returns the default request queue associated with the crawler run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StorageManagerOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Open Request Queue options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/ProxyConfiguration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/enum/LogLevel"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LogLevel</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#assumedHandledCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> assumedHandledCount</a></li><li><a href="#assumedTotalCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> assumedTotalCount</a></li><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#clientKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> clientKey</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#inProgress" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inProgress</a></li><li><a href="#internalTimeoutMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> internalTimeoutMillis</a></li><li><a href="#lastActivity" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> lastActivity</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> log</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#queryQueueHeadPromise" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> queryQueueHeadPromise</a></li><li><a href="#recentlyHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> recentlyHandled</a></li><li><a href="#requestsCache" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestsCache</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li><li><a href="#addRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequest</a></li><li><a href="#addRequests" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequests</a></li><li><a href="#addRequestsBatched" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequestsBatched</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#fetchNextRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> fetchNextRequest</a></li><li><a href="#getInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInfo</a></li><li><a href="#getRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getRequest</a></li><li><a href="#handledCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> handledCount</a></li><li><a href="#isEmpty" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isEmpty</a></li><li><a href="#isFinished" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isFinished</a></li><li><a href="#markRequestHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> markRequestHandled</a></li><li><a href="#reclaimRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reclaimRequest</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/enum/LogLevel.html b/reference/enum/LogLevel.html index e0a3cda536..708bcec7f4 100644 --- a/reference/enum/LogLevel.html +++ b/reference/enum/LogLevel.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/enum/LogLevel">LogLevel</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Enumerations</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>LogLevel<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Enumeration Members</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#DEBUG" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>DEBUG</a></li><li><a href="#ERROR" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>ERROR</a></li><li><a href="#INFO" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>INFO</a></li><li><a href="#OFF" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>OFF</a></li><li><a href="#PERF" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>PERF</a></li><li><a href="#SOFT_FAIL" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>SOFT_FAIL</a></li><li><a href="#WARNING" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>WARNING</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Enumeration Members<!-- --> <a class="tsd-anchor" href="#Enumeration Members"><span class="tsd-anchor-id" id="Enumeration Members"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#DEBUG"><span class="tsd-anchor-id" id="DEBUG"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L7" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>DEBUG</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>DEBUG<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">5</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#ERROR"><span class="tsd-anchor-id" id="ERROR"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L3" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>ERROR</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>ERROR<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">1</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#INFO"><span class="tsd-anchor-id" id="INFO"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L6" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>INFO</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>INFO<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">4</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#OFF"><span class="tsd-anchor-id" id="OFF"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L2" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>OFF</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>OFF<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">0</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#PERF"><span class="tsd-anchor-id" id="PERF"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>PERF</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>PERF<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">6</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#SOFT_FAIL"><span class="tsd-anchor-id" id="SOFT_FAIL"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L4" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>SOFT_FAIL</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>SOFT_FAIL<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">2</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#WARNING"><span class="tsd-anchor-id" id="WARNING"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L5" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>WARNING</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>WARNING<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">3</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/class/RequestQueue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/AbortOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AbortOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#DEBUG" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> DEBUG</a></li><li><a href="#ERROR" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> ERROR</a></li><li><a href="#INFO" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> INFO</a></li><li><a href="#OFF" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> OFF</a></li><li><a href="#PERF" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> PERF</a></li><li><a href="#SOFT_FAIL" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> SOFT_FAIL</a></li><li><a href="#WARNING" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> WARNING</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/AbortOptions.html b/reference/interface/AbortOptions.html index a615c21631..d4cb478e16 100644 --- a/reference/interface/AbortOptions.html +++ b/reference/interface/AbortOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>AbortOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">RunAbortOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">AbortOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#gracefully" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#gracefully"><span class="tsd-anchor-id" id="gracefully"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/run.d.ts#L76" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>gracefully</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RunAbortOptions.gracefully</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1600" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1597" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/enum/LogLevel"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LogLevel</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ActorRun"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#gracefully" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> gracefully</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ActorRun.html b/reference/interface/ActorRun.html index 9b547b15a6..b7b3f22a31 100644 --- a/reference/interface/ActorRun.html +++ b/reference/interface/ActorRun.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ActorRun<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ActorRunListItem</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ActorRun</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#buildId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildId</a></li><li><a href="#buildNumber" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildNumber</a></li><li><a href="#containerUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultRequestQueueId</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#finishedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>finishedAt</a></li><li><a href="#gitBranchName" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gitBranchName</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#isContainerServerReady" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isContainerServerReady</a></li><li><a href="#meta" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>meta</a></li><li><a href="#options" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>options</a></li><li><a href="#startedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt</a></li><li><a href="#stats" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats</a></li><li><a href="#status" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>status</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#usage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usage</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actId"><span class="tsd-anchor-id" id="actId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L172" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.actId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L173" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.actorTaskId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#buildId"><span class="tsd-anchor-id" id="buildId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L178" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>buildId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.buildId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#buildNumber"><span class="tsd-anchor-id" id="buildNumber"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L179" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>buildNumber</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildNumber<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.buildNumber</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerUrl"><span class="tsd-anchor-id" id="containerUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L190" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>containerUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultDatasetId"><span class="tsd-anchor-id" id="defaultDatasetId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L181" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultDatasetId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.defaultDatasetId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultKeyValueStoreId"><span class="tsd-anchor-id" id="defaultKeyValueStoreId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L180" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultKeyValueStoreId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.defaultKeyValueStoreId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultRequestQueueId"><span class="tsd-anchor-id" id="defaultRequestQueueId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L182" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultRequestQueueId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultRequestQueueId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.defaultRequestQueueId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L189" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#finishedAt"><span class="tsd-anchor-id" id="finishedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L175" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>finishedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>finishedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.finishedAt</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#gitBranchName"><span class="tsd-anchor-id" id="gitBranchName"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L192" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>gitBranchName</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gitBranchName<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L171" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.id</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isContainerServerReady"><span class="tsd-anchor-id" id="isContainerServerReady"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L191" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>isContainerServerReady</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isContainerServerReady<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#meta"><span class="tsd-anchor-id" id="meta"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L177" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>meta</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>meta<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunMeta</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.meta</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#options"><span class="tsd-anchor-id" id="options"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L188" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>options</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>options<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunOptions</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L174" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.startedAt</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#stats"><span class="tsd-anchor-id" id="stats"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L187" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>stats</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunStats</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#status"><span class="tsd-anchor-id" id="status"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L176" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>status</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>status<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">READY</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RUNNING</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">SUCCEEDED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">FAILED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ABORTING</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ABORTED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TIMING-OUT</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TIMED-OUT</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.status</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L186" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#usage"><span class="tsd-anchor-id" id="usage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L193" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>usage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">ActorRunUsage</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L185" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/AbortOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AbortOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ApifyClientOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyClientOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#buildId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> buildId</a></li><li><a href="#buildNumber" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> buildNumber</a></li><li><a href="#containerUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerUrl</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultRequestQueueId</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#finishedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> finishedAt</a></li><li><a href="#gitBranchName" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> gitBranchName</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#isContainerServerReady" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isContainerServerReady</a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> meta</a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> options</a></li><li><a href="#startedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> startedAt</a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> stats</a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> status</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#usage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> usage</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ApifyClientOptions.html b/reference/interface/ApifyClientOptions.html index 64a2084d1c..39b6ee64a3 100644 --- a/reference/interface/ApifyClientOptions.html +++ b/reference/interface/ApifyClientOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ApifyClientOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#baseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl</a></li><li><a href="#maxRetries" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxRetries</a></li><li><a href="#minDelayBetweenRetriesMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>minDelayBetweenRetriesMillis</a></li><li><a href="#requestInterceptors" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestInterceptors</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#baseUrl"><span class="tsd-anchor-id" id="baseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L122" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>baseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">https://api.apify.com</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxRetries"><span class="tsd-anchor-id" id="maxRetries"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L124" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxRetries</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxRetries<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">8</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#minDelayBetweenRetriesMillis"><span class="tsd-anchor-id" id="minDelayBetweenRetriesMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L126" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>minDelayBetweenRetriesMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>minDelayBetweenRetriesMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">500</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestInterceptors"><span class="tsd-anchor-id" id="requestInterceptors"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L128" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>requestInterceptors</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestInterceptors<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ApifyRequestConfig</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ApifyRequestConfig</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L130" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">360</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L131" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ActorRun"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ApifyEnv"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#baseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> baseUrl</a></li><li><a href="#maxRetries" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxRetries</a></li><li><a href="#minDelayBetweenRetriesMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> minDelayBetweenRetriesMillis</a></li><li><a href="#requestInterceptors" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestInterceptors</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ApifyEnv.html b/reference/interface/ApifyEnv.html index 1f06962687..a0834587cc 100644 --- a/reference/interface/ApifyEnv.html +++ b/reference/interface/ApifyEnv.html @@ -11,7 +11,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -23,7 +23,7 @@ in megabytes (ACTOR_MEMORY_MBYTES)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1551" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor was started (ACTOR_STARTED_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutAt"><span class="tsd-anchor-id" id="timeoutAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1556" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>timeoutAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor will time out (ACTOR_TIMEOUT_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1546" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Authentication token representing privileges given to the actor run, it can be passed to various Apify APIs (APIFY_TOKEN)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1540" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ApifyClientOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyClientOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/CallOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CallOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actorId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorId</a></li><li><a href="#actorRunId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorRunId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#memoryMbytes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memoryMbytes</a></li><li><a href="#startedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> startedAt</a></li><li><a href="#timeoutAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutAt</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/CallOptions.html b/reference/interface/CallOptions.html index b549d1b58b..390d139006 100644 --- a/reference/interface/CallOptions.html +++ b/reference/interface/CallOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,7 +25,7 @@ If not provided, the run uses timeout of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1583" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#waitSecs"><span class="tsd-anchor-id" id="waitSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L168" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>waitSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>waitSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.waitSecs</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed, see <a href="https://docs.apify.com/webhooks/ad-hoc-webhooks" target="_blank" rel="noopener noreferrer">ad hook webhooks documentation</a> for detailed description.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ApifyEnv"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/CallTaskOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CallTaskOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li><li><a href="#maxItems" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxItems</a></li><li><a href="#memory" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memory</a></li><li><a href="#timeout" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeout</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#waitSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> waitSecs</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/CallTaskOptions.html b/reference/interface/CallTaskOptions.html index 8c9e71a1ce..dad8891e7d 100644 --- a/reference/interface/CallTaskOptions.html +++ b/reference/interface/CallTaskOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,7 +22,7 @@ If not provided, the run uses timeout of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1590" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#waitSecs"><span class="tsd-anchor-id" id="waitSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/task.d.ts#L86" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>waitSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>waitSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.waitSecs</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed, see <a href="https://docs.apify.com/webhooks/ad-hoc-webhooks" target="_blank" rel="noopener noreferrer">ad hook webhooks documentation</a> for detailed description.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/CallOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CallOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ConfigurationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#maxItems" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxItems</a></li><li><a href="#memory" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memory</a></li><li><a href="#timeout" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeout</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#waitSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> waitSecs</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ConfigurationOptions.html b/reference/interface/ConfigurationOptions.html index 964e16ea2a..265afa4d56 100644 --- a/reference/interface/ConfigurationOptions.html +++ b/reference/interface/ConfigurationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -50,7 +50,7 @@ e.g. MemoryStorageOptions could be used to adjust the MemoryStorage behavior.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#systemInfoIntervalMillis"><span class="tsd-anchor-id" id="systemInfoIntervalMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L84" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>systemInfoIntervalMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>systemInfoIntervalMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">60_000</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.systemInfoIntervalMillis</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the interval of emitting the <code>systemInfo</code> event.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L13" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/configuration.ts#L25" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#xvfb"><span class="tsd-anchor-id" id="xvfb"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L106" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>xvfb</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>xvfb<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.xvfb</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether to run X virtual framebuffer on the web browsers launched by Crawlee.</p> <p>Alternative to <code>CRAWLEE_XVFB</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/CallTaskOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CallTaskOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actorEventsWsUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorEventsWsUrl</a></li><li><a href="#actorId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorId</a></li><li><a href="#actorRunId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorRunId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#apiBaseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apiBaseUrl</a></li><li><a href="#availableMemoryRatio" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> availableMemoryRatio</a></li><li><a href="#chromeExecutablePath" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> chromeExecutablePath</a></li><li><a href="#containerPort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerPort</a></li><li><a href="#containerUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerUrl</a></li><li><a href="#defaultBrowserPath" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultBrowserPath</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultRequestQueueId</a></li><li><a href="#disableBrowserSandbox" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> disableBrowserSandbox</a></li><li><a href="#eventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventManager</a></li><li><a href="#headless" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> headless</a></li><li><a href="#inputKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputKey</a></li><li><a href="#inputSecretsPrivateKeyFile" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputSecretsPrivateKeyFile</a></li><li><a href="#inputSecretsPrivateKeyPassphrase" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputSecretsPrivateKeyPassphrase</a></li><li><a href="#isAtHome" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isAtHome</a></li><li><a href="#logLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logLevel</a></li><li><a href="#maxUsedCpuRatio" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxUsedCpuRatio</a></li><li><a href="#memoryMbytes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memoryMbytes</a></li><li><a href="#metamorphAfterSleepMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> metamorphAfterSleepMillis</a></li><li><a href="#persistStateIntervalMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> persistStateIntervalMillis</a></li><li><a href="#persistStorage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> persistStorage</a></li><li><a href="#proxyHostname" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyHostname</a></li><li><a href="#proxyPassword" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyPassword</a></li><li><a href="#proxyPort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyPort</a></li><li><a href="#proxyStatusUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyStatusUrl</a></li><li><a href="#purgeOnStart" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> purgeOnStart</a></li><li><a href="#storageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageClient</a></li><li><a href="#storageClientOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageClientOptions</a></li><li><a href="#systemInfoIntervalMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> systemInfoIntervalMillis</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li><li><a href="#xvfb" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> xvfb</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetConsumer.html b/reference/interface/DatasetConsumer.html index ce62059cbe..f2d958dc9e 100644 --- a/reference/interface/DatasetConsumer.html +++ b/reference/interface/DatasetConsumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetConsumer<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetConsumer<span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ConfigurationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetContent"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetContent.html b/reference/interface/DatasetContent.html index f9caf723d1..5005ccb055 100644 --- a/reference/interface/DatasetContent.html +++ b/reference/interface/DatasetContent.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetContent<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#count" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>count</a></li><li><a href="#desc" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc</a></li><li><a href="#items" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>items</a></li><li><a href="#limit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit</a></li><li><a href="#offset" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset</a></li><li><a href="#total" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>total</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#count"><span class="tsd-anchor-id" id="count"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L376" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>count</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>count<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Count of dataset entries returned in this set.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#desc"><span class="tsd-anchor-id" id="desc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L384" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>desc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Should the results be in descending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#items"><span class="tsd-anchor-id" id="items"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L382" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>items</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>items<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Dataset entries based on chosen format parameter.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#limit"><span class="tsd-anchor-id" id="limit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L380" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>limit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Maximum number of dataset entries requested.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#offset"><span class="tsd-anchor-id" id="offset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L378" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>offset</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of the first returned entry in the dataset.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#total"><span class="tsd-anchor-id" id="total"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L374" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>total</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>total<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Total count of entries in the dataset.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetConsumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetDataOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetDataOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#count" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> count</a></li><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#items" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> items</a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> limit</a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> offset</a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> total</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetDataOptions.html b/reference/interface/DatasetDataOptions.html index 03f77da651..446637993a 100644 --- a/reference/interface/DatasetDataOptions.html +++ b/reference/interface/DatasetDataOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,7 +19,7 @@ Otherwise they are sorted in ascending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fields"><span class="tsd-anchor-id" id="fields"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>fields</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of field names that will be included in the result. If omitted, all fields are included in the results.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#limit"><span class="tsd-anchor-id" id="limit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>limit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">250000</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Maximum number of array elements to return.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#offset"><span class="tsd-anchor-id" id="offset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L29" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>offset</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">0</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Number of array elements that should be skipped at the start.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#skipEmpty"><span class="tsd-anchor-id" id="skipEmpty"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L66" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>skipEmpty</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>skipEmpty<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the function doesn’t return empty items. Note that in this case the returned number of items might be lower than limit parameter and pagination must be done using the <code>limit</code> value.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#skipHidden"><span class="tsd-anchor-id" id="skipHidden"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>skipHidden</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>skipHidden<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the function doesn’t return hidden fields (fields starting with “#” character).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#unwind"><span class="tsd-anchor-id" id="unwind"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>unwind</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default, the results are returned as they are.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetContent"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetIteratorOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetIteratorOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#clean" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> clean</a></li><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#fields" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> fields</a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> limit</a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> offset</a></li><li><a href="#skipEmpty" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> skipEmpty</a></li><li><a href="#skipHidden" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> skipHidden</a></li><li><a href="#unwind" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> unwind</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetIteratorOptions.html b/reference/interface/DatasetIteratorOptions.html index 2349f49d44..12148859bc 100644 --- a/reference/interface/DatasetIteratorOptions.html +++ b/reference/interface/DatasetIteratorOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetIteratorOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">offset</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">limit</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">clean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">skipHidden</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">skipEmpty</span><span class="tsd-signature-symbol">></span><ul class="tsd-hierarchy"><li><em class="tsd-target">DatasetIteratorOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#desc" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc</a></li><li><a href="#fields" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields</a></li><li><a href="#unwind" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#desc"><span class="tsd-anchor-id" id="desc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L40" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>desc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.desc</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the objects are sorted by <code>createdAt</code> in descending order. Otherwise they are sorted in ascending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fields"><span class="tsd-anchor-id" id="fields"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>fields</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.fields</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of field names that will be included in the result. If omitted, all fields are included in the results.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#unwind"><span class="tsd-anchor-id" id="unwind"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>unwind</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.unwind</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default, the results are returned as they are.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetDataOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetDataOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetMapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#fields" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> fields</a></li><li><a href="#unwind" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> unwind</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetMapper.html b/reference/interface/DatasetMapper.html index cdf2225412..d7291f8d21 100644 --- a/reference/interface/DatasetMapper.html +++ b/reference/interface/DatasetMapper.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetMapper<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">, </span>R<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetMapper<span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">R</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User-function used in the <code>Dataset.map()</code> API.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">R</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetIteratorOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetIteratorOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetOptions.html b/reference/interface/DatasetOptions.html index 8a75adc3b6..bd1ec3a4f7 100644 --- a/reference/interface/DatasetOptions.html +++ b/reference/interface/DatasetOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L370" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L368" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L369" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetMapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/DatasetReducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/DatasetReducer.html b/reference/interface/DatasetReducer.html index f11a48b669..4b3d7a3cdb 100644 --- a/reference/interface/DatasetReducer.html +++ b/reference/interface/DatasetReducer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetReducer<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetReducer<span class="tsd-signature-symbol">(</span><span>memo<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>memo: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Previous state of the reduction.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ExitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ExitOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ExitOptions.html b/reference/interface/ExitOptions.html index ab4d381b2d..598e2fdd30 100644 --- a/reference/interface/ExitOptions.html +++ b/reference/interface/ExitOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ExitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">ExitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1664" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1662" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1655" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1660" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/DatasetReducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/InitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">InitOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/InitOptions.html b/reference/interface/InitOptions.html index 22e247574a..7854d9aeec 100644 --- a/reference/interface/InitOptions.html +++ b/reference/interface/InitOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>InitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">InitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1511" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ExitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ExitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/KeyConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/KeyConsumer.html b/reference/interface/KeyConsumer.html index a89998fbb3..e33b55a7c1 100644 --- a/reference/interface/KeyConsumer.html +++ b/reference/interface/KeyConsumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyConsumer<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>KeyConsumer<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span>info<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span><span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol"> }</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/class/KeyValueStore">KeyValueStore</a> key being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of the current key in <a href="/sdk/js/reference/class/KeyValueStore">KeyValueStore</a>.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>info: <span class="tsd-signature-symbol">{ </span><span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol"> }</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Information about the current <a href="/sdk/js/reference/class/KeyValueStore">KeyValueStore</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/InitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">InitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStoreIteratorOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/KeyValueStoreIteratorOptions.html b/reference/interface/KeyValueStoreIteratorOptions.html index f63cae39df..be9f56631b 100644 --- a/reference/interface/KeyValueStoreIteratorOptions.html +++ b/reference/interface/KeyValueStoreIteratorOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyValueStoreIteratorOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exclusiveStartKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exclusiveStartKey</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exclusiveStartKey"><span class="tsd-anchor-id" id="exclusiveStartKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L378" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>exclusiveStartKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exclusiveStartKey<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>All keys up to this one (including) are skipped from the result.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/KeyConsumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/KeyValueStoreOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStoreOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exclusiveStartKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exclusiveStartKey</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/KeyValueStoreOptions.html b/reference/interface/KeyValueStoreOptions.html index b7433fe990..5964cd2ec3 100644 --- a/reference/interface/KeyValueStoreOptions.html +++ b/reference/interface/KeyValueStoreOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyValueStoreOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L366" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L364" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L365" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStoreIteratorOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/LoggerOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/LoggerOptions.html b/reference/interface/LoggerOptions.html index 5e87ad1607..b30c934c51 100644 --- a/reference/interface/LoggerOptions.html +++ b/reference/interface/LoggerOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>LoggerOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#data" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>data</a></li><li><a href="#level" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>level</a></li><li><a href="#logger" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger</a></li><li><a href="#maxDepth" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxDepth</a></li><li><a href="#maxStringLength" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxStringLength</a></li><li><a href="#prefix" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>prefix</a></li><li><a href="#suffix" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>suffix</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#data"><span class="tsd-anchor-id" id="data"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L23" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>data</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>data<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Additional data to be added to each log line.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#level"><span class="tsd-anchor-id" id="level"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>level</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>level<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with the <code>log.LEVELS</code> constants.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logger"><span class="tsd-anchor-id" id="logger"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L21" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>logger</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/class/Logger">Logger</a></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use <code>log.LoggerJson</code> that formats each log line as a JSON.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxDepth"><span class="tsd-anchor-id" id="maxDepth"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L10" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxDepth</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxDepth<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Max depth of data object that will be logged. Anything deeper than the limit will be stripped off.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxStringLength"><span class="tsd-anchor-id" id="maxStringLength"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxStringLength</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxStringLength<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Max length of the string to be logged. Longer strings will be truncated.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#prefix"><span class="tsd-anchor-id" id="prefix"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L14" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>prefix</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>prefix<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Prefix to be prepended the each logged line.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#suffix"><span class="tsd-anchor-id" id="suffix"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L16" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>suffix</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>suffix<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Suffix that will be appended the each logged line.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/KeyValueStoreOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStoreOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/MainOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MainOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#data" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> data</a></li><li><a href="#level" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> level</a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logger</a></li><li><a href="#maxDepth" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxDepth</a></li><li><a href="#maxStringLength" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxStringLength</a></li><li><a href="#prefix" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> prefix</a></li><li><a href="#suffix" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> suffix</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/MainOptions.html b/reference/interface/MainOptions.html index ea084cb6fe..29befc49e3 100644 --- a/reference/interface/MainOptions.html +++ b/reference/interface/MainOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>MainOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/interface/InitOptions">InitOptions</a><ul class="tsd-hierarchy"><li><em class="tsd-target">MainOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1664" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exit</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1662" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exitCode</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1655" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.statusMessage</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1511" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">InitOptions.storage</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1660" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.timeoutSecs</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/LoggerOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MetamorphOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/MetamorphOptions.html b/reference/interface/MetamorphOptions.html index a55e86e7de..174294b88c 100644 --- a/reference/interface/MetamorphOptions.html +++ b/reference/interface/MetamorphOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,7 +19,7 @@ <code>input</code> is expected to be an object that will be stringified to JSON and content type set to <code>application/json; charset=utf-8</code>. If <code>options.contentType</code> is specified, then <code>input</code> must be a <code>String</code> or <code>Buffer</code>.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/MainOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MainOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/OpenStorageOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">OpenStorageOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/OpenStorageOptions.html b/reference/interface/OpenStorageOptions.html index 4e71ad8d70..0ea2074114 100644 --- a/reference/interface/OpenStorageOptions.html +++ b/reference/interface/OpenStorageOptions.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>OpenStorageOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forceCloud" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forceCloud"><span class="tsd-anchor-id" id="forceCloud"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1673" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>forceCloud</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code> then the cloud storage is used even if the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable is set. This way it is possible to combine local and cloud storage.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MetamorphOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ProxyConfigurationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#forceCloud" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> forceCloud</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ProxyConfigurationOptions.html b/reference/interface/ProxyConfigurationOptions.html index ae48ce96c1..75deb9aeb3 100644 --- a/reference/interface/ProxyConfigurationOptions.html +++ b/reference/interface/ProxyConfigurationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -31,7 +31,7 @@ environment variable, which is automatically set by the system when running the actors.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyUrls"><span class="tsd-anchor-id" id="proxyUrls"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L10" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>proxyUrls</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyUrls<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyConfigurationOptions.proxyUrls</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will cause an error to be thrown on initialize.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/OpenStorageOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">OpenStorageOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/ProxyInfo"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apifyProxyCountry" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apifyProxyCountry</a></li><li><a href="#apifyProxyGroups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apifyProxyGroups</a></li><li><a href="#countryCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> countryCode</a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> groups</a></li><li><a href="#newUrlFunction" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> newUrlFunction</a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> password</a></li><li><a href="#proxyUrls" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyUrls</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/ProxyInfo.html b/reference/interface/ProxyInfo.html index 2ab773d9e1..4d2092f55b 100644 --- a/reference/interface/ProxyInfo.html +++ b/reference/interface/ProxyInfo.html @@ -67,7 +67,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -89,7 +89,7 @@ If not provided, the proxy will select the groups automatically.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#hostname"><span class="tsd-anchor-id" id="hostname"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L68" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>hostname</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>hostname<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.hostname</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Hostname of your proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#password"><span class="tsd-anchor-id" id="password"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/proxy_configuration.ts#L115" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>password</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyInfo.password</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User’s password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> environment variable, which is automatically set by the system when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener noreferrer">Apify CLI</a>.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#port"><span class="tsd-anchor-id" id="port"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L72" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>port</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>port<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.port</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Proxy port.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#sessionId"><span class="tsd-anchor-id" id="sessionId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L52" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>sessionId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.sessionId</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The identifier of used Session, if used.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#url"><span class="tsd-anchor-id" id="url"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>url</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>url<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.url</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The URL of the proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#username"><span class="tsd-anchor-id" id="username"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>username</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>username<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.username</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Username for the proxy.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ProxyConfigurationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/QueueOperationInfo"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#countryCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> countryCode</a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> groups</a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> hostname</a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> password</a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> port</a></li><li><a href="#sessionId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> sessionId</a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> url</a></li><li><a href="#username" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> username</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/QueueOperationInfo.html b/reference/interface/QueueOperationInfo.html index 7feea64ce1..f0d24216a3 100644 --- a/reference/interface/QueueOperationInfo.html +++ b/reference/interface/QueueOperationInfo.html @@ -11,14 +11,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>QueueOperationInfo<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>A helper class that is used to report results from various <a href="/sdk/js/reference/class/RequestQueue">RequestQueue</a> functions as well as enqueueLinks.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#requestId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId</a></li><li><a href="#wasAlreadyHandled" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled</a></li><li><a href="#wasAlreadyPresent" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyPresent</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestId"><span class="tsd-anchor-id" id="requestId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/types/storages.d.ts#L14" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The ID of the added request</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyHandled"><span class="tsd-anchor-id" id="wasAlreadyHandled"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/types/storages.d.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyHandled</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Indicates if request was already marked as handled.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyPresent"><span class="tsd-anchor-id" id="wasAlreadyPresent"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/types/storages.d.ts#L10" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyPresent</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyPresent<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Indicates if request was already present in the queue.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/ProxyInfo"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/RecordOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RecordOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestId</a></li><li><a href="#wasAlreadyHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyHandled</a></li><li><a href="#wasAlreadyPresent" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyPresent</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/RecordOptions.html b/reference/interface/RecordOptions.html index 4102da8661..6816756bf1 100644 --- a/reference/interface/RecordOptions.html +++ b/reference/interface/RecordOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RecordOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#contentType" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#contentType"><span class="tsd-anchor-id" id="contentType"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L372" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>contentType</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a custom MIME content type of the record.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/QueueOperationInfo"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/RequestQueueOperationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueueOperationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/RequestQueueOperationOptions.html b/reference/interface/RequestQueueOperationOptions.html index 2736f9c9a3..80a59f6b31 100644 --- a/reference/interface/RequestQueueOperationOptions.html +++ b/reference/interface/RequestQueueOperationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RequestQueueOperationOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forefront" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forefront</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forefront"><span class="tsd-anchor-id" id="forefront"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L63" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>forefront</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forefront<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code>:</p><ul><li>while adding the request to the queue: the request will be added to the foremost position in the queue.</li><li>while reclaiming the request: the request will be placed to the beginning of the queue, so that it’s returned in the next call to <a href="/sdk/js/reference/class/RequestQueue#fetchNextRequest">RequestQueue.fetchNextRequest</a>. By default, it’s put to the end of the queue.</li></ul></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/RecordOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RecordOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueueOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#forefront" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> forefront</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/RequestQueueOptions.html b/reference/interface/RequestQueueOptions.html index 9912157c6a..2bae476bde 100644 --- a/reference/interface/RequestQueueOptions.html +++ b/reference/interface/RequestQueueOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: 3.1</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RequestQueueOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li><li><a href="#proxyConfiguration" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyConfiguration</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L337" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L335" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L336" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyConfiguration"><span class="tsd-anchor-id" id="proxyConfiguration"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L343" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>proxyConfiguration</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyConfiguration<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">ProxyConfiguration</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Used to pass the proxy configuration for the <code>requestsFromUrl</code> objects. Takes advantage of the internal address rotation and authentication process. If undefined, the <code>requestsFromUrl</code> requests will be made without proxy.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/RequestQueueOperationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOperationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/interface/WebhookOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">WebhookOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#proxyConfiguration" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyConfiguration</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/interface/WebhookOptions.html b/reference/interface/WebhookOptions.html index 442d5f23fa..53a7fb6fdb 100644 --- a/reference/interface/WebhookOptions.html +++ b/reference/interface/WebhookOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,7 +24,7 @@ is available in the <a href="https://docs.apify.com/webhooks" target="_blank" rel="noopener noreferrer">Apify webhook documentation</a>. If <code>payloadTemplate</code> is omitted, the default payload template is used (<a href="https://docs.apify.com/webhooks/actions#payload-template" target="_blank" rel="noopener noreferrer">view docs</a>).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestUrl"><span class="tsd-anchor-id" id="requestUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/1e586e64f6/packages/apify/src/actor.ts#L1613" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>requestUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>URL which will be requested using HTTP POST request, when actor run will reach the set event type.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference#UserFunc"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">UserFunc</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#eventTypes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventTypes</a></li><li><a href="#idempotencyKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> idempotencyKey</a></li><li><a href="#payloadTemplate" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> payloadTemplate</a></li><li><a href="#requestUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next.html b/reference/next.html index 952ee4e240..e8f002929e 100644 --- a/reference/next.html +++ b/reference/next.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -25,8 +25,8 @@ For contribution guidelines and the code of conduct, see <a href="https://github.com/apify/apify-sdk-js/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer">CONTRIBUTING.md</a>.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="license">License<a href="#license" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>This project is licensed under the Apache License 2.0 - see the <a href="https://github.com/apify/apify-sdk-js/blob/master/LICENSE.md" target="_blank" rel="noopener noreferrer">LICENSE.md</a> file for details.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="acknowledgments">Acknowledgments<a href="#acknowledgments" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><p>Many thanks to <a href="https://www.npmjs.com/~jbalsas" target="_blank" rel="noopener noreferrer">Chema Balsas</a> for giving up the <code>apify</code> package name -on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener noreferrer">jsdocify</a>.</p></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Classes</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Actor"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Actor</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/ApifyClient"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ApifyClient</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Configuration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Configuration</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/KeyValueStore"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>KeyValueStore</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Log"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Log</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Logger"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Logger</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/LoggerJson"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>LoggerJson</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/LoggerText"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>LoggerText</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/PlatformEventManager"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>PlatformEventManager</a></li></ul></div><h3 class="tsd-panel-header">Result Stores</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Dataset"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Dataset</a></li></ul></div><h3 class="tsd-panel-header">Scaling</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/ProxyConfiguration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ProxyConfiguration</a></li></ul></div><h3 class="tsd-panel-header">Sources</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/RequestQueue"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>RequestQueue</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Enumerations</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/enum/LogLevel"><i class="codicon codicon-symbol-enum" style="color:var(--ifm-color-danger)"></i>LogLevel</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Interfaces</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/AbortOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>AbortOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ActorRun"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ActorRun</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ApifyClientOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyClientOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ApifyEnv"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyEnv</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/CallOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/CallTaskOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallTaskOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetContent"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetContent</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetDataOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetDataOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetMapper"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetMapper</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetReducer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetReducer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ExitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ExitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/InitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>InitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/KeyConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/KeyValueStoreOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/LoggerOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>LoggerOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/MainOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MainOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/MetamorphOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MetamorphOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/OpenStorageOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>OpenStorageOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ProxyInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/QueueOperationInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>QueueOperationInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RebootOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RebootOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RecordOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RecordOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOperationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RequestQueueOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/WebhookOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>WebhookOptions</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Type Aliases</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next#UserFunc"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Variables</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next#log"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success)"></i>log</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Type Aliases<!-- --> <a class="tsd-anchor" href="#Type Aliases"><span class="tsd-anchor-id" id="Type Aliases"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#UserFunc"><span class="tsd-anchor-id" id="UserFunc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1609" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>UserFunc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><div class="tds-type-parameters"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">unknown</span></span></li></ul></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Variables<!-- --> <a class="tsd-anchor" href="#Variables"><span class="tsd-anchor-id" id="Variables"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#log"><span class="tsd-anchor-id" id="log"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/index.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-const">const</span>log</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success)"></i>log<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Log">Log</a></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#UserFunc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger);"></i> UserFunc</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success);"></i> log</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +on NPM and renaming his project to <a href="https://www.npmjs.com/package/jsdocify" target="_blank" rel="noopener noreferrer">jsdocify</a>.</p></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Classes</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Actor"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Actor</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/ApifyClient"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ApifyClient</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Configuration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Configuration</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/KeyValueStore"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>KeyValueStore</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Log"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Log</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Logger"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Logger</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/LoggerJson"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>LoggerJson</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/LoggerText"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>LoggerText</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/PlatformEventManager"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>PlatformEventManager</a></li></ul></div><h3 class="tsd-panel-header">Result Stores</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/Dataset"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>Dataset</a></li></ul></div><h3 class="tsd-panel-header">Scaling</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/ProxyConfiguration"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>ProxyConfiguration</a></li></ul></div><h3 class="tsd-panel-header">Sources</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/class/RequestQueue"><i class="codicon codicon-symbol-class" style="color:var(--ifm-color-warning)"></i>RequestQueue</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Enumerations</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/enum/LogLevel"><i class="codicon codicon-symbol-enum" style="color:var(--ifm-color-danger)"></i>LogLevel</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Interfaces</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/AbortOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>AbortOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ActorRun"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ActorRun</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ApifyClientOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyClientOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ApifyEnv"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ApifyEnv</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/CallOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/CallTaskOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>CallTaskOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetContent"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetContent</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetDataOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetDataOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetMapper"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetMapper</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/DatasetReducer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>DatasetReducer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ExitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ExitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/InitOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>InitOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/KeyConsumer"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyConsumer</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreIteratorOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/KeyValueStoreOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>KeyValueStoreOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/LoggerOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>LoggerOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/MainOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MainOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/MetamorphOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>MetamorphOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/OpenStorageOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>OpenStorageOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyConfigurationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/ProxyInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>ProxyInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/QueueOperationInfo"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>QueueOperationInfo</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RebootOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RebootOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RecordOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RecordOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOperationOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/RequestQueueOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>RequestQueueOptions</a></li><li><a class="tsd-kind-icon" href="/sdk/js/reference/next/interface/WebhookOptions"><i class="codicon codicon-symbol-interface" style="color:var(--ifm-color-danger)"></i>WebhookOptions</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Type Aliases</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next#UserFunc"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Variables</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a class="tsd-kind-icon" href="/sdk/js/reference/next#log"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success)"></i>log</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Type Aliases<!-- --> <a class="tsd-anchor" href="#Type Aliases"><span class="tsd-anchor-id" id="Type Aliases"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#UserFunc"><span class="tsd-anchor-id" id="UserFunc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1609" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>UserFunc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger)"></i>UserFunc<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><div class="tds-type-parameters"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">unknown</span></span></li></ul></div><div class="tsd-type-declaration"><h4>Type declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></li></ul></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Variables<!-- --> <a class="tsd-anchor" href="#Variables"><span class="tsd-anchor-id" id="Variables"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#log"><span class="tsd-anchor-id" id="log"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/index.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-const">const</span>log</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success)"></i>log<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Log">Log</a></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#UserFunc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-parameter" style="color:var(--ifm-color-danger);"></i> UserFunc</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-variable" style="color:var(--ifm-color-success);"></i> log</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/changelog.html b/reference/next/changelog.html index d199d35742..eb46542b13 100644 --- a/reference/next/changelog.html +++ b/reference/next/changelog.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -33,7 +33,7 @@ early as possible.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="mitigation-of-zero-concurrency-issue">Mitigation of zero concurrency issue<a href="#mitigation-of-zero-concurrency-issue" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><p>Several new timeouts were added to the task function, which should help mitigate the zero concurrency bug. Namely fetching of next request information and reclaiming failed requests back to the queue are now executed with a timeout with 3 additional retries before the task fails. The timeout is always at least 300s (5 minutes), or <code>requestHandlerTimeoutSecs</code> if that value is higher.</p><h3 class="anchor anchorWithStickyNavbar_LWe7" id="full-list-of-changes">Full list of changes<a href="#full-list-of-changes" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h3><ul><li>fix <code>RequestError: URI malformed</code> in cheerio crawler (#1205)</li><li>only provide Cookie header if cookies are present (#1218)</li><li>handle extra cases for <code>diffCookie</code> (#1217)</li><li>add timeout for task function (#1234)</li><li>implement proxy per page in browser crawlers (#1228)</li><li>add fingerprinting support (#1243)</li><li>implement abortable timeouts (#1245)</li><li>add timeouts with retries to <code>runTaskFunction()</code> (#1250)</li><li>automatically convert google spreadsheet URLs to CSV exports (#1255)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="210-2021-10-07"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.7...v2.1.0" target="_blank" rel="noopener noreferrer">2.1.0</a> (2021-10-07)<a href="#210-2021-10-07" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>automatically convert google docs share urls to csv download ones in request list (#1174)</li><li>use puppeteer emulating scrolls instead of <code>window.scrollBy</code> (#1170)</li><li>warn if apify proxy is used in proxyUrls (#1173)</li><li>fix <code>YOUTUBE_REGEX_STRING</code> being too greedy (#1171)</li><li>add <code>purgeLocalStorage</code> utility method (#1187)</li><li>catch errors inside request interceptors (#1188, #1190)</li><li>add support for cgroups v2 (#1177)</li><li>fix incorrect offset in <code>fixUrl</code> function (#1184)</li><li>support channel and user links in YouTube regex (#1178)</li><li>fix: allow passing <code>requestsFromUrl</code> to <code>RequestListOptions</code> in TS (#1191)</li><li>allow passing <code>forceCloud</code> down to the KV store (#1186), closes #752</li><li>merge cookies from session with user provided ones (#1201), closes #1197</li><li>use <code>ApifyClient</code> v2 (full rewrite to TS)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="207-2021-09-08"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.6...v2.0.7" target="_blank" rel="noopener noreferrer">2.0.7</a> (2021-09-08)<a href="#207-2021-09-08" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix casting of int/bool environment variables (e.g. <code>APIFY_LOCAL_STORAGE_ENABLE_WAL_MODE</code>), closes #956</li><li>Fix incognito pages and user data dir (#1145)</li><li>Add <code>@ts-ignore</code> comments to imports of optional peer dependencies (#1152)</li><li>Use config instance in <code>sdk.openSessionPool()</code> (#1154)</li><li>Add a breaking callback to <code>infiniteScroll</code> (#1140)</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="206-2021-08-27"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.5...v2.0.6" target="_blank" rel="noopener noreferrer">2.0.6</a> (2021-08-27)<a href="#206-2021-08-27" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix deprecation messages logged from <code>ProxyConfiguration</code> and <code>CheerioCrawler</code>.</li><li>Update <code>got-scraping</code> to receive multiple improvements.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="205-2021-08-24"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.4...v2.0.5" target="_blank" rel="noopener noreferrer">2.0.5</a> (2021-08-24)<a href="#205-2021-08-24" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix error handling in puppeteer crawler</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="204-2021-08-23"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.3...v2.0.4" target="_blank" rel="noopener noreferrer">2.0.4</a> (2021-08-23)<a href="#204-2021-08-23" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Use <code>sessionToken</code> with <code>got-scraping</code></li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="203-2021-08-20"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.2...v2.0.3" target="_blank" rel="noopener noreferrer">2.0.3</a> (2021-08-20)<a href="#203-2021-08-20" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><strong>BREAKING IN EDGE CASES</strong> * We removed <code>forceUrlEncoding</code> in <code>requestAsBrowser</code> because we found out that recent versions of the underlying HTTP client <code>got</code> already encode URLs and <code>forceUrlEncoding</code> could lead to weird behavior. We think of this as fixing a bug, so we're not bumping the major version.</li><li>Limit <code>handleRequestTimeoutMillis</code> to max valid value to prevent Node.js fallback to <code>1</code>.</li><li>Use <code>got-scraping@^3.0.1</code></li><li>Disable SSL validation on MITM proxie</li><li>Limit <code>handleRequestTimeoutMillis</code> to max valid value</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="202-2021-08-12"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.1...v2.0.2" target="_blank" rel="noopener noreferrer">2.0.2</a> (2021-08-12)<a href="#202-2021-08-12" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Fix serialization issues in <code>CheerioCrawler</code> caused by parser conflicts in recent versions of <code>cheerio</code>.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="201-2021-08-06"><a href="https://github.com/apify/apify-sdk-js/compare/v2.0.0...v2.0.1" target="_blank" rel="noopener noreferrer">2.0.1</a> (2021-08-06)<a href="#201-2021-08-06" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li>Use <code>got-scraping</code> 2.0.1 until fully compatible.</li></ul><h2 class="anchor anchorWithStickyNavbar_LWe7" id="200-2021-08-05"><a href="https://github.com/apify/apify-sdk-js/compare/v1.3.4...v2.0.0" target="_blank" rel="noopener noreferrer">2.0.0</a> (2021-08-05)<a href="#200-2021-08-05" class="hash-link" aria-label="Direct link to heading" title="Direct link to heading">​</a></h2><ul><li><strong>BREAKING</strong>: Require Node.js >=15.10.0 because HTTP2 support on lower Node.js versions is very buggy.</li><li><strong>BREAKING</strong>: Bump <code>cheerio</code> to <code>1.0.0-rc.10</code> from <code>rc.3</code>. There were breaking changes in <code>cheerio</code> between the versions so this bump might be breaking for you as well.</li><li>Remove <code>LiveViewServer</code> which was deprecated before release of SDK v1.</li></ul></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#3112-2023-10-05" class="table-of-contents__link toc-highlight">3.1.12 (2023-10-05)</a><ul><li><a href="#bug-fixes" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#3111-2023-10-04" class="table-of-contents__link toc-highlight">3.1.11 (2023-10-04)</a><ul><li><a href="#bug-fixes-1" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#3110-2023-09-07" class="table-of-contents__link toc-highlight">3.1.10 (2023-09-07)</a><ul><li><a href="#bug-fixes-2" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#319-2023-09-06" class="table-of-contents__link toc-highlight">3.1.9 (2023-09-06)</a></li><li><a href="#318-2023-07-20" class="table-of-contents__link toc-highlight">3.1.8 (2023-07-20)</a><ul><li><a href="#bug-fixes-3" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-1" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#317-2023-06-09" class="table-of-contents__link toc-highlight">3.1.7 (2023-06-09)</a></li><li><a href="#316-2023-06-09" class="table-of-contents__link toc-highlight">3.1.6 (2023-06-09)</a><ul><li><a href="#bug-fixes-4" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#315-2023-05-31" class="table-of-contents__link toc-highlight">3.1.5 (2023-05-31)</a><ul><li><a href="#bug-fixes-5" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-2" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#314-2023-03-23" class="table-of-contents__link toc-highlight">3.1.4 (2023-03-23)</a><ul><li><a href="#bug-fixes-6" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#313-2023-03-22" class="table-of-contents__link toc-highlight">3.1.3 (2023-03-22)</a><ul><li><a href="#bug-fixes-7" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-3" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#312-2023-02-07" class="table-of-contents__link toc-highlight">3.1.2 (2023-02-07)</a><ul><li><a href="#bug-fixes-8" class="table-of-contents__link toc-highlight">Bug Fixes</a></li></ul></li><li><a href="#311-2022-11-13" class="table-of-contents__link toc-highlight">3.1.1 (2022-11-13)</a><ul><li><a href="#features-4" class="table-of-contents__link toc-highlight">Features</a></li><li><a href="#bug-fixes-9" class="table-of-contents__link toc-highlight">Bug Fixes</a></li><li><a href="#features-5" class="table-of-contents__link toc-highlight">Features</a></li></ul></li><li><a href="#300-2022-07-13" class="table-of-contents__link toc-highlight">3.0.0 (2022-07-13)</a><ul><li><a href="#crawlee-vs-apify-sdk" class="table-of-contents__link toc-highlight">Crawlee vs Apify SDK</a><ul><li><a href="#installing-crawlee" class="table-of-contents__link toc-highlight">Installing Crawlee</a></li></ul></li><li><a href="#full-typescript-support" class="table-of-contents__link toc-highlight">Full TypeScript support</a><ul><li><a href="#docker-build" class="table-of-contents__link toc-highlight">Docker build</a></li></ul></li><li><a href="#browser-fingerprints" class="table-of-contents__link toc-highlight">Browser fingerprints</a></li><li><a href="#session-cookie-method-renames" class="table-of-contents__link toc-highlight">Session cookie method renames</a></li><li><a href="#memory-storage" class="table-of-contents__link toc-highlight">Memory storage</a></li><li><a href="#purging-of-the-default-storage" class="table-of-contents__link toc-highlight">Purging of the default storage</a></li><li><a href="#renamed-crawler-options-and-interfaces" class="table-of-contents__link toc-highlight">Renamed crawler options and interfaces</a></li><li><a href="#context-aware-helpers" class="table-of-contents__link toc-highlight">Context aware helpers</a><ul><li><a href="#enqueuing-links" class="table-of-contents__link toc-highlight">Enqueuing links</a></li></ul></li><li><a href="#implicit-requestqueue-instance" class="table-of-contents__link toc-highlight">Implicit <code>RequestQueue</code> instance</a></li><li><a href="#crawleraddrequests" class="table-of-contents__link toc-highlight"><code>crawler.addRequests()</code></a></li><li><a href="#less-verbose-error-logging" class="table-of-contents__link toc-highlight">Less verbose error logging</a></li><li><a href="#removal-of-requestasbrowser" class="table-of-contents__link toc-highlight">Removal of <code>requestAsBrowser</code></a><ul><li><a href="#how-to-use-sendrequest" class="table-of-contents__link toc-highlight">How to use <code>sendRequest()</code>?</a></li><li><a href="#removed-options" class="table-of-contents__link toc-highlight">Removed options</a></li><li><a href="#renamed-options" class="table-of-contents__link toc-highlight">Renamed options</a><ul><li><a href="#payload" class="table-of-contents__link toc-highlight"><code>payload</code></a></li><li><a href="#ignoresslerrors" class="table-of-contents__link toc-highlight"><code>ignoreSslErrors</code></a></li><li><a href="#header-generator-options" class="table-of-contents__link toc-highlight"><code>header-generator</code> options</a></li><li><a href="#timeoutsecs" class="table-of-contents__link toc-highlight"><code>timeoutSecs</code></a></li><li><a href="#throwonhttperrors" class="table-of-contents__link toc-highlight"><code>throwOnHttpErrors</code></a></li><li><a href="#decodebody" class="table-of-contents__link toc-highlight"><code>decodeBody</code></a></li><li><a href="#abortfunction" class="table-of-contents__link toc-highlight"><code>abortFunction</code></a></li></ul></li></ul></li><li><a href="#removal-of-browser-pool-plugin-mixing" class="table-of-contents__link toc-highlight">Removal of browser pool plugin mixing</a></li><li><a href="#handling-requests-outside-of-browser" class="table-of-contents__link toc-highlight">Handling requests outside of browser</a></li><li><a href="#logging" class="table-of-contents__link toc-highlight">Logging</a></li><li><a href="#auto-saved-crawler-state" class="table-of-contents__link toc-highlight">Auto-saved crawler state</a></li><li><a href="#apify-sdk" class="table-of-contents__link toc-highlight">Apify SDK</a><ul><li><a href="#events" class="table-of-contents__link toc-highlight">Events</a></li></ul></li><li><a href="#smallerinternal-breaking-changes" class="table-of-contents__link toc-highlight">Smaller/internal breaking changes</a></li></ul></li><li><a href="#232-2022-05-05" class="table-of-contents__link toc-highlight">2.3.2 (2022-05-05)</a></li><li><a href="#231-2022-05-03" class="table-of-contents__link toc-highlight">2.3.1 (2022-05-03)</a></li><li><a href="#230-2022-04-07" class="table-of-contents__link toc-highlight">2.3.0 (2022-04-07)</a><ul><li><a href="#0-concurrency-mitigation" class="table-of-contents__link toc-highlight">0 concurrency mitigation</a></li></ul></li><li><a href="#222-2022-02-14" class="table-of-contents__link toc-highlight">2.2.2 (2022-02-14)</a></li><li><a href="#221-2022-01-03" class="table-of-contents__link toc-highlight">2.2.1 (2022-01-03)</a></li><li><a href="#220-2021-12-17" class="table-of-contents__link toc-highlight">2.2.0 (2021-12-17)</a><ul><li><a href="#proxy-per-page" class="table-of-contents__link toc-highlight">Proxy per page</a></li><li><a href="#abortable-timeouts" class="table-of-contents__link toc-highlight">Abortable timeouts</a></li><li><a href="#mitigation-of-zero-concurrency-issue" class="table-of-contents__link toc-highlight">Mitigation of zero concurrency issue</a></li><li><a href="#full-list-of-changes" class="table-of-contents__link toc-highlight">Full list of changes</a></li></ul></li><li><a href="#210-2021-10-07" class="table-of-contents__link toc-highlight">2.1.0 (2021-10-07)</a></li><li><a href="#207-2021-09-08" class="table-of-contents__link toc-highlight">2.0.7 (2021-09-08)</a></li><li><a href="#206-2021-08-27" class="table-of-contents__link toc-highlight">2.0.6 (2021-08-27)</a></li><li><a href="#205-2021-08-24" class="table-of-contents__link toc-highlight">2.0.5 (2021-08-24)</a></li><li><a href="#204-2021-08-23" class="table-of-contents__link toc-highlight">2.0.4 (2021-08-23)</a></li><li><a href="#203-2021-08-20" class="table-of-contents__link toc-highlight">2.0.3 (2021-08-20)</a></li><li><a href="#202-2021-08-12" class="table-of-contents__link toc-highlight">2.0.2 (2021-08-12)</a></li><li><a href="#201-2021-08-06" class="table-of-contents__link toc-highlight">2.0.1 (2021-08-06)</a></li><li><a href="#200-2021-08-05" class="table-of-contents__link toc-highlight">2.0.0 (2021-08-05)</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/Actor.html b/reference/next/class/Actor.html index 507ede92af..69cabff4f4 100644 --- a/reference/next/class/Actor.html +++ b/reference/next/class/Actor.html @@ -13,17 +13,17 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/class/Actor">Classes</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/class/Actor">Actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Dataset">Dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Log">Log</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Logger">Logger</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/LoggerJson">LoggerJson</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/LoggerText">LoggerText</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/PlatformEventManager">PlatformEventManager</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Classes</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>Actor<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p><code>Actor</code> class serves as an alternative approach to the static helpers exported from the package. It allows to pass configuration that will be used on the instance methods. Environment variables will have precedence over this configuration. -See <a href="/sdk/js/reference/next/class/Configuration">Configuration</a> for details about what can be configured and what are the default values.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#initialized" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>initialized</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Accessors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#apifyClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info)"></i>apifyClient</a></li><li><a href="#config" class="tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info)"></i>config</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#getInputOrThrow" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow</a></li><li><a href="#useState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState</a></li><li><a href="#abort" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>abort</a></li><li><a href="#addWebhook" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>addWebhook</a></li><li><a href="#call" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>call</a></li><li><a href="#callTask" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>callTask</a></li><li><a href="#createProxyConfiguration" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>createProxyConfiguration</a></li><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>exit</a></li><li><a href="#fail" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>fail</a></li><li><a href="#getEnv" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEnv</a></li><li><a href="#getInput" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInput</a></li><li><a href="#getInputOrThrow" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow</a></li><li><a href="#getValue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getValue</a></li><li><a href="#init" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init</a></li><li><a href="#isAtHome" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isAtHome</a></li><li><a href="#main" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>main</a></li><li><a href="#metamorph" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>metamorph</a></li><li><a href="#newClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newClient</a></li><li><a href="#off" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off</a></li><li><a href="#on" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on</a></li><li><a href="#openDataset" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openDataset</a></li><li><a href="#openKeyValueStore" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openKeyValueStore</a></li><li><a href="#openRequestQueue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openRequestQueue</a></li><li><a href="#pushData" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>pushData</a></li><li><a href="#reboot" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>reboot</a></li><li><a href="#setStatusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage</a></li><li><a href="#setValue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setValue</a></li><li><a href="#start" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>start</a></li><li><a href="#useState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L82" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new Actor<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Actor">Actor</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <span class="tsd-signature-type">ConfigurationOptions</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Actor">Actor</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#initialized"><span class="tsd-anchor-id" id="initialized"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L74" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>initialized</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>initialized<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <!-- -->false</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Whether the actor instance was initialized. This is set by calling <a href="/sdk/js/reference/next/class/Actor#init">Actor.init</a>.</p></div></div></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Accessors<!-- --> <a class="tsd-anchor" href="#Accessors"><span class="tsd-anchor-id" id="Accessors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apifyClient"><span class="tsd-anchor-id" id="apifyClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1503" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>apifyClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-success)"></i><span class="tsd-signature-symbol">get </span>apifyClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Default <a href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a> instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#config"><span class="tsd-anchor-id" id="config"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1508" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>config</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-success)"></i><span class="tsd-signature-symbol">get </span>config<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Default <a href="/sdk/js/reference/next/class/Configuration">Configuration</a> instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getInputOrThrow"><span class="tsd-anchor-id" id="getInputOrThrow"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L760" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>getInputOrThrow</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets the actor input value just like the <a href="/sdk/js/reference/next/class/Actor#getInput">Actor.getInput</a> method, -but throws if it is not found.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></span></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useState"><span class="tsd-anchor-id" id="useState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L963" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>useState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>State<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>name<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">State</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">UseStateOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Easily create and manage state values. All state values are automatically persisted.</p> +See <a href="/sdk/js/reference/next/class/Configuration">Configuration</a> for details about what can be configured and what are the default values.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#initialized" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>initialized</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Accessors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#apifyClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info)"></i>apifyClient</a></li><li><a href="#config" class="tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info)"></i>config</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#getInputOrThrow" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow</a></li><li><a href="#useState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState</a></li><li><a href="#abort" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>abort</a></li><li><a href="#addWebhook" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>addWebhook</a></li><li><a href="#call" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>call</a></li><li><a href="#callTask" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>callTask</a></li><li><a href="#createProxyConfiguration" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>createProxyConfiguration</a></li><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>exit</a></li><li><a href="#fail" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>fail</a></li><li><a href="#getEnv" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEnv</a></li><li><a href="#getInput" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInput</a></li><li><a href="#getInputOrThrow" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow</a></li><li><a href="#getValue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getValue</a></li><li><a href="#init" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init</a></li><li><a href="#isAtHome" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isAtHome</a></li><li><a href="#main" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>main</a></li><li><a href="#metamorph" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>metamorph</a></li><li><a href="#newClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newClient</a></li><li><a href="#off" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off</a></li><li><a href="#on" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on</a></li><li><a href="#openDataset" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openDataset</a></li><li><a href="#openKeyValueStore" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openKeyValueStore</a></li><li><a href="#openRequestQueue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openRequestQueue</a></li><li><a href="#pushData" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>pushData</a></li><li><a href="#reboot" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>reboot</a></li><li><a href="#setStatusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage</a></li><li><a href="#setValue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setValue</a></li><li><a href="#start" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>start</a></li><li><a href="#useState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L82" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new Actor<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Actor">Actor</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <span class="tsd-signature-type">ConfigurationOptions</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Actor">Actor</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#initialized"><span class="tsd-anchor-id" id="initialized"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L74" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>initialized</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>initialized<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <!-- -->false</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Whether the actor instance was initialized. This is set by calling <a href="/sdk/js/reference/next/class/Actor#init">Actor.init</a>.</p></div></div></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Accessors<!-- --> <a class="tsd-anchor" href="#Accessors"><span class="tsd-anchor-id" id="Accessors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apifyClient"><span class="tsd-anchor-id" id="apifyClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1503" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>apifyClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-success)"></i><span class="tsd-signature-symbol">get </span>apifyClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Default <a href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a> instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#config"><span class="tsd-anchor-id" id="config"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1508" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>config</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-success)"></i><span class="tsd-signature-symbol">get </span>config<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Default <a href="/sdk/js/reference/next/class/Configuration">Configuration</a> instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getInputOrThrow"><span class="tsd-anchor-id" id="getInputOrThrow"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L760" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>getInputOrThrow</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets the actor input value just like the <a href="/sdk/js/reference/next/class/Actor#getInput">Actor.getInput</a> method, +but throws if it is not found.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></span></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useState"><span class="tsd-anchor-id" id="useState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L963" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>useState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>State<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>name<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">State</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">UseStateOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Easily create and manage state values. All state values are automatically persisted.</p> -<p>Values can be modified by simply using the assignment operator.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>State</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>name: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The name of the store to use.</p></div></div></div></li><li><h5>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol"> = <!-- -->...</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If the store does not yet have a value in it, the value will be initialized with the <code>defaultValue</code> you provide.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">UseStateOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An optional object parameter where a custom <code>keyValueStoreName</code> and <code>config</code> can be passed in.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#abort"><span class="tsd-anchor-id" id="abort"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1184" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>abort</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>abort<span class="tsd-signature-symbol">(</span><span>runId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Aborts given actor run on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable).</p> +<p>Values can be modified by simply using the assignment operator.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>State</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>name: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The name of the store to use.</p></div></div></div></li><li><h5>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol"> = <!-- -->...</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If the store does not yet have a value in it, the value will be initialized with the <code>defaultValue</code> you provide.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">UseStateOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An optional object parameter where a custom <code>keyValueStoreName</code> and <code>config</code> can be passed in.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#abort"><span class="tsd-anchor-id" id="abort"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1184" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>abort</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>abort<span class="tsd-signature-symbol">(</span><span>runId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Aborts given actor run on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable).</p> <p>The result of the function is an <a href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a> object that contains details about the actor run.</p> @@ -32,12 +32,12 @@ <p><strong>Example usage:</strong></p> -<div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> run </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">runId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>runId: <span class="tsd-signature-type">string</span></h5></li><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#addWebhook"><span class="tsd-anchor-id" id="addWebhook"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1225" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>addWebhook</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>addWebhook<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Webhook</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed. +<div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> run </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">runId</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>runId: <span class="tsd-signature-type">string</span></h5></li><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#addWebhook"><span class="tsd-anchor-id" id="addWebhook"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1225" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>addWebhook</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>addWebhook<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Webhook</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates an ad-hoc webhook for the current actor run, which lets you receive a notification when the actor run finished or failed. For more information about Apify actor webhooks, please see the <a href="https://docs.apify.com/webhooks" target="_blank" rel="noopener noreferrer">documentation</a>.</p> <p>Note that webhooks are only supported for actors running on the Apify platform. In local environment, the function will print a warning and have no effect.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Webhook</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The return value is the Webhook object. -For more information, see the <a href="https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook" target="_blank" rel="noopener noreferrer">Get webhook</a> API endpoint.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#call"><span class="tsd-anchor-id" id="call"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1110" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>call</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>call<span class="tsd-signature-symbol">(</span><span>actorId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">unknown</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs an actor on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable).</p> +For more information, see the <a href="https://apify.com/docs/api/v2#/reference/webhooks/webhook-object/get-webhook" target="_blank" rel="noopener noreferrer">Get webhook</a> API endpoint.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#call"><span class="tsd-anchor-id" id="call"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1110" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>call</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>call<span class="tsd-signature-symbol">(</span><span>actorId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">unknown</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs an actor on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable).</p> <p>The result of the function is an <a href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a> object that contains details about the actor run.</p> @@ -49,7 +49,7 @@ <div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> run </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">call</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/hello-world'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myInput</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>actorId: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Allowed formats are <code>username/actor-name</code>, <code>userId/actor-name</code> or actor ID.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>input: <span class="tsd-signature-type">unknown</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Input for the actor. If it is an object, it will be stringified to JSON and its content type set to <code>application/json; charset=utf-8</code>. - Otherwise the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#callTask"><span class="tsd-anchor-id" id="callTask"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1139" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>callTask</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>callTask<span class="tsd-signature-symbol">(</span><span>taskId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">Dictionary</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs an actor task on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable).</p> + Otherwise the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#callTask"><span class="tsd-anchor-id" id="callTask"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1139" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>callTask</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>callTask<span class="tsd-signature-symbol">(</span><span>taskId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">Dictionary</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs an actor task on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable).</p> <p>The result of the function is an <a href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a> object that contains details about the actor run.</p> @@ -63,7 +63,7 @@ <div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> run </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">callTask</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'bob/some-task'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>taskId: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Allowed formats are <code>username/task-name</code>, <code>userId/task-name</code> or task ID.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>input: <span class="tsd-signature-type">Dictionary</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Input overrides for the actor task. If it is an object, it will be stringified to JSON and its content type set to <code>application/json; charset=utf-8</code>. - Provided input will be merged with actor task input.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#createProxyConfiguration"><span class="tsd-anchor-id" id="createProxyConfiguration"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1467" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>createProxyConfiguration</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>createProxyConfiguration<span class="tsd-signature-symbol">(</span><span>proxyConfigurationOptions<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><span>useApifyProxy<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">boolean</span></span><span class="tsd-signature-symbol"> }</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates a proxy configuration and returns a promise resolving to an instance + Provided input will be merged with actor task input.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#createProxyConfiguration"><span class="tsd-anchor-id" id="createProxyConfiguration"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1467" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>createProxyConfiguration</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>createProxyConfiguration<span class="tsd-signature-symbol">(</span><span>proxyConfigurationOptions<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><span>useApifyProxy<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">boolean</span></span><span class="tsd-signature-symbol"> }</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates a proxy configuration and returns a promise resolving to an instance of the <a href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a> class that is already initialized.</p> <p>Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking @@ -77,11 +77,11 @@ <p>For compatibility with existing Actor Input UI (Input Schema), this function returns <code>undefined</code> when the following object is passed as <code>proxyConfigurationOptions</code>.</p> -<div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> useApifyProxy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>proxyConfigurationOptions: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><span>useApifyProxy<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">boolean</span></span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1066" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>exit</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>exit<span class="tsd-signature-symbol">(</span><span>messageOrOptions<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gracefully exits the actor run with the provided status message and exit code.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>messageOrOptions: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>First parameter accepts either a string (a terminal status message) or an <code>ExitOptions</code> object.</p></div></div></div></li><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Second parameter accepts an <code>ExitOptions</code> object.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fail"><span class="tsd-anchor-id" id="fail"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1075" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>fail</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>fail<span class="tsd-signature-symbol">(</span><span>messageOrOptions<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Calls <code>Actor.exit()</code> with <code>options.exitCode</code> set to <code>1</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>messageOrOptions: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>First parameter accepts either a string (a terminal status message) or an <code>ExitOptions</code> object.</p></div></div></div></li><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Second parameter accepts an <code>ExitOptions</code> object.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEnv"><span class="tsd-anchor-id" id="getEnv"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1480" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getEnv</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEnv<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a new <a href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a> object which contains information parsed from all the Apify environment variables.</p> +<div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> useApifyProxy</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token boolean" style="color:#36acaa">false</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>proxyConfigurationOptions: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a><span class="tsd-signature-symbol"> & </span><span class="tsd-signature-symbol">{ </span><span>useApifyProxy<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">boolean</span></span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1066" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>exit</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>exit<span class="tsd-signature-symbol">(</span><span>messageOrOptions<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gracefully exits the actor run with the provided status message and exit code.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>messageOrOptions: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>First parameter accepts either a string (a terminal status message) or an <code>ExitOptions</code> object.</p></div></div></div></li><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Second parameter accepts an <code>ExitOptions</code> object.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fail"><span class="tsd-anchor-id" id="fail"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1075" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>fail</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>fail<span class="tsd-signature-symbol">(</span><span>messageOrOptions<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Calls <code>Actor.exit()</code> with <code>options.exitCode</code> set to <code>1</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>messageOrOptions: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>First parameter accepts either a string (a terminal status message) or an <code>ExitOptions</code> object.</p></div></div></div></li><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Second parameter accepts an <code>ExitOptions</code> object.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEnv"><span class="tsd-anchor-id" id="getEnv"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1480" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getEnv</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEnv<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a new <a href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a> object which contains information parsed from all the Apify environment variables.</p> <p>For the list of the Apify environment variables, see <a href="https://docs.apify.com/actor/run#environment-variables" target="_blank" rel="noopener noreferrer">Actor documentation</a>. -If some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getInput"><span class="tsd-anchor-id" id="getInput"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1382" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getInput</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInput<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets the actor input value from the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current actor run.</p> +If some of the variables are not defined or are invalid, the corresponding value in the resulting object will be null.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getInput"><span class="tsd-anchor-id" id="getInput"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1382" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getInput</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInput<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets the actor input value from the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current actor run.</p> <p>This is just a convenient shortcut for <a href="/sdk/js/reference/next/class/KeyValueStore#getValue"><code>keyValueStore.getValue('INPUT')</code></a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> input </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getInput</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div> @@ -95,8 +95,8 @@ <p>For more information, see <a href="/sdk/js/reference/next/class/Actor#openKeyValueStore">Actor.openKeyValueStore</a> and <a href="/sdk/js/reference/next/class/KeyValueStore#getValue">KeyValueStore.getValue</a>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></span></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a promise that resolves to an object, string or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener noreferrer"><code>Buffer</code></a>, depending on the MIME content type of the record, or <code>null</code> - if the record is missing.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getInputOrThrow"><span class="tsd-anchor-id" id="getInputOrThrow"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1390" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getInputOrThrow</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets the actor input value just like the <a href="/sdk/js/reference/next/class/Actor#getInput">Actor.getInput</a> method, -but throws if it is not found.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></span></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getValue"><span class="tsd-anchor-id" id="getValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1317" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets a value from the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current actor run.</p> + if the record is missing.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getInputOrThrow"><span class="tsd-anchor-id" id="getInputOrThrow"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1390" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getInputOrThrow</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getInputOrThrow<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets the actor input value just like the <a href="/sdk/js/reference/next/class/Actor#getInput">Actor.getInput</a> method, +but throws if it is not found.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span></span></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getValue"><span class="tsd-anchor-id" id="getValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1317" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets a value from the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current actor run.</p> <p>This is just a convenient shortcut for <a href="/sdk/js/reference/next/class/KeyValueStore#getValue">KeyValueStore.getValue</a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> value </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'my-key'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div> @@ -109,7 +109,7 @@ and <a href="/sdk/js/reference/next/class/KeyValueStore#getValue">KeyValueStore.getValue</a>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">unknown</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Unique record key.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a promise that resolves to an object, string or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener noreferrer"><code>Buffer</code></a>, depending on the MIME content type of the record, or <code>null</code> - if the record is missing.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#init"><span class="tsd-anchor-id" id="init"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1057" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>init</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isAtHome"><span class="tsd-anchor-id" id="isAtHome"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1498" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>isAtHome</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isAtHome<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns <code>true</code> when code is running on Apify platform and <code>false</code> otherwise (for example locally).</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#main"><span class="tsd-anchor-id" id="main"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1053" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>main</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>main<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>userFunc<span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Type alias" href="/sdk/js/reference/next#UserFunc">UserFunc</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs the main user function that performs the job of the actor + if the record is missing.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#init"><span class="tsd-anchor-id" id="init"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1057" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>init</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isAtHome"><span class="tsd-anchor-id" id="isAtHome"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1498" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>isAtHome</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isAtHome<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns <code>true</code> when code is running on Apify platform and <code>false</code> otherwise (for example locally).</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#main"><span class="tsd-anchor-id" id="main"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1053" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>main</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>main<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>userFunc<span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Type alias" href="/sdk/js/reference/next#UserFunc">UserFunc</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs the main user function that performs the job of the actor and terminates the process when the user function finishes.</p> <p><strong>The <code>Actor.main()</code> function is optional</strong> and is provided merely for your convenience. @@ -139,29 +139,29 @@ <p>To simplify your code, you can take advantage of the <code>async</code>/<code>await</code> keywords:</p> <div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> gotScraping </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'got-scraping'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">main</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// My asynchronous function</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> html </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">gotScraping</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'http://www.example.com'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">html</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>userFunc: <a class="tsd-signature-type" data-tsd-kind="Type alias" href="/sdk/js/reference/next#UserFunc">UserFunc</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User function to be executed. If it returns a promise, -the promise will be awaited. The user function is called with no arguments.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#metamorph"><span class="tsd-anchor-id" id="metamorph"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1201" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>metamorph</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>metamorph<span class="tsd-signature-symbol">(</span><span>targetActorId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">unknown</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Transforms this actor run to an actor run of a given actor. The system stops the current container and starts +the promise will be awaited. The user function is called with no arguments.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#metamorph"><span class="tsd-anchor-id" id="metamorph"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1201" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>metamorph</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>metamorph<span class="tsd-signature-symbol">(</span><span>targetActorId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">unknown</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Transforms this actor run to an actor run of a given actor. The system stops the current container and starts the new container instead. All the default storages are preserved and the new input is stored under the <code>INPUT-METAMORPH-1</code> key in the same default key-value store.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>targetActorId: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Either <code>username/actor-name</code> or actor ID of an actor to which we want to metamorph.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>input: <span class="tsd-signature-type">unknown</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Input for the actor. If it is an object, it will be stringified to JSON and its content type set to <code>application/json; charset=utf-8</code>. - Otherwise, the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newClient"><span class="tsd-anchor-id" id="newClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1491" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>newClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newClient<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a new instance of the Apify API client. The <code>ApifyClient</code> class is provided + Otherwise, the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newClient"><span class="tsd-anchor-id" id="newClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1491" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>newClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newClient<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a new instance of the Apify API client. The <code>ApifyClient</code> class is provided by the <a href="https://www.npmjs.com/package/apify-client" target="_blank" rel="noopener noreferrer">apify-client</a> NPM package, and it is automatically configured using the <code>APIFY_API_BASE_URL</code>, and <code>APIFY_TOKEN</code> environment variables. You can override the token via the available options. That’s useful -if you want to use the client as a different Apify user than the SDK internals are using.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#off"><span class="tsd-anchor-id" id="off"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1083" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>off</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#on"><span class="tsd-anchor-id" id="on"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1079" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>on</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#openDataset"><span class="tsd-anchor-id" id="openDataset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1284" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>openDataset</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openDataset<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>datasetIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Opens a dataset and returns a promise resolving to an instance of the <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> class.</p> +if you want to use the client as a different Apify user than the SDK internals are using.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#off"><span class="tsd-anchor-id" id="off"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1083" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>off</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#on"><span class="tsd-anchor-id" id="on"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1079" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>on</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#openDataset"><span class="tsd-anchor-id" id="openDataset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1284" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>openDataset</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openDataset<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>datasetIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Opens a dataset and returns a promise resolving to an instance of the <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> class.</p> <p>Datasets are used to store structured data where each object stored has the same attributes, such as online store products or real estate offers. The actual data is stored either on the local filesystem or in the cloud.</p> <p>For more details and code examples, see the <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>datasetIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the dataset to be opened. If <code>null</code> or <code>undefined</code>, - the function returns the default dataset associated with the actor run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#openKeyValueStore"><span class="tsd-anchor-id" id="openKeyValueStore"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1408" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>openKeyValueStore</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openKeyValueStore<span class="tsd-signature-symbol">(</span><span>storeIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Opens a key-value store and returns a promise resolving to an instance of the <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> class.</p> + the function returns the default dataset associated with the actor run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#openKeyValueStore"><span class="tsd-anchor-id" id="openKeyValueStore"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1408" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>openKeyValueStore</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openKeyValueStore<span class="tsd-signature-symbol">(</span><span>storeIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Opens a key-value store and returns a promise resolving to an instance of the <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> class.</p> <p>Key-value stores are used to store records or files, along with their MIME content type. The records are stored and retrieved using a unique key. The actual data is stored either on a local filesystem or in the Apify cloud.</p> <p>For more details and code examples, see the <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>storeIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the key-value store to be opened. If <code>null</code> or <code>undefined</code>, - the function returns the default key-value store associated with the actor run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#openRequestQueue"><span class="tsd-anchor-id" id="openRequestQueue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1428" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>openRequestQueue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openRequestQueue<span class="tsd-signature-symbol">(</span><span>queueIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Opens a request queue and returns a promise resolving to an instance + the function returns the default key-value store associated with the actor run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#openRequestQueue"><span class="tsd-anchor-id" id="openRequestQueue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1428" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>openRequestQueue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>openRequestQueue<span class="tsd-signature-symbol">(</span><span>queueIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Opens a request queue and returns a promise resolving to an instance of the <a href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a> class.</p> <p><a href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a> represents a queue of URLs to crawl, which is stored either on local filesystem or in the cloud. @@ -170,7 +170,7 @@ and depth-first crawling orders.</p> <p>For more details and code examples, see the <a href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>queueIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the request queue to be opened. If <code>null</code> or <code>undefined</code>, - the function returns the default request queue associated with the actor run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#pushData"><span class="tsd-anchor-id" id="pushData"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1266" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>pushData</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>pushData<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Stores an object or an array of objects to the default <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> of the current actor run.</p> + the function returns the default request queue associated with the actor run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#pushData"><span class="tsd-anchor-id" id="pushData"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1266" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>pushData</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>pushData<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Stores an object or an array of objects to the default <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> of the current actor run.</p> <p>This is just a convenient shortcut for <a href="/sdk/js/reference/next/class/Dataset#pushData">Dataset.pushData</a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">pushData</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myValue</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div> @@ -181,10 +181,10 @@ <p><strong>IMPORTANT</strong>: Make sure to use the <code>await</code> keyword when calling <code>pushData()</code>, otherwise the actor process might finish before the data are stored!</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Object or array of objects containing data to be stored in the default dataset. -The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#reboot"><span class="tsd-anchor-id" id="reboot"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1210" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>reboot</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>reboot<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Internally reboots this actor run. The system stops the current container and starts +The objects must be serializable to JSON and the JSON representation of each object must be smaller than 9MB.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#reboot"><span class="tsd-anchor-id" id="reboot"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1210" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>reboot</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>reboot<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Internally reboots this actor run. The system stops the current container and starts a new container with the same run id. -This can be used to get the Actor out of irrecoverable error state and continue where it left off.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setStatusMessage"><span class="tsd-anchor-id" id="setStatusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1239" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>setStatusMessage</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage<span class="tsd-signature-symbol">(</span><span>statusMessage<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">SetStatusMessageOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the status message for the current actor run.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>statusMessage: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The status message to set.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">SetStatusMessageOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The return value is the Run object. When run locally, this method returns empty object (<code>{}</code>). -For more information, see the <a href="https://docs.apify.com/api/v2#/reference/actor-runs/" target="_blank" rel="noopener noreferrer">Actor Runs</a> API endpoints.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setValue"><span class="tsd-anchor-id" id="setValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1351" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>setValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Stores or deletes a value in the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current actor run.</p> +This can be used to get the Actor out of irrecoverable error state and continue where it left off.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setStatusMessage"><span class="tsd-anchor-id" id="setStatusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1239" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>setStatusMessage</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage<span class="tsd-signature-symbol">(</span><span>statusMessage<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">SetStatusMessageOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the status message for the current actor run.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>statusMessage: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The status message to set.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">SetStatusMessageOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The return value is the Run object. When run locally, this method returns empty object (<code>{}</code>). +For more information, see the <a href="https://docs.apify.com/api/v2#/reference/actor-runs/" target="_blank" rel="noopener noreferrer">Actor Runs</a> API endpoints.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setValue"><span class="tsd-anchor-id" id="setValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1351" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>setValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Stores or deletes a value in the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current actor run.</p> <p>This is just a convenient shortcut for <a href="/sdk/js/reference/next/class/KeyValueStore#setValue">KeyValueStore.setValue</a>. For example, calling the following code:</p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">setValue</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'OUTPUT'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">foo</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"bar"</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div> @@ -195,7 +195,7 @@ <p>For more information, see <a href="/sdk/js/reference/next/class/Actor#openKeyValueStore">Actor.openKeyValueStore</a> and <a href="/sdk/js/reference/next/class/KeyValueStore#getValue">KeyValueStore.getValue</a>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Unique record key.</p></div></div></div></li><li><h5>value: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record data, which can be one of the following values:</p><ul><li>If <code>null</code>, the record in the key-value store is deleted.</li><li>If no <code>options.contentType</code> is specified, <code>value</code> can be any JavaScript object, and it will be stringified to JSON.</li><li>If <code>options.contentType</code> is set, <code>value</code> is taken as is, and it must be a <code>String</code> or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener noreferrer"><code>Buffer</code></a>. - For any other value an error will be thrown.</li></ul></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#start"><span class="tsd-anchor-id" id="start"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1166" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>start</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>start<span class="tsd-signature-symbol">(</span><span>actorId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">Dictionary</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs an actor on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable), + For any other value an error will be thrown.</li></ul></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#start"><span class="tsd-anchor-id" id="start"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1166" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>start</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>start<span class="tsd-signature-symbol">(</span><span>actorId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>input<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">Dictionary</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Runs an actor on the Apify platform using the current user account (determined by the <code>APIFY_TOKEN</code> environment variable), unlike <code>Actor.call</code>, this method just starts the run without waiting for finish.</p> <p>The result of the function is an <a href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a> object that contains details about the actor run.</p> @@ -207,10 +207,10 @@ <div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> run </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">start</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'apify/hello-world'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">myInput</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">123</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>actorId: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Allowed formats are <code>username/actor-name</code>, <code>userId/actor-name</code> or actor ID.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>input: <span class="tsd-signature-type">Dictionary</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Input for the actor. If it is an object, it will be stringified to JSON and its content type set to <code>application/json; charset=utf-8</code>. - Otherwise the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useState"><span class="tsd-anchor-id" id="useState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L981" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>useState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>State<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>name<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">State</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">UseStateOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Easily create and manage state values. All state values are automatically persisted.</p> + Otherwise the <code>options.contentType</code> parameter must be provided.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useState"><span class="tsd-anchor-id" id="useState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L981" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>useState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useState<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>State<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>name<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">State</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">UseStateOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Easily create and manage state values. All state values are automatically persisted.</p> <p>Values can be modified by simply using the assignment operator.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>State</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>name: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The name of the store to use.</p></div></div></div></li><li><h5>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol"> = <!-- -->...</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If the store does not yet have a value in it, the value will be initialized with the <code>defaultValue</code> you provide.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">UseStateOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An optional object parameter where a custom <code>keyValueStoreName</code> and <code>config</code> can be passed in.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">State</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/ApifyClient"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyClient</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#initialized" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> initialized</a></li><li><a href="#apifyClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info);"></i> apifyClient</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-field" style="color:var(--ifm-color-info);"></i> config</a></li><li><a href="#getInputOrThrow" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInputOrThrow</a></li><li><a href="#useState" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useState</a></li><li><a href="#abort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> abort</a></li><li><a href="#addWebhook" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addWebhook</a></li><li><a href="#call" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> call</a></li><li><a href="#callTask" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> callTask</a></li><li><a href="#createProxyConfiguration" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> createProxyConfiguration</a></li><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exit</a></li><li><a href="#fail" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> fail</a></li><li><a href="#getEnv" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEnv</a></li><li><a href="#getInput" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInput</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#init" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> init</a></li><li><a href="#isAtHome" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isAtHome</a></li><li><a href="#main" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> main</a></li><li><a href="#metamorph" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> metamorph</a></li><li><a href="#newClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newClient</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#openDataset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openDataset</a></li><li><a href="#openKeyValueStore" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openKeyValueStore</a></li><li><a href="#openRequestQueue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> openRequestQueue</a></li><li><a href="#pushData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> pushData</a></li><li><a href="#reboot" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reboot</a></li><li><a href="#setStatusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setStatusMessage</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#start" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> start</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/ApifyClient.html b/reference/next/class/ApifyClient.html index a6c4ae19c8..86b3e162bf 100644 --- a/reference/next/class/ApifyClient.html +++ b/reference/next/class/ApifyClient.html @@ -11,14 +11,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/class/Actor">Classes</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Actor">Actor</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Dataset">Dataset</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Log">Log</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/Logger">Logger</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/LoggerJson">LoggerJson</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/LoggerText">LoggerText</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/PlatformEventManager">PlatformEventManager</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/ProxyConfiguration">ProxyConfiguration</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Classes</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ApifyClient<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>ApifyClient is the official library to access <a href="https://docs.apify.com/api/v2" target="_blank" rel="noopener noreferrer">Apify API</a> from your JavaScript applications. It runs both in Node.js and browser.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#baseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl</a></li><li><a href="#httpClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>httpClient</a></li><li><a href="#logger" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger</a></li><li><a href="#stats" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actor" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actor</a></li><li><a href="#actors" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actors</a></li><li><a href="#build" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>build</a></li><li><a href="#dataset" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>dataset</a></li><li><a href="#datasets" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>datasets</a></li><li><a href="#keyValueStore" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStore</a></li><li><a href="#keyValueStores" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStores</a></li><li><a href="#log" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>log</a></li><li><a href="#requestQueue" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueue</a></li><li><a href="#requestQueues" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueues</a></li><li><a href="#run" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>run</a></li><li><a href="#schedule" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedule</a></li><li><a href="#schedules" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedules</a></li><li><a href="#setStatusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage</a></li><li><a href="#store" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>store</a></li><li><a href="#task" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>task</a></li><li><a href="#tasks" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>tasks</a></li><li><a href="#user" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>user</a></li><li><a href="#webhook" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhook</a></li><li><a href="#webhookDispatch" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatch</a></li><li><a href="#webhookDispatches" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatches</a></li><li><a href="#webhooks" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhooks</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L37" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new ApifyClient<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/ApifyClient">ApifyClient</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#baseUrl"><span class="tsd-anchor-id" id="baseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L32" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>baseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#httpClient"><span class="tsd-anchor-id" id="httpClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L36" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>httpClient</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>httpClient<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">HttpClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logger"><span class="tsd-anchor-id" id="logger"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>logger</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Log">Log</a></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#stats"><span class="tsd-anchor-id" id="stats"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>stats</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Statistics</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L33" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actor"><span class="tsd-anchor-id" id="actor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L46" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actor<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ActorClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actors/actor-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actors/actor-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ActorClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actors"><span class="tsd-anchor-id" id="actors"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L42" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actors</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>actors<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ActorCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actors/actor-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actors/actor-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ActorCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#build"><span class="tsd-anchor-id" id="build"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L50" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>build</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>build<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">BuildClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-builds/build-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-builds/build-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">BuildClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#dataset"><span class="tsd-anchor-id" id="dataset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L58" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>dataset</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>dataset<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DatasetClient</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/datasets/dataset" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/datasets/dataset</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DatasetClient</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#datasets"><span class="tsd-anchor-id" id="datasets"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L54" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>datasets</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>datasets<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DatasetCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/datasets/dataset-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/datasets/dataset-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DatasetCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#keyValueStore"><span class="tsd-anchor-id" id="keyValueStore"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L66" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>keyValueStore</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStore<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">KeyValueStoreClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/key-value-stores/store-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/key-value-stores/store-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">KeyValueStoreClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#keyValueStores"><span class="tsd-anchor-id" id="keyValueStores"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L62" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>keyValueStores</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>keyValueStores<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">KeyValueStoreCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">KeyValueStoreCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#log"><span class="tsd-anchor-id" id="log"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L70" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>log</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>log<span class="tsd-signature-symbol">(</span><span>buildOrRunId<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">LogClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/logs" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/logs</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>buildOrRunId: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">LogClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestQueue"><span class="tsd-anchor-id" id="requestQueue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L78" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestQueue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueue<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">RequestQueueUserOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RequestQueueClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/request-queues/queue" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/request-queues/queue</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">RequestQueueUserOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RequestQueueClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestQueues"><span class="tsd-anchor-id" id="requestQueues"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L74" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestQueues</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>requestQueues<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RequestQueueCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/request-queues/queue-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/request-queues/queue-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RequestQueueCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#run"><span class="tsd-anchor-id" id="run"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L82" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>run</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>run<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">RunClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">RunClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#schedule"><span class="tsd-anchor-id" id="schedule"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L98" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>schedule</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedule<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ScheduleClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/schedules/schedule-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/schedules/schedule-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ScheduleClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#schedules"><span class="tsd-anchor-id" id="schedules"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L94" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>schedules</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>schedules<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ScheduleCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/schedules/schedules-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/schedules/schedules-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">ScheduleCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setStatusMessage"><span class="tsd-anchor-id" id="setStatusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L123" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>setStatusMessage</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setStatusMessage<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">SetStatusMessageOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">SetStatusMessageOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#store"><span class="tsd-anchor-id" id="store"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L122" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>store</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>store<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StoreCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2/#/reference/store" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2/#/reference/store</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">StoreCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#task"><span class="tsd-anchor-id" id="task"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L90" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>task</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>task<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TaskClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-tasks/task-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-tasks/task-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TaskClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#tasks"><span class="tsd-anchor-id" id="tasks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L86" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>tasks</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>tasks<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">TaskCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">TaskCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#user"><span class="tsd-anchor-id" id="user"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L102" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>user</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>user<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">UserClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/users" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/users</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">UserClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhook"><span class="tsd-anchor-id" id="webhook"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L110" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhook</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhook<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhooks/webhook-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhooks/webhook-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhookDispatch"><span class="tsd-anchor-id" id="webhookDispatch"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L118" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhookDispatch</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatch<span class="tsd-signature-symbol">(</span><span>id<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookDispatchClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>id: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookDispatchClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhookDispatches"><span class="tsd-anchor-id" id="webhookDispatches"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L114" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhookDispatches</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhookDispatches<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookDispatchCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhook-dispatches" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhook-dispatches</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookDispatchCollectionClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L106" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>webhooks</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>webhooks<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">WebhookCollectionClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p><a href="https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection" target="_blank" rel="noopener noreferrer">https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection</a></p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">WebhookCollectionClient</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/Actor"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Actor</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/Configuration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Configuration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#baseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> baseUrl</a></li><li><a href="#httpClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> httpClient</a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logger</a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> stats</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#actor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> actor</a></li><li><a href="#actors" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> actors</a></li><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> build</a></li><li><a href="#dataset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> dataset</a></li><li><a href="#datasets" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> datasets</a></li><li><a href="#keyValueStore" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> keyValueStore</a></li><li><a href="#keyValueStores" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> keyValueStores</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#requestQueue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> requestQueue</a></li><li><a href="#requestQueues" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> requestQueues</a></li><li><a href="#run" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> run</a></li><li><a href="#schedule" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> schedule</a></li><li><a href="#schedules" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> schedules</a></li><li><a href="#setStatusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setStatusMessage</a></li><li><a href="#store" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> store</a></li><li><a href="#task" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> task</a></li><li><a href="#tasks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> tasks</a></li><li><a href="#user" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> user</a></li><li><a href="#webhook" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhook</a></li><li><a href="#webhookDispatch" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhookDispatch</a></li><li><a href="#webhookDispatches" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhookDispatches</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/Configuration.html b/reference/next/class/Configuration.html index 0e378e0804..afc0513b97 100644 --- a/reference/next/class/Configuration.html +++ b/reference/next/class/Configuration.html @@ -139,7 +139,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -152,10 +152,10 @@ <div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">BasicCrawler</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">Configuration</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'crawlee'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Get the global configuration</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> config </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token maybe-class-name">Configuration</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">getGlobalConfig</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Set the 'persistStateIntervalMillis' option</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// of global configuration to 30 seconds</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">config</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">set</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'persistStateIntervalMillis'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">30_000</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// No need to pass the configuration to the crawler,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// as it's using the global configuration by default</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">BasicCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></li></ol> -<h2>Supported Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>memoryMbytes</code></td><td><code>ACTOR_MEMORY_MBYTES</code></td><td>-</td></tr><tr><td><code>headless</code></td><td><code>APIFY_HEADLESS</code></td><td>-</td></tr><tr><td><code>persistStateIntervalMillis</code></td><td><code>APIFY_PERSIST_STATE_INTERVAL_MILLIS</code></td><td><code>60e3</code></td></tr><tr><td><code>token</code></td><td><code>APIFY_TOKEN</code></td><td>-</td></tr><tr><td><code>isAtHome</code></td><td><code>APIFY_IS_AT_HOME</code></td><td>-</td></tr><tr><td><code>defaultDatasetId</code></td><td><code>ACTOR_DEFAULT_DATASET_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultKeyValueStoreId</code></td><td><code>ACTOR_DEFAULT_KEY_VALUE_STORE_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultRequestQueueId</code></td><td><code>ACTOR_DEFAULT_REQUEST_QUEUE_ID</code></td><td><code>'default'</code></td></tr></tbody></table><h2>Advanced Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>actorEventsWsUrl</code></td><td><code>ACTOR_EVENTS_WEBSOCKET_URL</code></td><td>-</td></tr><tr><td><code>actorId</code></td><td><code>ACTOR_ID</code></td><td>-</td></tr><tr><td><code>actorRunId</code></td><td><code>ACTOR_RUN_ID</code></td><td>-</td></tr><tr><td><code>actorTaskId</code></td><td><code>ACTOR_TASK_ID</code></td><td>-</td></tr><tr><td><code>apiBaseUrl</code></td><td><code>APIFY_API_BASE_URL</code></td><td><code>'https://api.apify.com'</code></td></tr><tr><td><code>containerPort</code></td><td><code>ACTOR_WEB_SERVER_PORT</code></td><td><code>4321</code></td></tr><tr><td><code>containerUrl</code></td><td><code>ACTOR_WEB_SERVER_URL</code></td><td><code>'http://localhost:4321'</code></td></tr><tr><td><code>inputKey</code></td><td><code>ACTOR_INPUT_KEY</code></td><td><code>'INPUT'</code></td></tr><tr><td><code>metamorphAfterSleepMillis</code></td><td><code>APIFY_METAMORPH_AFTER_SLEEP_MILLIS</code></td><td><code>300e3</code></td></tr><tr><td><code>proxyHostname</code></td><td><code>APIFY_PROXY_HOSTNAME</code></td><td><code>'proxy.apify.com'</code></td></tr><tr><td><code>proxyPassword</code></td><td><code>APIFY_PROXY_PASSWORD</code></td><td>-</td></tr><tr><td><code>proxyPort</code></td><td><code>APIFY_PROXY_PORT</code></td><td><code>8000</code></td></tr><tr><td><code>proxyStatusUrl</code></td><td><code>APIFY_PROXY_STATUS_URL</code></td><td><code>'http://proxy.apify.com'</code></td></tr><tr><td><code>userId</code></td><td><code>APIFY_USER_ID</code></td><td>-</td></tr><tr><td><code>xvfb</code></td><td><code>APIFY_XVFB</code></td><td>-</td></tr><tr><td><code>chromeExecutablePath</code></td><td><code>APIFY_CHROME_EXECUTABLE_PATH</code></td><td>-</td></tr><tr><td><code>defaultBrowserPath</code></td><td><code>APIFY_DEFAULT_BROWSER_PATH</code></td><td>-</td></tr></tbody></table></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Configuration</span><ul class="tsd-hierarchy"><li><em class="tsd-target">Configuration</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#storageManagers" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageManagers</a></li><li><a href="#globalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#get" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#getGlobalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig</a></li><li><a href="#getStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient</a></li><li><a href="#resetGlobalState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L226" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new Configuration<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.constructor</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates new <code>Configuration</code> instance with provided options. Env vars will have precedence over those.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">ConfigurationOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storageManagers"><span class="tsd-anchor-id" id="storageManagers"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L222" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-readonly">readonly</span>storageManagers</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageManagers<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Constructor</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">StorageManager</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">IStorage</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.storageManagers</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#globalConfig"><span class="tsd-anchor-id" id="globalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L100" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-optional">optional</span>globalConfig</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.globalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#get"><span class="tsd-anchor-id" id="get"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L179" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>get</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>U<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.get</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li><strong>U</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">StorageClient</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventManager</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">U</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type tsd-signature-type-generic">U</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L254" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#set"><span class="tsd-anchor-id" id="set"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L186" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>set</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.set</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>value: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useEventManager"><span class="tsd-anchor-id" id="useEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L262" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager<span class="tsd-signature-symbol">(</span><span>events<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useEventManager</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>events: <span class="tsd-signature-type">EventManager</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useStorageClient"><span class="tsd-anchor-id" id="useStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L260" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient<span class="tsd-signature-symbol">(</span><span>client<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useStorageClient</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>client: <span class="tsd-signature-type">StorageClient</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L274" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default EventManager instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getGlobalConfig"><span class="tsd-anchor-id" id="getGlobalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L193" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getGlobalConfig</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.getGlobalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getStorageClient"><span class="tsd-anchor-id" id="getStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L270" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getStorageClient</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default StorageClient instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">StorageClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#resetGlobalState"><span class="tsd-anchor-id" id="resetGlobalState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L206" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>resetGlobalState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.resetGlobalState</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Resets global configuration instance. The default instance holds configuration based on env vars, +<h2>Supported Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>memoryMbytes</code></td><td><code>ACTOR_MEMORY_MBYTES</code></td><td>-</td></tr><tr><td><code>headless</code></td><td><code>APIFY_HEADLESS</code></td><td>-</td></tr><tr><td><code>persistStateIntervalMillis</code></td><td><code>APIFY_PERSIST_STATE_INTERVAL_MILLIS</code></td><td><code>60e3</code></td></tr><tr><td><code>token</code></td><td><code>APIFY_TOKEN</code></td><td>-</td></tr><tr><td><code>isAtHome</code></td><td><code>APIFY_IS_AT_HOME</code></td><td>-</td></tr><tr><td><code>defaultDatasetId</code></td><td><code>ACTOR_DEFAULT_DATASET_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultKeyValueStoreId</code></td><td><code>ACTOR_DEFAULT_KEY_VALUE_STORE_ID</code></td><td><code>'default'</code></td></tr><tr><td><code>defaultRequestQueueId</code></td><td><code>ACTOR_DEFAULT_REQUEST_QUEUE_ID</code></td><td><code>'default'</code></td></tr></tbody></table><h2>Advanced Configuration Options</h2><table><thead><tr><th>Key</th><th>Environment Variable</th><th>Default Value</th></tr></thead><tbody><tr><td><code>actorEventsWsUrl</code></td><td><code>ACTOR_EVENTS_WEBSOCKET_URL</code></td><td>-</td></tr><tr><td><code>actorId</code></td><td><code>ACTOR_ID</code></td><td>-</td></tr><tr><td><code>actorRunId</code></td><td><code>ACTOR_RUN_ID</code></td><td>-</td></tr><tr><td><code>actorTaskId</code></td><td><code>ACTOR_TASK_ID</code></td><td>-</td></tr><tr><td><code>apiBaseUrl</code></td><td><code>APIFY_API_BASE_URL</code></td><td><code>'https://api.apify.com'</code></td></tr><tr><td><code>containerPort</code></td><td><code>ACTOR_WEB_SERVER_PORT</code></td><td><code>4321</code></td></tr><tr><td><code>containerUrl</code></td><td><code>ACTOR_WEB_SERVER_URL</code></td><td><code>'http://localhost:4321'</code></td></tr><tr><td><code>inputKey</code></td><td><code>ACTOR_INPUT_KEY</code></td><td><code>'INPUT'</code></td></tr><tr><td><code>metamorphAfterSleepMillis</code></td><td><code>APIFY_METAMORPH_AFTER_SLEEP_MILLIS</code></td><td><code>300e3</code></td></tr><tr><td><code>proxyHostname</code></td><td><code>APIFY_PROXY_HOSTNAME</code></td><td><code>'proxy.apify.com'</code></td></tr><tr><td><code>proxyPassword</code></td><td><code>APIFY_PROXY_PASSWORD</code></td><td>-</td></tr><tr><td><code>proxyPort</code></td><td><code>APIFY_PROXY_PORT</code></td><td><code>8000</code></td></tr><tr><td><code>proxyStatusUrl</code></td><td><code>APIFY_PROXY_STATUS_URL</code></td><td><code>'http://proxy.apify.com'</code></td></tr><tr><td><code>userId</code></td><td><code>APIFY_USER_ID</code></td><td>-</td></tr><tr><td><code>xvfb</code></td><td><code>APIFY_XVFB</code></td><td>-</td></tr><tr><td><code>chromeExecutablePath</code></td><td><code>APIFY_CHROME_EXECUTABLE_PATH</code></td><td>-</td></tr><tr><td><code>defaultBrowserPath</code></td><td><code>APIFY_DEFAULT_BROWSER_PATH</code></td><td>-</td></tr></tbody></table></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Configuration</span><ul class="tsd-hierarchy"><li><em class="tsd-target">Configuration</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#storageManagers" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageManagers</a></li><li><a href="#globalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#get" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li><li><a href="#getEventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager</a></li><li><a href="#getGlobalConfig" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig</a></li><li><a href="#getStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient</a></li><li><a href="#resetGlobalState" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState</a></li><li><a href="#set" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set</a></li><li><a href="#useStorageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L226" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new Configuration<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.constructor</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Creates new <code>Configuration</code> instance with provided options. Env vars will have precedence over those.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">ConfigurationOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storageManagers"><span class="tsd-anchor-id" id="storageManagers"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L222" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-readonly">readonly</span>storageManagers</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageManagers<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Map</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Constructor</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">StorageManager</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">IStorage</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.storageManagers</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#globalConfig"><span class="tsd-anchor-id" id="globalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L100" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-optional">optional</span>globalConfig</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>globalConfig<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.globalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#get"><span class="tsd-anchor-id" id="get"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L179" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>get</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>get<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>U<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">U</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.get</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li><strong>U</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">StorageClient</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventManager</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">U</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type tsd-signature-type-generic">U</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L254" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#set"><span class="tsd-anchor-id" id="set"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L186" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>set</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.set</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-symbol">keyof<!-- --> </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></h5></li><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>value: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useEventManager"><span class="tsd-anchor-id" id="useEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L262" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useEventManager<span class="tsd-signature-symbol">(</span><span>events<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useEventManager</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>events: <span class="tsd-signature-type">EventManager</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useStorageClient"><span class="tsd-anchor-id" id="useStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L260" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>useStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient<span class="tsd-signature-symbol">(</span><span>client<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useStorageClient</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>client: <span class="tsd-signature-type">StorageClient</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getEventManager"><span class="tsd-anchor-id" id="getEventManager"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L274" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getEventManager</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getEventManager<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventManager</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getEventManager</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default EventManager instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">EventManager</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getGlobalConfig"><span class="tsd-anchor-id" id="getGlobalConfig"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L193" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>getGlobalConfig</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getGlobalConfig<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.getGlobalConfig</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getStorageClient"><span class="tsd-anchor-id" id="getStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L270" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getStorageClient<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.getStorageClient</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets default StorageClient instance.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">StorageClient</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#resetGlobalState"><span class="tsd-anchor-id" id="resetGlobalState"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L206" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>resetGlobalState</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>resetGlobalState<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreConfiguration.resetGlobalState</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Resets global configuration instance. The default instance holds configuration based on env vars, if we want to change them, we need to first reset the global state. Used mainly for testing purposes.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#set"><span class="tsd-anchor-id" id="set"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L243" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>set</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>set<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">keyof<!-- --> </span><span class="tsd-signature-type">ConfigurationOptions</span></span><span class="tsd-signature-symbol">, </span><span>value<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.set</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets value for given option. Only affects the global <code>Configuration</code> instance, the value will not be propagated down to the env var. To reset a value, we can omit the <code>value</code> argument or pass <code>undefined</code> there.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-symbol">keyof<!-- --> </span><span class="tsd-signature-type">ConfigurationOptions</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>value: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#useStorageClient"><span class="tsd-anchor-id" id="useStorageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L261" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>useStorageClient</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>useStorageClient<span class="tsd-signature-symbol">(</span><span>client<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">StorageClient</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfiguration.useStorageClient</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>client: <span class="tsd-signature-type">StorageClient</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/ApifyClient"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyClient</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/Dataset"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Dataset</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#storageManagers" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageManagers</a></li><li><a href="#globalConfig" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> globalConfig</a></li><li><a href="#get" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> get</a></li><li><a href="#getEventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventManager</a></li><li><a href="#set" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> set</a></li><li><a href="#useEventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useEventManager</a></li><li><a href="#useStorageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> useStorageClient</a></li><li><a href="#getGlobalConfig" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getGlobalConfig</a></li><li><a href="#getStorageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getStorageClient</a></li><li><a href="#resetGlobalState" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> resetGlobalState</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/Dataset.html b/reference/next/class/Dataset.html index 654eac8d8c..a14691ed9b 100644 --- a/reference/next/class/Dataset.html +++ b/reference/next/class/Dataset.html @@ -103,7 +103,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -187,7 +187,7 @@ <p>For more details and code examples, see the <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> class.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>Data</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>datasetIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID or name of the dataset to be opened. If <code>null</code> or <code>undefined</code>, the function returns the default dataset associated with the crawler run.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StorageManagerOptions</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Storage manager options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Dataset">Dataset</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/Configuration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Configuration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/KeyValueStore"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStore</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> log</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#exportTo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exportTo</a></li><li><a href="#exportToCSV" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exportToCSV</a></li><li><a href="#exportToJSON" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exportToJSON</a></li><li><a href="#forEach" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEach</a></li><li><a href="#getData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getData</a></li><li><a href="#getInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInfo</a></li><li><a href="#map" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> map</a></li><li><a href="#pushData" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> pushData</a></li><li><a href="#reduce" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reduce</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/KeyValueStore.html b/reference/next/class/KeyValueStore.html index 8229fe1e88..2a619e5103 100644 --- a/reference/next/class/KeyValueStore.html +++ b/reference/next/class/KeyValueStore.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -24,7 +24,7 @@ <p>If the <code>iteratee</code> function returns a Promise then it is awaited before the next call. If it throws an error, the iteration is aborted and the <code>forEachKey</code> function throws the error.</p> -<p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> keyValueStore </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">KeyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> keyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEachKey</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">key</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Key at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">key</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> has size </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">info</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">size</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>iteratee: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A function that is called for every key in the key-value store.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>All <code>forEachKey()</code> parameters.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getAutoSavedValue"><span class="tsd-anchor-id" id="getAutoSavedValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L146" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getAutoSavedValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getAutoSavedValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getAutoSavedValue</span></p></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getPublicUrl"><span class="tsd-anchor-id" id="getPublicUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/key_value_store.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>getPublicUrl</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getPublicUrl<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a URL for the given key that may be used to publicly +<p><strong>Example usage</strong></p><div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> keyValueStore </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">KeyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">open</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> keyValueStore</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">forEachKey</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">key</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> index</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> info</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token arrow operator" style="color:#393A34">=></span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token template-string string" style="color:#e3116c">Key at </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">index</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c">: </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">key</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string string" style="color:#e3116c"> has size </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">${</span><span class="token template-string interpolation">info</span><span class="token template-string interpolation punctuation" style="color:#393A34">.</span><span class="token template-string interpolation property-access">size</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:#393A34">}</span><span class="token template-string template-punctuation string" style="color:#e3116c">`</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>iteratee: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A function that is called for every key in the key-value store.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>All <code>forEachKey()</code> parameters.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getAutoSavedValue"><span class="tsd-anchor-id" id="getAutoSavedValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L146" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getAutoSavedValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getAutoSavedValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getAutoSavedValue</span></p></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getPublicUrl"><span class="tsd-anchor-id" id="getPublicUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/key_value_store.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>getPublicUrl</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getPublicUrl<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a URL for the given key that may be used to publicly access the value in the remote key-value store.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>key: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getValue"><span class="tsd-anchor-id" id="getValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L112" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L145" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>getValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon tsd-pressable"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li><li class="tsd-signature tsd-kind-icon tsd-signature-inactive tsd-pressable"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getValue</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Gets a value from the key-value store.</p> <p>The function returns a <code>Promise</code> that resolves to the record value, @@ -68,8 +68,8 @@ <p><strong>IMPORTANT:</strong> Always make sure to use the <code>await</code> keyword when calling <code>setValue()</code>, otherwise the crawler process might finish before the value is stored!</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Unique key of the record. It can be at most 256 characters long and only consist of the following characters: <code>a</code>-<code>z</code>, <code>A</code>-<code>Z</code>, <code>0</code>-<code>9</code> and <code>!-_.'()</code></p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>value: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record data, which can be one of the following values:</p><ul><li>If <code>null</code>, the record in the key-value store is deleted.</li><li>If no <code>options.contentType</code> is specified, <code>value</code> can be any JavaScript object and it will be stringified to JSON.</li><li>If <code>options.contentType</code> is set, <code>value</code> is taken as is and it must be a <code>String</code> or <a href="https://nodejs.org/api/buffer.html" target="_blank" rel="noopener noreferrer"><code>Buffer</code></a>. - For any other value an error will be thrown.</li></ul></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getAutoSavedValue"><span class="tsd-anchor-id" id="getAutoSavedValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L295" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getAutoSavedValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getAutoSavedValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getAutoSavedValue</span></p></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#open"><span class="tsd-anchor-id" id="open"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/key_value_store.ts#L19" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>open</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>open<span class="tsd-signature-symbol">(</span><span>storeIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">StorageManagerOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreKeyValueStore.open</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>storeIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li><li><h5>options: <span class="tsd-signature-type">StorageManagerOptions</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/Dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/Log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#forEachKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEachKey</a></li><li><a href="#getAutoSavedValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getAutoSavedValue</a></li><li><a href="#getPublicUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getPublicUrl</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> + For any other value an error will be thrown.</li></ul></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Record options.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#getAutoSavedValue"><span class="tsd-anchor-id" id="getAutoSavedValue"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L295" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>getAutoSavedValue</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>getAutoSavedValue<span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>defaultValue<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreKeyValueStore.getAutoSavedValue</span></p></aside><h4 class="tsd-type-parameters-title">Type parameters</h4><ul class="tsd-type-parameters"><li><strong>T</strong><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">Dictionary</span></span></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultValue: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#open"><span class="tsd-anchor-id" id="open"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/key_value_store.ts#L19" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span>open</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>open<span class="tsd-signature-symbol">(</span><span>storeIdOrName<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">StorageManagerOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreKeyValueStore.open</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@inheritDoc</strong></dt><dd></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>storeIdOrName: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></h5></li><li><h5>options: <span class="tsd-signature-type">StorageManagerOptions</span><span class="tsd-signature-symbol"> = <!-- -->{}</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/Dataset"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Dataset</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/Log"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Log</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#forEachKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> forEachKey</a></li><li><a href="#getAutoSavedValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getAutoSavedValue</a></li><li><a href="#getPublicUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getPublicUrl</a></li><li><a href="#getValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getValue</a></li><li><a href="#setValue" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setValue</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/Log.html b/reference/next/class/Log.html index 601f5b8911..354be25745 100644 --- a/reference/next/class/Log.html +++ b/reference/next/class/Log.html @@ -131,7 +131,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -177,7 +177,7 @@ <div class="language-typescript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-typescript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">setLevel</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">log</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">LEVELS</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">DEBUG</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div> <p>Default log level is INFO.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>level: <a class="tsd-signature-type" data-tsd-kind="Enumeration" href="/sdk/js/reference/next/enum/LogLevel">LogLevel</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setOptions"><span class="tsd-anchor-id" id="setOptions"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L122" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>setOptions</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setOptions<span class="tsd-signature-symbol">(</span><span>options<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a><span class="tsd-signature-symbol">></span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Configures logger.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>options: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a><span class="tsd-signature-symbol">></span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#softFail"><span class="tsd-anchor-id" id="softFail"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L141" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>softFail</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>softFail<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>data<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">AdditionalData</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>data: <span class="tsd-signature-type">AdditionalData</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#warning"><span class="tsd-anchor-id" id="warning"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L145" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>warning</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>warning<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>data<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">AdditionalData</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Logs a <code>WARNING</code> level message. Data are stringified and appended to the message.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>data: <span class="tsd-signature-type">AdditionalData</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#warningOnce"><span class="tsd-anchor-id" id="warningOnce"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L162" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>warningOnce</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>warningOnce<span class="tsd-signature-symbol">(</span><span>message<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Logs a <code>WARNING</code> level message only once.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>message: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/KeyValueStore"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStore</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/Logger"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Logger</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#LEVELS" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> LEVELS</a></li><li><a href="#child" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> child</a></li><li><a href="#debug" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> debug</a></li><li><a href="#deprecated" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> deprecated</a></li><li><a href="#error" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> error</a></li><li><a href="#exception" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> exception</a></li><li><a href="#getLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getLevel</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#info" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> info</a></li><li><a href="#internal" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> internal</a></li><li><a href="#perf" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> perf</a></li><li><a href="#setLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setLevel</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#softFail" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> softFail</a></li><li><a href="#warning" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> warning</a></li><li><a href="#warningOnce" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> warningOnce</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/Logger.html b/reference/next/class/Logger.html index ae450183f7..9edb17c393 100644 --- a/reference/next/class/Logger.html +++ b/reference/next/class/Logger.html @@ -15,7 +15,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -203,7 +203,7 @@ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p> <div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> once </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ee </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ac </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">AbortController</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">emitter</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">once</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">emitter</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> signal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'event emitted!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'AbortError'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Waiting for the event was canceled!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'There was an error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Abort waiting for the event</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">emit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Prints: Waiting for the event was canceled!</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v11.13.0, v10.16.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>emitter: <span class="tsd-signature-type">_NodeEventTarget</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>eventName: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StaticEventEmitterOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setMaxListeners"><span class="tsd-anchor-id" id="setMaxListeners"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@types/node/events.d.ts#L352" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>setMaxListeners</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setMaxListeners<span class="tsd-signature-symbol">(</span><span>n<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>eventTargets<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventEmitter.setMaxListeners</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> setMaxListeners</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> target </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventTarget</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> emitter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">setMaxListeners</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> target</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> emitter</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v15.4.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>n: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>eventTargets: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/Log"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Log</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/LoggerJson"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerJson</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#captureRejectionSymbol" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejectionSymbol</a></li><li><a href="#captureRejections" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejections</a></li><li><a href="#defaultMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultMaxListeners</a></li><li><a href="#errorMonitor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> errorMonitor</a></li><li><a href="#[captureRejectionSymbol]" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> [captureRejectionSymbol]</a></li><li><a href="#_log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _log</a></li><li><a href="#_outputWithConsole" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _outputWithConsole</a></li><li><a href="#addListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addListener</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#eventNames" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> eventNames</a></li><li><a href="#getMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getMaxListeners</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#listenerCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listenerCount</a></li><li><a href="#listeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listeners</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#once" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> once</a></li><li><a href="#prependListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependListener</a></li><li><a href="#prependOnceListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependOnceListener</a></li><li><a href="#rawListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> rawListeners</a></li><li><a href="#removeAllListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeAllListeners</a></li><li><a href="#removeListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeListener</a></li><li><a href="#setMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setMaxListeners</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#addAbortListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addAbortListener</a></li><li><a href="#getEventListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventListeners</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/LoggerJson.html b/reference/next/class/LoggerJson.html index b33bdc1f43..dea1f82d30 100644 --- a/reference/next/class/LoggerJson.html +++ b/reference/next/class/LoggerJson.html @@ -15,7 +15,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -203,7 +203,7 @@ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p> <div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> once </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ee </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ac </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">AbortController</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">emitter</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">once</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">emitter</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> signal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'event emitted!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'AbortError'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Waiting for the event was canceled!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'There was an error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Abort waiting for the event</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">emit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Prints: Waiting for the event was canceled!</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v11.13.0, v10.16.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>emitter: <span class="tsd-signature-type">_NodeEventTarget</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>eventName: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StaticEventEmitterOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setMaxListeners"><span class="tsd-anchor-id" id="setMaxListeners"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@types/node/events.d.ts#L352" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>setMaxListeners</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setMaxListeners<span class="tsd-signature-symbol">(</span><span>n<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>eventTargets<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type tsd-signature-type-generic">Logger.setMaxListeners</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> setMaxListeners</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> target </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventTarget</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> emitter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">setMaxListeners</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> target</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> emitter</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v15.4.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>n: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>eventTargets: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/Logger"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Logger</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/LoggerText"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerText</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#captureRejectionSymbol" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejectionSymbol</a></li><li><a href="#captureRejections" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejections</a></li><li><a href="#defaultMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultMaxListeners</a></li><li><a href="#errorMonitor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> errorMonitor</a></li><li><a href="#[captureRejectionSymbol]" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> [captureRejectionSymbol]</a></li><li><a href="#_log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _log</a></li><li><a href="#_outputWithConsole" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _outputWithConsole</a></li><li><a href="#addListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addListener</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#eventNames" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> eventNames</a></li><li><a href="#getMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getMaxListeners</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#listenerCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listenerCount</a></li><li><a href="#listeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listeners</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#once" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> once</a></li><li><a href="#prependListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependListener</a></li><li><a href="#prependOnceListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependOnceListener</a></li><li><a href="#rawListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> rawListeners</a></li><li><a href="#removeAllListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeAllListeners</a></li><li><a href="#removeListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeListener</a></li><li><a href="#setMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setMaxListeners</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#addAbortListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addAbortListener</a></li><li><a href="#getEventListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventListeners</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/LoggerText.html b/reference/next/class/LoggerText.html index c8b7e8a222..ccbb16059d 100644 --- a/reference/next/class/LoggerText.html +++ b/reference/next/class/LoggerText.html @@ -15,7 +15,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -203,7 +203,7 @@ <p>An <code>AbortSignal</code> can be used to cancel waiting for the event:</p> <div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> once </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ee </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> ac </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">AbortController</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">async</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">function</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter">emitter</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> event</span><span class="token parameter punctuation" style="color:#393A34">,</span><span class="token parameter"> signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">once</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">emitter</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> event</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> signal </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">log</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'event emitted!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">catch</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">if</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">name</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">===</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'AbortError'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'Waiting for the event was canceled!'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">else</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token console class-name">console</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">error</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'There was an error'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> error</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">foo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">signal</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ac</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">abort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Abort waiting for the event</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">ee</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">emit</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">'foo'</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Prints: Waiting for the event was canceled!</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v11.13.0, v10.16.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>emitter: <span class="tsd-signature-type">_NodeEventTarget</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>eventName: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>options: <span class="tsd-signature-type">StaticEventEmitterOptions</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#setMaxListeners"><span class="tsd-anchor-id" id="setMaxListeners"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@types/node/events.d.ts#L352" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>setMaxListeners</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>setMaxListeners<span class="tsd-signature-symbol">(</span><span>n<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>eventTargets<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type tsd-signature-type-generic">Logger.setMaxListeners</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><div class="language-js codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-js codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword module" style="color:#00009f">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:#393A34">{</span><span class="token imports"> setMaxListeners</span><span class="token imports punctuation" style="color:#393A34">,</span><span class="token imports"> </span><span class="token imports maybe-class-name">EventEmitter</span><span class="token imports"> </span><span class="token imports punctuation" style="color:#393A34">}</span><span class="token plain"> </span><span class="token keyword module" style="color:#00009f">from</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'node:events'</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> target </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventTarget</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> emitter </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">EventEmitter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token function" style="color:#d73a49">setMaxListeners</span><span class="token punctuation" style="color:#393A34">(</span><span class="token number" style="color:#36acaa">5</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> target</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> emitter</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div><dl class="tsd-comment-tags"><dt><strong>@since</strong></dt><dd><div class="tsd-markdown markdown"><p>v15.4.0</p></div></dd></dl></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>n: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A non-negative number. The maximum number of listeners per <code>EventTarget</code> event.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>eventTargets: <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">_DOMEventTarget</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">EventEmitter</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/LoggerJson"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerJson</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/PlatformEventManager"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">PlatformEventManager</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#captureRejectionSymbol" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejectionSymbol</a></li><li><a href="#captureRejections" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> captureRejections</a></li><li><a href="#defaultMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultMaxListeners</a></li><li><a href="#errorMonitor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> errorMonitor</a></li><li><a href="#[captureRejectionSymbol]" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> [captureRejectionSymbol]</a></li><li><a href="#_log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _log</a></li><li><a href="#_outputWithConsole" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _outputWithConsole</a></li><li><a href="#_parseException" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> _parseException</a></li><li><a href="#addListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addListener</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#eventNames" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> eventNames</a></li><li><a href="#getMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getMaxListeners</a></li><li><a href="#getOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getOptions</a></li><li><a href="#listenerCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listenerCount</a></li><li><a href="#listeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> listeners</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> log</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li><li><a href="#once" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> once</a></li><li><a href="#prependListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependListener</a></li><li><a href="#prependOnceListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> prependOnceListener</a></li><li><a href="#rawListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> rawListeners</a></li><li><a href="#removeAllListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeAllListeners</a></li><li><a href="#removeListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> removeListener</a></li><li><a href="#setMaxListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setMaxListeners</a></li><li><a href="#setOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> setOptions</a></li><li><a href="#addAbortListener" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addAbortListener</a></li><li><a href="#getEventListeners" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getEventListeners</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/PlatformEventManager.html b/reference/next/class/PlatformEventManager.html index fcc8cfc22c..4d9cb6b400 100644 --- a/reference/next/class/PlatformEventManager.html +++ b/reference/next/class/PlatformEventManager.html @@ -79,7 +79,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -112,11 +112,11 @@ This event is automatically emitted together with the <code>migrating</code> event, in which case the <code>isMigrating</code> flag is set to <code>true</code>. Otherwise the flag is <code>false</code>. Note that the <code>persistState</code> event is provided merely for user convenience, -you can achieve the same effect using <code>setInterval()</code> and listening for the <code>migrating</code> event.</li></ul></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">EventManager</span><ul class="tsd-hierarchy"><li><em class="tsd-target">PlatformEventManager</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#config" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#close" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>close</a></li><li><a href="#emit" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>emit</a></li><li><a href="#init" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init</a></li><li><a href="#isInitialized" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isInitialized</a></li><li><a href="#off" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off</a></li><li><a href="#on" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new PlatformEventManager<span class="tsd-signature-symbol">(</span><span>config<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/PlatformEventManager">PlatformEventManager</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.constructor</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>config: <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a><span class="tsd-signature-symbol"> = <!-- -->...</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/PlatformEventManager">PlatformEventManager</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#config"><span class="tsd-anchor-id" id="config"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-readonly">readonly</span>config</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a><span class="tsd-signature-symbol"> = <!-- -->...</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.config</span></p></aside></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#close"><span class="tsd-anchor-id" id="close"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L111" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>close</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>close<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.close</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Closes websocket providing events from Actor infrastructure and also stops sending internal events +you can achieve the same effect using <code>setInterval()</code> and listening for the <code>migrating</code> event.</li></ul></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">EventManager</span><ul class="tsd-hierarchy"><li><em class="tsd-target">PlatformEventManager</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Constructors</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#constructor" class="tsd-kind-icon"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info)"></i>constructor</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#config" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#close" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>close</a></li><li><a href="#emit" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>emit</a></li><li><a href="#init" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init</a></li><li><a href="#isInitialized" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isInitialized</a></li><li><a href="#off" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off</a></li><li><a href="#on" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors<!-- --> <a class="tsd-anchor" href="#Constructors"><span class="tsd-anchor-id" id="Constructors"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#constructor"><span class="tsd-anchor-id" id="constructor"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>constructor</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>new PlatformEventManager<span class="tsd-signature-symbol">(</span><span>config<span class="tsd-signature-symbol">?<!-- -->: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/PlatformEventManager">PlatformEventManager</a></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.constructor</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>config: <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a><span class="tsd-signature-symbol"> = <!-- -->...</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/PlatformEventManager">PlatformEventManager</a></h4></li></ul></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#config"><span class="tsd-anchor-id" id="config"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-readonly">readonly</span>config</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a><span class="tsd-signature-symbol"> = <!-- -->...</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.config</span></p></aside></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#close"><span class="tsd-anchor-id" id="close"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L111" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>close</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>close<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.close</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Closes websocket providing events from Actor infrastructure and also stops sending internal events of Apify package such as <code>persistState</code>. -This is automatically called at the end of <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#emit"><span class="tsd-anchor-id" id="emit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>emit</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>emit<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.emit</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#init"><span class="tsd-anchor-id" id="init"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/platform_event_manager.ts#L57" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>init</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.init</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Initializes <code>Actor.events</code> event emitter by creating a connection to a websocket that provides them. +This is automatically called at the end of <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#emit"><span class="tsd-anchor-id" id="emit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L35" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>emit</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>emit<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.emit</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#init"><span class="tsd-anchor-id" id="init"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/platform_event_manager.ts#L57" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>init</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>init<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">EventManager.init</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Initializes <code>Actor.events</code> event emitter by creating a connection to a websocket that provides them. This is an internal function that is automatically called by <code>Actor.main()</code>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isInitialized"><span class="tsd-anchor-id" id="isInitialized"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L36" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>isInitialized</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isInitialized<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.isInitialized</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#off"><span class="tsd-anchor-id" id="off"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>off</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>off<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.off</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#on"><span class="tsd-anchor-id" id="on"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/events/event_manager.d.ts#L33" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>on</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>on<span class="tsd-signature-symbol">(</span><span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventTypeName</span></span><span class="tsd-signature-symbol">, </span><span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">EventManager.on</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>event: <span class="tsd-signature-type">EventTypeName</span></h5></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>listener: <span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/LoggerText"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerText</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/ProxyConfiguration"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfiguration</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#constructor" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-constructor" style="color:var(--ifm-color-info);"></i> constructor</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#close" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> close</a></li><li><a href="#emit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> emit</a></li><li><a href="#init" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> init</a></li><li><a href="#isInitialized" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isInitialized</a></li><li><a href="#off" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> off</a></li><li><a href="#on" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> on</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/ProxyConfiguration.html b/reference/next/class/ProxyConfiguration.html index 706357f566..b8aff58ea7 100644 --- a/reference/next/class/ProxyConfiguration.html +++ b/reference/next/class/ProxyConfiguration.html @@ -67,7 +67,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -86,12 +86,12 @@ <p><strong>Example usage:</strong></p> -<div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">groups</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'GROUP1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'GROUP2'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// List of Apify Proxy groups</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> usedProxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Getting the proxy URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ProxyConfiguration</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ProxyConfiguration</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#config" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config</a></li><li><a href="#isManInTheMiddle" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isManInTheMiddle</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#initialize" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>initialize</a></li><li><a href="#newProxyInfo" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newProxyInfo</a></li><li><a href="#newUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newUrl</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#config"><span class="tsd-anchor-id" id="config"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L162" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-readonly">readonly</span>config</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a><span class="tsd-signature-symbol"> = <!-- -->...</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isManInTheMiddle"><span class="tsd-anchor-id" id="isManInTheMiddle"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L103" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>isManInTheMiddle</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isManInTheMiddle<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyConfiguration.isManInTheMiddle</span></p></aside></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#initialize"><span class="tsd-anchor-id" id="initialize"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L215" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>initialize</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>initialize<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups +<div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">groups</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'GROUP1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'GROUP2'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// List of Apify Proxy groups</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> usedProxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Getting the proxy URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ProxyConfiguration</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ProxyConfiguration</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#config" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config</a></li><li><a href="#isManInTheMiddle" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isManInTheMiddle</a></li></ul></div></section><section class="tsd-index-section"><h3 class="tsd-panel-header">Methods</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#initialize" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>initialize</a></li><li><a href="#newProxyInfo" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newProxyInfo</a></li><li><a href="#newUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newUrl</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#config"><span class="tsd-anchor-id" id="config"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L162" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-readonly">readonly</span>config</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>config<span class="tsd-signature-symbol">: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Configuration">Configuration</a><span class="tsd-signature-symbol"> = <!-- -->...</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isManInTheMiddle"><span class="tsd-anchor-id" id="isManInTheMiddle"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L103" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>isManInTheMiddle</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isManInTheMiddle<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyConfiguration.isManInTheMiddle</span></p></aside></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods<!-- --> <a class="tsd-anchor" href="#Methods"><span class="tsd-anchor-id" id="Methods"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#initialize"><span class="tsd-anchor-id" id="initialize"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L215" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>initialize</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>initialize<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups if Apify Proxy configuration is used. Also checks if country has access to Apify Proxy groups if the country code is provided.</p> <p>You should use the createProxyConfiguration function to create a pre-initialized -<code>ProxyConfiguration</code> instance instead of calling this manually.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newProxyInfo"><span class="tsd-anchor-id" id="newProxyInfo"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L239" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>newProxyInfo</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newProxyInfo<span class="tsd-signature-symbol">(</span><span>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyConfiguration.newProxyInfo</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>This function creates a new <a href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a> info object. +<code>ProxyConfiguration</code> instance instead of calling this manually.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newProxyInfo"><span class="tsd-anchor-id" id="newProxyInfo"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L239" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>newProxyInfo</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newProxyInfo<span class="tsd-signature-symbol">(</span><span>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyConfiguration.newProxyInfo</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>This function creates a new <a href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a> info object. It is used by CheerioCrawler and PuppeteerCrawler to generate proxy URLs and also to allow the user to inspect the currently used proxy via the requestHandler parameter <code>proxyInfo</code>. Use it if you want to work with a rich representation of a proxy URL. @@ -102,7 +102,7 @@ <p> All the HTTP requests going through the proxy with the same session identifier will use the same target proxy server (i.e. the same IP address). - The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Represents information about used proxy and its configuration.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newUrl"><span class="tsd-anchor-id" id="newUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L270" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>newUrl</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newUrl<span class="tsd-signature-symbol">(</span><span>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyConfiguration.newUrl</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a new proxy URL based on provided configuration options and the <code>sessionId</code> parameter.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>sessionId: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Represents the identifier of user Session that can be managed by the SessionPool or + The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Represents information about used proxy and its configuration.</p></div></div></div></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newUrl"><span class="tsd-anchor-id" id="newUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L270" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>newUrl</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>newUrl<span class="tsd-signature-symbol">(</span><span>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyConfiguration.newUrl</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Returns a new proxy URL based on provided configuration options and the <code>sessionId</code> parameter.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-optional">optional</span>sessionId: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Represents the identifier of user Session that can be managed by the SessionPool or you can use the Apify Proxy <a href="https://docs.apify.com/proxy#sessions" target="_blank" rel="noopener noreferrer">Session</a> identifier. When the provided sessionId is a number, it’s converted to a string.</p> @@ -110,7 +110,7 @@ will use the same target proxy server (i.e. the same IP address). The identifier must not be longer than 50 characters and include only the following: <code>0-9</code>, <code>a-z</code>, <code>A-Z</code>, <code>"."</code>, <code>"_"</code> and <code>"~"</code>.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span></h4><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>A string with a proxy URL, including authentication credentials and port number. For example, <code>http://bob:password123@proxy.example.com:8000</code></p></div></div></div></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/PlatformEventManager"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">PlatformEventManager</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/class/RequestQueue"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueue</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#isManInTheMiddle" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isManInTheMiddle</a></li><li><a href="#initialize" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> initialize</a></li><li><a href="#newProxyInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newProxyInfo</a></li><li><a href="#newUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> newUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/class/RequestQueue.html b/reference/next/class/RequestQueue.html index 9cb877fad2..d7f30511d2 100644 --- a/reference/next/class/RequestQueue.html +++ b/reference/next/class/RequestQueue.html @@ -93,7 +93,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -157,7 +157,7 @@ would return <code>null</code>, otherwise it resolves to <code>false</code>. Note that even if the queue is empty, there might be some pending requests currently being processed. If you need to ensure that there is no activity in the queue, use <a href="/sdk/js/reference/next/class/RequestQueue#isFinished">RequestQueue.isFinished</a>.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isFinished"><span class="tsd-anchor-id" id="isFinished"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L90" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>isFinished</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>isFinished<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">RequestProvider.isFinished</span></p></aside><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#markRequestHandled"><span class="tsd-anchor-id" id="markRequestHandled"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L94" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>markRequestHandled</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>markRequestHandled<span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span>request<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RequestQueueOperationInfo</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">RequestProvider.markRequestHandled</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-symbol">[</span>request<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RequestQueueOperationInfo</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#reclaimRequest"><span class="tsd-anchor-id" id="reclaimRequest"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L95" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>reclaimRequest</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>reclaimRequest<span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span>request<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">, </span>options<span class="tsd-signature-symbol">?: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a><span class="tsd-signature-symbol">]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RequestQueueOperationInfo</span><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">RequestProvider.reclaimRequest</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-symbol">[</span>request<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">Dictionary</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">, </span>options<span class="tsd-signature-symbol">?: </span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a><span class="tsd-signature-symbol">]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RequestQueueOperationInfo</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#open"><span class="tsd-anchor-id" id="open"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_queue.d.ts#L97" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-static">static</span><span class="tsd-flag tsd-flag-external">external</span>open</h3><div class="tsd-panel-content"><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>open<span class="tsd-signature-symbol">(</span><span><span class="tsd-signature-symbol">...</span>args<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span>queueIdOrName<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">StorageManagerOptions</span><span class="tsd-signature-symbol">]</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></li></ul></div><div class="tsd-panel-content"><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">RequestProvider.open</span></p></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-rest">rest</span><span class="tsd-signature-symbol">...</span>args: <span class="tsd-signature-symbol">[</span>queueIdOrName<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span>options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">StorageManagerOptions</span><span class="tsd-signature-symbol">]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a><span class="tsd-signature-symbol">></span></h4></li></ul></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/ProxyConfiguration"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfiguration</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/enum/LogLevel"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LogLevel</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#assumedHandledCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> assumedHandledCount</a></li><li><a href="#assumedTotalCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> assumedTotalCount</a></li><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#clientKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> clientKey</a></li><li><a href="#config" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> config</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#internalTimeoutMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> internalTimeoutMillis</a></li><li><a href="#log" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> log</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#requestLockSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestLockSecs</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li><li><a href="#addRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequest</a></li><li><a href="#addRequests" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequests</a></li><li><a href="#addRequestsBatched" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> addRequestsBatched</a></li><li><a href="#drop" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> drop</a></li><li><a href="#fetchNextRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> fetchNextRequest</a></li><li><a href="#getInfo" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getInfo</a></li><li><a href="#getRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> getRequest</a></li><li><a href="#handledCount" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> handledCount</a></li><li><a href="#isEmpty" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isEmpty</a></li><li><a href="#isFinished" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> isFinished</a></li><li><a href="#markRequestHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> markRequestHandled</a></li><li><a href="#reclaimRequest" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> reclaimRequest</a></li><li><a href="#open" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info);"></i> open</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/enum/LogLevel.html b/reference/next/enum/LogLevel.html index 3e29f16106..6abeb65895 100644 --- a/reference/next/enum/LogLevel.html +++ b/reference/next/enum/LogLevel.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/enum/LogLevel">LogLevel</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Enumerations</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>LogLevel<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Enumeration Members</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#DEBUG" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>DEBUG</a></li><li><a href="#ERROR" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>ERROR</a></li><li><a href="#INFO" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>INFO</a></li><li><a href="#OFF" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>OFF</a></li><li><a href="#PERF" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>PERF</a></li><li><a href="#SOFT_FAIL" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>SOFT_FAIL</a></li><li><a href="#WARNING" class="tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>WARNING</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Enumeration Members<!-- --> <a class="tsd-anchor" href="#Enumeration Members"><span class="tsd-anchor-id" id="Enumeration Members"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#DEBUG"><span class="tsd-anchor-id" id="DEBUG"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L7" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>DEBUG</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>DEBUG<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">5</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#ERROR"><span class="tsd-anchor-id" id="ERROR"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L3" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>ERROR</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>ERROR<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">1</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#INFO"><span class="tsd-anchor-id" id="INFO"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L6" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>INFO</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>INFO<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">4</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#OFF"><span class="tsd-anchor-id" id="OFF"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L2" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>OFF</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>OFF<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">0</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#PERF"><span class="tsd-anchor-id" id="PERF"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>PERF</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>PERF<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">6</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#SOFT_FAIL"><span class="tsd-anchor-id" id="SOFT_FAIL"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L4" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>SOFT_FAIL</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>SOFT_FAIL<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">2</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#WARNING"><span class="tsd-anchor-id" id="WARNING"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log_consts.d.ts#L5" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>WARNING</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success)"></i>WARNING<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">3</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/class/RequestQueue"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueue</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/AbortOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">AbortOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#DEBUG" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> DEBUG</a></li><li><a href="#ERROR" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> ERROR</a></li><li><a href="#INFO" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> INFO</a></li><li><a href="#OFF" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> OFF</a></li><li><a href="#PERF" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> PERF</a></li><li><a href="#SOFT_FAIL" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> SOFT_FAIL</a></li><li><a href="#WARNING" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-enum-member" style="color:var(--ifm-color-success);"></i> WARNING</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/AbortOptions.html b/reference/next/interface/AbortOptions.html index 9cdb28540a..b528ffbd88 100644 --- a/reference/next/interface/AbortOptions.html +++ b/reference/next/interface/AbortOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>AbortOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">RunAbortOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">AbortOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#gracefully" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#gracefully"><span class="tsd-anchor-id" id="gracefully"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/run.d.ts#L80" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>gracefully</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RunAbortOptions.gracefully</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1632" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1629" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/enum/LogLevel"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LogLevel</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ActorRun"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#gracefully" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> gracefully</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>AbortOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">RunAbortOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">AbortOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#gracefully" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#gracefully"><span class="tsd-anchor-id" id="gracefully"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/run.d.ts#L80" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>gracefully</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gracefully<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RunAbortOptions.gracefully</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1632" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1629" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/enum/LogLevel"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LogLevel</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ActorRun"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ActorRun</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#gracefully" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> gracefully</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ActorRun.html b/reference/next/interface/ActorRun.html index ebdb3b8ce4..6a7ffc438d 100644 --- a/reference/next/interface/ActorRun.html +++ b/reference/next/interface/ActorRun.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ActorRun<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ActorRunListItem</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ActorRun</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#buildId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildId</a></li><li><a href="#buildNumber" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildNumber</a></li><li><a href="#containerUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultRequestQueueId</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#finishedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>finishedAt</a></li><li><a href="#gitBranchName" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gitBranchName</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#isContainerServerReady" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isContainerServerReady</a></li><li><a href="#meta" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>meta</a></li><li><a href="#options" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>options</a></li><li><a href="#startedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt</a></li><li><a href="#stats" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats</a></li><li><a href="#status" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>status</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#usage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usage</a></li><li><a href="#usageTotalUsd" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usageTotalUsd</a></li><li><a href="#usageUsd" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usageUsd</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actId"><span class="tsd-anchor-id" id="actId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L172" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>actId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.actId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L173" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.actorTaskId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#buildId"><span class="tsd-anchor-id" id="buildId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L178" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>buildId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.buildId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#buildNumber"><span class="tsd-anchor-id" id="buildNumber"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L179" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>buildNumber</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>buildNumber<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.buildNumber</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerUrl"><span class="tsd-anchor-id" id="containerUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L191" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>containerUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultDatasetId"><span class="tsd-anchor-id" id="defaultDatasetId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L181" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultDatasetId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.defaultDatasetId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultKeyValueStoreId"><span class="tsd-anchor-id" id="defaultKeyValueStoreId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L180" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultKeyValueStoreId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.defaultKeyValueStoreId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultRequestQueueId"><span class="tsd-anchor-id" id="defaultRequestQueueId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L182" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>defaultRequestQueueId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultRequestQueueId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.defaultRequestQueueId</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L190" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#finishedAt"><span class="tsd-anchor-id" id="finishedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L175" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>finishedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>finishedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.finishedAt</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#gitBranchName"><span class="tsd-anchor-id" id="gitBranchName"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L193" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>gitBranchName</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>gitBranchName<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L171" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.id</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isContainerServerReady"><span class="tsd-anchor-id" id="isContainerServerReady"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L192" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>isContainerServerReady</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isContainerServerReady<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#meta"><span class="tsd-anchor-id" id="meta"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L177" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>meta</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>meta<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunMeta</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.meta</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#options"><span class="tsd-anchor-id" id="options"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L189" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>options</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>options<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunOptions</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L174" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.startedAt</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#stats"><span class="tsd-anchor-id" id="stats"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L188" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>stats</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>stats<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">ActorRunStats</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#status"><span class="tsd-anchor-id" id="status"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L176" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>status</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>status<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">READY</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">RUNNING</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">SUCCEEDED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">FAILED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ABORTING</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">ABORTED</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TIMING-OUT</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">TIMED-OUT</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.status</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L187" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#usage"><span class="tsd-anchor-id" id="usage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L194" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>usage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">ActorRunUsage</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#usageTotalUsd"><span class="tsd-anchor-id" id="usageTotalUsd"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L183" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>usageTotalUsd</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usageTotalUsd<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorRunListItem.usageTotalUsd</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#usageUsd"><span class="tsd-anchor-id" id="usageUsd"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L195" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>usageUsd</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>usageUsd<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">ActorRunUsage</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L186" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/AbortOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">AbortOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ApifyClientOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyClientOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#buildId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> buildId</a></li><li><a href="#buildNumber" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> buildNumber</a></li><li><a href="#containerUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerUrl</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultRequestQueueId</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#finishedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> finishedAt</a></li><li><a href="#gitBranchName" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> gitBranchName</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#isContainerServerReady" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isContainerServerReady</a></li><li><a href="#meta" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> meta</a></li><li><a href="#options" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> options</a></li><li><a href="#startedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> startedAt</a></li><li><a href="#stats" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> stats</a></li><li><a href="#status" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> status</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#usage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> usage</a></li><li><a href="#usageTotalUsd" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> usageTotalUsd</a></li><li><a href="#usageUsd" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> usageUsd</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ApifyClientOptions.html b/reference/next/interface/ApifyClientOptions.html index 21f999d494..361b085648 100644 --- a/reference/next/interface/ApifyClientOptions.html +++ b/reference/next/interface/ApifyClientOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>ApifyClientOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#baseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl</a></li><li><a href="#maxRetries" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxRetries</a></li><li><a href="#minDelayBetweenRetriesMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>minDelayBetweenRetriesMillis</a></li><li><a href="#requestInterceptors" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestInterceptors</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#baseUrl"><span class="tsd-anchor-id" id="baseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L127" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>baseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>baseUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">https://api.apify.com</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxRetries"><span class="tsd-anchor-id" id="maxRetries"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L129" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxRetries</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxRetries<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">8</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#minDelayBetweenRetriesMillis"><span class="tsd-anchor-id" id="minDelayBetweenRetriesMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L131" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>minDelayBetweenRetriesMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>minDelayBetweenRetriesMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">500</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestInterceptors"><span class="tsd-anchor-id" id="requestInterceptors"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L133" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>requestInterceptors</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestInterceptors<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ApifyRequestConfig</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-symbol">(</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ApifyRequestConfig</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">[]</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L135" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">360</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/apify_client.d.ts#L136" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ActorRun"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ActorRun</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ApifyEnv"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ApifyEnv</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#baseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> baseUrl</a></li><li><a href="#maxRetries" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxRetries</a></li><li><a href="#minDelayBetweenRetriesMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> minDelayBetweenRetriesMillis</a></li><li><a href="#requestInterceptors" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestInterceptors</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ApifyEnv.html b/reference/next/interface/ApifyEnv.html index 713243b88e..4f0217421d 100644 --- a/reference/next/interface/ApifyEnv.html +++ b/reference/next/interface/ApifyEnv.html @@ -11,19 +11,19 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ApifyEnv<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>Parsed representation of the Apify environment variables. -This object is returned by the <a href="/sdk/js/reference/next/class/Actor#getEnv">Actor.getEnv</a> function.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actorId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId</a></li><li><a href="#actorRunId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#memoryMbytes" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes</a></li><li><a href="#startedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt</a></li><li><a href="#timeoutAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutAt</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorId"><span class="tsd-anchor-id" id="actorId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1556" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>actorId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the actor (ACTOR_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorRunId"><span class="tsd-anchor-id" id="actorRunId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1561" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>actorRunId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the actor run (ACTOR_RUN_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1566" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the actor task (ACTOR_TASK_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultDatasetId"><span class="tsd-anchor-id" id="defaultDatasetId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1600" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>defaultDatasetId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the dataset where input and output data of this -actor is stored (ACTOR_DEFAULT_DATASET_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultKeyValueStoreId"><span class="tsd-anchor-id" id="defaultKeyValueStoreId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1594" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>defaultKeyValueStoreId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the key-value store where input and output data of this -actor is stored (ACTOR_DEFAULT_KEY_VALUE_STORE_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#memoryMbytes"><span class="tsd-anchor-id" id="memoryMbytes"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1606" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>memoryMbytes</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of memory allocated for the actor, -in megabytes (ACTOR_MEMORY_MBYTES)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1583" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor was started (ACTOR_STARTED_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutAt"><span class="tsd-anchor-id" id="timeoutAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1588" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>timeoutAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor will time out (ACTOR_TIMEOUT_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1578" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Authentication token representing privileges given to the actor run, -it can be passed to various Apify APIs (APIFY_TOKEN)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1572" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the user who started the actor - note that it might be +This object is returned by the <a href="/sdk/js/reference/next/class/Actor#getEnv">Actor.getEnv</a> function.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actorId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId</a></li><li><a href="#actorRunId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#memoryMbytes" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes</a></li><li><a href="#startedAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt</a></li><li><a href="#timeoutAt" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutAt</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorId"><span class="tsd-anchor-id" id="actorId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1556" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>actorId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the actor (ACTOR_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorRunId"><span class="tsd-anchor-id" id="actorRunId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1561" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>actorRunId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the actor run (ACTOR_RUN_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1566" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the actor task (ACTOR_TASK_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultDatasetId"><span class="tsd-anchor-id" id="defaultDatasetId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1600" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>defaultDatasetId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the dataset where input and output data of this +actor is stored (ACTOR_DEFAULT_DATASET_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultKeyValueStoreId"><span class="tsd-anchor-id" id="defaultKeyValueStoreId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1594" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>defaultKeyValueStoreId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the key-value store where input and output data of this +actor is stored (ACTOR_DEFAULT_KEY_VALUE_STORE_ID)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#memoryMbytes"><span class="tsd-anchor-id" id="memoryMbytes"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1606" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>memoryMbytes</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of memory allocated for the actor, +in megabytes (ACTOR_MEMORY_MBYTES)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#startedAt"><span class="tsd-anchor-id" id="startedAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1583" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>startedAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>startedAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor was started (ACTOR_STARTED_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutAt"><span class="tsd-anchor-id" id="timeoutAt"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1588" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>timeoutAt</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutAt<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Date</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Date when the actor will time out (ACTOR_TIMEOUT_AT)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1578" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Authentication token representing privileges given to the actor run, +it can be passed to various Apify APIs (APIFY_TOKEN)</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1572" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>ID of the user who started the actor - note that it might be different than the owner ofthe actor (APIFY_USER_ID)</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ApifyClientOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyClientOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/CallOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CallOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actorId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorId</a></li><li><a href="#actorRunId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorRunId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#memoryMbytes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memoryMbytes</a></li><li><a href="#startedAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> startedAt</a></li><li><a href="#timeoutAt" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutAt</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/CallOptions.html b/reference/next/interface/CallOptions.html index be1e0aff6e..1401fb35b1 100644 --- a/reference/next/interface/CallOptions.html +++ b/reference/next/interface/CallOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -22,10 +22,10 @@ This is used by pay per result actors to limit the maximum number of results that will be charged to customer. Value can be accessed in actor run using <code>ACTOR_MAX_PAID_DATASET_ITEMS</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#memory"><span class="tsd-anchor-id" id="memory"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L141" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>memory</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memory<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.memory</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Memory in megabytes which will be allocated for the new actor run. If not provided, the run uses memory of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeout"><span class="tsd-anchor-id" id="timeout"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L146" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>timeout</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeout<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.timeout</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Timeout for the actor run in seconds. Zero value means there is no timeout. -If not provided, the run uses timeout of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1615" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#waitSecs"><span class="tsd-anchor-id" id="waitSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L168" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>waitSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>waitSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.waitSecs</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used +If not provided, the run uses timeout of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1615" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#waitSecs"><span class="tsd-anchor-id" id="waitSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L168" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>waitSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>waitSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.waitSecs</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ActorCallOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed, see <a href="https://docs.apify.com/webhooks/ad-hoc-webhooks" target="_blank" rel="noopener noreferrer">ad hook webhooks documentation</a> for detailed description.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ApifyEnv"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ApifyEnv</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/CallTaskOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">CallTaskOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li><li><a href="#maxItems" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxItems</a></li><li><a href="#memory" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memory</a></li><li><a href="#timeout" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeout</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#waitSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> waitSecs</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/CallTaskOptions.html b/reference/next/interface/CallTaskOptions.html index cd729d401d..f775deadf4 100644 --- a/reference/next/interface/CallTaskOptions.html +++ b/reference/next/interface/CallTaskOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,10 +19,10 @@ This is used by pay per result actors to limit the maximum number of results that will be charged to customer. Value can be accessed in actor run using <code>ACTOR_MAX_PAID_DATASET_ITEMS</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#memory"><span class="tsd-anchor-id" id="memory"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L141" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>memory</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memory<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.memory</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Memory in megabytes which will be allocated for the new actor run. If not provided, the run uses memory of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeout"><span class="tsd-anchor-id" id="timeout"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L146" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>timeout</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeout<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.timeout</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Timeout for the actor run in seconds. Zero value means there is no timeout. -If not provided, the run uses timeout of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1622" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#waitSecs"><span class="tsd-anchor-id" id="waitSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/task.d.ts#L86" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>waitSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>waitSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.waitSecs</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used +If not provided, the run uses timeout of the default actor run configuration.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1622" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User API token that is used to run the actor. By default, it is taken from the <code>APIFY_TOKEN</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#waitSecs"><span class="tsd-anchor-id" id="waitSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/task.d.ts#L86" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>waitSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>waitSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.waitSecs</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#webhooks"><span class="tsd-anchor-id" id="webhooks"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/apify-client/src/resource_clients/actor.d.ts#L159" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>webhooks</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>webhooks<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookUpdateData</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">TaskCallOptions.webhooks</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed, see <a href="https://docs.apify.com/webhooks/ad-hoc-webhooks" target="_blank" rel="noopener noreferrer">ad hook webhooks documentation</a> for detailed description.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/CallOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CallOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ConfigurationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#maxItems" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxItems</a></li><li><a href="#memory" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memory</a></li><li><a href="#timeout" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeout</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#waitSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> waitSecs</a></li><li><a href="#webhooks" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> webhooks</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ConfigurationOptions.html b/reference/next/interface/ConfigurationOptions.html index c2097419ad..c15a3d31a6 100644 --- a/reference/next/interface/ConfigurationOptions.html +++ b/reference/next/interface/ConfigurationOptions.html @@ -9,17 +9,17 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ConfigurationOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ConfigurationOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ConfigurationOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actorEventsWsUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorEventsWsUrl</a></li><li><a href="#actorId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId</a></li><li><a href="#actorRunId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#apiBaseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apiBaseUrl</a></li><li><a href="#availableMemoryRatio" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>availableMemoryRatio</a></li><li><a href="#chromeExecutablePath" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>chromeExecutablePath</a></li><li><a href="#containerPort" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerPort</a></li><li><a href="#containerUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl</a></li><li><a href="#defaultBrowserPath" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultBrowserPath</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultRequestQueueId</a></li><li><a href="#disableBrowserSandbox" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>disableBrowserSandbox</a></li><li><a href="#eventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>eventManager</a></li><li><a href="#headless" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>headless</a></li><li><a href="#inputKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputKey</a></li><li><a href="#inputSecretsPrivateKeyFile" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyFile</a></li><li><a href="#inputSecretsPrivateKeyPassphrase" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyPassphrase</a></li><li><a href="#isAtHome" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isAtHome</a></li><li><a href="#logLevel" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logLevel</a></li><li><a href="#maxUsedCpuRatio" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxUsedCpuRatio</a></li><li><a href="#memoryMbytes" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes</a></li><li><a href="#metamorphAfterSleepMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>metamorphAfterSleepMillis</a></li><li><a href="#persistStateIntervalMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStateIntervalMillis</a></li><li><a href="#persistStorage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStorage</a></li><li><a href="#proxyHostname" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyHostname</a></li><li><a href="#proxyPassword" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPassword</a></li><li><a href="#proxyPort" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPort</a></li><li><a href="#proxyStatusUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyStatusUrl</a></li><li><a href="#purgeOnStart" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>purgeOnStart</a></li><li><a href="#storageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageClient</a></li><li><a href="#storageClientOptions" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageClientOptions</a></li><li><a href="#systemInfoIntervalMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>systemInfoIntervalMillis</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li><li><a href="#xvfb" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>xvfb</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorEventsWsUrl"><span class="tsd-anchor-id" id="actorEventsWsUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorEventsWsUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorEventsWsUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorId"><span class="tsd-anchor-id" id="actorId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L14" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorRunId"><span class="tsd-anchor-id" id="actorRunId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L15" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorRunId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L16" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apiBaseUrl"><span class="tsd-anchor-id" id="apiBaseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L17" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>apiBaseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apiBaseUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#availableMemoryRatio"><span class="tsd-anchor-id" id="availableMemoryRatio"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L67" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>availableMemoryRatio</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>availableMemoryRatio<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">0.25</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.availableMemoryRatio</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the ratio, defining the amount of system memory that could be used by the AutoscaledPool. +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ConfigurationOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ConfigurationOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ConfigurationOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#actorEventsWsUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorEventsWsUrl</a></li><li><a href="#actorId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId</a></li><li><a href="#actorRunId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId</a></li><li><a href="#actorTaskId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId</a></li><li><a href="#apiBaseUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apiBaseUrl</a></li><li><a href="#availableMemoryRatio" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>availableMemoryRatio</a></li><li><a href="#chromeExecutablePath" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>chromeExecutablePath</a></li><li><a href="#containerPort" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerPort</a></li><li><a href="#containerUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl</a></li><li><a href="#defaultBrowserPath" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultBrowserPath</a></li><li><a href="#defaultDatasetId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultRequestQueueId</a></li><li><a href="#disableBrowserSandbox" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>disableBrowserSandbox</a></li><li><a href="#eventManager" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>eventManager</a></li><li><a href="#headless" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>headless</a></li><li><a href="#inputKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputKey</a></li><li><a href="#inputSecretsPrivateKeyFile" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyFile</a></li><li><a href="#inputSecretsPrivateKeyPassphrase" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyPassphrase</a></li><li><a href="#isAtHome" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isAtHome</a></li><li><a href="#logLevel" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logLevel</a></li><li><a href="#maxUsedCpuRatio" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxUsedCpuRatio</a></li><li><a href="#memoryMbytes" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes</a></li><li><a href="#metamorphAfterSleepMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>metamorphAfterSleepMillis</a></li><li><a href="#persistStateIntervalMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStateIntervalMillis</a></li><li><a href="#persistStorage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStorage</a></li><li><a href="#proxyHostname" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyHostname</a></li><li><a href="#proxyPassword" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPassword</a></li><li><a href="#proxyPort" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPort</a></li><li><a href="#proxyStatusUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyStatusUrl</a></li><li><a href="#purgeOnStart" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>purgeOnStart</a></li><li><a href="#storageClient" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageClient</a></li><li><a href="#storageClientOptions" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageClientOptions</a></li><li><a href="#systemInfoIntervalMillis" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>systemInfoIntervalMillis</a></li><li><a href="#token" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token</a></li><li><a href="#userId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId</a></li><li><a href="#xvfb" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>xvfb</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorEventsWsUrl"><span class="tsd-anchor-id" id="actorEventsWsUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorEventsWsUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorEventsWsUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorId"><span class="tsd-anchor-id" id="actorId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L14" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorRunId"><span class="tsd-anchor-id" id="actorRunId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L15" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorRunId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorRunId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#actorTaskId"><span class="tsd-anchor-id" id="actorTaskId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L16" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>actorTaskId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>actorTaskId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apiBaseUrl"><span class="tsd-anchor-id" id="apiBaseUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L17" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>apiBaseUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apiBaseUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#availableMemoryRatio"><span class="tsd-anchor-id" id="availableMemoryRatio"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L67" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>availableMemoryRatio</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>availableMemoryRatio<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">0.25</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.availableMemoryRatio</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the ratio, defining the amount of system memory that could be used by the AutoscaledPool. When the memory usage is more than the provided ratio, the memory is considered overloaded.</p> <p>Alternative to <code>CRAWLEE_AVAILABLE_MEMORY_RATIO</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#chromeExecutablePath"><span class="tsd-anchor-id" id="chromeExecutablePath"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L114" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>chromeExecutablePath</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>chromeExecutablePath<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.chromeExecutablePath</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines a path to Chrome executable.</p> -<p>Alternative to <code>CRAWLEE_CHROME_EXECUTABLE_PATH</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerPort"><span class="tsd-anchor-id" id="containerPort"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L18" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>containerPort</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerPort<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerUrl"><span class="tsd-anchor-id" id="containerUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L19" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>containerUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultBrowserPath"><span class="tsd-anchor-id" id="defaultBrowserPath"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L120" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultBrowserPath</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultBrowserPath<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.defaultBrowserPath</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines a path to default browser executable.</p> +<p>Alternative to <code>CRAWLEE_CHROME_EXECUTABLE_PATH</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerPort"><span class="tsd-anchor-id" id="containerPort"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L18" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>containerPort</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerPort<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#containerUrl"><span class="tsd-anchor-id" id="containerUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L19" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>containerUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>containerUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultBrowserPath"><span class="tsd-anchor-id" id="defaultBrowserPath"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L120" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultBrowserPath</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultBrowserPath<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.defaultBrowserPath</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines a path to default browser executable.</p> <p>Alternative to <code>CRAWLEE_DEFAULT_BROWSER_PATH</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#defaultDatasetId"><span class="tsd-anchor-id" id="defaultDatasetId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L32" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>defaultDatasetId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>defaultDatasetId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">'default'</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.defaultDatasetId</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Default dataset id.</p> @@ -34,23 +34,23 @@ <p>Alternative to <code>CRAWLEE_HEADLESS</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#inputKey"><span class="tsd-anchor-id" id="inputKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L94" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>inputKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputKey<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">'INPUT'</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.inputKey</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the default input key, i.e. the key that is used to get the crawler input value from the default <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> associated with the current crawler run.</p> -<p>Alternative to <code>CRAWLEE_INPUT_KEY</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#inputSecretsPrivateKeyFile"><span class="tsd-anchor-id" id="inputSecretsPrivateKeyFile"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L27" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>inputSecretsPrivateKeyFile</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyFile<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#inputSecretsPrivateKeyPassphrase"><span class="tsd-anchor-id" id="inputSecretsPrivateKeyPassphrase"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L26" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>inputSecretsPrivateKeyPassphrase</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyPassphrase<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isAtHome"><span class="tsd-anchor-id" id="isAtHome"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L24" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>isAtHome</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isAtHome<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logLevel"><span class="tsd-anchor-id" id="logLevel"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L133" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>logLevel</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logLevel<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Enumeration" href="/sdk/js/reference/next/enum/LogLevel">LogLevel</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> = <a class="tsd-signature-type" data-tsd-kind="Enumeration" href="/sdk/js/reference/next/enum/LogLevel">LogLevel</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.logLevel</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the log level to the given value.</p> +<p>Alternative to <code>CRAWLEE_INPUT_KEY</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#inputSecretsPrivateKeyFile"><span class="tsd-anchor-id" id="inputSecretsPrivateKeyFile"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L27" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>inputSecretsPrivateKeyFile</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyFile<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#inputSecretsPrivateKeyPassphrase"><span class="tsd-anchor-id" id="inputSecretsPrivateKeyPassphrase"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L26" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>inputSecretsPrivateKeyPassphrase</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>inputSecretsPrivateKeyPassphrase<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#isAtHome"><span class="tsd-anchor-id" id="isAtHome"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L24" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>isAtHome</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>isAtHome<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logLevel"><span class="tsd-anchor-id" id="logLevel"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L133" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>logLevel</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logLevel<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Enumeration" href="/sdk/js/reference/next/enum/LogLevel">LogLevel</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> = <a class="tsd-signature-type" data-tsd-kind="Enumeration" href="/sdk/js/reference/next/enum/LogLevel">LogLevel</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>radix<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>fractionDigits<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span>precision<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">{ </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span><span class="tsd-signature-symbol">(</span><span>locales<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">LocalesArgument</span></span><span class="tsd-signature-symbol">, </span><span>options<span class="tsd-signature-symbol">?<!-- -->: </span><span class="tsd-signature-type">NumberFormatOptions</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.logLevel</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the log level to the given value.</p> <p>Alternative to <code>CRAWLEE_LOG_LEVEL</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxUsedCpuRatio"><span class="tsd-anchor-id" id="maxUsedCpuRatio"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L59" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxUsedCpuRatio</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxUsedCpuRatio<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">0.95</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.maxUsedCpuRatio</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the ratio, defining the maximum CPU usage. When the CPU usage is higher than the provided ratio, the CPU is considered overloaded.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#memoryMbytes"><span class="tsd-anchor-id" id="memoryMbytes"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L74" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>memoryMbytes</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>memoryMbytes<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.memoryMbytes</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the amount of system memory in megabytes to be used by the AutoscaledPool. By default, the maximum memory is set to one quarter of total system memory.</p> -<p>Alternative to <code>CRAWLEE_MEMORY_MBYTES</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#metamorphAfterSleepMillis"><span class="tsd-anchor-id" id="metamorphAfterSleepMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L11" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>metamorphAfterSleepMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>metamorphAfterSleepMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#persistStateIntervalMillis"><span class="tsd-anchor-id" id="persistStateIntervalMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L81" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>persistStateIntervalMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStateIntervalMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">60_000</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.persistStateIntervalMillis</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the interval of emitting the <code>persistState</code> event.</p> +<p>Alternative to <code>CRAWLEE_MEMORY_MBYTES</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#metamorphAfterSleepMillis"><span class="tsd-anchor-id" id="metamorphAfterSleepMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L11" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>metamorphAfterSleepMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>metamorphAfterSleepMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#persistStateIntervalMillis"><span class="tsd-anchor-id" id="persistStateIntervalMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L81" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>persistStateIntervalMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStateIntervalMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">60_000</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.persistStateIntervalMillis</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the interval of emitting the <code>persistState</code> event.</p> <p>Alternative to <code>CRAWLEE_PERSIST_STATE_INTERVAL_MILLIS</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#persistStorage"><span class="tsd-anchor-id" id="persistStorage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L139" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>persistStorage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>persistStorage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.persistStorage</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether the storage client used should persist the data it stores.</p> -<p>Alternative to <code>CRAWLEE_PERSIST_STORAGE</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyHostname"><span class="tsd-anchor-id" id="proxyHostname"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L20" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyHostname</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyHostname<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyPassword"><span class="tsd-anchor-id" id="proxyPassword"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L21" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyPassword</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPassword<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyPort"><span class="tsd-anchor-id" id="proxyPort"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L22" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyPort</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPort<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyStatusUrl"><span class="tsd-anchor-id" id="proxyStatusUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L23" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyStatusUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyStatusUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#purgeOnStart"><span class="tsd-anchor-id" id="purgeOnStart"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L39" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>purgeOnStart</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>purgeOnStart<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">true</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.purgeOnStart</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether to purge the default storage folders before starting the crawler run.</p> +<p>Alternative to <code>CRAWLEE_PERSIST_STORAGE</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyHostname"><span class="tsd-anchor-id" id="proxyHostname"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L20" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyHostname</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyHostname<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyPassword"><span class="tsd-anchor-id" id="proxyPassword"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L21" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyPassword</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPassword<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyPort"><span class="tsd-anchor-id" id="proxyPort"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L22" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyPort</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyPort<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyStatusUrl"><span class="tsd-anchor-id" id="proxyStatusUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L23" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>proxyStatusUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyStatusUrl<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#purgeOnStart"><span class="tsd-anchor-id" id="purgeOnStart"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L39" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>purgeOnStart</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>purgeOnStart<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">true</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.purgeOnStart</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether to purge the default storage folders before starting the crawler run.</p> <p>Alternative to <code>CRAWLEE_PURGE_ON_START</code> environment variable.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storageClient"><span class="tsd-anchor-id" id="storageClient"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L15" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>storageClient</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageClient<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">StorageClient</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.storageClient</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines storage client to be used.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storageClientOptions"><span class="tsd-anchor-id" id="storageClientOptions"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L25" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>storageClientOptions</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storageClientOptions<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">Dictionary</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.storageClientOptions</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Could be used to adjust the storage client behavior -e.g. MemoryStorageOptions could be used to adjust the MemoryStorage behavior.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#systemInfoIntervalMillis"><span class="tsd-anchor-id" id="systemInfoIntervalMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L86" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>systemInfoIntervalMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>systemInfoIntervalMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">60_000</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.systemInfoIntervalMillis</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the interval of emitting the <code>systemInfo</code> event.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L13" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/configuration.ts#L25" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#xvfb"><span class="tsd-anchor-id" id="xvfb"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L108" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>xvfb</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>xvfb<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.xvfb</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether to run X virtual framebuffer on the web browsers launched by Crawlee.</p> +e.g. MemoryStorageOptions could be used to adjust the MemoryStorage behavior.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#systemInfoIntervalMillis"><span class="tsd-anchor-id" id="systemInfoIntervalMillis"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L86" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>systemInfoIntervalMillis</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>systemInfoIntervalMillis<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">60_000</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.systemInfoIntervalMillis</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines the interval of emitting the <code>systemInfo</code> event.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#token"><span class="tsd-anchor-id" id="token"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L13" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>token</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>token<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#userId"><span class="tsd-anchor-id" id="userId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/configuration.ts#L25" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>userId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>userId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#xvfb"><span class="tsd-anchor-id" id="xvfb"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/configuration.d.ts#L108" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>xvfb</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>xvfb<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreConfigurationOptions.xvfb</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Defines whether to run X virtual framebuffer on the web browsers launched by Crawlee.</p> <p>Alternative to <code>CRAWLEE_XVFB</code> environment variable.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/CallTaskOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">CallTaskOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#actorEventsWsUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorEventsWsUrl</a></li><li><a href="#actorId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorId</a></li><li><a href="#actorRunId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorRunId</a></li><li><a href="#actorTaskId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> actorTaskId</a></li><li><a href="#apiBaseUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apiBaseUrl</a></li><li><a href="#availableMemoryRatio" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> availableMemoryRatio</a></li><li><a href="#chromeExecutablePath" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> chromeExecutablePath</a></li><li><a href="#containerPort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerPort</a></li><li><a href="#containerUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> containerUrl</a></li><li><a href="#defaultBrowserPath" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultBrowserPath</a></li><li><a href="#defaultDatasetId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultDatasetId</a></li><li><a href="#defaultKeyValueStoreId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultKeyValueStoreId</a></li><li><a href="#defaultRequestQueueId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> defaultRequestQueueId</a></li><li><a href="#disableBrowserSandbox" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> disableBrowserSandbox</a></li><li><a href="#eventManager" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventManager</a></li><li><a href="#headless" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> headless</a></li><li><a href="#inputKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputKey</a></li><li><a href="#inputSecretsPrivateKeyFile" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputSecretsPrivateKeyFile</a></li><li><a href="#inputSecretsPrivateKeyPassphrase" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> inputSecretsPrivateKeyPassphrase</a></li><li><a href="#isAtHome" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> isAtHome</a></li><li><a href="#logLevel" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logLevel</a></li><li><a href="#maxUsedCpuRatio" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxUsedCpuRatio</a></li><li><a href="#memoryMbytes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> memoryMbytes</a></li><li><a href="#metamorphAfterSleepMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> metamorphAfterSleepMillis</a></li><li><a href="#persistStateIntervalMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> persistStateIntervalMillis</a></li><li><a href="#persistStorage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> persistStorage</a></li><li><a href="#proxyHostname" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyHostname</a></li><li><a href="#proxyPassword" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyPassword</a></li><li><a href="#proxyPort" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyPort</a></li><li><a href="#proxyStatusUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyStatusUrl</a></li><li><a href="#purgeOnStart" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> purgeOnStart</a></li><li><a href="#storageClient" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageClient</a></li><li><a href="#storageClientOptions" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storageClientOptions</a></li><li><a href="#systemInfoIntervalMillis" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> systemInfoIntervalMillis</a></li><li><a href="#token" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> token</a></li><li><a href="#userId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> userId</a></li><li><a href="#xvfb" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> xvfb</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetConsumer.html b/reference/next/interface/DatasetConsumer.html index 18ec1b62aa..64e44fece1 100644 --- a/reference/next/interface/DatasetConsumer.html +++ b/reference/next/interface/DatasetConsumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetConsumer<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetConsumer<span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ConfigurationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetContent"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetContent</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetContent.html b/reference/next/interface/DatasetContent.html index 24fc004817..c39829a3da 100644 --- a/reference/next/interface/DatasetContent.html +++ b/reference/next/interface/DatasetContent.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetContent<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#count" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>count</a></li><li><a href="#desc" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc</a></li><li><a href="#items" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>items</a></li><li><a href="#limit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit</a></li><li><a href="#offset" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset</a></li><li><a href="#total" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>total</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#count"><span class="tsd-anchor-id" id="count"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L376" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>count</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>count<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Count of dataset entries returned in this set.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#desc"><span class="tsd-anchor-id" id="desc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L384" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>desc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Should the results be in descending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#items"><span class="tsd-anchor-id" id="items"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L382" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>items</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>items<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type tsd-signature-type-generic">Data</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Dataset entries based on chosen format parameter.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#limit"><span class="tsd-anchor-id" id="limit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L380" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>limit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Maximum number of dataset entries requested.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#offset"><span class="tsd-anchor-id" id="offset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L378" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>offset</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of the first returned entry in the dataset.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#total"><span class="tsd-anchor-id" id="total"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L374" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>total</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>total<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Total count of entries in the dataset.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetConsumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetDataOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetDataOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#count" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> count</a></li><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#items" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> items</a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> limit</a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> offset</a></li><li><a href="#total" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> total</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetDataOptions.html b/reference/next/interface/DatasetDataOptions.html index 7af9358fcf..880a7d1819 100644 --- a/reference/next/interface/DatasetDataOptions.html +++ b/reference/next/interface/DatasetDataOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -19,7 +19,7 @@ Otherwise they are sorted in ascending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fields"><span class="tsd-anchor-id" id="fields"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>fields</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of field names that will be included in the result. If omitted, all fields are included in the results.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#limit"><span class="tsd-anchor-id" id="limit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L34" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>limit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>limit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">250000</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Maximum number of array elements to return.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#offset"><span class="tsd-anchor-id" id="offset"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L29" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>offset</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>offset<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">0</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Number of array elements that should be skipped at the start.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#skipEmpty"><span class="tsd-anchor-id" id="skipEmpty"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L66" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>skipEmpty</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>skipEmpty<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the function doesn’t return empty items. Note that in this case the returned number of items might be lower than limit parameter and pagination must be done using the <code>limit</code> value.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#skipHidden"><span class="tsd-anchor-id" id="skipHidden"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>skipHidden</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>skipHidden<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the function doesn’t return hidden fields (fields starting with “#” character).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#unwind"><span class="tsd-anchor-id" id="unwind"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>unwind</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default, the results are returned as they are.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetContent"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetContent</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetIteratorOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetIteratorOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#clean" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> clean</a></li><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#fields" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> fields</a></li><li><a href="#limit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> limit</a></li><li><a href="#offset" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> offset</a></li><li><a href="#skipEmpty" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> skipEmpty</a></li><li><a href="#skipHidden" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> skipHidden</a></li><li><a href="#unwind" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> unwind</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetIteratorOptions.html b/reference/next/interface/DatasetIteratorOptions.html index 688faded55..38a1ac9ea4 100644 --- a/reference/next/interface/DatasetIteratorOptions.html +++ b/reference/next/interface/DatasetIteratorOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetIteratorOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">Omit</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">offset</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">limit</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">clean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">skipHidden</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">skipEmpty</span><span class="tsd-signature-symbol">></span><ul class="tsd-hierarchy"><li><em class="tsd-target">DatasetIteratorOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#desc" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc</a></li><li><a href="#fields" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields</a></li><li><a href="#unwind" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#desc"><span class="tsd-anchor-id" id="desc"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L40" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>desc</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>desc<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.desc</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If <code>true</code> then the objects are sorted by <code>createdAt</code> in descending order. Otherwise they are sorted in ascending order.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#fields"><span class="tsd-anchor-id" id="fields"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>fields</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>fields<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.fields</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of field names that will be included in the result. If omitted, all fields are included in the results.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#unwind"><span class="tsd-anchor-id" id="unwind"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L49" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>unwind</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>unwind<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">Omit.unwind</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a name of the field in the result objects that will be used to unwind the resulting objects. By default, the results are returned as they are.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetDataOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetDataOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetMapper"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetMapper</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#desc" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> desc</a></li><li><a href="#fields" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> fields</a></li><li><a href="#unwind" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> unwind</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetMapper.html b/reference/next/interface/DatasetMapper.html index b418ac98bb..476270ad81 100644 --- a/reference/next/interface/DatasetMapper.html +++ b/reference/next/interface/DatasetMapper.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetMapper<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>Data<span class="tsd-signature-symbol">, </span>R<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetMapper<span class="tsd-signature-symbol">(</span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">R</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User-function used in the <code>Dataset.map()</code> API.</p></div></div></div><hr class="tsd-divider"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">R</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetIteratorOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetIteratorOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetOptions.html b/reference/next/interface/DatasetOptions.html index c4578209ed..843a6afe6f 100644 --- a/reference/next/interface/DatasetOptions.html +++ b/reference/next/interface/DatasetOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L370" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L368" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/dataset.d.ts#L369" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetMapper"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetMapper</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/DatasetReducer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">DatasetReducer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/DatasetReducer.html b/reference/next/interface/DatasetReducer.html index a334369db4..2993b53dff 100644 --- a/reference/next/interface/DatasetReducer.html +++ b/reference/next/interface/DatasetReducer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>DatasetReducer<!-- --> <span class="tsd-generics"><span class="tsd-signature-symbol"><</span>T<span class="tsd-signature-symbol">, </span>Data<span class="tsd-signature-symbol">></span></span></h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>DatasetReducer<span class="tsd-signature-symbol">(</span><span>memo<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">T</span></span><span class="tsd-signature-symbol">, </span><span>item<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type tsd-signature-type-generic">Data</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>memo: <span class="tsd-signature-type tsd-signature-type-generic">T</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Previous state of the reduction.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>item: <span class="tsd-signature-type tsd-signature-type-generic">Data</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> entry being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of current <a href="/sdk/js/reference/next/class/Dataset">Dataset</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-signature-type-generic">T</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ExitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ExitOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ExitOptions.html b/reference/next/interface/ExitOptions.html index b7ae8f4804..bfc2e37dd6 100644 --- a/reference/next/interface/ExitOptions.html +++ b/reference/next/interface/ExitOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ExitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">ExitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1701" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1699" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1692" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1697" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetReducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/InitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">InitOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ExitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">ExitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1701" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1699" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1692" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1697" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/DatasetReducer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">DatasetReducer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/InitOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">InitOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/InitOptions.html b/reference/next/interface/InitOptions.html index f4e6e0b03a..cb1db73753 100644 --- a/reference/next/interface/InitOptions.html +++ b/reference/next/interface/InitOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>InitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">InitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1543" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ExitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ExitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/KeyConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>InitOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><em class="tsd-target">InitOptions</em><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1543" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ExitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ExitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/KeyConsumer"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyConsumer</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/KeyConsumer.html b/reference/next/interface/KeyConsumer.html index fe782d4513..4c0238edd2 100644 --- a/reference/next/interface/KeyConsumer.html +++ b/reference/next/interface/KeyConsumer.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyConsumer<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header tsd-before-signature">Callable</h3><div class="tsd-panel-content"><div><ul class="tsd-signatures"><li class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-method" style="color:var(--ifm-color-info)"></i>KeyConsumer<span class="tsd-signature-symbol">(</span><span>key<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></span><span class="tsd-signature-symbol">, </span><span>index<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol">, </span><span>info<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span><span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol"> }</span></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></li></ul></div><hr class="tsd-divider"><div><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag tsd-flag-external">external</span>key: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Current <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> key being processed.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>index: <span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Position of the current key in <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a>.</p></div></div></div></li><li><h5><span class="tsd-flag tsd-flag-external">external</span>info: <span class="tsd-signature-symbol">{ </span><span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></span><span class="tsd-signature-symbol"> }</span></h5><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Information about the current <a href="/sdk/js/reference/next/class/KeyValueStore">KeyValueStore</a> entry.</p></div></div></div></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Awaitable</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">></span></h4></li></ul></div></div></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/InitOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">InitOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStoreIteratorOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/KeyValueStoreIteratorOptions.html b/reference/next/interface/KeyValueStoreIteratorOptions.html index e6511757fe..5de95e4977 100644 --- a/reference/next/interface/KeyValueStoreIteratorOptions.html +++ b/reference/next/interface/KeyValueStoreIteratorOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyValueStoreIteratorOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exclusiveStartKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exclusiveStartKey</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exclusiveStartKey"><span class="tsd-anchor-id" id="exclusiveStartKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L378" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>exclusiveStartKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exclusiveStartKey<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>All keys up to this one (including) are skipped from the result.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/KeyConsumer"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyConsumer</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/KeyValueStoreOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">KeyValueStoreOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exclusiveStartKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exclusiveStartKey</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/KeyValueStoreOptions.html b/reference/next/interface/KeyValueStoreOptions.html index 377f1f90fa..de5ac2625d 100644 --- a/reference/next/interface/KeyValueStoreOptions.html +++ b/reference/next/interface/KeyValueStoreOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>KeyValueStoreOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L366" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L364" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L365" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStoreIteratorOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/LoggerOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">LoggerOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/LoggerOptions.html b/reference/next/interface/LoggerOptions.html index fd362fb0f2..bc2a5ae03f 100644 --- a/reference/next/interface/LoggerOptions.html +++ b/reference/next/interface/LoggerOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>LoggerOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#data" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>data</a></li><li><a href="#level" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>level</a></li><li><a href="#logger" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger</a></li><li><a href="#maxDepth" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxDepth</a></li><li><a href="#maxStringLength" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxStringLength</a></li><li><a href="#prefix" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>prefix</a></li><li><a href="#suffix" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>suffix</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#data"><span class="tsd-anchor-id" id="data"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L23" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>data</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>data<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Additional data to be added to each log line.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#level"><span class="tsd-anchor-id" id="level"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L8" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>level</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>level<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Sets the log level to the given value, preventing messages from less important log levels from being printed to the console. Use in conjunction with the <code>log.LEVELS</code> constants.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#logger"><span class="tsd-anchor-id" id="logger"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L21" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>logger</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>logger<span class="tsd-signature-symbol">?<!-- -->: </span> <a class="tsd-signature-type" data-tsd-kind="Class" href="/sdk/js/reference/next/class/Logger">Logger</a></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Logger implementation to be used. Default one is log.LoggerText to log messages as easily readable strings. Optionally you can use <code>log.LoggerJson</code> that formats each log line as a JSON.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxDepth"><span class="tsd-anchor-id" id="maxDepth"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L10" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxDepth</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxDepth<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Max depth of data object that will be logged. Anything deeper than the limit will be stripped off.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#maxStringLength"><span class="tsd-anchor-id" id="maxStringLength"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L12" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>maxStringLength</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>maxStringLength<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Max length of the string to be logged. Longer strings will be truncated.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#prefix"><span class="tsd-anchor-id" id="prefix"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L14" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>prefix</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>prefix<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Prefix to be prepended the each logged line.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#suffix"><span class="tsd-anchor-id" id="suffix"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@apify/log/log.d.ts#L16" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>suffix</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>suffix<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Suffix that will be appended the each logged line.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/KeyValueStoreOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">KeyValueStoreOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/MainOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MainOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#data" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> data</a></li><li><a href="#level" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> level</a></li><li><a href="#logger" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> logger</a></li><li><a href="#maxDepth" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxDepth</a></li><li><a href="#maxStringLength" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> maxStringLength</a></li><li><a href="#prefix" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> prefix</a></li><li><a href="#suffix" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> suffix</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/MainOptions.html b/reference/next/interface/MainOptions.html index 87e9a5e350..f153403a46 100644 --- a/reference/next/interface/MainOptions.html +++ b/reference/next/interface/MainOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>MainOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a><ul class="tsd-hierarchy"><li><em class="tsd-target">MainOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1701" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exit</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1699" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exitCode</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1692" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.statusMessage</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1543" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">InitOptions.storage</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1697" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.timeoutSecs</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/LoggerOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MetamorphOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>MainOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li><a class="tsd-signature-type" data-tsd-kind="Interface" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a><ul class="tsd-hierarchy"><li><em class="tsd-target">MainOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#exit" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit</a></li><li><a href="#exitCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode</a></li><li><a href="#statusMessage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage</a></li><li><a href="#storage" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage</a></li><li><a href="#timeoutSecs" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exit"><span class="tsd-anchor-id" id="exit"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1701" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exit</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exit<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exit</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Call <code>process.exit()</code>? Defaults to true</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#exitCode"><span class="tsd-anchor-id" id="exitCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1699" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>exitCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>exitCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.exitCode</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit code, defaults to 0</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#statusMessage"><span class="tsd-anchor-id" id="statusMessage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1692" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>statusMessage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>statusMessage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.statusMessage</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Exit with given status message</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#storage"><span class="tsd-anchor-id" id="storage"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1543" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>storage</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>storage<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">InitOptions.storage</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#timeoutSecs"><span class="tsd-anchor-id" id="timeoutSecs"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1697" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>timeoutSecs</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>timeoutSecs<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">30</span></span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">ExitOptions.timeoutSecs</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Amount of time, in seconds, to wait for all event handlers to finish before exiting the process.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/LoggerOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">LoggerOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">MetamorphOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#exit" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exit</a></li><li><a href="#exitCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> exitCode</a></li><li><a href="#statusMessage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> statusMessage</a></li><li><a href="#storage" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> storage</a></li><li><a href="#timeoutSecs" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> timeoutSecs</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/MetamorphOptions.html b/reference/next/interface/MetamorphOptions.html index 442e41e784..705bdb8626 100644 --- a/reference/next/interface/MetamorphOptions.html +++ b/reference/next/interface/MetamorphOptions.html @@ -9,17 +9,17 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>MetamorphOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#build" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>build</a></li><li><a href="#contentType" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#build"><span class="tsd-anchor-id" id="build"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1679" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>build</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>build<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Tag or number of the target actor build to metamorph into (e.g. <code>beta</code> or <code>1.2.345</code>). -If not provided, the run uses build tag or number from the default actor run configuration (typically <code>latest</code>).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#contentType"><span class="tsd-anchor-id" id="contentType"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1673" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>contentType</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Content type for the <code>input</code>. If not specified, +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>MetamorphOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#build" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>build</a></li><li><a href="#contentType" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#build"><span class="tsd-anchor-id" id="build"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1679" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>build</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>build<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Tag or number of the target actor build to metamorph into (e.g. <code>beta</code> or <code>1.2.345</code>). +If not provided, the run uses build tag or number from the default actor run configuration (typically <code>latest</code>).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#contentType"><span class="tsd-anchor-id" id="contentType"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1673" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>contentType</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Content type for the <code>input</code>. If not specified, <code>input</code> is expected to be an object that will be stringified to JSON and content type set to <code>application/json; charset=utf-8</code>. If <code>options.contentType</code> is specified, then <code>input</code> must be a <code>String</code> or <code>Buffer</code>.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/MainOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MainOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/OpenStorageOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">OpenStorageOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#build" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> build</a></li><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/OpenStorageOptions.html b/reference/next/interface/OpenStorageOptions.html index b9cbe12a24..82c4ee7c1b 100644 --- a/reference/next/interface/OpenStorageOptions.html +++ b/reference/next/interface/OpenStorageOptions.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>OpenStorageOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forceCloud" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forceCloud"><span class="tsd-anchor-id" id="forceCloud"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1710" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>forceCloud</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code> then the cloud storage is used even if the <code>APIFY_LOCAL_STORAGE_DIR</code> +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>OpenStorageOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forceCloud" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forceCloud"><span class="tsd-anchor-id" id="forceCloud"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1710" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>forceCloud</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forceCloud<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code> then the cloud storage is used even if the <code>APIFY_LOCAL_STORAGE_DIR</code> environment variable is set. This way it is possible to combine local and cloud storage.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/MetamorphOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">MetamorphOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#forceCloud" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> forceCloud</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ProxyConfigurationOptions.html b/reference/next/interface/ProxyConfigurationOptions.html index deca270f35..27988b7f7b 100644 --- a/reference/next/interface/ProxyConfigurationOptions.html +++ b/reference/next/interface/ProxyConfigurationOptions.html @@ -9,14 +9,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ProxyConfigurationOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ProxyConfigurationOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ProxyConfigurationOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#apifyProxyCountry" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyCountry</a></li><li><a href="#apifyProxyGroups" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyGroups</a></li><li><a href="#countryCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode</a></li><li><a href="#groups" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups</a></li><li><a href="#newUrlFunction" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>newUrlFunction</a></li><li><a href="#password" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password</a></li><li><a href="#proxyUrls" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyUrls</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apifyProxyCountry"><span class="tsd-anchor-id" id="apifyProxyCountry"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>apifyProxyCountry</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyCountry<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Same option as <code>countryCode</code> which can be used to -configurate the proxy by UI input schema. You should use the <code>countryCode</code> option in your crawler code.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apifyProxyGroups"><span class="tsd-anchor-id" id="apifyProxyGroups"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L50" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>apifyProxyGroups</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyGroups<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Same option as <code>groups</code> which can be used to -configurate the proxy by UI input schema. You should use the <code>groups</code> option in your crawler code.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#countryCode"><span class="tsd-anchor-id" id="countryCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>countryCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set and relevant proxies are available in your Apify account, all proxied requests will +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>ProxyConfigurationOptions<!-- --> </h1></header><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ProxyConfigurationOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ProxyConfigurationOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#apifyProxyCountry" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyCountry</a></li><li><a href="#apifyProxyGroups" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyGroups</a></li><li><a href="#countryCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode</a></li><li><a href="#groups" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups</a></li><li><a href="#newUrlFunction" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>newUrlFunction</a></li><li><a href="#password" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password</a></li><li><a href="#proxyUrls" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyUrls</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apifyProxyCountry"><span class="tsd-anchor-id" id="apifyProxyCountry"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>apifyProxyCountry</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyCountry<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Same option as <code>countryCode</code> which can be used to +configurate the proxy by UI input schema. You should use the <code>countryCode</code> option in your crawler code.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#apifyProxyGroups"><span class="tsd-anchor-id" id="apifyProxyGroups"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L50" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>apifyProxyGroups</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>apifyProxyGroups<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Same option as <code>groups</code> which can be used to +configurate the proxy by UI input schema. You should use the <code>groups</code> option in your crawler code.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#countryCode"><span class="tsd-anchor-id" id="countryCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L44" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>countryCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified country. For example <code>GB</code> for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the country selection is a best attempt at geolocation, rather than @@ -24,14 +24,14 @@ an IP address from a random country. The country code needs to be a two letter ISO country code. See the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" target="_blank" rel="noopener noreferrer">full list of available country codes</a>. This parameter is optional, by default, the proxy uses all available proxy servers from all countries. -on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener noreferrer">Apify CLI</a>.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#groups"><span class="tsd-anchor-id" id="groups"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L31" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>groups</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of proxy groups to be used by the <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener noreferrer">Apify Proxy</a>. +on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener noreferrer">Apify CLI</a>.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#groups"><span class="tsd-anchor-id" id="groups"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L31" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>groups</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of proxy groups to be used by the <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener noreferrer">Apify Proxy</a>. If not provided, the proxy will select the groups automatically.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#newUrlFunction"><span class="tsd-anchor-id" id="newUrlFunction"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L16" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>newUrlFunction</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>newUrlFunction<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">ProxyConfigurationFunction</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyConfigurationOptions.newUrlFunction</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Custom function that allows you to generate the new proxy URL dynamically. It gets the <code>sessionId</code> as a parameter and should always return stringified proxy URL. Can be asynchronous. -This function is used to generate the URL when <a href="/sdk/js/reference/next/class/ProxyConfiguration#newUrl">ProxyConfiguration.newUrl</a> or <a href="/sdk/js/reference/next/class/ProxyConfiguration#newProxyInfo">ProxyConfiguration.newProxyInfo</a> is called.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#password"><span class="tsd-anchor-id" id="password"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L25" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>password</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User’s password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> +This function is used to generate the URL when <a href="/sdk/js/reference/next/class/ProxyConfiguration#newUrl">ProxyConfiguration.newUrl</a> or <a href="/sdk/js/reference/next/class/ProxyConfiguration#newProxyInfo">ProxyConfiguration.newProxyInfo</a> is called.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#password"><span class="tsd-anchor-id" id="password"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L25" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>password</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User’s password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> environment variable, which is automatically set by the system when running the actors.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyUrls"><span class="tsd-anchor-id" id="proxyUrls"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L10" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>proxyUrls</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyUrls<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyConfigurationOptions.proxyUrls</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of custom proxy URLs to be rotated. Custom proxies are not compatible with Apify Proxy and an attempt to use both configuration options will cause an error to be thrown on initialize.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/OpenStorageOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">OpenStorageOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/ProxyInfo"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">ProxyInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#apifyProxyCountry" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apifyProxyCountry</a></li><li><a href="#apifyProxyGroups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> apifyProxyGroups</a></li><li><a href="#countryCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> countryCode</a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> groups</a></li><li><a href="#newUrlFunction" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> newUrlFunction</a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> password</a></li><li><a href="#proxyUrls" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyUrls</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/ProxyInfo.html b/reference/next/interface/ProxyInfo.html index fd132a93bd..585fe117cb 100644 --- a/reference/next/interface/ProxyInfo.html +++ b/reference/next/interface/ProxyInfo.html @@ -67,7 +67,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -78,18 +78,18 @@ <p><strong>Example usage:</strong></p> -<div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">groups</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'GROUP1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'GROUP2'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// List of Apify Proxy groups</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Getting proxyInfo object by calling class method directly</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyInfo </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newProxyInfo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// In crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Getting used proxy URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Getting ID of used Session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionIdentifier </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">sessionId</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ProxyInfo</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ProxyInfo</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#countryCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode</a></li><li><a href="#groups" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups</a></li><li><a href="#hostname" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>hostname</a></li><li><a href="#password" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password</a></li><li><a href="#port" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>port</a></li><li><a href="#sessionId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>sessionId</a></li><li><a href="#url" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>url</a></li><li><a href="#username" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>username</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#countryCode"><span class="tsd-anchor-id" id="countryCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L108" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>countryCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set and relevant proxies are available in your Apify account, all proxied requests will +<div class="language-javascript codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-javascript codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyConfiguration </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword control-flow" style="color:#00009f">await</span><span class="token plain"> </span><span class="token maybe-class-name">Actor</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">createProxyConfiguration</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">groups</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">[</span><span class="token string" style="color:#e3116c">'GROUP1'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'GROUP2'</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// List of Apify Proxy groups</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token literal-property property" style="color:#36acaa">countryCode</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">'US'</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// Getting proxyInfo object by calling class method directly</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyInfo </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">.</span><span class="token method function property-access" style="color:#d73a49">newProxyInfo</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// In crawler</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> crawler </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">CheerioCrawler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> proxyConfiguration</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token function" style="color:#d73a49">requestHandler</span><span class="token punctuation" style="color:#393A34">(</span><span class="token parameter punctuation" style="color:#393A34">{</span><span class="token parameter"> proxyInfo </span><span class="token parameter punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Getting used proxy URL</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> proxyUrl </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">url</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token comment" style="color:#999988;font-style:italic">// Getting ID of used Session</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token keyword" style="color:#00009f">const</span><span class="token plain"> sessionIdentifier </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> proxyInfo</span><span class="token punctuation" style="color:#393A34">.</span><span class="token property-access">sessionId</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">ProxyInfo</span><ul class="tsd-hierarchy"><li><em class="tsd-target">ProxyInfo</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#countryCode" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode</a></li><li><a href="#groups" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups</a></li><li><a href="#hostname" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>hostname</a></li><li><a href="#password" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password</a></li><li><a href="#port" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>port</a></li><li><a href="#sessionId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>sessionId</a></li><li><a href="#url" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>url</a></li><li><a href="#username" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>username</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#countryCode"><span class="tsd-anchor-id" id="countryCode"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L108" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>countryCode</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>countryCode<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set and relevant proxies are available in your Apify account, all proxied requests will use IP addresses that are geolocated to the specified country. For example <code>GB</code> for IPs from Great Britain. Note that online services often have their own rules for handling geolocation and thus the country selection is a best attempt at geolocation, rather than a guaranteed hit. This parameter is optional, by default, each proxied request is assigned an IP address from a random country. The country code needs to be a two letter ISO country code. See the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements" target="_blank" rel="noopener noreferrer">full list of available country codes</a>. -This parameter is optional, by default, the proxy uses all available proxy servers from all countries.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#groups"><span class="tsd-anchor-id" id="groups"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L96" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>groups</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of proxy groups to be used by the <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener noreferrer">Apify Proxy</a>. -If not provided, the proxy will select the groups automatically.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#hostname"><span class="tsd-anchor-id" id="hostname"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L68" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>hostname</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>hostname<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.hostname</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Hostname of your proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#password"><span class="tsd-anchor-id" id="password"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/proxy_configuration.ts#L115" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>password</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyInfo.password</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User’s password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> +This parameter is optional, by default, the proxy uses all available proxy servers from all countries.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#groups"><span class="tsd-anchor-id" id="groups"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L96" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>groups</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>groups<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>An array of proxy groups to be used by the <a href="https://docs.apify.com/proxy" target="_blank" rel="noopener noreferrer">Apify Proxy</a>. +If not provided, the proxy will select the groups automatically.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#hostname"><span class="tsd-anchor-id" id="hostname"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L68" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>hostname</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>hostname<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.hostname</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Hostname of your proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#password"><span class="tsd-anchor-id" id="password"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/proxy_configuration.ts#L115" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>password</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>password<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Overrides <span class="tsd-signature-type">CoreProxyInfo.password</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>User’s password for the proxy. By default, it is taken from the <code>APIFY_PROXY_PASSWORD</code> environment variable, which is automatically set by the system when running the actors on the Apify cloud, or when using the <a href="https://github.com/apify/apify-cli" target="_blank" rel="noopener noreferrer">Apify CLI</a>.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#port"><span class="tsd-anchor-id" id="port"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L72" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>port</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>port<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.port</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Proxy port.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#sessionId"><span class="tsd-anchor-id" id="sessionId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L52" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>sessionId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>sessionId<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.sessionId</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The identifier of used Session, if used.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#url"><span class="tsd-anchor-id" id="url"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L56" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>url</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>url<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.url</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The URL of the proxy.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#username"><span class="tsd-anchor-id" id="username"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/proxy_configuration.d.ts#L60" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>username</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>username<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">CoreProxyInfo.username</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Username for the proxy.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyConfigurationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/QueueOperationInfo"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">QueueOperationInfo</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#countryCode" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> countryCode</a></li><li><a href="#groups" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> groups</a></li><li><a href="#hostname" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> hostname</a></li><li><a href="#password" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> password</a></li><li><a href="#port" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> port</a></li><li><a href="#sessionId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> sessionId</a></li><li><a href="#url" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> url</a></li><li><a href="#username" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> username</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/QueueOperationInfo.html b/reference/next/interface/QueueOperationInfo.html index 72eeaef438..6c04485823 100644 --- a/reference/next/interface/QueueOperationInfo.html +++ b/reference/next/interface/QueueOperationInfo.html @@ -11,14 +11,14 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>QueueOperationInfo<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"><div class="tsd-markdown markdown"><p>A helper class that is used to report results from various <a href="/sdk/js/reference/next/class/RequestQueue">RequestQueue</a> functions as well as enqueueLinks.</p></div></div></div><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#requestId" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId</a></li><li><a href="#wasAlreadyHandled" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled</a></li><li><a href="#wasAlreadyPresent" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyPresent</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestId"><span class="tsd-anchor-id" id="requestId"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/types/storages.d.ts#L13" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>requestId</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestId<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>The ID of the added request</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyHandled"><span class="tsd-anchor-id" id="wasAlreadyHandled"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/types/storages.d.ts#L11" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyHandled</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyHandled<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Indicates if request was already marked as handled.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#wasAlreadyPresent"><span class="tsd-anchor-id" id="wasAlreadyPresent"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/types/storages.d.ts#L9" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>wasAlreadyPresent</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>wasAlreadyPresent<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">boolean</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Indicates if request was already present in the queue.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/ProxyInfo"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">ProxyInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/RebootOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RebootOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#requestId" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestId</a></li><li><a href="#wasAlreadyHandled" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyHandled</a></li><li><a href="#wasAlreadyPresent" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> wasAlreadyPresent</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/RebootOptions.html b/reference/next/interface/RebootOptions.html index 3a1f509ece..a79546245e 100644 --- a/reference/next/interface/RebootOptions.html +++ b/reference/next/interface/RebootOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>RebootOptions<!-- --> </h1></header></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/QueueOperationInfo"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">QueueOperationInfo</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/RecordOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RecordOptions</div></a></nav></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/RecordOptions.html b/reference/next/interface/RecordOptions.html index bc550cdfd7..c9fe4b9d0a 100644 --- a/reference/next/interface/RecordOptions.html +++ b/reference/next/interface/RecordOptions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RecordOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#contentType" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#contentType"><span class="tsd-anchor-id" id="contentType"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/key_value_store.d.ts#L372" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>contentType</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>contentType<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Specifies a custom MIME content type of the record.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/RebootOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RebootOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueueOperationOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#contentType" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> contentType</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/RequestQueueOperationOptions.html b/reference/next/interface/RequestQueueOperationOptions.html index a4e0910751..7af0e689db 100644 --- a/reference/next/interface/RequestQueueOperationOptions.html +++ b/reference/next/interface/RequestQueueOperationOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RequestQueueOperationOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#forefront" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forefront</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#forefront"><span class="tsd-anchor-id" id="forefront"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_provider.d.ts#L226" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>forefront</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>forefront<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = <span class="tsd-signature-type">false</span></span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>If set to <code>true</code>:</p><ul><li>while adding the request to the queue: the request will be added to the foremost position in the queue.</li><li>while reclaiming the request: the request will be placed to the beginning of the queue, so that it’s returned in the next call to <a href="/sdk/js/reference/next/class/RequestQueue#fetchNextRequest">RequestQueue.fetchNextRequest</a>. By default, it’s put to the end of the queue.</li></ul></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/RecordOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RecordOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">RequestQueueOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#forefront" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> forefront</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/RequestQueueOptions.html b/reference/next/interface/RequestQueueOptions.html index 6f4e470eee..7b6a5919fb 100644 --- a/reference/next/interface/RequestQueueOptions.html +++ b/reference/next/interface/RequestQueueOptions.html @@ -9,7 +9,7 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> @@ -17,7 +17,7 @@ <div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"><span class="tsd-flag tsd-flag-external">external</span></span>RequestQueueOptions<!-- --> </h1></header><div class="tsd-comment tsd-typography tsd-comment-root"><div class="lead"></div><dl class="tsd-comment-tags"><dt><strong>@deprecated</strong></dt><dd><div class="tsd-markdown markdown"><p>Use RequestProviderOptions instead.</p></div></dd></dl></div><section class="tsd-panel"><h3 class="tsd-panel-header">Hierarchy</h3><div class="tsd-panel-content"><ul class="tsd-hierarchy"><li><span class="tsd-signature-type">RequestProviderOptions</span><ul class="tsd-hierarchy"><li><em class="tsd-target">RequestQueueOptions</em></li></ul></li></ul></div></section><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#client" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client</a></li><li><a href="#id" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id</a></li><li><a href="#name" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name</a></li><li><a href="#proxyConfiguration" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyConfiguration</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#client"><span class="tsd-anchor-id" id="client"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_provider.d.ts#L196" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>client</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>client<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">StorageClient</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RequestProviderOptions.client</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#id"><span class="tsd-anchor-id" id="id"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_provider.d.ts#L194" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span>id</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>id<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RequestProviderOptions.id</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#name"><span class="tsd-anchor-id" id="name"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_provider.d.ts#L195" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>name</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>name<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RequestProviderOptions.name</span></p></aside></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#proxyConfiguration"><span class="tsd-anchor-id" id="proxyConfiguration"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://undefined/apify/apify-sdk-js/blob/master/node_modules/@crawlee/core/storages/request_provider.d.ts#L202" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-external">external</span><span class="tsd-flag tsd-flag-optional">optional</span>proxyConfiguration</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>proxyConfiguration<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">ProxyConfiguration</span></div></div><div class="tsd-panel-content"><aside class="tsd-sources"><p>Inherited from <span class="tsd-signature-type">RequestProviderOptions.proxyConfiguration</span></p></aside><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Used to pass the proxy configuration for the <code>requestsFromUrl</code> objects. Takes advantage of the internal address rotation and authentication process. If undefined, the <code>requestsFromUrl</code> requests will be made without proxy.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOperationOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next/interface/WebhookOptions"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">WebhookOptions</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#client" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> client</a></li><li><a href="#id" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> id</a></li><li><a href="#name" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> name</a></li><li><a href="#proxyConfiguration" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> proxyConfiguration</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/reference/next/interface/WebhookOptions.html b/reference/next/interface/WebhookOptions.html index 68670deb34..af81432c82 100644 --- a/reference/next/interface/WebhookOptions.html +++ b/reference/next/interface/WebhookOptions.html @@ -9,22 +9,22 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> -<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>WebhookOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#eventTypes" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>eventTypes</a></li><li><a href="#idempotencyKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>idempotencyKey</a></li><li><a href="#payloadTemplate" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>payloadTemplate</a></li><li><a href="#requestUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestUrl</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#eventTypes"><span class="tsd-anchor-id" id="eventTypes"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1640" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>eventTypes</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>eventTypes<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookEventType</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Array of event types, which you can set for actor run, see -the <a href="https://docs.apify.com/webhooks/events#actor-run" target="_blank" rel="noopener noreferrer">actor run events</a> in the Apify doc.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#idempotencyKey"><span class="tsd-anchor-id" id="idempotencyKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1663" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>idempotencyKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>idempotencyKey<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Idempotency key enables you to ensure that a webhook will not be added multiple times in case of +<div class="apiPage"><div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a aria-current="page" class="navbar__link navbar__item active" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/reference">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/reference/next">Next</a></li><li><a class="dropdown__link" href="/sdk/js/reference">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/reference/3.0">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/reference/2.3">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/reference/1.3">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next">Overview</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/class/Actor">Classes</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next/enum/LogLevel">Enumerations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" aria-expanded="true" href="/sdk/js/reference/next/interface/AbortOptions">Interfaces</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/AbortOptions">AbortOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ActorRun">ActorRun</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyClientOptions">ApifyClientOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ApifyEnv">ApifyEnv</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallOptions">CallOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/CallTaskOptions">CallTaskOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ConfigurationOptions">ConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetConsumer">DatasetConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetContent">DatasetContent</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetDataOptions">DatasetDataOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetIteratorOptions">DatasetIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetMapper">DatasetMapper</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetOptions">DatasetOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/DatasetReducer">DatasetReducer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ExitOptions">ExitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/InitOptions">InitOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyConsumer">KeyConsumer</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreIteratorOptions">KeyValueStoreIteratorOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/KeyValueStoreOptions">KeyValueStoreOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/LoggerOptions">LoggerOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MainOptions">MainOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/MetamorphOptions">MetamorphOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/OpenStorageOptions">OpenStorageOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyConfigurationOptions">ProxyConfigurationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/ProxyInfo">ProxyInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/QueueOperationInfo">QueueOperationInfo</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RebootOptions">RebootOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RecordOptions">RecordOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOperationOptions">RequestQueueOperationOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/sdk/js/reference/next/interface/RequestQueueOptions">RequestQueueOptions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/sdk/js/reference/next/interface/WebhookOptions">WebhookOptions</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#UserFunc">Type Aliases</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="false" href="/sdk/js/reference/next#log">Variables</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/sdk/js/reference/next/changelog">Changelog</a></li></ul></nav><button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" class="button button--secondary button--outline collapseSidebarButton_PEFL"><svg width="20" height="20" aria-hidden="true" class="collapseSidebarButtonIcon_kv0_"><g fill="#7a7a7a"><path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"></path><path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"></path></g></svg></button></div></div></aside><main class="docMainContainer_gTbr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col apiItemCol"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for an unreleased version.<!-- --> <!-- -->For the latest API, see version<!-- --> <b><a href="/sdk/js/reference">3.1</a></b>.</div></div><div class="apiItemContainer"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_TXK0" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/sdk/js/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_IbIC"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Interfaces</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">Version: Next</span><div class="tocCollapsible_ETCw theme-doc-toc-mobile apiTocMobile"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1><span class="tsd-header-flags"></span>WebhookOptions<!-- --> </h1></header><section class="tsd-panel-group tsd-index-group"><h2>Index <a class="tsd-anchor" href="#Index"><span class="tsd-anchor-id" id="Index"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section"><h3 class="tsd-panel-header">Properties</h3><div class="tsd-panel-content"><ul class="tsd-index-list"><li><a href="#eventTypes" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>eventTypes</a></li><li><a href="#idempotencyKey" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>idempotencyKey</a></li><li><a href="#payloadTemplate" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>payloadTemplate</a></li><li><a href="#requestUrl" class="tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestUrl</a></li></ul></div></section></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties<!-- --> <a class="tsd-anchor" href="#Properties"><span class="tsd-anchor-id" id="Properties"></span><i class="codicon codicon-symbol-numeric"></i></a></h2><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#eventTypes"><span class="tsd-anchor-id" id="eventTypes"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1640" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>eventTypes</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>eventTypes<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-symbol">readonly<!-- --> </span><span class="tsd-signature-type">WebhookEventType</span><span class="tsd-signature-symbol">[]</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Array of event types, which you can set for actor run, see +the <a href="https://docs.apify.com/webhooks/events#actor-run" target="_blank" rel="noopener noreferrer">actor run events</a> in the Apify doc.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#idempotencyKey"><span class="tsd-anchor-id" id="idempotencyKey"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1663" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>idempotencyKey</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>idempotencyKey<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Idempotency key enables you to ensure that a webhook will not be added multiple times in case of an actor restart or other situation that would cause the <code>addWebhook()</code> function to be called again. We suggest using the actor run ID as the idempotency key. You can get the run ID by calling -<a href="/sdk/js/reference/next/class/Actor#getEnv">Actor.getEnv</a> function.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#payloadTemplate"><span class="tsd-anchor-id" id="payloadTemplate"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1655" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>payloadTemplate</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>payloadTemplate<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Payload template is a JSON-like string that describes the structure of the webhook POST request payload. +<a href="/sdk/js/reference/next/class/Actor#getEnv">Actor.getEnv</a> function.</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#payloadTemplate"><span class="tsd-anchor-id" id="payloadTemplate"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1655" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a><span class="tsd-flag tsd-flag-optional">optional</span>payloadTemplate</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>payloadTemplate<span class="tsd-signature-symbol">?<!-- -->: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>Payload template is a JSON-like string that describes the structure of the webhook POST request payload. It uses JSON syntax, extended with a double curly braces syntax for injecting variables <code>{{variable}}</code>. Those variables are resolved at the time of the webhook’s dispatch, and a list of available variables with their descriptions is available in the <a href="https://docs.apify.com/webhooks" target="_blank" rel="noopener noreferrer">Apify webhook documentation</a>. If <code>payloadTemplate</code> is omitted, the default payload template is used -(<a href="https://docs.apify.com/webhooks/actions#payload-template" target="_blank" rel="noopener noreferrer">view docs</a>).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestUrl"><span class="tsd-anchor-id" id="requestUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/dddf6db/packages/apify/src/actor.ts#L1645" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>requestUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>URL which will be requested using HTTP POST request, when actor run will reach the set event type.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next#UserFunc"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">UserFunc</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#eventTypes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventTypes</a></li><li><a href="#idempotencyKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> idempotencyKey</a></li><li><a href="#payloadTemplate" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> payloadTemplate</a></li><li><a href="#requestUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +(<a href="https://docs.apify.com/webhooks/actions#payload-template" target="_blank" rel="noopener noreferrer">view docs</a>).</p></div></div></div></div></section><section class="tsd-panel tsd-member"><h3 class="tsd-panel-header"><a class="tsd-anchor" href="#requestUrl"><span class="tsd-anchor-id" id="requestUrl"></span><i class="codicon codicon-symbol-numeric"></i></a><a class="tsd-anchor" href="https://github.com/apify/apify-sdk-js/blob/cec019c/packages/apify/src/actor.ts#L1645" rel="noreferrer" target="_blank"><i class="codicon codicon-file-code"></i></a>requestUrl</h3><div class="tsd-panel-content"><div class="tsd-signature tsd-kind-icon"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success)"></i>requestUrl<span class="tsd-signature-symbol">: </span> <span class="tsd-signature-type">string</span></div></div><div class="tsd-panel-content"><div class="tsd-comment tsd-typography"><div class="lead"><div class="tsd-markdown markdown"><p>URL which will be requested using HTTP POST request, when actor run will reach the set event type.</p></div></div></div></div></section></section></div><footer class="tsd-footer">Powered by<!-- --> <a href="https://github.com/milesj/docusaurus-plugin-typedoc-api">docusaurus-plugin-typedoc-api</a> <!-- -->and <a href="https://typedoc.org/">TypeDoc</a></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><a class="pagination-nav__link pagination-nav__link--prev" href="/sdk/js/reference/next/interface/RequestQueueOptions"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">RequestQueueOptions</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/sdk/js/reference/next#UserFunc"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">UserFunc</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#eventTypes" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> eventTypes</a></li><li><a href="#idempotencyKey" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> idempotencyKey</a></li><li><a href="#payloadTemplate" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> payloadTemplate</a></li><li><a href="#requestUrl" class="table-of-contents__link toc-highlight"><i class="codicon codicon-symbol-property" style="color:var(--ifm-color-success);"></i> requestUrl</a></li></ul></div></div></div></div></main></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div></div> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/search.html b/search.html index c60529201c..ad7dd1f455 100644 --- a/search.html +++ b/search.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="container margin-vert--lg"><h1>Search the documentation</h1><form class="row"><div class="col searchQueryColumn_tL1b col--9"><input type="search" name="q" class="searchQueryInput_zhTK" placeholder="Type your search here" aria-label="Search" autocomplete="off" autofocus=""></div><div class="col col--3 padding-left--none searchVersionColumn_iqv4"><select class="searchVersionInput_hAmL"><option selected="" label="Next" value="current"></option><option label="3.1" value="3.1"></option><option label="3.0" value="3.0"></option><option label="2.3" value="2.3"></option><option label="1.3" value="1.3"></option></select></div></form><div class="row"><div class="col col--8 searchResultsColumn_qHES"></div><div class="col col--4 text--right searchLogoColumn_yYpQ"><a target="_blank" rel="noopener noreferrer" href="https://www.algolia.com/" aria-label="Search by Algolia"><svg viewBox="0 0 168 24" class="algoliaLogo_J63M"><g fill="none"><path class="algoliaLogoPathFill_Dp29" d="M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"></path><path fill="#5468FF" d="M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"></path><path fill="white" d="M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"></path></g></svg></a></div></div></div></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> diff --git a/versions.html b/versions.html index 048759b07e..6e2ddf3970 100644 --- a/versions.html +++ b/versions.html @@ -9,13 +9,13 @@ <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-MNGXGGB",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script> <!-- End Google Tag Manager --> <script async defer="defer" id="hs-script-loader" src="//js.hs-scripts.com/19497222.js"></script><link rel="stylesheet" href="/sdk/js/assets/css/styles.c94daa89.css"> -<link rel="preload" href="/sdk/js/assets/js/runtime~main.f0c284b9.js" as="script"> +<link rel="preload" href="/sdk/js/assets/js/runtime~main.d3ee87be.js" as="script"> <link rel="preload" href="/sdk/js/assets/js/main.0cb2acc1.js" as="script"> </head> <body class="navigation-with-keyboard"> <script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(e){}return e}()||function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,e("light"))}()</script><div id="__docusaurus"> <div style="--ifm-navbar-height:123px;margin:0;padding:0;box-sizing:border-box"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div style="width:100%;height:fit-content;align-items:center;display:flex;flex-direction:column"><div class="navbar__inner"><div class="navbar__container"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="https://docs.apify.com" target="_self" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="/sdk/js/img/apify_sdk.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/sdk/js/img/apify_sdk_white.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div></a><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="navbar__item navbar__link">Academy</a><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="navbar__item navbar__link">Platform</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link">API</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="dropdown__link">Reference</a></li><li><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="dropdown__link">Client for JavaScript</a></li><li><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="dropdown__link">Client for Python</a></li></ul></div><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__item navbar__link navbar__link--active">SDK</a><ul class="dropdown__menu"><li><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="dropdown__link">SDK for JavaScript</a></li><li><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="dropdown__link">SDK for Python</a></li></ul></div><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="navbar__item navbar__link">CLI</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link navbar__item">Open source</a><ul class="dropdown__menu"><li><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="dropdown__link">Crawlee<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/got-scraping" target="_blank" rel="noopener noreferrer" class="dropdown__link">Got Scraping<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify/fingerprint-suite" target="_blank" rel="noopener noreferrer" class="dropdown__link">Fingerprint Suite<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="dropdown__link">Apify on GitHub<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_tst0 colorModeToggle_pe1S"><button class="clean-btn toggleButton_i_WE toggleButtonDisabled_j78O" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_Upjj"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_AJo4"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Apify on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><a href="https://discord.com/invite/jyEM2PRvMU" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="Chat on Discord">Discord<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"></div></div></div></div><div class="navbar__inner navbar__sub"><div class="navbar__container"><div class="navbar__items"><div class="navbar__sub--title"><a class="navbar__item navbar__link" href="/sdk/js/">SDK for JavaScript</a></div><a class="navbar__item navbar__link" href="/sdk/js/docs/guides/apify-platform">Docs</a><a class="navbar__item navbar__link" href="/sdk/js/docs/examples">Examples</a><a class="navbar__item navbar__link" href="/sdk/js/reference">Reference</a><a class="navbar__item navbar__link" href="/sdk/js/docs/changelog">Changelog</a><a href="https://github.com/apify/apify-sdk-js" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link navbar__item" aria-haspopup="true" aria-expanded="false" role="button" data-api-links="["reference/next","reference","reference/3.0","reference/2.3","reference/1.3"]" href="/sdk/js/docs/guides/apify-platform">3.1</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/sdk/js/docs/next/guides/apify-platform">Next</a></li><li><a class="dropdown__link" href="/sdk/js/docs/guides/apify-platform">3.1</a></li><li><a class="dropdown__link" href="/sdk/js/docs/3.0/guides/apify-platform">3.0</a></li><li><a class="dropdown__link" href="/sdk/js/docs/2.3/guides/motivation">2.3</a></li><li><a class="dropdown__link" href="/sdk/js/docs/1.3/guides/motivation">1.3</a></li></ul></div></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><section class="container features_cAfv"><div class="mainContainer versionsContainer"><div class="post"><header class="postHeader"><h1>SDK for JavaScript | Apify Documentation<!-- --> Versions</h1></header><p>New versions of Apify SDK are released once a month or so. With major releases once a year.</p><h3 id="latest">Current version (Stable)</h3><table class="versions"><tbody><tr><th>3.1</th><td><a href="/sdk/js/undefined/api/apify">Documentation</a></td><td><a href="https://github.com/apify/apify-sdk-js/releases/tag/v3.1">Release Notes</a></td></tr></tbody></table><p>This is the version that is configured automatically when you first install Apify SDK.</p><h3 id="rc">Pre-release versions</h3><table class="versions"><tbody><tr><th>master</th><td><a href="/sdk/js/undefined/next/api/apify">Documentation</a></td><td><a href="https://github.com/apify/apify-sdk-js">Source Code</a></td></tr></tbody></table><h3 id="archive">Past Versions</h3><p>Here you can find previous versions of the documentation.</p><table class="versions"><tbody><tr><th>3.0</th><td><a href="/sdk/js/undefined/3.0/api/apify">Documentation</a></td><td><a href="https://github.com/apify/apify-sdk-js/releases/tag/v3.0">Release Notes</a></td></tr><tr><th>2.3</th><td><a href="/sdk/js/undefined/2.3/api/apify">Documentation</a></td><td><a href="https://github.com/apify/apify-sdk-js/releases/tag/v2.3">Release Notes</a></td></tr><tr><th>1.3</th><td><a href="/sdk/js/undefined/1.3/api/apify">Documentation</a></td><td><a href="https://github.com/apify/apify-sdk-js/releases/tag/v1.3">Release Notes</a></td></tr></tbody></table><p>You can find past versions of this project on<!-- --> <a href="https://github.com/apify/apify-sdk-js">GitHub</a>.</p></div></div></section></div><footer class="footer_stxo light"><div class="container padding-horiz--lg"><div class="row" style="justify-content:space-between"><div class="col col--2"><div class="footerTitle_lK2o">Learn</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/academy" target="_self" rel="dofollow" class="footer__link-item">Academy</a></li><li class="footer__item"><a href="https://docs.apify.com/platform" target="_self" rel="dofollow" class="footer__link-item">Platform</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">API</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/api/v2/" target="_self" rel="dofollow" class="footer__link-item">Reference</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/js/" target="_self" rel="dofollow" class="footer__link-item">Client for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/api/client/python/" target="_self" rel="dofollow" class="footer__link-item">Client for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">SDK</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/sdk/js/" target="_self" rel="dofollow" class="footer__link-item">SDK for JavaScript</a></li><li class="footer__item"><a href="https://docs.apify.com/sdk/python/" target="_self" rel="dofollow" class="footer__link-item">SDK for Python</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">Other</div><ul class="clean-list"><li class="footer__item"><a href="https://docs.apify.com/cli/" target="_self" rel="dofollow" class="footer__link-item" position="left">CLI</a></li></ul></div><div class="col col--2"><div class="footerTitle_lK2o">More</div><ul class="clean-list"><li class="footer__item"><a href="https://crawlee.dev" target="_blank" rel="dofollow" class="footer__link-item">Crawlee</a></li><li class="footer__item"><a href="https://github.com/apify" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="row padding-vert--md padding-top--lg"><div class="col padding-vert--md col--6"><a href="https://apify.com" target="_blank" rel="dofollow noreferrer"><span class="footerLogo_pNWh"></span></a></div></div></div></footer></div></div> -<script src="/sdk/js/assets/js/runtime~main.f0c284b9.js"></script> +<script src="/sdk/js/assets/js/runtime~main.d3ee87be.js"></script> <script src="/sdk/js/assets/js/main.0cb2acc1.js"></script> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNGXGGB" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>